mt_metadata.common.band ======================= .. py:module:: mt_metadata.common.band .. autoapi-nested-parse:: Band class for frequency band definitions. Development Notes: To add better overlap and intersection checking, consider using piso https://piso.readthedocs.io/en/latest/getting_started/index.html Classes ------- .. autoapisummary:: mt_metadata.common.band.CenterAveragingTypeEnum mt_metadata.common.band.ClosedEnum mt_metadata.common.band.Band Module Contents --------------- .. py:class:: CenterAveragingTypeEnum Bases: :py:obj:`mt_metadata.common.enumerations.StrEnumerationBase` str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'. .. py:attribute:: arithmetic :value: 'arithmetic' .. py:attribute:: geometric :value: 'geometric' .. py:class:: ClosedEnum Bases: :py:obj:`mt_metadata.common.enumerations.StrEnumerationBase` str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'. .. py:attribute:: left :value: 'left' .. py:attribute:: right :value: 'right' .. py:attribute:: both :value: 'both' .. py:class:: Band(**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:: decimation_level :type: Annotated[int, Field(default=None, description='Decimation level for the band', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['0']})] .. py:attribute:: index_max :type: Annotated[int, Field(default=None, description='maximum band index', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})] .. py:attribute:: index_min :type: Annotated[int, Field(default=None, description='minimum band index', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['10']})] .. py:attribute:: frequency_max :type: Annotated[float, Field(default=0.0, description='maximum band frequency', alias=None, json_schema_extra={'units': 'Hertz', 'required': True, 'examples': ['0.04296875']})] .. py:attribute:: frequency_min :type: Annotated[float, Field(default=0.0, description='minimum band frequency', alias=None, json_schema_extra={'units': 'Hertz', 'required': True, 'examples': ['0.03515625']})] .. py:attribute:: center_averaging_type :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']})] .. py:attribute:: closed :type: Annotated[ClosedEnum, Field(default=ClosedEnum.left, description='whether interval is open or closed', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['left']})] .. py:attribute:: name :type: Annotated[Optional[str], Field(default='', description='Name of the band', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['0.039062']})] .. py:method:: validate_name(value, info) :classmethod: .. py:method:: update_name_on_frequency_change(value, info) :classmethod: .. py:method:: check_name() .. py:property:: lower_bound :type: float .. py:property:: upper_bound :type: float .. py:property:: width :type: float returns the width of the band (the bandwidth). .. py:property:: lower_closed :type: bool .. py:property:: upper_closed :type: bool .. py:method:: set_indices_from_frequencies(frequencies) assumes min/max freqs are defined .. py:method:: to_interval() .. py:property:: harmonic_indices Assumes all harmoincs between min and max are present in the band :rtype: numpy array of integers corresponding to harminic indices .. py:method:: in_band_harmonics(frequencies) :param frequencies: :type frequencies: array-like, floating poirt :param Returns: the actual harmonics or frequencies in band, rather than the indices. :type Returns: numpy array :param -------: .. py:property:: center_frequency :type: float returns: **center_frequency** -- The frequency associated with the band center. :rtype: float .. py:property:: center_period :type: float Returns the inverse of center frequency. .. py:method:: overlaps(other) Check if this band overlaps with another .. py:method:: contains(other) Check if this band contains nother .. py:property:: fractional_bandwidth :type: float See - https://en.wikipedia.org/wiki/Bandwidth_(signal_processing)#Fractional_bandwidth - https://en.wikipedia.org/wiki/Q_factor .. py:property:: Q :type: float Quality factor (Q) of the band. :returns: Q factor. Returns infinity for zero-width bands. :rtype: float