settings#
- class stream.settings.NMSettings(*args, sampling_rate_features_hz: Annotated[float, Gt(gt=0)] = 10, segment_length_features_ms: Annotated[float, Gt(gt=0)] = 1000, frequency_ranges_hz: dict[str, FrequencyRange] = {'HFA': {'frequency_high_hz': 400.0, 'frequency_low_hz': 200.0}, 'alpha': {'frequency_high_hz': 12.0, 'frequency_low_hz': 8.0}, 'high_beta': {'frequency_high_hz': 35.0, 'frequency_low_hz': 20.0}, 'high_gamma': {'frequency_high_hz': 200.0, 'frequency_low_hz': 90.0}, 'low_beta': {'frequency_high_hz': 20.0, 'frequency_low_hz': 13.0}, 'low_gamma': {'frequency_high_hz': 80.0, 'frequency_low_hz': 60.0}, 'theta': {'frequency_high_hz': 8.0, 'frequency_low_hz': 4.0}}, preprocessing: list[Literal['preprocessing_filter', 'notch_filter', 'raw_resampling', 're_referencing', 'raw_normalization']] = ['raw_resampling', 'notch_filter', 're_referencing'], raw_resampling_settings: ResamplerSettings = {'resample_freq_hz': 1000}, preprocessing_filter: FilterSettings = {'bandpass_filter': True, 'bandpass_filter_settings': {'frequency_high_hz': 200.0, 'frequency_low_hz': 2.0}, 'bandstop_filter': True, 'bandstop_filter_settings': {'frequency_high_hz': 160.0, 'frequency_low_hz': 100.0}, 'highpass_filter': True, 'highpass_filter_cutoff_hz': 3, 'lowpass_filter': True, 'lowpass_filter_cutoff_hz': 200}, raw_normalization_settings: NormalizationSettings = {'clip': 3, 'normalization_method': 'zscore', 'normalization_time_s': 30}, postprocessing: PostprocessingSettings = {'feature_normalization': True, 'project_cortex': False, 'project_subcortex': False}, feature_normalization_settings: NormalizationSettings = {'clip': 3, 'normalization_method': 'zscore', 'normalization_time_s': 30}, project_cortex_settings: ProjectionSettings = {'max_dist_mm': 20.0}, project_subcortex_settings: ProjectionSettings = {'max_dist_mm': 5.0}, features: FeatureSelection = {'bandpass_filter': False, 'bispectrum': False, 'bursts': True, 'coherence': False, 'fft': True, 'fooof': False, 'linelength': True, 'mne_connectivity': False, 'nolds': False, 'raw_hjorth': True, 'return_raw': True, 'sharpwave_analysis': True, 'stft': False, 'welch': True}, fft_settings: OscillatorySettings = {'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000}, welch_settings: OscillatorySettings = {'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000}, stft_settings: OscillatorySettings = {'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000}, bandpass_filter_settings: BandPowerSettings = {'bandpower_features': {'activity': True, 'complexity': False, 'mobility': False}, 'kalman_filter': False, 'log_transform': True, 'segment_lengths_ms': {'HFA': 100, 'alpha': 500, 'high beta': 333, 'high gamma': 100, 'low beta': 333, 'low gamma': 100, 'theta': 1000}}, kalman_filter_settings: KalmanSettings = {'Tp': 0.1, 'frequency_bands': ['theta', 'alpha', 'low_beta', 'high_beta', 'low_gamma', 'high_gamma', 'HFA'], 'sigma_v': 1.0, 'sigma_w': 0.7}, burst_settings: BurstsSettings = {'burst_features': {'amplitude': True, 'burst_rate_per_s': True, 'duration': True, 'in_burst': True}, 'frequency_bands': ['low_beta', 'high_beta', 'low_gamma'], 'threshold': 75, 'time_duration_s': 30}, sharpwave_analysis_settings: SharpwaveSettings = {'apply_estimator_between_peaks_and_troughs': True, 'detect_peaks': {'distance_peaks_ms': 5, 'distance_troughs_ms': 10, 'estimate': True}, 'detect_troughs': {'distance_peaks_ms': 5, 'distance_troughs_ms': 10, 'estimate': True}, 'estimator': {'max': ['prominence', 'sharpness'], 'mean': ['interval'], 'median': [], 'min': [], 'var': []}, 'filter_ranges_hz': [{'frequency_high_hz': 80.0, 'frequency_low_hz': 5.0}, {'frequency_high_hz': 30.0, 'frequency_low_hz': 5.0}], 'sharpwave_features': {'decay_steepness': False, 'decay_time': False, 'interval': True, 'num_peaks': False, 'peak_left': False, 'peak_right': False, 'prominence': True, 'rise_steepness': False, 'rise_time': False, 'sharpness': True, 'slope_ratio': False, 'trough': False, 'width': False}}, mne_connectivity_settings: MNEConnectivitySettings = {'method': 'plv', 'mode': 'multitaper'}, coherence_settings: CoherenceSettings = {'channels': [], 'features': {'max_allfbands': True, 'max_fband': True, 'mean_fband': True}, 'frequency_bands': ['high_beta'], 'method': {'coh': True, 'icoh': True}, 'nperseg': 128}, fooof_settings: FooofSettings = {'aperiodic': {'exponent': True, 'knee': True, 'offset': True}, 'freq_range_hz': {'frequency_high_hz': 40.0, 'frequency_low_hz': 2.0}, 'knee': True, 'max_n_peaks': 3, 'min_peak_height': 0, 'peak_threshold': 2, 'peak_width_limits': {'frequency_high_hz': 12.0, 'frequency_low_hz': 0.5}, 'periodic': {'band_width': False, 'center_frequency': False, 'height_over_ap': False}, 'windowlength_ms': 800}, nolds_settings: NoldsSettings = {'features': {'correlation_dimension': False, 'detrended_fluctuation_analysis': False, 'hurst_exponent': False, 'lyapunov_exponent': True, 'sample_entropy': False}, 'frequency_bands': ['low_beta'], 'raw': True}, bispectrum_settings: BispectraSettings = {'bispectrum_features': {'mean': True, 'sum': True, 'var': True}, 'components': {'absolute': True, 'imag': True, 'phase': True, 'real': True}, 'compute_features_for_whole_fband_range': True, 'f1s': {'frequency_high_hz': 35.0, 'frequency_low_hz': 5.0}, 'f2s': {'frequency_high_hz': 35.0, 'frequency_low_hz': 5.0}, 'frequency_bands': ['theta', 'alpha', 'low_beta', 'high_beta']}, **kwargs)[source]#
- static from_file(PATH: str | PathLike) NMSettings [source]#
Load settings from file or a directory.
- Parameters:
PATH (_PathLike) – Path to settings file or to directory containing settings file, or path to experiment including experiment prefix (e.g. /path/to/exp/exp_prefix[_SETTINGS.json]). Supported file types are .json and .yaml
- Raises:
ValueError – when file format is not supported.
- Returns:
PyNM settings object
- Return type:
- 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]] = {'bandpass_filter_settings': FieldInfo(annotation=BandPowerSettings, required=False, default={'bandpower_features': {'activity': True, 'complexity': False, 'mobility': False}, 'kalman_filter': False, 'log_transform': True, 'segment_lengths_ms': {'HFA': 100, 'alpha': 500, 'high beta': 333, 'high gamma': 100, 'low beta': 333, 'low gamma': 100, 'theta': 1000}}), 'bispectrum_settings': FieldInfo(annotation=BispectraSettings, required=False, default={'bispectrum_features': {'mean': True, 'sum': True, 'var': True}, 'components': {'absolute': True, 'imag': True, 'phase': True, 'real': True}, 'compute_features_for_whole_fband_range': True, 'f1s': {'frequency_high_hz': 35.0, 'frequency_low_hz': 5.0}, 'f2s': {'frequency_high_hz': 35.0, 'frequency_low_hz': 5.0}, 'frequency_bands': ['theta', 'alpha', 'low_beta', 'high_beta']}), 'burst_settings': FieldInfo(annotation=BurstsSettings, required=False, default={'burst_features': {'amplitude': True, 'burst_rate_per_s': True, 'duration': True, 'in_burst': True}, 'frequency_bands': ['low_beta', 'high_beta', 'low_gamma'], 'threshold': 75, 'time_duration_s': 30}), 'coherence_settings': FieldInfo(annotation=CoherenceSettings, required=False, default={'channels': [], 'features': {'max_allfbands': True, 'max_fband': True, 'mean_fband': True}, 'frequency_bands': ['high_beta'], 'method': {'coh': True, 'icoh': True}, 'nperseg': 128}), 'feature_normalization_settings': FieldInfo(annotation=NormalizationSettings, required=False, default={'clip': 3, 'normalization_method': 'zscore', 'normalization_time_s': 30}), 'features': FieldInfo(annotation=FeatureSelection, required=False, default={'bandpass_filter': False, 'bispectrum': False, 'bursts': True, 'coherence': False, 'fft': True, 'fooof': False, 'linelength': True, 'mne_connectivity': False, 'nolds': False, 'raw_hjorth': True, 'return_raw': True, 'sharpwave_analysis': True, 'stft': False, 'welch': True}), 'fft_settings': FieldInfo(annotation=OscillatorySettings, required=False, default={'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000}), 'fooof_settings': FieldInfo(annotation=FooofSettings, required=False, default={'aperiodic': {'exponent': True, 'knee': True, 'offset': True}, 'freq_range_hz': {'frequency_high_hz': 40.0, 'frequency_low_hz': 2.0}, 'knee': True, 'max_n_peaks': 3, 'min_peak_height': 0, 'peak_threshold': 2, 'peak_width_limits': {'frequency_high_hz': 12.0, 'frequency_low_hz': 0.5}, 'periodic': {'band_width': False, 'center_frequency': False, 'height_over_ap': False}, 'windowlength_ms': 800}), 'frequency_ranges_hz': FieldInfo(annotation=dict[str, FrequencyRange], required=False, default={'theta': {'frequency_high_hz': 8.0, 'frequency_low_hz': 4.0}, 'alpha': {'frequency_high_hz': 12.0, 'frequency_low_hz': 8.0}, 'low_beta': {'frequency_high_hz': 20.0, 'frequency_low_hz': 13.0}, 'high_beta': {'frequency_high_hz': 35.0, 'frequency_low_hz': 20.0}, 'low_gamma': {'frequency_high_hz': 80.0, 'frequency_low_hz': 60.0}, 'high_gamma': {'frequency_high_hz': 200.0, 'frequency_low_hz': 90.0}, 'HFA': {'frequency_high_hz': 400.0, 'frequency_low_hz': 200.0}}), 'kalman_filter_settings': FieldInfo(annotation=KalmanSettings, required=False, default={'Tp': 0.1, 'frequency_bands': ['theta', 'alpha', 'low_beta', 'high_beta', 'low_gamma', 'high_gamma', 'HFA'], 'sigma_v': 1.0, 'sigma_w': 0.7}), 'mne_connectivity_settings': FieldInfo(annotation=MNEConnectivitySettings, required=False, default={'method': 'plv', 'mode': 'multitaper'}), 'nolds_settings': FieldInfo(annotation=NoldsSettings, required=False, default={'features': {'correlation_dimension': False, 'detrended_fluctuation_analysis': False, 'hurst_exponent': False, 'lyapunov_exponent': True, 'sample_entropy': False}, 'frequency_bands': ['low_beta'], 'raw': True}), 'postprocessing': FieldInfo(annotation=PostprocessingSettings, required=False, default={'feature_normalization': True, 'project_cortex': False, 'project_subcortex': False}), 'preprocessing': FieldInfo(annotation=list[Literal['preprocessing_filter', 'notch_filter', 'raw_resampling', 're_referencing', 'raw_normalization']], required=False, default=['raw_resampling', 'notch_filter', 're_referencing']), 'preprocessing_filter': FieldInfo(annotation=FilterSettings, required=False, default={'bandpass_filter': True, 'bandpass_filter_settings': {'frequency_high_hz': 200.0, 'frequency_low_hz': 2.0}, 'bandstop_filter': True, 'bandstop_filter_settings': {'frequency_high_hz': 160.0, 'frequency_low_hz': 100.0}, 'highpass_filter': True, 'highpass_filter_cutoff_hz': 3, 'lowpass_filter': True, 'lowpass_filter_cutoff_hz': 200}), 'project_cortex_settings': FieldInfo(annotation=ProjectionSettings, required=False, default={'max_dist_mm': 20.0}), 'project_subcortex_settings': FieldInfo(annotation=ProjectionSettings, required=False, default={'max_dist_mm': 5.0}), 'raw_normalization_settings': FieldInfo(annotation=NormalizationSettings, required=False, default={'clip': 3, 'normalization_method': 'zscore', 'normalization_time_s': 30}), 'raw_resampling_settings': FieldInfo(annotation=ResamplerSettings, required=False, default={'resample_freq_hz': 1000}), 'sampling_rate_features_hz': FieldInfo(annotation=float, required=False, default=10, metadata=[Gt(gt=0)]), 'segment_length_features_ms': FieldInfo(annotation=float, required=False, default=1000, metadata=[Gt(gt=0)]), 'sharpwave_analysis_settings': FieldInfo(annotation=SharpwaveSettings, required=False, default={'apply_estimator_between_peaks_and_troughs': True, 'detect_peaks': {'distance_peaks_ms': 5, 'distance_troughs_ms': 10, 'estimate': True}, 'detect_troughs': {'distance_peaks_ms': 5, 'distance_troughs_ms': 10, 'estimate': True}, 'estimator': {'max': ['prominence', 'sharpness'], 'mean': ['interval'], 'median': [], 'min': [], 'var': []}, 'filter_ranges_hz': [{'frequency_high_hz': 80.0, 'frequency_low_hz': 5.0}, {'frequency_high_hz': 30.0, 'frequency_low_hz': 5.0}], 'sharpwave_features': {'decay_steepness': False, 'decay_time': False, 'interval': True, 'num_peaks': False, 'peak_left': False, 'peak_right': False, 'prominence': True, 'rise_steepness': False, 'rise_time': False, 'sharpness': True, 'slope_ratio': False, 'trough': False, 'width': False}}), 'stft_settings': FieldInfo(annotation=OscillatorySettings, required=False, default={'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000}), 'welch_settings': FieldInfo(annotation=OscillatorySettings, required=False, default={'features': {'max': False, 'mean': True, 'median': False, 'std': False}, 'log_transform': True, 'return_spectrum': False, 'windowlength_ms': 1000})}#
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.