mth5.io.phoenix
Submodules
Classes
Container for Phoenix Geophysics recmeta.json metadata files. |
|
Phoenix Geophysics configuration file reader and metadata container. |
Functions
|
Read a Phoenix Geophysics data file into a ChannelTS or RunTS object |
|
Open a Phoenix Geophysics data file in the appropriate container. |
Package Contents
- class mth5.io.phoenix.PhoenixReceiverMetadata(fn: str | pathlib.Path | None = None, **kwargs: Any)[source]
Container for Phoenix Geophysics recmeta.json metadata files.
This class reads and parses receiver metadata from JSON configuration files used to control Phoenix Geophysics MTU-5C data recording systems. It provides methods to extract channel configurations, instrument settings, and convert them to standardized metadata objects.
- Parameters:
fn (str, Path, or None, optional) – Path to the recmeta.json file. If provided, the file will be read automatically during initialization.
**kwargs – Additional keyword arguments (currently unused).
- fn
Path to the metadata file.
- Type:
Path or None
- obj
Parsed JSON content as a SimpleNamespace object.
- Type:
SimpleNamespace or None
- logger
Logger instance for error reporting.
- Type:
loguru.Logger
- Raises:
IOError – If the specified file does not exist.
Examples
>>> metadata = PhoenixReceiverMetadata("recmeta.json") >>> channel_map = metadata.channel_map >>> e1_config = metadata.e1_metadata
Notes
The class supports both electric and magnetic channel configurations with automatic mapping from Phoenix-specific parameter names to standardized metadata attributes.
- property fn: pathlib.Path | None
Path to the metadata file.
- Returns:
Path to the recmeta.json file, or None if not set.
- Return type:
Path or None
- obj: types.SimpleNamespace | None = None
- logger
- property instrument_id: str | None
Instrument identifier from metadata.
- Returns:
Instrument ID if available, None otherwise.
- Return type:
str or None
- read(fn: str | pathlib.Path | None = None) None[source]
Read a recmeta.json file in Phoenix format.
- Parameters:
fn (str, Path, or None, optional) – Path to the JSON file. If None, uses the current fn property.
- Raises:
IOError – If no file path is specified or file doesn’t exist.
ValueError – If the file cannot be parsed as JSON.
- has_obj() bool[source]
Check if metadata object is loaded.
- Returns:
True if metadata object exists, False otherwise.
- Return type:
bool
- property channel_map: dict[int, str]
Channel mapping from index to component tag.
- Returns:
Dictionary mapping channel indices to component tags (lowercase).
- Return type:
dict[int, str]
- Raises:
AttributeError – If metadata object is not loaded or missing channel_map.
- property lp_filter_base_name: str | None
Base name for low-pass filter identifiers.
- Returns:
Filter base name combining receiver info, or None if not available.
- Return type:
str or None
- get_ch_index(tag: str) int[source]
Get channel index from component tag.
- Parameters:
tag (str) – Component tag (e.g., ‘e1’, ‘h1’, etc.).
- Returns:
Channel index corresponding to the tag.
- Return type:
int
- Raises:
ValueError – If the tag is not found in the channel map.
AttributeError – If metadata object is not loaded.
- get_ch_tag(index: int) str[source]
Get component tag from channel index.
- Parameters:
index (int) – Channel index.
- Returns:
Component tag corresponding to the index.
- Return type:
str
- Raises:
ValueError – If the index is not found in the channel map.
AttributeError – If metadata object is not loaded.
- property e1_metadata: mt_metadata.timeseries.Electric
Electric channel 1 metadata.
- property e2_metadata: mt_metadata.timeseries.Electric
Electric channel 2 metadata.
- property h1_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 1 metadata.
- property h2_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 2 metadata.
- property h3_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 3 metadata.
- property h4_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 4 metadata.
- property h5_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 5 metadata.
- property h6_metadata: mt_metadata.timeseries.Magnetic
Magnetic channel 6 metadata.
- get_ch_metadata(index: int) mt_metadata.timeseries.Electric | mt_metadata.timeseries.Magnetic[source]
Get channel metadata from index.
- Parameters:
index (int) – Channel index.
- Returns:
Channel metadata object corresponding to the index.
- Return type:
Electric or Magnetic
- Raises:
ValueError – If index is not found in channel map.
AttributeError – If the corresponding metadata property doesn’t exist.
- property run_metadata: mt_metadata.timeseries.Run
Run metadata from receiver configuration.
- Returns:
Run metadata object with data logger and timing information.
- Return type:
Run
- property station_metadata: mt_metadata.timeseries.Station
Station metadata from receiver configuration.
- Returns:
Station metadata object with location and acquisition information.
- Return type:
Station
- property survey_metadata: mt_metadata.timeseries.Survey
Survey metadata from receiver configuration.
- Returns:
Survey metadata object with survey information.
- Return type:
Survey
- class mth5.io.phoenix.PhoenixConfig(fn: str | pathlib.Path | None = None, **kwargs: Any)[source]
Phoenix Geophysics configuration file reader and metadata container.
This class reads and provides access to Phoenix MTU-5C instrument configuration data stored in JSON format. The configuration file contains recording parameters, instrument settings, and metadata used to control data acquisition.
- Parameters:
fn (str, pathlib.Path, or None, optional) – Path to the Phoenix configuration file (typically config.json). If provided, the file will be validated for existence.
**kwargs (Any) – Additional keyword arguments (currently unused).
- fn
Path to the configuration file.
- Type:
pathlib.Path or None
- obj
Parsed configuration object containing all settings.
- Type:
Any or None
- logger
Logger instance for debugging and error reporting.
- Type:
loguru.Logger
Examples
>>> config = PhoenixConfig("config.json") >>> config.read() >>> station = config.station_metadata() >>> print(f"Station ID: {station.id}")
- obj: Any = None
- logger: loguru.Logger
- property fn: pathlib.Path | None
Path to the Phoenix configuration file.
- Returns:
The path to the configuration file, or None if not set.
- Return type:
pathlib.Path or None
- read(fn: str | pathlib.Path | None = None) None[source]
Read and parse a Phoenix configuration file.
Loads and parses a Phoenix MTU-5C configuration file in JSON format. The parsed configuration is stored in the obj attribute and provides access to all recording parameters and instrument settings.
- Parameters:
fn (str, pathlib.Path, or None, optional) – Path to the configuration file to read. If None, uses the previously set file path from the fn property.
- Raises:
ValueError – If no file path is provided and none was previously set.
IOError – If the configuration file cannot be read or parsed.
Notes
The configuration file should be in Phoenix JSON format containing recording parameters, instrument settings, and metadata.
- has_obj() bool[source]
Check if configuration data has been loaded.
- Returns:
True if configuration data is loaded, False otherwise.
- Return type:
bool
- property auto_power_enabled: Any | None
Auto power enabled setting from configuration.
- Returns:
The auto power enabled setting, or None if no configuration is loaded.
- Return type:
Any or None
- property config: Any | None
Main configuration section from the configuration file.
- Returns:
The first configuration object containing recording parameters, or None if no configuration is loaded.
- Return type:
Any or None
- property empower_version: Any | None
EMPower software version from configuration.
- Returns:
The EMPower software version, or None if no configuration is loaded.
- Return type:
Any or None
- property mtc150_reset: Any | None
MTC150 reset setting from configuration.
- Returns:
The MTC150 reset setting, or None if no configuration is loaded.
- Return type:
Any or None
- property network: Any | None
Network configuration from configuration file.
- Returns:
The network configuration settings, or None if no configuration is loaded.
- Return type:
Any or None
- property receiver: Any | None
Receiver configuration from configuration file.
- Returns:
The receiver configuration settings, or None if no configuration is loaded.
- Return type:
Any or None
- property schedule: Any | None
Recording schedule from configuration file.
- Returns:
The recording schedule configuration, or None if no configuration is loaded.
- Return type:
Any or None
- property surveyTechnique: Any | None
Survey technique setting from configuration file.
- Returns:
The survey technique setting, or None if no configuration is loaded.
- Return type:
Any or None
- property timezone: Any | None
Timezone setting from configuration file.
- Returns:
The timezone setting, or None if no configuration is loaded.
- Return type:
Any or None
- property timezone_offset: Any | None
Timezone offset from configuration file.
- Returns:
The timezone offset in hours, or None if no configuration is loaded.
- Return type:
Any or None
- property version: Any | None
Configuration file version from configuration file.
- Returns:
The configuration file version, or None if no configuration is loaded.
- Return type:
Any or None
- station_metadata() mt_metadata.timeseries.Station[source]
Create a Station metadata object from configuration data.
Extracts station information from the loaded configuration and creates a standardized Station metadata object with basic station parameters.
- Returns:
A Station metadata object populated with configuration data including station ID, operator information, company name, and notes.
- Return type:
Station
- Raises:
AttributeError – If no configuration is loaded or required fields are missing.
Notes
The method extracts the following information from config.layout: - Station_Name -> station.id - Operator -> station.acquired_by.name - Company_Name -> station.acquired_by.organization - Notes -> station.comments
Examples
>>> config = PhoenixConfig("config.json") >>> config.read() >>> station = config.station_metadata() >>> print(f"Station: {station.id}")
- mth5.io.phoenix.read_phoenix(file_name: str | pathlib.Path, **kwargs: Any) mth5.timeseries.ChannelTS | mth5.timeseries.RunTS | mth5.io.phoenix.readers.MTUTable[source]
Read a Phoenix Geophysics data file into a ChannelTS or RunTS object depending on the file type. Newer files that end in .td_XX or .bin will be read into ChannelTS objects. Older MTU files that end in .TS3, .TS4, .TS5, .TSL, or .TSH will be read into RunTS objects.
- Parameters:
file_name (str or pathlib.Path) – Path to the Phoenix data file to read.
**kwargs (Any) –
Additional keyword arguments. May include:
- rxcal_fnstr or pathlib.Path, optional
Path to receiver calibration file.
- scal_fnstr or pathlib.Path, optional
Path to sensor calibration file.
- table_filepathstr or pathlib.Path, optional
Path to the MTU TBL file for use with MTUTSN files.
Other arguments passed to the Phoenix reader constructor.
- Returns:
channel_ts (ChannelTS) – Time series data object containing the Phoenix file data with calibration applied if calibration files were provided.
run_ts (RunTS) – Time series data object containing the MTU data from the Phoenix MTU files with calibration applied if specified.
mtu_table (MTUTable) – Metadata table object containing the MTU table data.
- Raises:
KeyError – If the file extension is not supported by any Phoenix reader.
ValueError – If the file cannot be read or converted to ChannelTS or RunTS format.
- mth5.io.phoenix.open_phoenix(file_name: str | pathlib.Path, **kwargs: Any) mth5.io.phoenix.readers.DecimatedContinuousReader | mth5.io.phoenix.readers.DecimatedSegmentedReader | mth5.io.phoenix.readers.NativeReader | mth5.io.phoenix.readers.MTUTSN | mth5.io.phoenix.readers.MTUTable[source]
Open a Phoenix Geophysics data file in the appropriate container.
- Parameters:
file_name (str or pathlib.Path) – Full path to the Phoenix data file to open.
**kwargs (Any) – Additional keyword arguments to pass to the reader constructor.
- Returns:
reader – The appropriate Phoenix reader container based on file extension: - .bin files: NativeReader - .td_24k files: DecimatedSegmentedReader - .td_150/.td_30 files: DecimatedContinuousReader
- Return type:
DecimatedContinuousReader | DecimatedSegmentedReader | NativeReader
- Raises:
KeyError – If the file extension is not supported by any Phoenix reader.