mth5.groups.transfer_function
Classes
Container for transfer functions under a station. |
|
Wrapper for a single transfer function estimation. |
Module Contents
- class mth5.groups.transfer_function.TransferFunctionsGroup(group: Any, **kwargs: Any)[source]
Bases:
mth5.groups.BaseGroupContainer for transfer functions under a station.
Each child group is a single transfer function estimation managed by
TransferFunctionGroup.Examples
>>> from mth5 import mth5 >>> m5 = mth5.MTH5() >>> _ = m5.open_mth5("/tmp/example.mth5", mode="a") >>> station = m5.stations_group.add_station("mt01") >>> tf_group = station.transfer_functions_group >>> tf_group.groups_list []
- tf_summary(as_dataframe: bool = True) pandas.DataFrame | numpy.ndarray[source]
Summarize transfer functions stored for the station.
- Parameters:
as_dataframe (bool, default True) – If
Truereturn a pandas DataFrame, otherwise a NumPy structured array.- Returns:
Summary rows including station reference, location, and TF metadata.
- Return type:
pandas.DataFrame or numpy.ndarray
Examples
>>> summary = tf_group.tf_summary() >>> summary.columns[:4].tolist() ['station_hdf5_reference', 'station', 'latitude', 'longitude']
- add_transfer_function(name: str, tf_object: mt_metadata.transfer_functions.core.TF | None = None) TransferFunctionGroup[source]
Add a transfer function group under this station.
- Parameters:
name (str) – Transfer function identifier.
tf_object (TF, optional) – Transfer function instance to seed metadata and datasets.
- Returns:
Wrapper for the created or existing transfer function.
- Return type:
Examples
>>> tf_group = station.transfer_functions_group >>> _ = tf_group.add_transfer_function("mt01_4096")
- get_transfer_function(tf_id: str) TransferFunctionGroup[source]
Return an existing transfer function by id.
- Parameters:
tf_id (str) – Name of the transfer function.
- Returns:
Wrapper for the requested transfer function.
- Return type:
- Raises:
MTH5Error – If the transfer function does not exist.
Examples
>>> existing = station.transfer_functions_group.get_transfer_function("mt01_4096") >>> existing.name 'mt01_4096'
- remove_transfer_function(tf_id: str) None[source]
Delete a transfer function reference from the station.
- Parameters:
tf_id (str) – Transfer function name.
Notes
HDF5 deletion removes the reference only; storage is not reclaimed.
Examples
>>> tf_group.remove_transfer_function("mt01_4096")
- get_tf_object(tf_id: str) mt_metadata.transfer_functions.core.TF[source]
Return a populated
mt_metadata.transfer_functions.core.TF.- Parameters:
tf_id (str) – Transfer function name to convert.
- Returns:
Transfer function populated with metadata and estimates.
- Return type:
mt_metadata.transfer_functions.core.TF
Examples
>>> tf_obj = tf_group.get_tf_object("mt01_4096")
- class mth5.groups.transfer_function.TransferFunctionGroup(group: Any, **kwargs: Any)[source]
Bases:
mth5.groups.BaseGroupWrapper for a single transfer function estimation.
- property period: numpy.ndarray | None[source]
Return period array stored in
perioddataset, if present.
- add_statistical_estimate(estimate_name: str, estimate_data: numpy.ndarray | xarray.DataArray | None = None, estimate_metadata: mt_metadata.transfer_functions.tf.statistical_estimate.StatisticalEstimate | None = None, max_shape: tuple[int | None, int | None, int | None] = (None, None, None), chunks: bool = True, **kwargs: Any) mth5.groups.EstimateDataset[source]
Add a statistical estimate dataset.
- Parameters:
estimate_name (str) – Dataset name.
estimate_data (numpy.ndarray or xarray.DataArray, optional) – Estimate values; if
Nonea placeholder array is created.estimate_metadata (StatisticalEstimate, optional) – Metadata describing the estimate.
max_shape (tuple of int or None, default (None, None, None)) – Maximum shape for resizable datasets.
chunks (bool, default True) – Chunking flag forwarded to HDF5 dataset creation.
- Returns:
Wrapper combining dataset and metadata.
- Return type:
- Raises:
TypeError – If
estimate_datais not array-like.
Examples
>>> est = tf_group.add_statistical_estimate("transfer_function") >>> isinstance(est, EstimateDataset) True
- get_estimate(estimate_name: str) mth5.groups.EstimateDataset[source]
Return a statistical estimate dataset by name.
- to_tf_object() mt_metadata.transfer_functions.core.TF[source]
Convert this group into a populated
TFobject.- Returns:
TF instance with survey, station, runs, channels, period, and estimate datasets applied.
- Return type:
mt_metadata.transfer_functions.core.TF
- Raises:
ValueError – If no period dataset is present.
Examples
>>> tf_obj = tf_group.to_tf_object()
- from_tf_object(tf_obj: mt_metadata.transfer_functions.core.TF, update_metadata: bool = True) None[source]
Populate datasets from a
TFobject.- Parameters:
tf_obj (TF) – Transfer function object containing estimates and metadata.
update_metadata (bool, default True) – If
Truewrite transfer function metadata to HDF5.
- Raises:
ValueError – If
tf_objis not aTFinstance.
Examples
>>> tf_group.from_tf_object(tf_obj)