mth5.tables.channel_table

Classes

ChannelSummaryTable

Convenience wrapper around the channel summary dataset.

Module Contents

class mth5.tables.channel_table.ChannelSummaryTable(hdf5_dataset: h5py.Dataset)[source]

Bases: mth5.tables.MTH5Table

Convenience wrapper around the channel summary dataset.

Provides helpers to summarize channels, convert to pandas, and derive run-level summaries.

Examples

>>> ch_table = ChannelSummaryTable(hdf5_dataset)
>>> df = ch_table.to_dataframe()
>>> run_df = ch_table.to_run_summary()
to_dataframe() pandas.DataFrame[source]

Convert the channel summary to a pandas DataFrame.

Returns:

Channel summary with decoded string columns and parsed datetimes.

Return type:

pandas.DataFrame

Examples

>>> df = ch_table.to_dataframe()
>>> df.head()
summarize() None[source]

Populate the summary table from channel datasets in the file.

to_run_summary(allowed_input_channels: Iterable[str] = ALLOWED_INPUT_CHANNELS, allowed_output_channels: Iterable[str] = ALLOWED_OUTPUT_CHANNELS, sortby: list[str] | None = None) pandas.DataFrame[source]

Compress channel summary into a run-level summary (one row per run).

Parameters:
  • allowed_input_channels (Iterable[str], optional) – Allowed input channel names, by default ALLOWED_INPUT_CHANNELS.

  • allowed_output_channels (Iterable[str], optional) – Allowed output channel names, by default ALLOWED_OUTPUT_CHANNELS.

  • sortby (list of str or None, optional) – Columns to sort by; defaults to ["station", "start"] when None.

Returns:

Run-level summary including channels, durations, and references.

Return type:

pandas.DataFrame

Examples

>>> run_df = ch_table.to_run_summary()
>>> run_df.columns[:4].tolist()
['survey', 'station', 'run', 'start']