mt_metadata.processing.aurora
Submodules
- mt_metadata.processing.aurora.channel
- mt_metadata.processing.aurora.channel_nomenclature
- mt_metadata.processing.aurora.decimation_level
- mt_metadata.processing.aurora.estimator
- mt_metadata.processing.aurora.frequency_bands
- mt_metadata.processing.aurora.processing
- mt_metadata.processing.aurora.regression
- mt_metadata.processing.aurora.run
- mt_metadata.processing.aurora.station
- mt_metadata.processing.aurora.stations
Classes
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Collection of Band objects, typically used at a single decimation level. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
|
Base class for all metadata objects with Pydantic validation. |
Package Contents
- class mt_metadata.processing.aurora.Band(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- decimation_level: Annotated[int, Field(default=None, description='Decimation level for the band', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['0']})]
- index_max: Annotated[int, Field(default=None, description='maximum band index', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- index_min: Annotated[int, Field(default=None, description='minimum band index', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- frequency_max: Annotated[float, Field(default=0.0, description='maximum band frequency', alias=None, json_schema_extra={'units': 'Hertz', 'required': True, 'examples': ['0.04296875']})]
- frequency_min: Annotated[float, Field(default=0.0, description='minimum band frequency', alias=None, json_schema_extra={'units': 'Hertz', 'required': True, 'examples': ['0.03515625']})]
- center_averaging_type: Annotated[CenterAveragingTypeEnum, Field(default=CenterAveragingTypeEnum.geometric, description='type of average to apply when computing the band center', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['geometric']})]
- closed: Annotated[ClosedEnum, Field(default=ClosedEnum.left, description='whether interval is open or closed', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['left']})]
- name: Annotated[Optional[str], Field(default='', description='Name of the band', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['0.039062']})]
- classmethod validate_name(value, info)
- classmethod update_name_on_frequency_change(value, info)
- check_name()
- property lower_bound: float
- property upper_bound: float
- property width: float
returns the width of the band (the bandwidth).
- property lower_closed: bool
- property upper_closed: bool
- set_indices_from_frequencies(frequencies)
assumes min/max freqs are defined
- to_interval()
- property harmonic_indices
Assumes all harmoincs between min and max are present in the band
- Return type:
numpy array of integers corresponding to harminic indices
- in_band_harmonics(frequencies)
- Parameters:
frequencies (array-like, floating poirt)
Returns (numpy array) – the actual harmonics or frequencies in band, rather than the indices.
-------
- property center_frequency: float
returns: center_frequency – The frequency associated with the band center. :rtype: float
- property center_period: float
Returns the inverse of center frequency.
- overlaps(other)
Check if this band overlaps with another
- contains(other)
Check if this band contains nother
- property fractional_bandwidth: float
See - https://en.wikipedia.org/wiki/Bandwidth_(signal_processing)#Fractional_bandwidth - https://en.wikipedia.org/wiki/Q_factor
- property Q: float
Quality factor (Q) of the band.
- Returns:
Q factor. Returns infinity for zero-width bands.
- Return type:
float
- class mt_metadata.processing.aurora.Channel(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- id: Annotated[str, Field(default='', description='channel ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['mt001']})]
- scale_factor: Annotated[float, Field(default=1.0, description='scale factor of the channel', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10.0']})]
- class mt_metadata.processing.aurora.ChannelNomenclature(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- ex: Annotated[ExEnum, Field(default='ex', description='label for the X electric field channel, X is assumed to be North', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['ex']})]
- ey: Annotated[EyEnum, Field(default='ey', description='label for the Y electric field channel, Y is assumed to be East', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['ey']})]
- hx: Annotated[HxEnum, Field(default='hx', description='label for the X magnetic field channel, X is assumed to be North', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hx']})]
- hy: Annotated[HyEnum, Field(default='hy', description='label for the Y magnetic field channel, Y is assumed to be East', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hy']})]
- hz: Annotated[HzEnum, Field(default='hz', description='label for the Z magnetic field channel, Z is assumed to be vertical Down', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hz']})]
- keyword: Annotated[SupportedNomenclatureEnum, Field(default=SupportedNomenclatureEnum.default, description='Keyword for the channel nomenclature system', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['default', 'lemi12', 'lemi34', 'musgraves', 'phoenix123']})]
- classmethod check_keyword(value, info)
- property ex_ey: list[str]
- property hx_hy: list[str]
- property hx_hy_hz: list[str]
- property ex_ey_hz: list[str]
- property default_input_channels: list[str]
- property default_output_channels: list[str]
- property default_reference_channels: list[str]
- get_channel_map()
Based on self.keyword return the mapping between conventional channel names and the custom channel names in the particular nomenclature.
- update()
Assign values to standard channel names “ex”, “ey” etc based on channel_map dict
- unpack()
- property channels: list[str]
- model_post_init(__context)
Called after model initialization to set up auto-update and do initial update.
- class mt_metadata.processing.aurora.DecimationLevel(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- bands: Annotated[list[mt_metadata.common.band.Band], Field(default_factory=list, description='List of bands', json_schema_extra={'units': None, 'required': True, 'examples': ['[]']})]
- channel_weight_specs: Annotated[List[mt_metadata.features.weights.ChannelWeightSpec], Field(default_factory=list, description='List of weighting schemes to use for TF processing for each output channel', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['[]']})]
- input_channels: Annotated[list[str], Field(default_factory=list, description='list of input channels (sources)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hx, hy']})]
- output_channels: Annotated[list[str], Field(default_factory=list, description='list of output channels (responses)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['ex, ey, hz']})]
- reference_channels: Annotated[list[str], Field(default_factory=list, description='list of reference channels (remote sources)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hx, hy']})]
- save_fcs: Annotated[bool, Field(default=False, description='Whether the Fourier coefficients are saved [True] or not [False].', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': [True]})]
- save_fcs_type: Annotated[SaveFcsTypeEnum | None, Field(default=None, description='Format to use for fc storage', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['h5']})]
- decimation: Annotated[mt_metadata.processing.TimeSeriesDecimation, Field(default_factory=Decimation, description='Decimation settings', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Decimation()']})]
- estimator: Annotated[mt_metadata.processing.aurora.estimator.Estimator, Field(default_factory=Estimator, description='Estimator settings', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Estimator()']})]
- regression: Annotated[mt_metadata.processing.aurora.regression.Regression, Field(default_factory=Regression, description='Regression settings', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Regression()']})]
- stft: Annotated[mt_metadata.processing.ShortTimeFourierTransform, Field(default_factory=STFT, description='Short-time Fourier transform settings', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['STFT()']})]
- classmethod validate_channel_weight_specs(value, info)
Validator for channel_weight_specs field.
- classmethod validate_bands(value, info)
- add_band(band)
add a band
- property lower_bounds: numpy.ndarray
get lower bounds index values into an array.
- property upper_bounds: numpy.ndarray
get upper bounds index values into an array.
- property bands_dataframe: pandas.DataFrame
Utility function that transforms a list of bands into a dataframe
See notes in _df_from_bands.
- Returns:
bands_df – Same format as that generated by EMTFBandSetupFile.get_decimation_level()
- Return type:
pd.Dataframe
- property frequency_sample_interval: float
Returns the delta_f in frequency domain df = 1 / (N * dt) Here dt is the sample interval after decimation
- Returns:
frequency_sample_interval – The frequency sample interval after decimation.
- Return type:
float
- property band_edges: numpy.ndarray
Returns the band edges as a numpy array
- Returns:
band_edges
- Return type:
2D numpy array, one row per frequency band and two columns
- frequency_bands_obj()
Gets a FrequencyBands object that is used as input to processing.
Used by Aurora.
TODO: consider adding .to_frequency_bands() method directly to self.bands
- Returns:
frequency_bands – A FrequencyBands object that can be used as an iterator for processing.
- Return type:
- property fft_frequencies: numpy.ndarray
Gets the harmonics of the STFT.
- Returns:
freqs – The frequencies at which the stft will be available.
- Return type:
np.ndarray
- property harmonic_indices: List[int]
Loops over all bands and returns a list of the harminic indices. TODO: Distinguish the bands which are a processing construction vs harmonic indices which are FFT info.
- Returns:
return_list – The indices of the harmonics that are needed for processing.
- Return type:
list of integers
- property local_channels
- is_consistent_with_archived_fc_parameters(fc_decimation, remote)
Usage: For an already existing spectrogram stored in an MTH5 archive, this compares the metadata within the archive (fc_decimation) with an aurora decimation level (self), and tells whether the parameters are in agreement. If True, this allows aurora to skip the calculation of FCs and instead read them from the archive.
TODO: Merge all checks of TimeSeriesDecimation parameters into a single check. - e.g. Compress all decimation checks to: assert fc_decimation.decimation == self.decimation
- decimation_level: FCDecimation
metadata describing the parameters used to compute an archived spectrogram
- remote: bool
If True, we are looking for reference channels, not local channels in the FCGroup.
- Iterates over FCDecimation attributes:
“channels_estimated”: to ensure all expected channels are in the group “decimation.anti_alias_filter”: check that the expected AAF was applied “decimation.sample_rate, “decimation.method”, “stft.prewhitening_type”, “stft.recoloring”, “stft.pre_fft_detrend_type”, “stft.min_num_stft_windows”, “stft.window”, “stft.harmonic_indices”,
- Return type:
return:
- to_fc_decimation(remote=False, ignore_harmonic_indices=True)
Generates a FC Decimation() object for use with FC Layer in mth5.
TODO: this is being tested only in aurora – move a test to mt_metadata or move the method. Ignoring for now these properties “time_period.end”: “1980-01-01T00:00:00+00:00”, “time_period.start”: “1980-01-01T00:00:00+00:00”,
TODO: FIXME: Assignment of TSDecimation can be done in one shot once #235 is addressed.
- Parameters:
remote (bool) – If True, use reference channels, if False, use local_channels. We may wish to not pass remote=True when _building_ FCs however, because then not all channels will get built.
ignore_harmonic_indices (bool) – If True, leave harmonic indices at default [-1,], which means all indices. If False, only the specific harmonic indices needed for processing will be stored. Thus, when building FCs, it maybe best to leave this as True, that way all FCs will be stored, so if the band setup is changed, the FCs will still be there.
Returns – fc_dec_obj:mt_metadata.transfer_functions.processing.fourier_coefficients.decimation.Decimation A decimation object configured for STFT processing
- class mt_metadata.processing.aurora.Estimator(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- engine: Annotated[EngineEnum, Field(default=EngineEnum.RME_RR, description='The transfer function estimator engine', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['RME_RR']})]
- estimate_per_channel: Annotated[bool, Field(default=True, description='Estimate per channel', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['True']})]
- class mt_metadata.processing.aurora.FrequencyBands(band_edges=None)
Collection of Band objects, typically used at a single decimation level.
- _band_edges
DataFrame with columns [‘lower_bound’, ‘upper_bound’] containing frequency band boundaries
- Type:
pd.DataFrame
- property band_edges: pandas.DataFrame
Get band edges as a DataFrame
- property number_of_bands: int
Number of frequency bands
- property array: numpy.ndarray
Get band edges as numpy array
- sort(by='center_frequency', ascending=True)
Sort bands by specified criterion.
- Parameters:
by (str) – Criterion to sort by: - “lower_bound”: Sort by lower frequency bound - “upper_bound”: Sort by upper frequency bound - “center_frequency”: Sort by geometric center frequency (default)
ascending (bool) – If True, sort in ascending order, else descending
- bands(direction='increasing_frequency', sortby=None, rtype='list')
Generate Band objects in specified order.
- Parameters:
direction (str) – Order of iteration: “increasing_frequency” or “increasing_period”
sortby (str, optional) – Sort bands before iteration: - “lower_bound”: Sort by lower frequency bound - “upper_bound”: Sort by upper frequency bound - “center_frequency”: Sort by geometric center frequency If None, uses existing order
rtype (str) – Return type: “list” or “generator”. Default is “list” for easier reuse. Use “generator” for memory efficiency when bands are only iterated once.
- Returns:
Band objects for each frequency band, either as a list or generator depending on rtype parameter.
- Return type:
- band(i_band)
Get specific frequency band.
- Parameters:
i_band (int) – Index of band to return (zero-based)
- Returns:
Frequency band object
- Return type:
- band_centers(frequency_or_period='frequency')
Calculate center frequencies/periods for all bands.
- Parameters:
frequency_or_period (str) – Return values in “frequency” (Hz) or “period” (s)
- Returns:
Center frequencies/periods for each band
- Return type:
np.ndarray
- validate()
Validate and potentially reorder bands based on center frequencies.
- class mt_metadata.processing.aurora.Processing(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- decimations: Annotated[list[mt_metadata.processing.aurora.decimation_level.DecimationLevel], Field(default_factory=list, description='decimation levels', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['0']})]
- band_specification_style: Annotated[BandSpecificationStyleEnum | None, Field(default=None, description='describes how bands were sourced', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['EMTF']})]
- band_setup_file: Annotated[str | None, Field(default=None, description='the band setup file used to define bands', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['/home/user/bs_test.cfg']})]
- id: Annotated[str, Field(default='', description='Configuration ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['0']})]
- channel_nomenclature: Annotated[mt_metadata.processing.aurora.channel_nomenclature.ChannelNomenclature, Field(default_factory=ChannelNomenclature, description='Channel nomenclature', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['EMTF']})]
- stations: Annotated[mt_metadata.processing.aurora.stations.Stations, Field(default_factory=Stations, description='Station information', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['Station1', 'Station2']})]
- classmethod validate_decimations(value, info)
- property decimations_dict: dict[int, mt_metadata.processing.aurora.decimation_level.DecimationLevel]
need to have a dictionary, but it can’t be an attribute cause that gets confusing when reading in a json file
- Returns:
A dictionary mapping decimation levels to their corresponding DecimationLevel objects.
- Return type:
dict[int, DecimationLevel]
- get_decimation_level(level)
Get a decimation level for easy access
- Parameters:
level (int) – The decimation level to retrieve.
- Returns:
The DecimationLevel object corresponding to the specified level.
- Return type:
- add_decimation_level(decimation_level)
add a decimation level
- Parameters:
decimation_level (DecimationLevel | dict) – The decimation level to add, either as a DecimationLevel object or a dictionary.
- Return type:
None
- property band_edges_dict: dict[int, list[tuple[float, float]]]
- assign_decimation_level_data_emtf(sample_rate)
Warning: This does not actually tell us how many samples we are decimating down at each level. That is assumed to be 4 but we need a way to bookkeep this in general
- Parameters:
sample_rate (float) – The initial sampling rate of the data before any decimation
- assign_bands(band_edges_dict, sample_rate, decimation_factors, num_samples_window=256)
Warning: This does not actually tell us how many samples we are decimating down at each level. That is assumed to be 4 but we need a way to bookkeep this in general
- Parameters:
band_edges (dict[int, list[tuple[float, float]]]) – A dictionary mapping decimation levels to lists of frequency band edges. keys are integers, starting with 0, values are arrays of edges
sample_rate (float) – The initial sampling rate of the data before any decimation.
decimation_factors (dict[int, int]) – A dictionary mapping decimation levels to their corresponding decimation factors.
num_samples_window (dict[int, int] | int, optional (default=256)) – The number of samples in the STFT window for each decimation level. If an integer is provided, it will be applied to all levels. If a dictionary is provided, it should map decimation levels to their corresponding number of samples.
- Return type:
None
- json_fn()
- property num_decimation_levels
- drop_reference_channels()
- set_input_channels(channels)
- set_output_channels(channels)
- set_reference_channels(channels)
- set_default_input_output_channels()
- set_default_reference_channels()
- validate_processing(kernel_dataset)
Placeholder. Some of the checks and methods here maybe better placed in TFKernel, which would validate the dataset against the processing config.
Things that are validated: 1. The default estimation engine from the json file is “RME_RR”, which is fine ( we expect to in general to do more RR processing than SS) but if there is only one station (no remote)then the RME_RR should be replaced by default with “RME”.
make sure local station id is defined (correctly from kernel dataset)
- class mt_metadata.processing.aurora.Regression(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- minimum_cycles: Annotated[int, Field(default=1, description='Minimum number of cycles in the regression', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- max_iterations: Annotated[int, Field(default=10, description='Max iterations of the regression', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- max_redescending_iterations: Annotated[int, Field(default=2, description='Max redescending iterations of the regression', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['2']})]
- r0: Annotated[float, Field(default=1.5, description='The number of standard deviations where the influence function changes from linear to quadratic', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['1.4']})]
- u0: Annotated[float, Field(default=2.8, description='Control for redescending Huber regression weights.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['2.8']})]
- tolerance: Annotated[float, Field(default=0.005, description='Control for convergence of RME algorithm. Lower means more iterations', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['0.005']})]
- verbosity: Annotated[int, Field(default=1, description='Control for logging messages during regression -- Higher means more messages', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['1']})]
- class mt_metadata.processing.aurora.Run(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- id: Annotated[str, Field(default='', description='run ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['001']})]
- input_channels: Annotated[list[mt_metadata.processing.aurora.channel.Channel], Field(default_factory=list, description='List of input channels (source)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hx, hy']})]
- output_channels: Annotated[list[mt_metadata.processing.aurora.channel.Channel], Field(default_factory=list, description='List of output channels (response)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['ex, ey, hz']})]
- time_periods: Annotated[list[mt_metadata.common.TimePeriod], Field(default_factory=list, description='List of time periods to process', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ["[{'start': '2020-01-01T00:00:00', 'end': '2020-01-01T01:00:00'}]"]})]
- sample_rate: Annotated[float, Field(default=1.0, description='sample rate of the run', alias=None, json_schema_extra={'units': 'samples per second', 'required': True, 'examples': ['1']})]
- classmethod validate_channel_list(values, info)
- classmethod validate_time_periods(values, info)
- property channel_scale_factors: dict[str, float]
- set_channel_scale_factors(values)
Validate and process channel scale factors.
- Parameters:
values (Union[dict, float]) – The scale factors for the channels.
- Raises:
TypeError – If the input is not a dictionary or float.
- property input_channel_names: list[str]
list of channel names
- property output_channel_names: list[str]
list of channel names
- class mt_metadata.processing.aurora.Station(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- id: Annotated[str, Field(default='', description='Station ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['mt001']})]
- mth5_path: Annotated[str | pathlib.Path, Field(default='', description='full path to MTH5 file where the station data is contained', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['/home/mt/experiment_01.h5']})]
- remote: Annotated[bool, Field(default=False, description='remote station (True) or local station (False)', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['False']})]
- runs: Annotated[list[mt_metadata.processing.aurora.run.Run], Field(default_factory=list, description='List of runs to process', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['001']})]
- classmethod validate_mth5_path(value, info)
- classmethod validate_runs(values, info)
- get_run(run_id)
Get a run by ID
- Parameters:
run_id (TYPE) – DESCRIPTION
- Returns:
DESCRIPTION
- Return type:
Run | None
- property run_list: list[str]
list of run names
- property run_dict: dict[str, mt_metadata.processing.aurora.run.Run]
need to have a dictionary, but it can’t be an attribute cause that gets confusing when reading in a json file
- Returns:
DESCRIPTION
- Return type:
dict[str, Run]
- to_dataset_dataframe()
Create a dataset definition dataframe that can be used in the processing
- [
“station”, “run”, “start”, “end”, “mth5_path”, “sample_rate”, “input_channels”, “output_channels”, “remote”,
]
- from_dataset_dataframe(df)
set a data frame
- [
“station”, “run”, “start”, “end”, “mth5_path”, “sample_rate”, “input_channels”, “output_channels”, “remote”,
]
- Parameters:
df (pd.DataFrame) – DESCRIPTION
- Returns:
DESCRIPTION
- Return type:
TYPE
- class mt_metadata.processing.aurora.Stations(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- remote: Annotated[list[mt_metadata.processing.aurora.station.Station], Field(default_factory=list, description='list of remote sites', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- local: Annotated[mt_metadata.processing.aurora.station.Station, Field(default_factory=Station, description='local site', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})]
- validate_remote(value, info)
Method for unpacking rr_station info into mt_metadata object.
Developmnent Notes: This function was raising an exception when trying to populate an aurora.Processing object from a json.loads() dict. TODO: add a description of input variable and use cases, … it seems that we may not want to support multiple rr stations yet.
- Parameters:
rr_station
- Return type:
list of Station objects
- property remote_dict: dict[str, mt_metadata.processing.aurora.station.Station]
need to have a dictionary, but it can’t be an attribute cause that gets confusing when reading in a json file
- Returns:
dictionary of remote stations
- Return type:
dict[str, Station]
- from_dataset_dataframe(df)
from a dataset dataframe
- Parameters:
df (pd.DataFrame) – dataset dataframe to read from
- Return type:
None
- to_dataset_dataframe()
output a dataframe
- Returns:
dataframe representation of the station
- Return type:
pd.DataFrame