CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
defaults.py381 linesDownload Raw Back to mne
1# Authors: The MNE-Python contributors.2# License: BSD-3-Clause3# Copyright the MNE-Python contributors.4 5from copy import deepcopy6 7DEFAULTS = dict(8    color=dict(9        mag="darkblue",10        grad="b",11        eeg="k",12        eog="k",13        ecg="m",14        emg="k",15        ref_meg="steelblue",16        misc="k",17        stim="k",18        resp="k",19        chpi="k",20        exci="k",21        ias="k",22        syst="k",23        seeg="saddlebrown",24        dbs="seagreen",25        dipole="k",26        gof="k",27        bio="k",28        ecog="k",29        hbo="#AA3377",30        hbr="b",31        fnirs_cw_amplitude="k",32        fnirs_fd_ac_amplitude="k",33        fnirs_fd_phase="k",34        fnirs_od="k",35        csd="k",36        whitened="k",37        gsr="#666633",38        temperature="#663333",39        eyegaze="k",40        pupil="k",41    ),42    si_units=dict(43        mag="T",44        grad="T/m",45        eeg="V",46        eog="V",47        ecg="V",48        emg="V",49        misc="AU",50        seeg="V",51        dbs="V",52        dipole="Am",53        gof="GOF",54        bio="V",55        ecog="V",56        hbo="M",57        hbr="M",58        ref_meg="T",59        fnirs_cw_amplitude="V",60        fnirs_fd_ac_amplitude="V",61        fnirs_fd_phase="rad",62        fnirs_od="V",63        csd="V/m²",64        whitened="Z",65        gsr="S",66        temperature="C",67        eyegaze="rad",68        pupil="m",69    ),70    units=dict(71        mag="fT",72        grad="fT/cm",73        eeg="µV",74        eog="µV",75        ecg="µV",76        emg="µV",77        misc="AU",78        seeg="mV",79        dbs="µV",80        dipole="nAm",81        gof="GOF",82        bio="µV",83        ecog="µV",84        hbo="µM",85        hbr="µM",86        ref_meg="fT",87        fnirs_cw_amplitude="V",88        fnirs_fd_ac_amplitude="V",89        fnirs_fd_phase="rad",90        fnirs_od="V",91        csd="mV/m²",92        whitened="Z",93        gsr="S",94        temperature="C",95        eyegaze="rad",96        pupil="mm",97    ),98    # scalings for the units99    scalings=dict(100        mag=1e15,101        grad=1e13,102        eeg=1e6,103        eog=1e6,104        emg=1e6,105        ecg=1e6,106        misc=1.0,107        seeg=1e3,108        dbs=1e6,109        ecog=1e6,110        dipole=1e9,111        gof=1.0,112        bio=1e6,113        hbo=1e6,114        hbr=1e6,115        ref_meg=1e15,116        fnirs_cw_amplitude=1.0,117        fnirs_fd_ac_amplitude=1.0,118        fnirs_fd_phase=1.0,119        fnirs_od=1.0,120        csd=1e3,121        whitened=1.0,122        gsr=1.0,123        temperature=1.0,124        eyegaze=1.0,125        pupil=1e3,126    ),127    # rough guess for a good plot128    scalings_plot_raw=dict(129        mag=1e-12,130        grad=4e-11,131        eeg=20e-6,132        eog=150e-6,133        ecg=5e-4,134        emg=1e-3,135        ref_meg=1e-12,136        misc="auto",137        stim=1,138        resp=1,139        chpi=1e-4,140        exci=1,141        ias=1,142        syst=1,143        seeg=1e-4,144        dbs=1e-4,145        bio=1e-6,146        ecog=1e-4,147        hbo=10e-6,148        hbr=10e-6,149        whitened=10.0,150        fnirs_cw_amplitude=2e-2,151        fnirs_fd_ac_amplitude=2e-2,152        fnirs_fd_phase=2e-1,153        fnirs_od=2e-2,154        csd=200e-4,155        dipole=1e-7,156        gof=1e2,157        gsr=1.0,158        temperature=0.1,159        eyegaze=2e-1,160        pupil=1e-2,161    ),162    scalings_cov_rank=dict(163        mag=1e12,164        grad=1e11,165        eeg=1e5,  # ~100x scalings166        seeg=1e1,167        dbs=1e4,168        ecog=1e4,169        hbo=1e4,170        hbr=1e4,171    ),172    ylim=dict(173        mag=(-600.0, 600.0),174        grad=(-200.0, 200.0),175        eeg=(-200.0, 200.0),176        misc=(-5.0, 5.0),177        seeg=(-20.0, 20.0),178        dbs=(-200.0, 200.0),179        dipole=(-100.0, 100.0),180        gof=(0.0, 1.0),181        bio=(-500.0, 500.0),182        ecog=(-200.0, 200.0),183        hbo=(0, 20),184        hbr=(0, 20),185        csd=(-50.0, 50.0),186        eyegaze=(-1, 1),187        pupil=(-1.0, 1.0),188    ),189    titles=dict(190        mag="Magnetometers",191        grad="Gradiometers",192        eeg="EEG",193        eog="EOG",194        ecg="ECG",195        emg="EMG",196        misc="misc",197        seeg="sEEG",198        dbs="DBS",199        bio="BIO",200        dipole="Dipole",201        ecog="ECoG",202        hbo="Oxyhemoglobin",203        ref_meg="Reference Magnetometers",204        fnirs_cw_amplitude="fNIRS (CW amplitude)",205        fnirs_fd_ac_amplitude="fNIRS (FD AC amplitude)",206        fnirs_fd_phase="fNIRS (FD phase)",207        fnirs_od="fNIRS (OD)",208        hbr="Deoxyhemoglobin",209        gof="Goodness of fit",210        csd="Current source density",211        stim="Stimulus",212        gsr="Galvanic skin response",213        temperature="Temperature",214        eyegaze="Eye-tracking (Gaze position)",215        pupil="Eye-tracking (Pupil size)",216        resp="Respiration monitoring channel",217        chpi="Continuous head position indicator (HPI) coil channels",218        exci="Flux excitation channel",219        ias="Internal Active Shielding data (Triux systems)",220        syst="System status channel information (Triux systems)",221        whitened="Whitened data",222    ),223    mask_params=dict(224        marker="o",225        markerfacecolor="w",226        markeredgecolor="k",227        linewidth=0,228        markeredgewidth=1,229        markersize=4,230    ),231    coreg=dict(232        mri_fid_opacity=1.0,233        dig_fid_opacity=1.0,234        # go from unit scaling (e.g., unit-radius sphere) to meters235        mri_fid_scale=5e-3,236        dig_fid_scale=8e-3,237        extra_scale=4e-3,238        eeg_scale=4e-3,239        eegp_scale=20e-3,240        eegp_height=0.1,241        ecog_scale=2e-3,242        seeg_scale=2e-3,243        meg_scale=1.0,  # sensors are already in SI units244        ref_meg_scale=1.0,245        dbs_scale=5e-3,246        fnirs_scale=5e-3,247        source_scale=5e-3,248        detector_scale=5e-3,249        hpi_scale=4e-3,250        head_color=(0.988, 0.89, 0.74),251        hpi_color=(1.0, 0.0, 1.0),252        extra_color=(1.0, 1.0, 1.0),253        meg_color=(0.0, 0.25, 0.5),254        ref_meg_color=(0.5, 0.5, 0.5),255        helmet_color=(0.0, 0.0, 0.6),256        eeg_color=(1.0, 0.596, 0.588),257        eegp_color=(0.839, 0.15, 0.16),258        ecog_color=(1.0, 1.0, 1.0),259        dbs_color=(0.82, 0.455, 0.659),260        seeg_color=(1.0, 1.0, 0.3),261        fnirs_color=(1.0, 0.647, 0.0),262        source_color=(1.0, 0.05, 0.0),263        detector_color=(0.3, 0.15, 0.15),264        lpa_color=(1.0, 0.0, 0.0),265        nasion_color=(0.0, 1.0, 0.0),266        rpa_color=(0.0, 0.0, 1.0),267    ),268    report_coreg=dict(dig=True, meg=("helmet", "sensors"), show_axes=True),269    noise_std=dict(grad=5e-13, mag=20e-15, eeg=0.2e-6),270    eloreta_options=dict(eps=1e-6, max_iter=20, force_equal=False),271    depth_mne=dict(272        exp=0.8,273        limit=10.0,274        limit_depth_chs=True,275        combine_xyz="spectral",276        allow_fixed_depth=False,277    ),278    depth_sparse=dict(279        exp=0.8,280        limit=None,281        limit_depth_chs="whiten",282        combine_xyz="fro",283        allow_fixed_depth=True,284    ),285    interpolation_method=dict(286        eeg="spline", meg="MNE", fnirs="nearest", ecog="spline", seeg="spline"287    ),288    volume_options=dict(289        alpha=None,290        resolution=1.0,291        surface_alpha=None,292        blending="mip",293        silhouette_alpha=None,294        silhouette_linewidth=2.0,295    ),296    prefixes={297        "k": 1e-3,298        "h": 1e-2,299        "": 1e0,300        "d": 1e1,301        "c": 1e2,302        "m": 1e3,303        "µ": 1e6,304        "u": 1e6,305        "n": 1e9,306        "p": 1e12,307        "f": 1e15,308    },309    transform_zooms=dict(translation=None, rigid=None, affine=None, sdr=None),310    transform_niter=dict(311        translation=(10000, 1000, 100),312        rigid=(10000, 1000, 100),313        affine=(10000, 1000, 100),314        sdr=(10, 10, 5),315    ),316    volume_label_indices=(317        # Left and middle318        4,  # Left-Lateral-Ventricle319        5,  # Left-Inf-Lat-Vent320        8,  # Left-Cerebellum-Cortex321        10,  # Left-Thalamus-Proper322        11,  # Left-Caudate323        12,  # Left-Putamen324        13,  # Left-Pallidum325        14,  # 3rd-Ventricle326        15,  # 4th-Ventricle327        16,  # Brain-Stem328        17,  # Left-Hippocampus329        18,  # Left-Amygdala330        26,  # Left-Accumbens-area331        28,  # Left-VentralDC332        # Right333        43,  # Right-Lateral-Ventricle334        44,  # Right-Inf-Lat-Vent335        47,  # Right-Cerebellum-Cortex336        49,  # Right-Thalamus-Proper337        50,  # Right-Caudate338        51,  # Right-Putamen339        52,  # Right-Pallidum340        53,  # Right-Hippocampus341        54,  # Right-Amygdala342        58,  # Right-Accumbens-area343        60,  # Right-VentralDC344    ),345    report_stc_plot_kwargs=dict(346        views=("lateral", "medial"),347        hemi="split",348        backend="pyvistaqt",349        time_viewer=False,350        show_traces=False,351        size=(450, 450),352        background="white",353        time_label=None,354        add_data_kwargs={"colorbar_kwargs": {"label_font_size": 12, "n_labels": 5}},355    ),356)357 358 359def _handle_default(k, v=None):360    """Avoid dicts as default keyword arguments.361 362    Use this function instead to resolve default dict values. Example usage::363 364        scalings = _handle_default('scalings', scalings)365 366    """367    this_mapping = deepcopy(DEFAULTS[k])368    if v is not None:369        if isinstance(v, dict):370            this_mapping.update(v)371        else:372            for key in this_mapping:373                this_mapping[key] = v374    return this_mapping375 376 377HEAD_SIZE_DEFAULT = 0.095  # in [m]378_BORDER_DEFAULT = "mean"379_INTERPOLATION_DEFAULT = "cubic"380_EXTRAPOLATE_DEFAULT = "auto"381 
Aluode/PerceptionLabPortable · CoolFace