Pipelines
- class stride.optimisation.pipelines.pipeline.Pipeline(steps=None, **kwargs)[source]
Bases:
stride.core.Operator
A pipeline represents a series of processing steps that will be applied in order to a series of inputs. Pipelines encode pre-processing or post-processing steps such as filtering time traces or smoothing a gradient.
- Parameters
steps (list, optional) – List of steps that form the pipeline. Steps can be callable or strings pointing to a default, pre-defined step.
- async adjoint(*args, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- property comms
- property head
- classmethod local(*args, uid=None, **kwargs)
- classmethod local_parameter(*args, uid=None, **kwargs)
- property logger
- property loop
- property monitor
- property node
- classmethod parameter(*args, uid=None, **kwargs)
- classmethod remote(*args, **kwargs)
- property runtime
- async classmethod select_worker(runtime=None)
Select an available worker.
- Parameters
runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.
- Returns
UID of the target worker.
- Return type
str
- property worker
- property zmq_context
Default pipelines
- class stride.optimisation.pipelines.default_pipelines.ProcessGlobalGradient(steps=None, no_grad=True, **kwargs)[source]
Bases:
stride.optimisation.pipelines.pipeline.Pipeline
Default pipeline to process the global gradient before updating the variable.
Default steps:
mask
smooth_field
norm_field
- property comms
- property head
- classmethod local(*args, uid=None, **kwargs)
- classmethod local_parameter(*args, uid=None, **kwargs)
- property logger
- property loop
- property monitor
- property node
- classmethod parameter(*args, uid=None, **kwargs)
- classmethod remote(*args, **kwargs)
- property runtime
- async classmethod select_worker(runtime=None)
Select an available worker.
- Parameters
runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.
- Returns
UID of the target worker.
- Return type
str
- property worker
- property zmq_context
- class stride.optimisation.pipelines.default_pipelines.ProcessModelIteration(steps=None, no_grad=True, **kwargs)[source]
Bases:
stride.optimisation.pipelines.pipeline.Pipeline
Default pipeline to process the model after each iteration.
Default steps:
clip
- property comms
- property head
- classmethod local(*args, uid=None, **kwargs)
- classmethod local_parameter(*args, uid=None, **kwargs)
- property logger
- property loop
- property monitor
- property node
- classmethod parameter(*args, uid=None, **kwargs)
- classmethod remote(*args, **kwargs)
- property runtime
- async classmethod select_worker(runtime=None)
Select an available worker.
- Parameters
runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.
- Returns
UID of the target worker.
- Return type
str
- property worker
- property zmq_context
- class stride.optimisation.pipelines.default_pipelines.ProcessTraces(steps=None, no_grad=False, **kwargs)[source]
Bases:
stride.optimisation.pipelines.pipeline.Pipeline
Default pipeline to process modelled and observed before running the functional.
Default steps:
mute_traces
filter_traces
norm_per_shot
- property comms
- property head
- classmethod local(*args, uid=None, **kwargs)
- classmethod local_parameter(*args, uid=None, **kwargs)
- property logger
- property loop
- property monitor
- property node
- classmethod parameter(*args, uid=None, **kwargs)
- classmethod remote(*args, **kwargs)
- property runtime
- async classmethod select_worker(runtime=None)
Select an available worker.
- Parameters
runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.
- Returns
UID of the target worker.
- Return type
str
- property worker
- property zmq_context
- class stride.optimisation.pipelines.default_pipelines.ProcessWavelets(steps=None, no_grad=False, **kwargs)[source]
Bases:
stride.optimisation.pipelines.pipeline.Pipeline
Default pipeline to process wavelets before running the forward problem.
Default steps:
filter_wavelets
- property comms
- property head
- classmethod local(*args, uid=None, **kwargs)
- classmethod local_parameter(*args, uid=None, **kwargs)
- property logger
- property loop
- property monitor
- property node
- classmethod parameter(*args, uid=None, **kwargs)
- classmethod remote(*args, **kwargs)
- property runtime
- async classmethod select_worker(runtime=None)
Select an available worker.
- Parameters
runtime (str or Runtime, optional) – If a valid runtime is given, this will be selected as the target worker.
- Returns
UID of the target worker.
- Return type
str
- property worker
- property zmq_context
Steps
- class stride.optimisation.pipelines.steps.filter_traces.FilterTraces(**kwargs)[source]
Bases:
stride.core.Operator
Filter a set of time traces.
- Parameters
f_min (float, optional) – Lower value for the frequency filter, defaults to None (no lower filtering).
f_max (float, optional) – Upper value for the frequency filter, defaults to None (no upper filtering).
filter_type (str, optional) – Type of filter to apply, from
butterworth
(default for band pass and high pass),fir
, orcos
(default for low pass).
- adjoint(*d_traces, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(*traces, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.mute_traces.MuteTraces(**kwargs)[source]
Bases:
stride.core.Operator
Mute traces with respect to each other.
- adjoint(d_modelled, d_observed, modelled, observed, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(modelled, observed, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.filter_wavelets.FilterWavelets(**kwargs)[source]
Bases:
stride.core.Operator
Filter wavelets to 3/4 of the set frequencies.
- Parameters
f_min (float, optional) – Lower value for the frequency filter, defaults to None (no lower filtering).
f_max (float, optional) – Upper value for the frequency filter, defaults to None (no upper filtering).
filter_type (str, optional) – Type of filter to apply, from
butterworth
(default for band pass and high pass),fir
, orcos
(default for low pass).
- adjoint(d_wavelets, wavelets, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(wavelets, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.norm_per_shot.NormPerShot(**kwargs)[source]
Bases:
stride.core.Operator
Normalised a series of time traces to the maximum value of the set.
- Parameters
amplitude (bool, optional) – Whether to keep the true amplitude of the modelled after normalisation.
- adjoint(*d_traces, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(*traces, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.norm_per_trace.NormPerTrace(**kwargs)[source]
Bases:
stride.core.Operator
Normalised a series of time traces individually.
- Parameters
amplitude (bool, optional) – Whether to keep the true amplitude of the modelled after normalisation.
- adjoint(*d_traces, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(*traces, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.smooth_field.SmoothField(**kwargs)[source]
Bases:
stride.core.Operator
Apply Gaussian smoothing to a StructuredData object.
- Parameters
sigma (float, optional) – Standard deviation of the Gaussian kernel, defaults to 0.25 (25% of a grid point).
- adjoint(d_field, field, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(field, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.norm_field.NormField(**kwargs)[source]
Bases:
stride.core.Operator
Normalise a StructuredData object between -1 and +1.
- adjoint(d_field, field, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(field, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.clip.Clip(**kwargs)[source]
Bases:
stride.core.Operator
Clip data between two extreme values.
- Parameters
min (float, optional) – Lower value for the clipping, defaults to None (no lower clipping).
max (float, optional) – Upper value for the clipping, defaults to None (no upper clipping).
- adjoint(d_field, field, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(field, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –
- class stride.optimisation.pipelines.steps.mask.Mask(**kwargs)[source]
Bases:
stride.core.Operator
Mask a StructuredData object to remove values outside inner domain.
- adjoint(d_field, field, **kwargs)[source]
Method defining the adjoint behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method will be called with positional arguments comprised of: the gradients of every output of the forward operation, followed by the arguments originally given when calling the forward method.
The adjoint method needs to return a gradient for each of its Variable inputs (or None if the variable does not
needs_grad
).This method should not be called directly from user code.
- Parameters
args –
kwargs –
- forward(field, **kwargs)[source]
Method defining the forward behaviour of the operator. This method needs to be defined by classes inheriting from the operator.
The method can take multiple inputs and produce multiple outputs. Outputs of this method should be of type Variable.
Positional and keyword arguments to forward are processed so that present variables are tracked.
This method should not be called directly from user code.
- Parameters
args –
kwargs –