Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • RTIS Dev RTIS Dev
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • RTIS Software
  • RTIS DevRTIS Dev
  • Wiki
  • Home

Home · Changes

Page history
Update home authored Mar 15, 2022 by Wouter Jansen's avatar Wouter Jansen
Show whitespace changes
Inline Side-by-side
home.md
View page @ a578f6ea
......@@ -41,108 +41,108 @@
Here is a small example that goes over most basic steps:
```python
import rtisdev
import matplotlib.pyplot as plt
import numpy as np
>>> import rtisdev
>>> import matplotlib.pyplot as plt
>>> import numpy as np
```
Open a connection to the RTIS Device over the default serial port:
```python
success_connect = rtisdev.open_connection()
>>> success_connect = rtisdev.open_connection()
```
Set the default recording settings with 163840 samples and a call sweep between 25 and 50 KHz:
```python
success_settings_record = rtisdev.set_recording_settings(premade="default_25_50")
>>> success_settings_record = rtisdev.set_recording_settings(premade="default_25_50")
```
Enable all processing steps and preload them with RTIS CUDA. This will produce a 2D energyscape with 181 directions
with a maximum distance of 5m:
```python
success_settings_processing = rtisdev.set_processing_settings(premade="2D_5m_181")
>>> success_settings_processing = rtisdev.set_processing_settings(premade="2D_5m_181")
```
Get the used settings as a RTISSettings object:
```python
settings = rtisdev.get_current_settings()
>>> settings = rtisdev.get_current_settings()
```
Get an ACTIVE measurement (protect your ears!) in raw data:
```python
measurement = rtisdev.get_raw_measurement(True)
>>> measurement = rtisdev.get_raw_measurement(True)
```
Store the raw data of that measurement as a binary file. This can be opened in another application for further work:
```python
raw_data_sonar = measurement.rawData.tobytes()
file_handle_data = open("test_measurement_" + str(measurement.index) + ".bin", "wb")
file_handle_data.write(raw_data_sonar)
file_handle_data.close()
>>> raw_data_sonar = measurement.rawData.tobytes()
>>> file_handle_data = open("test_measurement_" + str(measurement.index) + ".bin", "wb")
>>> file_handle_data.write(raw_data_sonar)
>>> file_handle_data.close()
```
Process that raw measurement to an energyscape using the configuration chosen earlier:
```python
processed_measurement = rtisdev.process_measurement(measurement)
>>> processed_measurement = rtisdev.process_measurement(measurement)
```
Get a new ACTIVE measurement (protect your ears!) in both raw and processed data formats directly:
```python
new_processed_measurement = rtisdev.get_processed_measurement(True)
plt.imshow(np.transpose(new_processed_measurement.processedData), cmap="hot", interpolation='nearest')
>>> new_processed_measurement = rtisdev.get_processed_measurement(True)
>>> plt.imshow(np.transpose(new_processed_measurement.processedData), cmap="hot", interpolation='nearest')
```
Plot the 2D energyscape of this processed measurement using matplotlib:
```python
plt.xlabel("Directions (degrees)")
plt.ylabel("Range (meters)")
indexes_x = np.arange(0, new_processed_measurement.processedData.shape[0], 20)
labels_x = np.round(np.rad2deg(settings.directions[indexes_x, 0])).astype(int)
indexes_y = np.arange(0, new_processed_measurement.processedData.shape[1], 100)
labels_y = settings.ranges[indexes_y]
fmt_x = lambda x: "{:.0f}°".format(x)
fmt_y = lambda x: "{:.2f}m".format(x)
plt.xticks(indexes_x, [fmt_x(i) for i in labels_x])
plt.yticks(indexes_y, [fmt_y(i) for i in labels_y])
plt.title("RTIS Dev - 2D Energyscape Example")
ax = plt.gca()
ax.invert_yaxis()
ax.set_aspect("auto")
plt.show()
>>> plt.xlabel("Directions (degrees)")
>>> plt.ylabel("Range (meters)")
>>> indexes_x = np.arange(0, new_processed_measurement.processedData.shape[0], 20)
>>> labels_x = np.round(np.rad2deg(settings.directions[indexes_x, 0])).astype(int)
>>> indexes_y = np.arange(0, new_processed_measurement.processedData.shape[1], 100)
>>> labels_y = settings.ranges[indexes_y]
>>> fmt_x = lambda x: "{:.0f}°".format(x)
>>> fmt_y = lambda x: "{:.2f}m".format(x)
>>> plt.xticks(indexes_x, [fmt_x(i) for i in labels_x])
>>> plt.yticks(indexes_y, [fmt_y(i) for i in labels_y])
>>> plt.title("RTIS Dev - 2D Energyscape Example")
>>> ax = plt.gca()
>>> ax.invert_yaxis()
>>> ax.set_aspect("auto")
>>> plt.show()
```
Get a new ACTIVE measurement (protect your ears!) in both raw and microphone signal format directly:
```python
signal_measurement = rtisdev.get_signal_measurement(True)
>>> signal_measurement = rtisdev.get_signal_measurement(True)
```
Plot the microphone signals of this measurement:
```python
fig, axs = plt.subplots(8, 4, figsize=(10,16), constrained_layout = True)
for microphone_index_i in range(0, 8):
for microphone_index_j in range(0, 4):
axs[microphone_index_i, microphone_index_j].set_title(str(microphone_index_j+(microphone_index_i*4)+1))
axs[microphone_index_i, microphone_index_j].plot(signal_measurement.processedData[microphone_index_j+(microphone_index_i*4),:])
if microphone_index_j != 0:
plt.setp(axs[microphone_index_i, microphone_index_j], yticklabels=[])
if microphone_index_i != 7:
plt.setp(axs[microphone_index_i, microphone_index_j], xticklabels=[])
if microphone_index_i == 7:
axs[microphone_index_i, microphone_index_j].set_xlabel("Time (Samples)")
if microphone_index_j == 0:
axs[microphone_index_i, microphone_index_j].set_ylabel("Amplitude")
plt.show()
fig.suptitle("RTIS Dev - Microphone Signals")
>>> fig, axs = plt.subplots(8, 4, figsize=(10,16), constrained_layout = True)
>>> for microphone_index_i in range(0, 8):
... for microphone_index_j in range(0, 4):
... axs[microphone_index_i, microphone_index_j].set_title(str(microphone_index_j+(microphone_index_i*4)+1))
... axs[microphone_index_i, microphone_index_j].plot(signal_measurement.processedData[microphone_index_j+(microphone_index_i*4),:])
... if microphone_index_j != 0:
... plt.setp(axs[microphone_index_i, microphone_index_j], yticklabels=[])
... if microphone_index_i != 7:
... plt.setp(axs[microphone_index_i, microphone_index_j], xticklabels=[])
... if microphone_index_i == 7:
... axs[microphone_index_i, microphone_index_j].set_xlabel("Time (Samples)")
... if microphone_index_j == 0:
... axs[microphone_index_i, microphone_index_j].set_ylabel("Amplitude")
>>> plt.show()
>>> fig.suptitle("RTIS Dev - Microphone Signals")
```
# **Classes**
......@@ -150,7 +150,7 @@ fig.suptitle("RTIS Dev - Microphone Signals")
## **RTISMeasurement**
<p class="func-header">
<i>class</i> <b>RTISMeasurement</b>(<i>id: str='', timestamp: float=0, behaviour: bool=False, index: int=0, rawData: np.ndarray=None, processedData: np.ndarray=None</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L368">[source]</a>
<i>class</i> <b>RTISMeasurement</b>(<i>id: str='', timestamp: float=0, behaviour: bool=False, index: int=0, rawData: np.ndarray=None, processedData: np.ndarray=None</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L344">[source]</a>
</p>
Class storing all data and information on an RTIS device measurement.
......@@ -189,10 +189,11 @@ Class storing all data and information on an RTIS device measurement.
</tbody>
</table>
## **RTISSettings**
<p class="func-header">
<i>class</i> <b>RTISSettings</b>(<i>firmwareVersion, configName=''</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L438">[source]</a>
<i>class</i> <b>RTISSettings</b>(<i>firmwareVersion, configName=''</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L414">[source]</a>
</p>
Class describing all the processing and recording settings related to RTIS devices.
......@@ -206,11 +207,10 @@ Can be converted to a dictionary.
</table>
## **MeasureExternalTriggerQueueThread**
<p class="func-header">
<i>class</i> <b>MeasureExternalTriggerQueueThread</b>(<i>*args, **kwargs</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L662">[source]</a>
<i>class</i> <b>MeasureExternalTriggerQueueThread</b>(<i>*args, **kwargs</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L638">[source]</a>
</p>
The class based on a Multiprocessing Process to start RTIS sonar measurements triggered by an external trigger.
......@@ -228,10 +228,12 @@ Use [`create_measure_external_trigger_queue(dataQueue)`](https://cosysgit.uantwe
</table>
## **MeasureExternalTriggerCallbackThread**
<p class="func-header">
<i>class</i> <b>MeasureExternalTriggerCallbackThread</b>(<i>*args, **kwargs</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L823">[source]</a>
<i>class</i> <b>MeasureExternalTriggerCallbackThread</b>(<i>*args, **kwargs</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L799">[source]</a>
</p>
The class based on a Multiprocessing Process to start RTIS sonar measurements triggered by an external trigger.
......@@ -255,7 +257,7 @@ Use [`create_measure_external_trigger_callback(save_callback)`](https://cosysgit
## **open_connection**
<p class="func-header">
<i>def</i> <b>open_connection</b>(<i>port: string='/dev/ttyACM0', allowDebugMode: bool=False </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2455">[source]</a>
<i>def</i> <b>open_connection</b>(<i>port: string='/dev/ttyACM0', allowDebugMode: bool=False </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2431">[source]</a>
</p>
Connect to the port of the RTIS Hardware.
......@@ -290,7 +292,7 @@ Connect to the port of the RTIS Hardware.
## **close_connection**
<p class="func-header">
<i>def</i> <b>close_connection</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2559">[source]</a>
<i>def</i> <b>close_connection</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2535">[source]</a>
</p>
Manually close the connection to the RTIS device.
......@@ -316,7 +318,7 @@ be closed gracefully.
## **set_recording_settings**
<p class="func-header">
<i>def</i> <b>set_recording_settings</b>(<i>premade: str=None, jsonPath: str=None, callCustom: str=None, microphoneSamples: int=163840, microphoneSampleFrequency: int=4500000, callSampleFrequency: int=450000, callDuration: float=2.5, callMinimumFrequency: int=25000, callMaximumFrequency: int=50000, callEmissions: int=1, configName: str= '', applyToDevice: bool=True</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2592">[source]</a>
<i>def</i> <b>set_recording_settings</b>(<i>premade: str=None, jsonPath: str=None, callCustom: str=None, microphoneSamples: int=163840, microphoneSampleFrequency: int=4500000, callSampleFrequency: int=450000, callDuration: float=2.5, callMinimumFrequency: int=25000, callMaximumFrequency: int=50000, callEmissions: int=1, configName: str= '', applyToDevice: bool=True</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2568">[source]</a>
</p>
Set the recording settings. All parameters are optional and most have default values.
......@@ -392,7 +394,7 @@ Please read their decription carefully.
You can get the available premade settings with [`get_premade_recording_settings_list()`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#get_premade_processing_settings_list).
Create settings from a premade setup:
```python
rtisdev.set_recording_settings(premade="short_20_80")
>>> rtisdev.set_recording_settings(premade="short_20_80")
```
Create settings from a json file.
......@@ -401,20 +403,18 @@ Here we use auto-generated pulse call to emit.
More examples can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/recording/).
An example json:
```json
{
"microphoneSamples" : 294912,
"microphoneSampleFrequency" : 4500000,
"callSampleFrequency" : 450000,
"callDuration" : 2.5,
"callMinimumFrequency" : 25000,
"callMaximumFrequency" : 50000,
"callEmissions": 1
"microphoneSamples" : 294912,
"microphoneSampleFrequency" : 4500000,
"callSampleFrequency" : 450000,
"callDuration" : 2.5,
"callMinimumFrequency" : 25000,
"callMaximumFrequency" : 50000,
"callEmissions": 1
}
```
```python
rtisdev.set_recording_settings(jsonPath="./myrecordingsettings.json")
>>> rtisdev.set_recording_settings(jsonPath="./myrecordingsettings.json")
```
Create settings from a json file.
......@@ -423,37 +423,35 @@ Here we use manually generated call.
It has to be available on the given path and have the right format.
An example of such a custom call can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/recording/flutter.csv):
```json
{
"microphoneSamples" : 16777216,
"microphoneSampleFrequency" : 4500000,
"callSampleFrequency" : 450000,
"callCustom": "mycall.csv",
"callEmissions": 1
"microphoneSamples" : 16777216,
"microphoneSampleFrequency" : 4500000,
"callSampleFrequency" : 450000,
"callCustom": "mycall.csv",
"callEmissions": 1
}
```
```python
rtisdev.set_recording_settings(jsonPath="./myrecordingsettings.json")
>>> rtisdev.set_recording_settings(jsonPath="./myrecordingsettings.json")
```
Create full custom settings with the arguments. All arguments that aren't filled in will use default values:
```python
rtisdev.set_processing_settings(microphoneSamples=294912, callDuration=3, callMinimumFrequency=25000, callMaximumFrequency=80000)
>>> rtisdev.set_processing_settings(microphoneSamples=294912, callDuration=3, callMinimumFrequency=25000, callMaximumFrequency=80000)
```
Load in manually generated call. This requires the file to exist on the path and have the right format.
An example of such a custom call can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/recording/flutter.csv):
```python
rtisdev.set_processing_settings(callCustom="mycall.csv")
>>> rtisdev.set_processing_settings(callCustom="mycall.csv")
```
## **set_processing_settings**
<p class="func-header">
<i>def</i> <b>set_processing_settings</b>(<i>premade: str=None, jsonPath: str=None, customPath: str=None, microphoneLayout: str='eRTIS_v3D1', mode: int=1, directions: int=181, minRange: float=0.5, maxRange: float=5, microphoneSampleFrequency: int=4500000, pdmEnable: bool=True, matchedFilterEnable: bool=True, beamformingEnable: bool=True, enveloppeEnable: bool=True, cleanEnable: bool=True, preloadToggle: bool =True</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2779">[source]</a>
<i>def</i> <b>set_processing_settings</b>(<i>premade: str=None, jsonPath: str=None, customPath: str=None, microphoneLayout: str='eRTIS_v3D1', mode: int=1, directions: int=181, minRange: float=0.5, maxRange: float=5, microphoneSampleFrequency: int=4500000, pdmEnable: bool=True, matchedFilterEnable: bool=True, beamformingEnable: bool=True, enveloppeEnable: bool=True, cleanEnable: bool=True, preloadToggle: bool =True</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2742">[source]</a>
</p>
Set the processing settings. All parameters are optional and most have default values.
......@@ -542,20 +540,20 @@ You can get the available premade settings with [`get_premade_recording_settings
Create settings from a premade setup with all processing steps on:
```python
rtisdev.set_processing_settings(premade="3D_5m_3000", pdmEnable=True, matchedFilterEnable=True, beamformingEnable=True, enveloppeEnable=True, cleanEnable=True, preloadToggle=True)
>>> rtisdev.set_processing_settings(premade="3D_5m_3000", pdmEnable=True, matchedFilterEnable=True, beamformingEnable=True, enveloppeEnable=True, cleanEnable=True, preloadToggle=True)
```
You don't have to define all the processing steps, as they are all on by default:
```python
rtisdev.set_processing_settings(premade="3D_5m_3000")
>>> rtisdev.set_processing_settings(premade="3D_5m_3000")
```
Create settings from a premade setup with only part of the processing steps enabled and no preloading.
You can get the available premade settings with [`get_premade_recording_settings_list()`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#get_premade_processing_settings_list):
```python
rtisdev.set_processing_settings(premade="2D_5m_181", pdmEnable=True, matchedFilterEnable=True, beamformingEnable=False, enveloppeEnable=False, cleanEnable=False)
>>> rtisdev.set_processing_settings(premade="2D_5m_181", pdmEnable=True, matchedFilterEnable=True, beamformingEnable=False, enveloppeEnable=False, cleanEnable=False)
```
Create settings from a json file with full processing settings on.
......@@ -563,19 +561,17 @@ This expects a json to be available with a format such as seen below.
An example of such json files can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/processing/).
Here we use auto-generated processing files:
```json
{
"microphoneLayout" : "eRTIS_v3D1",
"microphoneSampleFrequency" : 4500000,
"minRange" : 0.5,
"maxRange" : 5,
"directions": 181,
"2D": 1
"microphoneLayout" : "eRTIS_v3D1",
"microphoneSampleFrequency" : 4500000,
"minRange" : 0.5,
"maxRange" : 5,
"directions": 181,
"2D": 1
}
```
```python
rtisdev.set_processing_settings(jsonPath="./myprocessingsettings.json")
>>> rtisdev.set_processing_settings(jsonPath="./myprocessingsettings.json")
```
Create settings from a json file with full processing settings on.
......@@ -584,24 +580,22 @@ Here we use manually generated processing files.
They have to be available on these paths and have the right format.
An example of such custom processing files can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/processing/) as well:
```json
{
"microphoneLayout" : "eRTIS_v3D1",
"microphoneSampleFrequency" : 4500000,
"directionsCustom": "./directions.csv",
"delayMatrixCustom": ".premade/delaymatrix.csv",
"rangesCustom": ".premade/ranges.csv"
"microphoneLayout" : "eRTIS_v3D1",
"microphoneSampleFrequency" : 4500000,
"directionsCustom": "./directions.csv",
"delayMatrixCustom": ".premade/delaymatrix.csv",
"rangesCustom": ".premade/ranges.csv"
}
```
```python
rtisdev.set_processing_settings(jsonPath="./myprocessingsettings.json")
>>> rtisdev.set_processing_settings(jsonPath="./myprocessingsettings.json")
```
Create full custom settings with the arguments. All arguments that aren't filled in will use default values:
```python
rtisdev.set_processing_settings(mode = 0, directions = 1337, minRange = 0.5, maxRange = 10)
>>> rtisdev.set_processing_settings(mode = 0, directions = 1337, minRange = 0.5, maxRange = 10)
```
Load in manually generated processing files. This requires 3 files to exist in the given path:
......@@ -610,13 +604,13 @@ microphoneSampleFrequency values correctly as these are absent in these csv file
An example of such custom processing files can be found [here](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/config/premadeSettings/processing/):
```python
rtisdev.set_processing_settings(customPath="mysettingsfolder")
>>> rtisdev.set_processing_settings(customPath="mysettingsfolder")
```
## **get_current_settings**
<p class="func-header">
<i>def</i> <b>get_current_settings</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2992">[source]</a>
<i>def</i> <b>get_current_settings</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2940">[source]</a>
</p>
Returns the [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtissettings) object of the current settings for processing and recording.
......@@ -640,7 +634,7 @@ Returns the [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-software/rtisde
## **clear_current_settings**
<p class="func-header">
<i>def</i> <b>clear_current_settings</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3009">[source]</a>
<i>def</i> <b>clear_current_settings</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2957">[source]</a>
</p>
Clear the current applied [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtissettings) configuration.
......@@ -657,7 +651,7 @@ Clear the current applied [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-s
## **get_settings**
<p class="func-header">
<i>def</i> <b>get_settings</b>(<i>recordingPremade: str=None, recordingJsonPath: str=None, recordingCallCustom: str=None, processingPremade: str=None, processingJsonPath: str=None, processingCustomPath: str=None, microphoneSamples: int=163840, microphoneSampleFrequency: int=4500000, callSampleFrequency: int=450000, callDuration: float=2.5, callMinimumFrequency: int=25000, callMaximumFrequency: int=50000, callEmissions: int=1, microphoneLayout: str='eRTIS_v3D1', mode: int=1, directions: int=181, minRange: float=0.5, maxRange: float=5, pdmEnable: bool=True, matchedFilterEnable: bool=True, beamformingEnable: bool=True, enveloppeEnable: bool=True, cleanEnable: bool=True, preloadToggle: bool =True, configName: str=''</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3018">[source]</a>
<i>def</i> <b>get_settings</b>(<i>recordingPremade: str=None, recordingJsonPath: str=None, recordingCallCustom: str=None, processingPremade: str=None, processingJsonPath: str=None, processingCustomPath: str=None, microphoneSamples: int=163840, microphoneSampleFrequency: int=4500000, callSampleFrequency: int=450000, callDuration: float=2.5, callMinimumFrequency: int=25000, callMaximumFrequency: int=50000, callEmissions: int=1, microphoneLayout: str='eRTIS_v3D1', mode: int=1, directions: int=181, minRange: float=0.5, maxRange: float=5, pdmEnable: bool=True, matchedFilterEnable: bool=True, beamformingEnable: bool=True, enveloppeEnable: bool=True, cleanEnable: bool=True, preloadToggle: bool =True, configName: str=''</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L2966">[source]</a>
</p>
Returns an [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtissettings) object with all chosen recording and processing settings based on the
......@@ -787,7 +781,7 @@ the [`set_recording_settings()`](https://cosysgit.uantwerpen.be/rtis-software/rt
## **set_settings_from_class**
<p class="func-header">
<i>def</i> <b>set_settings_from_class</b>(<i>settings: RTISSettings, applyToDevice: bool=True </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3221">[source]</a>
<i>def</i> <b>set_settings_from_class</b>(<i>settings: RTISSettings, applyToDevice: bool=True </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3169">[source]</a>
</p>
Set the wanted settings from an [`RTISSettings`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtissettings) object. These can be created
......@@ -823,7 +817,7 @@ with the [`get_settings()`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev
## **get_premade_processing_settings_list**
<p class="func-header">
<i>def</i> <b>get_premade_processing_settings_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3255">[source]</a>
<i>def</i> <b>get_premade_processing_settings_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3203">[source]</a>
</p>
Get a list of names of all the available premade settings for processing.
......@@ -847,7 +841,7 @@ Get a list of names of all the available premade settings for processing.
## **get_premade_recording_settings_list**
<p class="func-header">
<i>def</i> <b>get_premade_recording_settings_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3270">[source]</a>
<i>def</i> <b>get_premade_recording_settings_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3218">[source]</a>
</p>
Get a list of names of all the available premade settings for recording.
......@@ -871,7 +865,7 @@ Get a list of names of all the available premade settings for recording.
## **get_microphone_layout_list**
<p class="func-header">
<i>def</i> <b>get_microphone_layout_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3285">[source]</a>
<i>def</i> <b>get_microphone_layout_list</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3233">[source]</a>
</p>
Get a list of names of all the available microphone layouts that are available for recording.
......@@ -895,7 +889,7 @@ Get a list of names of all the available microphone layouts that are available f
## **prepare_processing**
<p class="func-header">
<i>def</i> <b>prepare_processing</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3299">[source]</a>
<i>def</i> <b>prepare_processing</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3247">[source]</a>
</p>
Start the CUDA workers for looped measurements with processing enabled.
......@@ -922,7 +916,7 @@ Furthermore, if using the default settings for processing this is enabled alread
## **unload_processing**
<p class="func-header">
<i>def</i> <b>unload_processing</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3326">[source]</a>
<i>def</i> <b>unload_processing</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3274">[source]</a>
</p>
Stop all CUDA workers.
......@@ -948,7 +942,7 @@ stopped when your script ends.
## **get_raw_measurement**
<p class="func-header">
<i>def</i> <b>get_raw_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3341">[source]</a>
<i>def</i> <b>get_raw_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3289">[source]</a>
</p>
Start an RTIS sonar measurement and return the raw data in an [`RTISMeasurement`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtismeasurement) object.
......@@ -980,16 +974,16 @@ This means that it will only record and not perform any processing.
Create a connection, set recording settings and make a raw measurement with passive behaviour:
```python
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
measurement = rtisdev.get_raw_measurement(True)
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> measurement = rtisdev.get_raw_measurement(True)
```
## **get_signal_measurement**
<p class="func-header">
<i>def</i> <b>get_signal_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3375">[source]</a>
<i>def</i> <b>get_signal_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3321">[source]</a>
</p>
Start an RTIS sonar measurement and process it with only PDM filtering
......@@ -1023,17 +1017,17 @@ have set. But will still use the other chosen recording and processing settings.
Create a connection, set recording and processing settings and make a signal measurement with active behaviour:
```python
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
signal_measurement = rtisdev.get_signal_measurement(True)
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> signal_measurement = rtisdev.get_signal_measurement(True)
```
## **get_processed_measurement**
<p class="func-header">
<i>def</i> <b>get_processed_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3416">[source]</a>
<i>def</i> <b>get_processed_measurement</b>(<i>behaviour: bool=False</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3360">[source]</a>
</p>
Start an RTIS sonar measurement and process it and return the raw and processed data
......@@ -1066,17 +1060,17 @@ Create a connection, set recording and processing settings and make
a processed measurement with active behaviour:
```python
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
processed_measurement = rtisdev.get_processed_measurement(True)
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> processed_measurement = rtisdev.get_processed_measurement(True)
```
## **process_measurement**
<p class="func-header">
<i>def</i> <b>process_measurement</b>(<i>measurement: RTISMeasurement</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3457">[source]</a>
<i>def</i> <b>process_measurement</b>(<i>measurement: RTISMeasurement</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3399">[source]</a>
</p>
Process a previously recorded raw RTIS sonar measurement from a [`RTISMeasurement`](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home#rtismeasurement) object
......@@ -1109,18 +1103,18 @@ Create a connection, set recording and processing settings and make a raw measur
Then afterwards process it:
```python
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
measurement = rtisdev.get_raw_measurement(True)
processed_measurement = rtisdev.process_measurement(measurement)
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> measurement = rtisdev.get_raw_measurement(True)
>>> processed_measurement = rtisdev.process_measurement(measurement)
```
## **set_counter**
<p class="func-header">
<i>def</i> <b>set_counter</b>(<i>newCount: int=0</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3497">[source]</a>
<i>def</i> <b>set_counter</b>(<i>newCount: int=0</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3437">[source]</a>
</p>
Set the internal measurement counter of the sonar hardware.
......@@ -1151,7 +1145,7 @@ Set the internal measurement counter of the sonar hardware.
## **set_behaviour**
<p class="func-header">
<i>def</i> <b>set_behaviour</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3520">[source]</a>
<i>def</i> <b>set_behaviour</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3460">[source]</a>
</p>
Set the behaviour of the sonar hardware to passive or active. This is only necessary if using external
......@@ -1185,7 +1179,7 @@ argument to define the sonar behaviour.
## **get_firmware_version**
<p class="func-header">
<i>def</i> <b>get_firmware_version</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3545">[source]</a>
<i>def</i> <b>get_firmware_version</b>(<i></i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3485">[source]</a>
</p>
Get the firmware version of the internal RTIS firmware used on the device.
......@@ -1209,7 +1203,7 @@ Get the firmware version of the internal RTIS firmware used on the device.
## **create_measure_external_trigger_queue**
<p class="func-header">
<i>def</i> <b>create_measure_external_trigger_queue</b>(<i>dataQueue: Queue </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3560">[source]</a>
<i>def</i> <b>create_measure_external_trigger_queue</b>(<i>dataQueue: Queue </i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3500">[source]</a>
</p>
This will create and return a Multiprocessing Process
......@@ -1242,22 +1236,22 @@ the RTIS Device and afterwards put this measurement on a data queue.
Create a queue to save the measurement to and assign it to the process:
```python
from multiprocessing import Manager
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
manager = Manager()
dataQueue = manager.Queue()
measure_thread = rtisdev.create_measure_external_trigger_queue(dataQueue)
measure_thread.start()
measure_thread.join()
>>> from multiprocessing import Manager
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> manager = Manager()
>>> dataQueue = manager.Queue()
>>> measure_thread = rtisdev.create_measure_external_trigger_queue(dataQueue)
>>> measure_thread.start()
>>> measure_thread.join()
```
## **create_measure_external_trigger_callback**
<p class="func-header">
<i>def</i> <b>create_measure_external_trigger_callback</b>(<i>callback: Callable[[ RTISMeasurement], any]</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3624">[source]</a>
<i>def</i> <b>create_measure_external_trigger_callback</b>(<i>callback: Callable[[ RTISMeasurement], any]</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3562">[source]</a>
</p>
This will create and return a Multiprocessing Process
......@@ -1290,28 +1284,28 @@ the RTIS Device and afterwards put this measurement on a data queue.
Create a callback to save the measurement to disk:
```python
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
index = 0
def save_callback(measurement=None):
if measurement is not None :
if measurement.rawData is not None:
data_sonar = measurement.rawData.tobytes()
file_handle_data = open(str(index) + ".bin","wb")
file_handle_data.write(data_sonar)
file_handle_data.close()
index = index + 1
measure_thread = rtisdev.create_measure_external_trigger_callback(save_callback)
measure_thread.start()
measure_thread.join()
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> index = 0
>>> def save_callback(measurement=None):
... if measurement is not None :
... if measurement.rawData is not None:
... data_sonar = measurement.rawData.tobytes()
... file_handle_data = open(str(index) + ".bin","wb")
... file_handle_data.write(data_sonar)
... file_handle_data.close()
... index = index + 1
>>> measure_thread = rtisdev.create_measure_external_trigger_callback(save_callback)
>>> measure_thread.start()
>>> measure_thread.join()
```
## **create_processing_workers**
<p class="func-header">
<i>def</i> <b>create_processing_workers</b>(<i>workerCount: int, inputQueue: Queue, outputQueue: Queue</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3697">[source]</a>
<i>def</i> <b>create_processing_workers</b>(<i>workerCount: int, inputQueue: Queue, outputQueue: Queue</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3633">[source]</a>
</p>
This will create and return a Multiprocessing Pool that will generate a chosen amount of processing
......@@ -1358,27 +1352,27 @@ all these measurements by getting them from the output queue.
Once the work is done, terminate the workers gracefully:
```python
from multiprocessing import Manager
import rtisdev
rtisdev.open_connection()
rtisdev.set_recording_settings(premade="default_25_50")
rtisdev.set_processing_settings(premade="2D_5m_181")
manager = Manager()
inputQueue = manager.Queue()
outputQueue = manager.Queue()
workersPool = rtisdev.create_processing_workers(4, inputQueue, outputQueue)
for measurement_index in range(0, 30):
measurement = rtisdev.get_raw_measurement()
inputQueue.put(measurement)
for measurement_index in range(0, 30):
measurement = outputQueue.get()
workersPool.terminate()
>>> from multiprocessing import Manager
>>> import rtisdev
>>> rtisdev.open_connection()
>>> rtisdev.set_recording_settings(premade="default_25_50")
>>> rtisdev.set_processing_settings(premade="2D_5m_181")
>>> manager = Manager()
>>> inputQueue = manager.Queue()
>>> outputQueue = manager.Queue()
>>> workersPool = rtisdev.create_processing_workers(4, inputQueue, outputQueue)
>>> for measurement_index in range(0, 30):
... measurement = rtisdev.get_raw_measurement()
... inputQueue.put(measurement)
>>> for measurement_index in range(0, 30):
... measurement = outputQueue.get()
>>> workersPool.terminate()
```
## **toggle_amplifier**
<p class="func-header">
<i>def</i> <b>toggle_amplifier</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3763">[source]</a>
<i>def</i> <b>toggle_amplifier</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3697">[source]</a>
</p>
Enable/disable the high voltage amplifier's step up controller.
......@@ -1411,7 +1405,7 @@ This will save on power usage and heat production.
## **toggle_external_triggers**
<p class="func-header">
<i>def</i> <b>toggle_external_triggers</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3785">[source]</a>
<i>def</i> <b>toggle_external_triggers</b>(<i>mode: bool</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3719">[source]</a>
</p>
Enable/disable external triggers being able to start a measurement on the RTIS device.
......@@ -1443,7 +1437,7 @@ They are disabled by default so have to be manually enabled.
## **reset_device**
<p class="func-header">
<i>def</i> <b>reset_device</b>(<i>stm32pin: int=7</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3806">[source]</a>
<i>def</i> <b>reset_device</b>(<i>stm32pin: int=7</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3740">[source]</a>
</p>
The function to reset the RTIS device hardware.
......@@ -1474,7 +1468,7 @@ The function to reset the RTIS device hardware.
## **set_log_mode**
<p class="func-header">
<i>def</i> <b>set_log_mode</b>(<i>mode: int</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3852">[source]</a>
<i>def</i> <b>set_log_mode</b>(<i>mode: int</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3786">[source]</a>
</p>
The function to set the logging level of the RTIS Dev module.
......@@ -1498,7 +1492,7 @@ The function to set the logging level of the RTIS Dev module.
## **set_custom_logger**
<p class="func-header">
<i>def</i> <b>set_custom_logger</b>(<i>customLogger: logging.Logger</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3880">[source]</a>
<i>def</i> <b>set_custom_logger</b>(<i>customLogger: logging.Logger</i>) <a class="src-href" target="_blank" href="https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/blob/master/rtisdev/RTISDev.py#L3814">[source]</a>
</p>
The function to set a custom logger to be used by RTIS Dev.
......
Clone repository
  • General Example
  • Classes
    • RTISMeasurement
    • RTISSettings
    • MeasureExternalTriggerQueueThread
    • MeasureExternalTriggerCallbackThread
  • Methods
    • open_connection
    • close_connection
    • set_recording_settings
    • set_processing_settings
    • get_current_settings
    • clear_current_settings
    • get_settings
    • set_settings_from_class
    • get_premade_processing_settings_list
    • get_premade_recording_settings_list
    • get_microphone_layout_list
    • prepare_processing
    • unload_processing
    • get_raw_measurement
    • get_signal_measurement
    • get_processed_measurement
    • process_measurement
    • set_counter
    • set_behaviour
    • get_firmware_version
    • create_measure_external_trigger_queue
    • create_measure_external_trigger_callback
    • create_processing_workers
    • toggle_amplifier
    • toggle_external_triggers
    • reset_device
    • set_log_mode
    • set_custom_logger