ezmsg.sigproc.affinetransform#
Affine transformations via matrix multiplication: y = Ax or y = Ax + B.
For full matrix transformations where channels are mixed (off-diagonal weights),
use AffineTransformTransformer or the AffineTransform unit.
For simple per-channel scaling and offset (diagonal weights only), use
LinearTransformTransformer from ezmsg.sigproc.linear instead,
which is more efficient as it avoids matrix multiplication.
Functions
- affine_transform(weights, axis=None, right_multiply=True)[source]#
Perform affine transformations on streaming data.
- Parameters:
weights (ndarray | str | Path) – An array of weights or a path to a file with weights compatible with np.loadtxt.
axis (str | None) – The name of the axis to apply the transformation to. Defaults to the leading (0th) axis in the array.
right_multiply (bool) – Set False to transpose the weights before applying.
- Returns:
- Return type:
- common_rereference(mode='mean', axis=None, include_current=True)[source]#
Perform common average referencing (CAR) on streaming data.
- Parameters:
- Returns:
- Return type:
Classes
- class AffineTransform(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[AffineTransformSettings,AxisArray,AxisArray,AffineTransformTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
AffineTransformSettings
- class AffineTransformSettings(weights, axis=None, right_multiply=True)[source]#
Bases:
SettingsSettings for
AffineTransform.- weights: ndarray | str | Path#
An array of weights or a path to a file with weights compatible with np.loadtxt.
- class AffineTransformTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[AffineTransformSettings,AxisArray,AxisArray,AffineTransformState]Apply affine transformation via matrix multiplication: y = Ax or y = Ax + B.
Use this transformer when you need full matrix transformations that mix channels (off-diagonal weights), such as spatial filters or projections.
For simple per-channel scaling and offset where each output channel depends only on its corresponding input channel (diagonal weight matrix), use
LinearTransformTransformerinstead, which is more efficient.The weights matrix can include an offset row (stacked as [A|B]) where the input is automatically augmented with a column of ones to compute y = Ax + B.
- class CommonRereference(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[CommonRereferenceSettings,AxisArray,AxisArray,CommonRereferenceTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
CommonRereferenceSettings
- class CommonRereferenceSettings(mode='mean', axis=None, include_current=True)[source]#
Bases:
SettingsSettings for
CommonRereference- __init__(mode='mean', axis=None, include_current=True)#
- class CommonRereferenceTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformer[CommonRereferenceSettings,AxisArray,AxisArray]- Parameters:
settings (SettingsType)
- class AffineTransformSettings(weights, axis=None, right_multiply=True)[source]#
Bases:
SettingsSettings for
AffineTransform.- weights: ndarray | str | Path#
An array of weights or a path to a file with weights compatible with np.loadtxt.
- class AffineTransformTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[AffineTransformSettings,AxisArray,AxisArray,AffineTransformState]Apply affine transformation via matrix multiplication: y = Ax or y = Ax + B.
Use this transformer when you need full matrix transformations that mix channels (off-diagonal weights), such as spatial filters or projections.
For simple per-channel scaling and offset where each output channel depends only on its corresponding input channel (diagonal weight matrix), use
LinearTransformTransformerinstead, which is more efficient.The weights matrix can include an offset row (stacked as [A|B]) where the input is automatically augmented with a column of ones to compute y = Ax + B.
- class AffineTransform(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[AffineTransformSettings,AxisArray,AxisArray,AffineTransformTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
AffineTransformSettings
- affine_transform(weights, axis=None, right_multiply=True)[source]#
Perform affine transformations on streaming data.
- Parameters:
weights (ndarray | str | Path) – An array of weights or a path to a file with weights compatible with np.loadtxt.
axis (str | None) – The name of the axis to apply the transformation to. Defaults to the leading (0th) axis in the array.
right_multiply (bool) – Set False to transpose the weights before applying.
- Returns:
- Return type:
- class CommonRereferenceSettings(mode='mean', axis=None, include_current=True)[source]#
Bases:
SettingsSettings for
CommonRereference- __init__(mode='mean', axis=None, include_current=True)#
- class CommonRereferenceTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformer[CommonRereferenceSettings,AxisArray,AxisArray]- Parameters:
settings (SettingsType)
- class CommonRereference(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[CommonRereferenceSettings,AxisArray,AxisArray,CommonRereferenceTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
CommonRereferenceSettings