mt_metadata.processing.fourier_coefficients.decimation

Classes

Decimation

Base class for all metadata objects with Pydantic validation.

Functions

fc_decimations_creator(initial_sample_rate[, ...])

Creates mt_metadata FCDecimation objects that parameterize Fourier coefficient decimation levels.

get_degenerate_fc_decimation(sample_rate)

WIP

Module Contents

class mt_metadata.processing.fourier_coefficients.decimation.Decimation(**data)

Bases: mt_metadata.base.MetadataBase

Base 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='Decimation level ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['1']})]
channels_estimated: Annotated[list[str], Field(default_factory=list, description='list of channels', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['[ex, hy]']})]
time_period: Annotated[mt_metadata.common.TimePeriod, Field(default_factory=TimePeriod, description='Time period over which these FCs were estimated', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['TimePeriod()']})]
channels: Annotated[mt_metadata.common.ListDict, Field(default_factory=ListDict, description='List of channels', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['[ex, hy]']})]
time_series_decimation: Annotated[mt_metadata.processing.TimeSeriesDecimation, Field(default_factory=TimeSeriesDecimation, description='Time series decimation settings', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['TimeSeriesDecimation()']})]
short_time_fourier_transform: Annotated[mt_metadata.processing.ShortTimeFourierTransform, Field(default_factory=ShortTimeFourierTransform, description='Short time Fourier transform settings', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['ShortTimeFourierTransform()']})]
classmethod validate_short_time_fourier_transform(value, info)
classmethod validate_channels_estimated(value, info)
classmethod validate_channels(value, info)
validate_channels_consistency()

Ensure that channels_estimated and channels are synchronized.

  • If a channel name exists in channels_estimated but not in channels, create a new FCChannel with that component name

  • Ensure all channels in channels ListDict have their component names in channels_estimated

add(other)
Parameters:

other

Returns:

property decimation: mt_metadata.processing.TimeSeriesDecimation

Passthrough method to access self.time_series_decimation

property stft
update(other, match=[])

Update attribute values from another like element, skipping None

Parameters:

other (TYPE) – DESCRIPTION

Returns:

DESCRIPTION

Return type:

TYPE

has_channel(component)

Check to see if the channel already exists

Parameters:

component (string) – channel component to look for

Returns:

True if found, False if not

Return type:

boolean

channel_index(component)

get index of the channel in the channel list

get_channel(component)

Get a channel

Parameters:

component (string) – channel component to look for

Returns:

FCChannel object based on channel type

Return type:

mt_metadata.timeseries.Channel

add_channel(channel_obj)

Add a channel to the list, check if one exists if it does overwrite it

Parameters:

channel_obj (mt_metadata.transfer_functions.processing.fourier_coefficients.Channel) – channel object to add

remove_channel(channel_id)

remove a channel from the survey

Parameters:

component (string) – channel component to look for

property n_channels
update_time_period()

update time period from ch information

is_valid_for_time_series_length(n_samples_ts)

Given a time series of len n_samples_ts, checks if there are sufficient samples to STFT.

property fft_frequencies: numpy.ndarray

Returns the one-sided fft frequencies (without Nyquist)

mt_metadata.processing.fourier_coefficients.decimation.fc_decimations_creator(initial_sample_rate, decimation_factors=None, max_levels=6, time_period=None)

Creates mt_metadata FCDecimation objects that parameterize Fourier coefficient decimation levels.

Note 1: This does not yet work through the assignment of which bands to keep. Refer to mt_metadata.transfer_functions.processing.Processing.assign_bands() to see how this was done in the past

Parameters:
  • initial_sample_rate (float) – Sample rate of the “level0” data – usually the sample rate during field acquisition.

  • decimation_factors (Optional[list]) – The decimation factors that will be applied at each FC decimation level

  • max_levels (Optional[int]) – The maximum number of decimation levels to allow

  • time_period (Optional[TimePeriod]) – Provides the start and end times

Returns:

fc_decimations – Each element of the list is an object of type mt_metadata.transfer_functions.processing.fourier_coefficients.Decimation, (a.k.a. FCDecimation).

The order of the list corresponds the order of the cascading decimation
  • No decimation levels are omitted.

  • This could be changed in future by using a dict instead of a list,

  • e.g. decimation_factors = dict(zip(np.arange(max_levels), decimation_factors))

Return type:

list

mt_metadata.processing.fourier_coefficients.decimation.get_degenerate_fc_decimation(sample_rate)

WIP

Makes a default fc_decimation list. This “degenerate” config will only operate on the first decimation level. This is useful for testing. It could also be used in future on an MTH5 stored time series in decimation levels already as separate runs.

Parameters:

sample_rate (float) – The sample rate associated with the time-series to convert to spectrogram

Returns:

output – List has only one element which is of type FCDecimation, aka.

Return type:

list