About the Code operator

The multithreaded Code operator is a virtual variable that executes a Python® script using the Echoview Python API. It gives your script access to detailed information from its input operands.

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 ping time of operand 1, using the operand’s estimator (linear, circular, or stepped). This ensures 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 operator. You can also follow the introductory tutorial and video for guided examples.

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 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 Variable 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 operator. 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 operator.

The Code operator and object-oriented programming

Using the Code operator 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 operator