ezmsg.sigproc.slicer#
Functions
- parse_slice(s, axinfo=None)[source]#
Parses a string representation of a slice and returns a tuple of slice objects.
“” -> slice(None, None, None) (take all)
“:” -> slice(None, None, None)
‘“none”` (case-insensitive) -> slice(None, None, None)
“{start}:{stop}” or {start}:{stop}:{step} -> slice(start, stop, step)
- “5” (or any integer) -> (5,). Take only that item.
applying this to a ndarray or AxisArray will drop the dimension.
A comma-separated list of the above -> a tuple of slices | ints
A comma-separated list of values and axinfo is provided and is a CoordinateAxis -> a tuple of ints
- Parameters:
s (str) – The string representation of the slice.
axinfo (CoordinateAxis | None) – (Optional) If provided, and of type CoordinateAxis, and s is a comma-separated list of values, then the values in s will be checked against the values in axinfo.data.
- Returns:
A tuple of slice objects and/or ints.
- Return type:
- slicer(selection='', axis=None)[source]#
Slice along a particular axis.
- Parameters:
selection (str) – See
ezmsg.sigproc.slicer.parse_slicefor details.axis (str | None) – The name of the axis to slice along. If None, the last axis is used.
- Returns:
- Return type:
Classes
- class Slicer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[SlicerSettings,AxisArray,AxisArray,SlicerTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
SlicerSettings
- class SlicerSettings(selection: str = '', axis: str | None = None)[source]#
Bases:
Settings- selection: str = ''#
See
ezmsg.sigproc.slicer.parse_slicefor details.- Type:
selection
- class SlicerTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[SlicerSettings,AxisArray,AxisArray,SlicerState]
- parse_slice(s, axinfo=None)[source]#
Parses a string representation of a slice and returns a tuple of slice objects.
“” -> slice(None, None, None) (take all)
“:” -> slice(None, None, None)
‘“none”` (case-insensitive) -> slice(None, None, None)
“{start}:{stop}” or {start}:{stop}:{step} -> slice(start, stop, step)
- “5” (or any integer) -> (5,). Take only that item.
applying this to a ndarray or AxisArray will drop the dimension.
A comma-separated list of the above -> a tuple of slices | ints
A comma-separated list of values and axinfo is provided and is a CoordinateAxis -> a tuple of ints
- Parameters:
s (str) – The string representation of the slice.
axinfo (CoordinateAxis | None) – (Optional) If provided, and of type CoordinateAxis, and s is a comma-separated list of values, then the values in s will be checked against the values in axinfo.data.
- Returns:
A tuple of slice objects and/or ints.
- Return type:
- class SlicerSettings(selection: str = '', axis: str | None = None)[source]#
Bases:
Settings- selection: str = ''#
See
ezmsg.sigproc.slicer.parse_slicefor details.- Type:
selection
- class SlicerTransformer(*args, **kwargs)[source]#
Bases:
BaseStatefulTransformer[SlicerSettings,AxisArray,AxisArray,SlicerState]
- class Slicer(*args, settings=None, **kwargs)[source]#
Bases:
BaseTransformerUnit[SlicerSettings,AxisArray,AxisArray,SlicerTransformer]- Parameters:
settings (Settings | None)
- SETTINGS#
alias of
SlicerSettings
- slicer(selection='', axis=None)[source]#
Slice along a particular axis.
- Parameters:
selection (str) – See
ezmsg.sigproc.slicer.parse_slicefor details.axis (str | None) – The name of the axis to slice along. If None, the last axis is used.
- Returns:
- Return type: