neuralset.extractors.neuro.MneRaw¶
- class neuralset.extractors.neuro.MneRaw(*, event_types: Literal['Meg', 'Eeg', 'Emg', 'Fnirs', 'Ieeg'] = 'Meg', aggregation: Literal['single', 'sum', 'mean', 'first', 'middle', 'last', 'cat', 'stack', 'trigger'] = 'single', allow_missing: bool = False, frequency: Literal['native'] | float = 'native', offset: float = 0.0, baseline: tuple[float, float] | None = None, picks: Annotated[str | tuple[str, ...], MinLen(min_length=1)] = ('data',), apply_proj: bool = False, filter: tuple[float | None, float | None] | None = None, apply_hilbert: bool = False, notch_filter: float | list[float] | None = None, drop_bads: bool = False, mne_cpus: int = -1, infra: MapInfra = MapInfra(folder=None, cluster=None, logs='{folder}/logs/{user}/%j', job_name=None, timeout_min=120, nodes=1, tasks_per_node=1, cpus_per_task=10, gpus_per_node=None, mem_gb=None, max_pickle_size_gb=None, slurm_constraint=None, slurm_partition=None, slurm_account=None, slurm_qos=None, slurm_use_srun=False, slurm_additional_parameters=None, conda_env=None, workdir=None, permissions=511, version='1', keep_in_ram=True, max_jobs=128, min_samples_per_job=1, forbid_single_item_computation=False, mode='cached'), scaler: None | Literal['RobustScaler', 'StandardScaler'] = None, scale_factor: float | None = None, clamp: float | None = None, fill_non_finite: float | None = None, bipolar_ref: tuple[list[str], list[str]] | None = None, channel_order: Literal['unique', 'original'] = 'unique', allow_maxshield: bool = False)[source][source]¶
Feature extractor for raw MNE data files.
This class handles loading, preprocessing, and caching of continuous MNE raw recordings. Extractor preparation and caching are executed with extractor.prepare()
The steps of preprocessing, if specified, are ordered as follows: 1. Channel selection 2. Drop bad channels 3. Bipolar referencing 4. Notch filtering 5. Band-pass filtering 6. Hilbert transform 7. Resampling 8. Scaling 9. Applying projectors 10. Baseline correction (applied on segments) 11. Clamp (applied on segments)
- Parameters:
baseline (tuple of float, optional) – If provided as a tuple
(start, end), defines the start and end times (in seconds) relative to the beginning of the analysis window — note this differs from MNE’s convention, which defines baseline relative to the epoch onset. Used for baseline correction.picks (str or tuple of str) – Channels to pick from the raw data. Can be channel types (e.g. ‘meg’, ‘eeg’), channel names (e.g. ‘MEG 0111’), “all” for all channels, or “data” for data channels. Regular expressions are supported for selecting channel names automatically (e.g. ‘MEG …1’).
frequency ("native" or float, default="native") – Target sampling frequency. If “native”, uses the frequency of the input recording.
offset (float, default=0.0) – Time offset (in seconds) to apply to the event (typically for aligning with the response)
apply_proj (bool, default=False) – Whether to apply projectors stored in the MNE raw object.
filter (tuple of (float or None, float or None), optional) – Band-pass filter limits as
(l_freq, h_freq). If None, no band-pass filtering is applied.apply_hilbert (bool, default=False) – If True, applies the Hilbert transform to extract the signal envelope.
notch_filter (float or list of float, optional) – Frequencies (in Hz) to apply a notch filter at. For a single frequency (as float) or a list of frequencies (as list of float), all harmonics of specified frequencies up to 300 Hz will be filtered out.
drop_bads (bool, default=False) – Whether to drop channels marked as bad in the MNE info structure.
mne_cpus (int, default=-1) – Number of CPUs to use for multiprocessing in MNE operations.
scaler ({"RobustScaler", "StandardScaler"}, optional) – Optional scaling strategy to normalize channel data using scikit-learn scalers.
scale_factor (float, optional) – Optional multiplicative factor applied to the data after scaling, but before clamping. E.g, can be used to convert from V to mV or uV.
clamp (float, optional) – Maximum absolute value for clamping the data after preprocessing.
fill_non_finite (float or None, optional) – If a float, any non-finite values (NaN / +inf / -inf) found after preprocessing are replaced with this value and a warning is logged. If None (the default), no replacement is performed.
bipolar_ref (tuple of (list of str, list of str), optional) – Explicit anode/cathode channel name lists for bipolar referencing via
mne.set_bipolar_reference. The first list contains anode names and the second list contains cathode names; they must have the same length. Applied after channel selection and dropping bad channels but before filtering. The original monopolar channels consumed by the pairs are removed and replaced with the new bipolar channels.channel_order (["unique", "original"]) –
if self.channel_order==”original” Assigns channel indices for each raw file (doesn’t match channel names across files). Allows use of a subject layer of fixed dimension across subjects. Prevents building a too large channel dimension when many subjects.
else: is default behavior (unique) channels are numbered based on unique names across all subjects.
allow_maxshield (bool, default=False) – If True, allow processing of Elekta/MEGIN MEG data recorded with Internal Active Shielding (MaxShield). Such recordings contain compensation signals that should normally be removed via SSS/tSSS (MaxFilter) before analysis. Does not affect the cache uid.