Pipelines
- class stride.optimisation.pipelines.pipeline.Pipeline(steps=None, **kwargs)[source]
Bases:
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, **kwargs)[source]
Bases:
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, **kwargs)[source]
Bases:
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.ProcessObserved(steps=None, **kwargs)[source]
Bases:
ProcessWavelets
Default pipeline to process observed data before running the forward problem.
Default steps:
check_traces
filter_traces
- 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, **kwargs)[source]
Bases:
Pipeline
Default pipeline to process modelled and observed before running the functional.
Default steps:
check_traces
mute_first_arrival
mute_traces
filter_traces
norm_per_shot
time_tweaking
time_weighting
- 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, **kwargs)[source]
Bases:
Pipeline
Default pipeline to process wavelets before running the forward problem.
Default steps:
check_traces
filter_traces
- 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.ProcessWaveletsObserved(steps=None, **kwargs)[source]
Bases:
Pipeline
Default pipeline to process wavelets and observed before running the forward problem, in steps that require both to be present.
Default steps:
differentiate_traces
- 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:
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).filter_relaxation (float, optional) – Relaxation factor for the filter in range (0, 1], defaults to 1 (no dilation).
- 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:
Operator
Mute traces with respect to each other.
- 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:
Operator
Apply Gaussian smoothing to a StructuredData object.
- Parameters:
smooth_sigma (float, optional) – Standard deviation of the Gaussian kernel, defaults to 0.25 (25% of a cell).
- 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:
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:
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:
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 –