Code
The multi-threaded Code operator allows you to apply a Python® script from a *.py file to specified operands. Echoview supports and includes the Python NumPy and SciPy modules which offer a wide range of open-source scientific computing and numerical integration capabilities. The Code operator is available under the Advanced Operators module.
The Code operator outputs one ping for each matched ping of operand 1 (the acoustic operand). The output data type is the same as operand 1. However, the Complex power dB, Complex Sv, Complex TS, Pulse compressed complex power dB, Pulse compressed complex Sv, and Pulse compressed complex TS types are output as single beam Power dB, Sv, and TS respectively. Calculations are carried out in the domain specified by the Python file.
The operator accepts both acoustic and time series variables as operands. Operand 1 must be acoustic (it defines the output geometry). Operands 2 and beyond may be acoustic or time series, to incorporate navigational, environmental, or other contextual information into your script. In the script, inputs[k].measurement is a Ping for acoustic operands and a TimeSeriesMeasurement for time series operands.
Echoview automatically creates additional operand slots when needed. For example, when you add a time series variable to the Code operator, Echoview provides an operand position that accepts it. Operand 1 always remains acoustic and cannot accept a time series.
The Echoview Python interface also provides the is_time_series() helper method and the TIME_SERIES_TYPES collection. These allow your script to detect whether an operand represents a time series type.
For each output ping, time series operands are estimated at the ping times of operand 1 (the acoustic operand). Interpolation follows the time series operand’s interpolation mode (linear / circular / stepped). The inputs[k].window_measurements list has one entry per ping in the acoustic window; window_index is the index of the matched ping within that list; and inputs[k].measurement is the time series value estimated at that matched ping time. If a time series lacks coverage for part of the window, the corresponding entries are returned as no-data.
Notes:
- See also Code operator error handling.
- Matched pings share the ping time of operand 1. Time series operands are estimated at that time, based on their interpolation mode.
- The Python modules NumPy and SciPy do not have an explicit system to handle no data values.
- See also: The Effect of No data samples on the Wideband Frequency Response graph page.
Echoview accepts multiple operands of the following data types as input:
Operand 1 |
Operand N |
|
|
Settings
Code page
The Code page lets you choose a Python program file and configure a sliding window for calculations that use it. For more information, see About the Code operator and Using the Code operator.
Setting |
Description |
Python source file |
Specifies the path and file name of an Echoview Python source file. Use ... to browse to and open a Python file. Use New to create a new Python file. Use Edit to edit the Python source file. Click X to remove a Python file. Notes:
|
Window size (pings) |
Specifies the number of pings the Code operator processes per iteration. Valid inputs are odd integers greater than or equal to 1. See Using the window of measurements for details. |
See also
About virtual variables
About wideband data processing
Operator licensing in Echoview
Using the Code operator