mt_metadata.processing.fourier_coefficients.decimation ====================================================== .. py:module:: mt_metadata.processing.fourier_coefficients.decimation Classes ------- .. autoapisummary:: mt_metadata.processing.fourier_coefficients.decimation.Decimation Functions --------- .. autoapisummary:: mt_metadata.processing.fourier_coefficients.decimation.fc_decimations_creator mt_metadata.processing.fourier_coefficients.decimation.get_degenerate_fc_decimation Module Contents --------------- .. py:class:: Decimation(**data) Bases: :py:obj:`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. .. attribute:: _skip_equals Private attribute listing fields to skip in equality comparisons :type: list[str] .. attribute:: _fields Private attribute caching field information :type: dict[str, Any] .. rubric:: 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 .. py:attribute:: id :type: Annotated[str, Field(default='', description='Decimation level ID', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['1']})] .. py:attribute:: channels_estimated :type: Annotated[list[str], Field(default_factory=list, description='list of channels', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['[ex, hy]']})] .. py:attribute:: time_period :type: 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()']})] .. py:attribute:: channels :type: 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]']})] .. py:attribute:: time_series_decimation :type: 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()']})] .. py:attribute:: short_time_fourier_transform :type: 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()']})] .. py:method:: validate_short_time_fourier_transform(value, info) :classmethod: .. py:method:: validate_channels_estimated(value, info) :classmethod: .. py:method:: validate_channels(value, info) :classmethod: .. py:method:: 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 .. py:method:: add(other) :param other: :return: .. py:property:: decimation :type: mt_metadata.processing.TimeSeriesDecimation Passthrough method to access self.time_series_decimation .. py:property:: stft .. py:method:: update(other, match=[]) Update attribute values from another like element, skipping None :param other: DESCRIPTION :type other: TYPE :return: DESCRIPTION :rtype: TYPE .. py:method:: has_channel(component) Check to see if the channel already exists :param component: channel component to look for :type component: string :return: True if found, False if not :rtype: boolean .. py:method:: channel_index(component) get index of the channel in the channel list .. py:method:: get_channel(component) Get a channel :param component: channel component to look for :type component: string :return: FCChannel object based on channel type :rtype: :class:`mt_metadata.timeseries.Channel` .. py:method:: add_channel(channel_obj) Add a channel to the list, check if one exists if it does overwrite it :param channel_obj: channel object to add :type channel_obj: :class:`mt_metadata.transfer_functions.processing.fourier_coefficients.Channel` .. py:method:: remove_channel(channel_id) remove a channel from the survey :param component: channel component to look for :type component: string .. py:property:: n_channels .. py:method:: update_time_period() update time period from ch information .. py:method:: 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. .. py:property:: fft_frequencies :type: numpy.ndarray Returns the one-sided fft frequencies (without Nyquist) .. py:function:: 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 :param initial_sample_rate: Sample rate of the "level0" data -- usually the sample rate during field acquisition. :type initial_sample_rate: float :param decimation_factors: The decimation factors that will be applied at each FC decimation level :type decimation_factors: Optional[list] :param max_levels: The maximum number of decimation levels to allow :type max_levels: Optional[int] :param time_period: Provides the start and end times :type time_period: Optional[TimePeriod] :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)) :rtype: list .. py:function:: 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. :param sample_rate: The sample rate associated with the time-series to convert to spectrogram :type sample_rate: float :returns: **output** -- List has only one element which is of type FCDecimation, aka. :rtype: list