|
|
|
# RTIS Dev Remote Python Wrapper
|
|
|
|
|
|
This is a wrapper of the RTIS Dev Remote library to use RTIS Dev remotely over IP from your Python interpreter.
|
|
This is a wrapper of the RTIS Dev Remote library to use RTIS Dev remotely over IP from your Python interpreter.
|
|
Quickly develop with connected RTIS devices. Almost all RTIS Dev functions are available as well as automatic conversion
|
|
Quickly develop with connected RTIS devices. Almost all RTIS Dev functions are available as well as automatic conversion
|
|
of RTIS Dev custom class objects.
|
|
of RTIS Dev custom class objects.
|
|
|
|
|
|
# Unavailable RTIS Dev methods
|
|
This work is published under the [CC BY-NC-SA 4.0 DEED](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
* Python 3.6 or higher with modules:
|
|
|
|
* Numpy
|
|
|
|
* Scipy
|
|
|
|
* Supported RTIS Dev version is v2.11.0.
|
|
|
|
|
|
|
|
### From PyPi
|
|
|
|
You can install this module from the [PyPi repository](https://pypi.org/project/rtisdevremotepy/) like any other:
|
|
|
|
```bash
|
|
|
|
pip install rtisdevremotepy
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Unavailable RTIS Dev methods
|
|
Here is a short list of the current RTIS Dev methods that aren't available through this wrapper:
|
|
Here is a short list of the current RTIS Dev methods that aren't available through this wrapper:
|
|
* [create_measure_external_trigger_queue](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#create_measure_external_trigger_queue)
|
|
* [create_measure_external_trigger_queue](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#create_measure_external_trigger_queue)
|
|
* [create_measure_external_trigger_callback](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#create_measure_external_trigger_callback)
|
|
* [create_measure_external_trigger_callback](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#create_measure_external_trigger_callback)
|
... | @@ -10,7 +30,6 @@ Here is a short list of the current RTIS Dev methods that aren't available throu |
... | @@ -10,7 +30,6 @@ Here is a short list of the current RTIS Dev methods that aren't available throu |
|
* [set_log_mode](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#set_log_mode)
|
|
* [set_log_mode](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#set_log_mode)
|
|
* [set_custom_logger](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#set_custom_logger)
|
|
* [set_custom_logger](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#set_custom_logger)
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Initial setup
|
|
### Initial setup
|
|
When starting with this wrapper, first try to make a connection the remote RTIS Device.
|
|
When starting with this wrapper, first try to make a connection the remote RTIS Device.
|
... | @@ -38,28 +57,28 @@ They use the exact same naming formats. |
... | @@ -38,28 +57,28 @@ They use the exact same naming formats. |
|
rtisdev.set_recording_settings(callDuration=4.4, callMinimumFrequency=30000, callMaximumFrequency=60000)
|
|
rtisdev.set_recording_settings(callDuration=4.4, callMinimumFrequency=30000, callMaximumFrequency=60000)
|
|
```
|
|
```
|
|
|
|
|
|
When you provide wrong arguments or run into other exceptions of RTIS Dev, the Python wrapper will raise a exception listing and describing the problem.
|
|
When you provide wrong arguments or run into other exceptions to RTIS Dev, the Python wrapper will raise an exception listing and describing the problem.
|
|
|
|
|
|
### Custom data types
|
|
### Custom data types
|
|
Some methods return or require one of the [RTIS Dev custom class object](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#classes).
|
|
Some methods return or require one of the [RTIS Dev custom class object](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#classes).
|
|
The RTIS Dev Python wrapper will automatically convert these to Python dictionary objects.
|
|
The RTIS Dev Python wrapper will automatically convert these to Python dictionary objects.
|
|
When these dictionary objects are provided as arguments, the wrapper will automatically convert them again so it should all work straight out of the box!
|
|
When these dictionary objects are provided as arguments, the wrapper will automatically convert them again, so it should all work straight out of the box!
|
|
```python
|
|
```python
|
|
settings = rtisdev.get_current_settings()
|
|
settings = rtisdev.get_current_settings(configName=config_uuid)
|
|
rtisdev.set_settings_from_class(settings)
|
|
rtisdev.set_settings_from_class(settings)
|
|
|
|
|
|
measurement_raw = rtisdev.get_raw_measurement(behaviour=true)
|
|
measurement_raw = rtisdev.get_raw_measurement(behaviour=true, configName=config_uuid)
|
|
measurement_processed_from_raw = rtisdev.process_measurement(measurement_raw)
|
|
measurement_processed_from_raw = rtisdev.process_measurement(measurement_raw, configName=config_uuid)
|
|
```
|
|
```
|
|
|
|
|
|
If one has RTIS Dev fully installed and imported, one can also use the function `convert_to_rtis_class(rtis_dict)` to convert the dictionary objects back to the full RTIS Dev custom class objects. For example:
|
|
If one has RTIS Dev fully installed and imported, one can also use the function `convert_to_rtis_class(rtis_dict)` to convert the dictionary objects back to the full RTIS Dev custom class objects. For example:
|
|
```python
|
|
```python
|
|
import rtisdev as fullrtisdev
|
|
import rtisdev as fullrtisdev
|
|
measurement_processed_from_raw = rtisdev.process_measurement(measurement_raw)
|
|
measurement_processed_from_raw = rtisdev.process_measurement(measurement_raw, configName=config_uuid)
|
|
measurement_processed_from_raw_converted = rtisdev.convert_to_rtis_class(measurement_processed_from_raw)
|
|
measurement_processed_from_raw_converted = rtisdev.convert_to_rtis_class(measurement_processed_from_raw)
|
|
```
|
|
```
|
|
|
|
|
|
## Example
|
|
## Full example
|
|
A bigger example showing how to connect, record and process a measurement and plot the RTIS Energyscape.
|
|
A bigger example showing how to connect, record and process a measurement and plot the RTIS Energyscape.
|
|
```python
|
|
```python
|
|
import matplotlib.pyplot as plt
|
|
import matplotlib.pyplot as plt
|
... | @@ -73,12 +92,12 @@ rtisdev = rtisdevremotepy.RTISDev("192.168.1.150") |
... | @@ -73,12 +92,12 @@ rtisdev = rtisdevremotepy.RTISDev("192.168.1.150") |
|
rtisdev.open_connection()
|
|
rtisdev.open_connection()
|
|
|
|
|
|
# Configure the recording and processing settings
|
|
# Configure the recording and processing settings
|
|
config_uuid = rtisdev.set_recording_settings(premade="default_25_50")
|
|
config_uuid = rtisdev.set_recording_settings(microphoneSamples=163840, callMinimumFrequency=25000, callMaximumFrequency=50000)
|
|
rtisdev.set_processing_settings(premade="2D_5m_181", configName=config_uuid)
|
|
rtisdev.set_processing_settings(directions=91, maxRange=5, configName=config_uuid)
|
|
settings = rtisdev.get_current_settings()
|
|
settings = rtisdev.get_current_settings(configName=config_uuid)
|
|
|
|
|
|
# Get an ACTIVE measurement (protect your ears!) and process it
|
|
# Get an ACTIVE measurement (protect your ears!) and process it
|
|
measurement_processed = rtisdev.get_processed_measurement(behaviour=True)
|
|
measurement_processed = rtisdev.get_processed_measurement(behaviour=True, configName=config_uuid)
|
|
|
|
|
|
# Plot the 2D energyscape of this processed measurement.
|
|
# Plot the 2D energyscape of this processed measurement.
|
|
plt.imshow(np.transpose(measurement_processed['processedData']), cmap="hot", interpolation='nearest')
|
|
plt.imshow(np.transpose(measurement_processed['processedData']), cmap="hot", interpolation='nearest')
|
... | | ... | |