mth5.io.phoenix.readers.segmented.decimated_segmented_reader
Module to read and parse native Phoenix Geophysics data formats of the MTU-5C Family
- This module implements Streamed readers for segmented-decimated time series
formats of the MTU-5C family.
- author:
Jorge Torres-Solis
Revised 2022 by J. Peacock
Classes
Class for subheader of segmented files. |
|
A segment class to hold a single segment. |
|
Class to create a streamer for segmented decimated time series. |
|
Class to read multiple segments from a segmented decimated time series file. |
Module Contents
- class mth5.io.phoenix.readers.segmented.decimated_segmented_reader.SubHeader(**kwargs)[source]
Class for subheader of segmented files.
This class handles the parsing and access to subheader information in Phoenix Geophysics segmented time series files. The subheader contains metadata about each segment including timing, sample counts, and statistics.
- Parameters:
**kwargs – Arbitrary keyword arguments that are set as attributes
- property gps_time_stamp: mt_metadata.common.mttime.MTime | None[source]
GPS time stamp in UTC.
- Returns:
GPS timestamp if header is available, None otherwise
- Return type:
MTime or None
- property n_samples: int | None[source]
Number of samples in the segment.
- Returns:
Number of samples if header is available, None otherwise
- Return type:
int or None
- property saturation_count: int | None[source]
Number of saturated samples.
- Returns:
Saturation count if header is available, None otherwise
- Return type:
int or None
- property missing_count: int | None[source]
Number of missing samples.
- Returns:
Missing sample count if header is available, None otherwise
- Return type:
int or None
- property value_min: float | None[source]
Minimum value in the segment.
- Returns:
Minimum value if header is available, None otherwise
- Return type:
float or None
- property value_max: float | None[source]
Maximum value in the segment.
- Returns:
Maximum value if header is available, None otherwise
- Return type:
float or None
- class mth5.io.phoenix.readers.segmented.decimated_segmented_reader.Segment(stream: BinaryIO, **kwargs)[source]
Bases:
SubHeaderA segment class to hold a single segment.
This class represents a single time series segment with its associated metadata and data. It inherits from SubHeader to provide access to segment-specific header information.
- Parameters:
stream (BinaryIO) – Binary file stream to read from
**kwargs – Additional keyword arguments passed to SubHeader
- read_segment(metadata_only: bool = False) None[source]
Read the segment data from the file stream.
- Parameters:
metadata_only (bool, optional) – If True, only read metadata without loading data, by default False
- class mth5.io.phoenix.readers.segmented.decimated_segmented_reader.DecimatedSegmentedReader(path: str | pathlib.Path, num_files: int = 1, report_hw_sat: bool = False, **kwargs)[source]
Bases:
mth5.io.phoenix.readers.TSReaderBaseClass to create a streamer for segmented decimated time series.
This reader handles segmented decimated time series files such as ‘td_24k’. These files have sub headers containing metadata for each segment.
- Parameters:
path (str or Path) – Path to the time series file
num_files (int, optional) – Number of files in the sequence, by default 1
report_hw_sat (bool, optional) – Whether to report hardware saturation, by default False
**kwargs – Additional keyword arguments passed to parent TSReaderBase class
- read_segment(metadata_only: bool = False) Segment[source]
Read a single segment from the file.
- Parameters:
metadata_only (bool, optional) – If True, only read metadata without loading data, by default False
- Returns:
Segment object containing data and metadata
- Return type:
- Raises:
ValueError – If stream is not available
- to_channel_ts(rxcal_fn: str | pathlib.Path | None = None, scal_fn: str | pathlib.Path | None = None) mth5.timeseries.ChannelTS[source]
Convert to a ChannelTS object.
- 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:
Channel time series object with data, metadata, and calibration
- Return type:
- class mth5.io.phoenix.readers.segmented.decimated_segmented_reader.DecimatedSegmentCollection(path: str | pathlib.Path, num_files: int = 1, report_hw_sat: bool = False, **kwargs)[source]
Bases:
mth5.io.phoenix.readers.TSReaderBaseClass to read multiple segments from a segmented decimated time series file.
This reader handles files containing multiple segments of decimated time series data such as ‘td_24k’. Each segment has its own sub header with metadata.
- Parameters:
path (str or Path) – Path to the time series file
num_files (int, optional) – Number of files in the sequence, by default 1
report_hw_sat (bool, optional) – Whether to report hardware saturation, by default False
**kwargs – Additional keyword arguments passed to parent TSReaderBase class
- read_segments(metadata_only: bool = False) list[Segment][source]
Read all segments from the file.
- Parameters:
metadata_only (bool, optional) – If True, only read metadata without loading data, by default False
- Returns:
List of Segment objects containing data and metadata
- Return type:
list[Segment]
- Raises:
ValueError – If stream is not available
- to_channel_ts(rxcal_fn: str | pathlib.Path | None = None, scal_fn: str | pathlib.Path | None = None) list[mth5.timeseries.ChannelTS][source]
Convert all segments to ChannelTS objects.
- 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:
List of ChannelTS objects, one for each segment
- Return type:
list[ChannelTS]