physioex.data.PhysicalScale#
- class physioex.data.PhysicalScale(mode)[source]#
Bases:
PreprocessingStepScale a channel using its EDF header (physical dimension / range).
Modes#
"mV"Convert a voltage channel to millivolts from its header unit:
uV/µV->* 1e-3,mV->* 1,V->* 1e3. An unknown or blank unit leaves the signal unchanged (with a logged warning), which matches the historical convention that unrecognised units are already in the expected unit."range"Map the header physical range to
[-1, 1]:y = (x - (pmax + pmin) / 2) / (|pmax - pmin| / 2). A zero range (pmax == pmin) leaves the signal unchanged.
The EDF header is reached through the pipeline’s optional
headerargument (a dict with at least one ofphysical_dimension,physical_min,physical_max– seephysioex.data.base.BasePhysioDataset._channel_header()). Steps that do not need the header ignore it. If the header is missing or lacks the fields the mode requires, the step logs a warning and passes the signal through unchanged.The header values are recording-specific but the step’s parameters (mode) are not, so
spec()(and thuspipeline.hash()) covers the step’s identity while the actual scale is fixed per cache entry by the source channel (cache files are keyed by physical channel).Parameters#
- modestr
"mV"or"range".
Methods
__init__(mode)compile(fs_in[, header])Precompute any expensive state and return a callable specialized for fs_in.
spec()Return canonical, hashable text repr.
Attributes
Keys of the channel-header dict this step consumes.
- compile(fs_in, header=None)[source]#
Precompute any expensive state and return a callable specialized for fs_in.
headeris an optional per-channel metadata dict (physical dimension, physical min/max, …) forwarded to steps that declare they need it (needs_headerattribute, e.g.PhysicalScale). Steps that ignore it simply do not read it; the signature default keeps every existingcompile(fs)call site working.- Parameters:
- Return type:
- needs_header = True#
Keys of the channel-header dict this step consumes.
- Parameters:
mode (str)