types#

class utils.types.BoolSelector(*args, **kwargs)[source]#
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'validate_assignment': False}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class utils.types.FrequencyRange(*args, frequency_low_hz: Annotated[float, Gt(gt=0)], frequency_high_hz: Annotated[float, Gt(gt=0)], **kwargs)[source]#
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'validate_assignment': False}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'frequency_high_hz': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0)]), 'frequency_low_hz': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0)])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class utils.types.NMBaseModel(*args, **kwargs)[source]#
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'validate_assignment': False}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class utils.types.NMFeature(settings: NMSettings, ch_names: Sequence[str], sfreq: int | float)[source]#
calc_feature(data: np.ndarray) dict[source]#

Feature calculation method. Each method needs to loop through all channels

Parameters:

data ('np.ndarray') – (channels, time)

Return type:

dict

class utils.types.NMPreprocessor(sfreq: float, settings: NMSettings)[source]#
utils.types.create_validation_error(error_message: str, loc: list[str | int] = None, title: str = 'Validation Error', input_type: Literal['python', 'json'] = 'python', hide_input: bool = False) ValidationError[source]#

Factory function to create a Pydantic v2 ValidationError instance from a single error message.

Args: error_message (str): The error message for the ValidationError. loc (List[str | int], optional): The location of the error. Defaults to None. title (str, optional): The title of the error. Defaults to “Validation Error”. input_type (Literal[“python”, “json”], optional): Whether the error is for a Python object or JSON. Defaults to “python”. hide_input (bool, optional): Whether to hide the input value in the error message. Defaults to False.

Returns: ValidationError: A Pydantic ValidationError instance.