ChannelLabeler
- class gpype.backend.flow.channel_labeler.ChannelLabeler[source]
Bases:
IONodeSays what each channel is, without touching the data.
Only some sources can name their own channels, and none of them can know what a user has wired downstream. Without names a recording lands as Ch01..ChNN and a stream goes out unnamed, which is a problem on analysis day rather than on recording day.
It also carries roles, which say how a channel must be treated rather than what it is. Marking the extra channels an amplifier appends – a digital input as a trigger, an accelerometer as auxiliary, a link quality as quality – is what stops a filter from smearing them.
And it carries units: the other route a stream’s physical unit reaches the context by, beside an amplifier source declaring its own. A
Generator, a foreign LSL stream, or an amplifier this package does not yet cover can be told what it measures, and units given here override whatever the input already declared – the author is asserting ground truth, not merely filling a gap.The data passes through untouched; only the description changes.
- AT_MOST_ONE_OF = (('montage', 'labels'),)
At most one of these – “Give either a montage or labels, not both”. Distinct from ONE_OF: both may be absent, so this is not a requirement, only an exclusion.
- class Configuration[source]
Bases:
ConfigurationConfiguration class for ChannelLabeler parameters.
- __init__(labels=None, roles=None, montage=None, units=None, **kwargs)[source]
Initialize the channel labeler.
- Parameters:
labels (
Optional[list]) – One name per channel, e.g.["C3", "Cz", "C4"].roles (
Optional[list]) – One role per channel, from Constants.ChannelRoles. Channels left unnamed here count as measured signal.montage (
Optional[Montage]) – A Montage to take the labels from, as an alternative to passing them directly.units (
Optional[list]) – One physical unit per channel, e.g.["uV", "uV"]; None for a channel with none. Overrides whatever the input already declared, rather than only filling a gap.**kwargs – Additional arguments for the parent IONode.
- Raises:
ValueError – If both a montage and labels are given, if any list is empty, or if a role is not a known role.
- setup(data, port_context_in)[source]
Attach the description to the output context.
- Parameters:
- Return type:
- Returns:
Output port contexts carrying the description.
- Raises:
ValueError – If a supplied list does not match the channel count, which would describe channels that do not exist.