About the Code operators
Code
The multithreaded Code operator is a virtual variable that executes a Python® script using the Echoview Python API. It gives the script access to detailed information from its input operands and any arguments configured on the Code page. Echoview passes each argument as a named value to the Operator class’s __init__ method, allowing multiple Code variables to use the same Python source file with different parameter values.
Operand 1 must be acoustic and provides ping-level data such as samples, date and time, and range limits. Operands 2 and beyond may be acoustic or time series variables (for example, speed, heading, or GPS position), allowing your script to include navigational or environmental context. The Code operator supports multiple operands, and Echoview creates additional operand slots automatically when needed.
When a time series operand is used, Echoview automatically estimates its value at each Operand 1 ping time using the operand’s interpolation mode (for example, linear, circular, stepped, or dB). This ensures that all operands are time-aligned inside the script.
For details of available fields, see the Ping class for acoustic operands and the TimeSeriesMeasurement class for time series operands.
Most Echoview variables perform fixed calculations, but the Code operator is user-programmable in Python, providing complete flexibility for custom processing of acoustic and time series data.
Note: From Echoview 16, the Measurement class has been renamed to Ping,
and time series operands use the TimeSeriesMeasurement class.
Existing scripts that reference Measurement will fail until updated.
The default script generated by the Code operator has been updated to use these new classes.
To begin, see Using the Code* operators. You can also follow the introductory tutorial and video for guided examples.
Code - Time series
The multithreaded Code - Time series operator is a virtual time series variable that executes a Python® script using the Echoview Python API. It gives the script access to detailed information from its input operands and any arguments configured on the Code - Time Series page. Echoview passes each argument as a named value to the Operator class’s __init__ method, allowing multiple Code - Time series variables to use the same Python source file with different parameter values.
Operand 1 must be acoustic and provides ping-level data such as samples, date and time, and range limits. Operands 2 and beyond must be time series variables (for example, speed, heading, or solar elevation), allowing your script to include navigational or environmental context.
The operator outputs a single virtual time series variable with one measurement for each ping of operand 1. The output measurements have the same date and time values as the corresponding pings.
When a time series operand is used, Echoview automatically estimates its value at each Operand 1 ping time using the operand’s interpolation mode (e.g., linear, circular, stepped, or dB). This ensures that all operands are time-aligned inside the script.
For more information about configuring arguments for either operator, see Arguments.
Security
Python programs may be written by anyone and could contain malicious code or other security risks. Echoview recommends reviewing any Python files before running them and only using sources you trust.
When opening an EV file that contains a Code or Code - Time series operator, or creating one in a new EV file, a Security Warning window requests permission to enable Python execution for that file. Selecting No allows you to view and edit the Code operator properties, but the Python script will not run.
The permission remains valid while the file is open. To change it, close and reopen the file. You can disable the security warning under the Messages section of the Interface page of the Echoview Configuration dialog box.
Echoview and Python
Echoview installs Python for use with the Code operators. For version information, see the Echoview Configuration dialog box.
The included Python environment provides common packages, including NumPy and SciPy. See installing a package to use additional packages with the Code operators.
The Code operators and object-oriented programming
Using the Code operators can benefit from a basic understanding of object-oriented programming (OOP) in Python. However, the help pages introduce all major features without assuming prior OOP knowledge.
See also
Code operator
About the Echoview Python source file
Ping class
TimeSeriesMeasurement class
Using the Code* operators