mth5.io.phoenix.readers.base

Module to read and parse native Phoenix Geophysics data formats of the MTU-5C Family.

This module implements Streamed readers for segmented-decimated continuus-decimated and native sampling rate time series formats of the MTU-5C family.

author:

Jorge Torres-Solis

Revised 2022 by J. Peacock

Classes

TSReaderBase

Generic reader that all other readers will inherit.

Module Contents

class mth5.io.phoenix.readers.base.TSReaderBase(path: str | pathlib.Path, num_files: int = 1, header_length: int = 128, report_hw_sat: bool = False, **kwargs)[source]

Bases: mth5.io.phoenix.readers.header.Header

Generic reader that all other readers will inherit.

This base class provides common functionality for reading Phoenix Geophysics time series data files, including header parsing, file sequence management, and metadata handling.

Parameters:
  • path (str or Path) – Path to the time series file

  • num_files (int, optional) – Number of files in the sequence, by default 1

  • header_length (int, optional) – Length of file header in bytes, by default 128

  • report_hw_sat (bool, optional) – Whether to report hardware saturation, by default False

  • **kwargs – Additional keyword arguments passed to parent Header class

stream[source]

File stream for reading binary data

Type:

BinaryIO or None

base_path[source]

Path to the current file

Type:

Path

last_seq[source]

Last sequence number in the file sequence

Type:

int

rx_metadata[source]

Receiver metadata object

Type:

PhoenixReceiverMetadata or None

logger[source]
property base_path: pathlib.Path[source]

Full path of the file.

Returns:

Full path to the file

Return type:

Path

last_seq[source]
stream = None[source]
rx_metadata = None[source]
property base_dir: pathlib.Path[source]

Parent directory of the file.

Returns:

Parent directory of the file

Return type:

Path

property file_name: str[source]

Name of the file.

Returns:

Name of the file

Return type:

str

property file_extension: str[source]

File extension.

Returns:

File extension including the dot

Return type:

str

property instrument_id: str[source]

Instrument ID extracted from filename.

Returns:

Instrument identifier

Return type:

str

property seq: int[source]

Sequence number of the file.

Returns:

Sequence number extracted from filename or set value

Return type:

int

property file_size: int[source]

File size in bytes.

Returns:

Size of the file in bytes

Return type:

int

property max_samples: int[source]

Maximum number of samples in a file.

Calculated as: (total number of bytes - header length) / frame size * n samples per frame

Returns:

Maximum number of samples in the file

Return type:

int

property sequence_list: list[pathlib.Path][source]

Get all the files in the sequence sorted by sequence number.

Returns:

List of Path objects for all files in the sequence

Return type:

list[Path]

property config_file_path: pathlib.Path | None[source]

Path to the config.json file.

Returns:

Path to config file if it exists, None otherwise

Return type:

Path or None

property recmeta_file_path: pathlib.Path | None[source]

Path to the recmeta.json file.

Returns:

Path to recmeta file if it exists, None otherwise

Return type:

Path or None

open_next() bool[source]

Open the next file in the sequence.

Returns:

True if next file is now open, False if it is not

Return type:

bool

open_file_seq(file_seq_num: int | None = None) bool[source]

Open a file in the sequence given the sequence number.

Parameters:

file_seq_num (int, optional) – Sequence number to open, by default None

Returns:

True if file is now open, False if it is not

Return type:

bool

close() None[source]

Close the file stream.

get_config_object() mth5.io.phoenix.readers.config.PhoenixConfig | None[source]

Read a config file into an object.

Returns:

Configuration object if config file exists, None otherwise

Return type:

PhoenixConfig or None

get_receiver_metadata_object() None[source]

Read recmeta.json into an object and store in rx_metadata attribute.

get_lowpass_filter_name() str | None[source]

Get the lowpass filter used by the receiver pre-decimation.

Returns:

Name of the lowpass filter if available, None otherwise

Return type:

str or None

update_channel_map_from_recmeta() None[source]

Update channel map from recmeta.json file.

property channel_metadata: Any[source]

Channel metadata updated from recmeta.

Returns:

Channel metadata object

Return type:

Any

property run_metadata: Any[source]

Run metadata updated from recmeta.

Returns:

Run metadata object

Return type:

Any

property station_metadata: Any[source]

Station metadata updated from recmeta.

Returns:

Station metadata object

Return type:

Any

get_receiver_lowpass_filter(rxcal_fn: str | pathlib.Path) Any[source]

Get receiver lowpass filter from the rxcal.json file.

Parameters:

rxcal_fn (str or Path) – Path to the receiver calibration file

Returns:

Filter object from calibration file

Return type:

Any

Raises:

ValueError – If the lowpass filter name cannot be found

get_dipole_filter() mt_metadata.timeseries.filters.CoefficientFilter | None[source]

Get dipole filter for electric field channels.

Returns:

Dipole filter if channel has dipole length, None otherwise

Return type:

CoefficientFilter or None

get_sensor_filter(scal_fn: str | pathlib.Path) Any[source]

Get sensor filter from calibration file.

Parameters:

scal_fn (str or Path) – Path to sensor calibration file

Returns:

Sensor filter object

Return type:

Any

Notes

This method is not implemented yet.

get_v_to_mv_filter() mt_metadata.timeseries.filters.CoefficientFilter[source]

Create a filter to convert units from volts to millivolts.

Returns:

Filter that converts volts to millivolts with gain of 1000

Return type:

CoefficientFilter

get_channel_response(rxcal_fn: str | pathlib.Path | None = None, scal_fn: str | pathlib.Path | None = None) mt_metadata.timeseries.filters.ChannelResponse[source]

Get the channel response filter.

Parameters:
  • rxcal_fn (str, Path or None, optional) – Path to receiver calibration file, by default None

  • scal_fn (str, Path or None, optional) – Path to sensor calibration file, by default None

Returns:

Complete channel response filter chain

Return type:

ChannelResponse