Skip to content

channel

Channel & signal models.

logger = logging.getLogger(__name__) module-attribute

The module logger

ChannelIdentityPatch pydantic-model

Bases: BaseModel

A person's correction of what a channel is.

Send a field to set it; send it as null to clear it; leave it out to keep it. Anything set here is recorded as coming from a person and is never overwritten by re-reading the label.

Fields:

Validators:

  • _says_something

canonical_name = None pydantic-field

The channel's canonical name ('C3-M2', 'E1'); null clears it.

laterality = None pydantic-field

The body side the channel records; null clears it.

ChannelOut pydantic-model

Bases: ChannelUpdate

Represents a single channel in a recording.

Fields:

canonical_name = None pydantic-field

One spelling for one thing: the electrode and its reference as 'C3-M2', 'E1', 'Fpz-Cz'. Read from the label (C3-A2, C3M2 and EEG C3-M2 all give C3-M2) or set by a person. None when the label names no site.

electrode = None pydantic-field

The active site in canonical spelling ('C3', 'E1'); None when unknown.

identity_source = None pydantic-field

Where canonical_name and laterality came from: 'label' (read from the file's label) or 'user' (set by a person, never overwritten by re-reading the label). None on channels registered before identity existed.

index pydantic-field

The index of the channel in the recording. Must be a positive integer.

laterality = None pydantic-field

The body side the channel records, from the electrode (odd 10-20 sites and E1 are left, even sites and E2 right) or set by a person. None when the label does not say, or says two things.

reference = None pydantic-field

The reference site in canonical spelling ('M2', 'Cz'); None when unreferenced or unknown.

source_name = None pydantic-field

The channel's label as it appears in the source file (EDF) header. Immutable: renaming a channel changes name (the display name) but never this. Analysis containers load signals from the file by this label, so it is what dispatch passes them. None only for channels registered before the field existed.

__hash__()

Hash by JSON serialisation (:func:_json_hash).

ChannelUpdate pydantic-model

Bases: BaseModel

Update model for a channel.

Fields:

sample_rate = None pydantic-field

The sample rate of the channel in Hz. Must be a positive float.

unit = None pydantic-field

The physical unit of the channel. Must be a string.

SignalWindow pydantic-model

Bases: BaseModel

Signal window model.

Represents a window of time in a signal with an offset start and end time relative to the beginning of the recording. Can be used to specify a subset of a signal or events in a signal.

Fields:

Validators:

duration_ms property

Calculate the duration of the signal in milliseconds.

window_end_time_ms = None pydantic-field

End of the signal in milliseconds relative to the beggining of the recording. Defaults None indicating to the end of the recording if not specified.

window_start_time_ms = 0 pydantic-field

Start of the signal in milliseconds relative to the beggining of the recording. Defaults to 0 if not specified.

__hash__()

Hash by JSON serialisation (:func:_json_hash).

validate_time_order() pydantic-validator

Validate that start time is less than end time.