pyrocko.squirrel.mantra

Processing pipeline configuration and wiring.

A Mantra describes a chain (or, more generally, connected graph) of BaseOperator instances to be connected on top of a Squirrel. Mantra configurations are Guts-serializable YAML, typically loaded via --mantra PATH[:PATTERN,...] in squirrel mantra and other CLI tools, or constructed programmatically and connected with Mantra.setup().

Classes

Mantra(**kwargs)

Represents a connected graph of processing operators.

Exceptions

MantraError

Raised on errors while planning or connecting a Mantra's operator graph, e.g. duplicate operator names, references to undefined operators, or unused operators.

exception MantraError[source]

Bases: SquirrelError

Raised on errors while planning or connecting a Mantra’s operator graph, e.g. duplicate operator names, references to undefined operators, or unused operators.

class Mantra(**kwargs)[source]

Bases: Object

Represents a connected graph of processing operators.

♦ name

str, default: 'untitled'

Name of this mantra, used e.g. to select it via --mantra PATH:PATTERN and as a namespacing element in derived data codes.

♦ operators

list of pyrocko.squirrel.operators.base.BaseOperator objects, default: []

Operators forming the processing graph, in connection order (see setup()).

setup(squirrel)[source]

Connect operators into a processing graph on top of a squirrel.

Parameters:

squirrel (Squirrel) – The squirrel instance to serve as the graph’s root input.

After this call, outlet holds the graph’s final operator (or squirrel itself, if this mantra has no operators), ready to be queried like a squirrel (e.g. mantra.outlet.get_waveforms(...)).

describe()[source]

Get textual description of the processing graph.

Return type:

str

Requires setup() to have been called first.