mth5.io.phoenix.readers package
Subpackages
- mth5.io.phoenix.readers.contiguous package
- mth5.io.phoenix.readers.native package
- mth5.io.phoenix.readers.segmented package
Submodules
mth5.io.phoenix.readers.base module
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
- class mth5.io.phoenix.readers.base.TSReaderBase(path, num_files=1, header_length=128, report_hw_sat=False, **kwargs)[source]
Bases:
Header
Generic reader that all other readers will inherit
- property base_dir
parent directory of file :rtype:
pathlib.Path
- Type
return
- property base_path
full path of file :rtype:
pathlib.Path
- Type
return
- property file_extension
file extension :rtype: string
- Type
return
- property file_name
name of the file :rtype: string
- Type
return
- property file_size
file size in bytes :rtype: integer
- Type
return
- property instrument_id
instrument ID :rtype: string
- Type
return
- property max_samples
Max number of samples in a file which is:
(total number of bytes - header length) / frame size * n samples per frame
- Returns
max number of samples in a file
- Return type
int
- open_file_seq(file_seq_num=None)[source]
Open a file in the sequence given the sequence number :param file_seq_num: sequence number to open, defaults to None :type file_seq_num: integer, optional :return: [True] if next file is now open, [False] if it is not :rtype: boolean
- open_next()[source]
Open the next file in the sequence :return: [True] if next file is now open, [False] if it is not :rtype: boolean
- property seq
sequence number of the file :rtype: int
- Type
return
- property sequence_list
get all the files in the sequence sorted by sequence number
mth5.io.phoenix.readers.header module
Adopted from TimeSeries reader, making all attributes properties for easier reading and testing.
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
- class mth5.io.phoenix.readers.header.Header(**kwargs)[source]
Bases:
object
The header is 128 bytes with a specific format. This reads in the 128 bytes and provides properties to read each attribute of the header in the correct way.
- property attenuator_gain
- property battery_voltage_v
- property board_model_main
- property board_model_revision
- property bytes_per_sample
- property ch_board_model
- property ch_board_serial
- property ch_firmware
- property channel_id
- property channel_main_gain
- channel_metadata()[source]
translate metadata to channel metadata :return: DESCRIPTION :rtype: TYPE
- property channel_type
- property decimation_node_id
- property detected_channel_type
- property file_sequence
- property file_type
- property file_version
- property frag_period
- property frame_rollover_count
- property frame_size
- property frame_size_bytes
- property future1
- property future2
- property gps_elevation
- property gps_horizontal_accuracy
In millimeters
- property gps_lat
- property gps_long
- property gps_vertical_accuracy
In millimeters
- property hardware_configuration
- property header_length
- property instrument_serial_number
- property instrument_type
- property intrinsic_circuitry_gain
This function will adjust the intrinsic circuitry gain based on the sensor range configuration in the configuration fingerprint
For this, we consider that for the Electric channel, calibration path, or H-legacy sensors all go through a 1/4 gain stage, and then they get a virtial x2 gain from Single-ended-diff before the A/D. In the case of newer sensors (differential) instead of a 1/4 gain stage, there is only a 1/2 gain stage
Therefore, in the E,cal and legacy sensor case the circuitry gain is 1/2, while for newer sensors it is 1
Note
Circuitry Gain not directly configurable by the user
- property lp_frequency
- property max_signal
- property min_signal
- property missing_frames
- property preamp_gain
- property recording_id
- property recording_start_time
The actual data recording starts 1 second after the set start time. This is cause by the data logger starting up and initializing filter. This is taken care of in the segment start time
See https://github.com/kujaku11/PhoenixGeoPy/tree/main/Docs for more information.
- Returns
DESCRIPTION
- Return type
TYPE
- property sample_rate
- property sample_rate_base
- property sample_rate_exp
- property saturated_frames
- property timing_flags
- property timing_sat_count
- property timing_stability
- property timing_status
- property total_circuitry_gain
- property total_selectable_gain
mth5.io.phoenix.readers.phx_json module
Created on Fri Jun 10 07:52:03 2022
- author
Jared Peacock
- license
MIT
- class mth5.io.phoenix.readers.phx_json.ConfigJSON(fn=None, **kwargs)[source]
Bases:
object
A container for the config.json file used to control the recording
- property auto_power_enabled
- property config
- property empower_version
- property fn
- property mtc150_reset
- property network
- read(fn=None)[source]
read a config.json file that is in the Phoenix format
- Parameters
fn (TYPE, optional) – DESCRIPTION, defaults to None
- Returns
DESCRIPTION
- Return type
TYPE
- property receiver
- property schedule
- property surveyTechnique
- property timezone
- property timezone_offset
- property version
- class mth5.io.phoenix.readers.phx_json.ReceiverMetadataJSON(fn=None, **kwargs)[source]
Bases:
object
A container for the recmeta.json file used to control the recording
- property channel_map
- property e1_metadata
- property e2_metadata
- property fn
- property h1_metadata
- property h2_metadata
- property h3_metadata
- property h4_metadata
- property h5_metadata
- property h6_metadata
- read(fn=None)[source]
read a config.json file that is in the Phoenix format
- Parameters
fn (TYPE, optional) – DESCRIPTION, defaults to None
- Returns
DESCRIPTION
- Return type
TYPE
- property run_metadata
- property station_metadata
- property survey_metadata
Module contents
- class mth5.io.phoenix.readers.ConfigJSON(fn=None, **kwargs)[source]
Bases:
object
A container for the config.json file used to control the recording
- property auto_power_enabled
- property config
- property empower_version
- property fn
- property mtc150_reset
- property network
- read(fn=None)[source]
read a config.json file that is in the Phoenix format
- Parameters
fn (TYPE, optional) – DESCRIPTION, defaults to None
- Returns
DESCRIPTION
- Return type
TYPE
- property receiver
- property schedule
- property surveyTechnique
- property timezone
- property timezone_offset
- property version
- class mth5.io.phoenix.readers.DecimatedContinuousReader(path, num_files=1, report_hw_sat=False, **kwargs)[source]
Bases:
TSReaderBase
Class to create a streamer for continuous decimated time series, i.e. ‘td_150’, ‘td_30’
These files have no sub header information.
- read()[source]
Read in the full data from the file given.
- Returns
single channel data array
- Return type
numpy.ndarray
- read_sequence(start=0, end=None)[source]
Read a sequence of files
- Parameters
start (integer, optional) – starting index in the sequence, defaults to 0
end (integer, optional) – eneding index in the sequence to read, defaults to None
- Returns
data within the given sequence range
- Return type
numpy.ndarray
- property segment_end_time
estimate end time
The first sequence starts 1 second later than the set start time due to initiation within the data logger
- Returns
estimated end time from number of samples
- Return type
mt_metadata.utils.mttime.MTime
- property segment_start_time
estimate the segment start time based on sequence number
The first sequence starts 1 second later than the set start time due to initiation within the data logger
- Returns
start time of the recording
- Return type
mt_metadata.utils.mttime.MTime
- class mth5.io.phoenix.readers.DecimatedSegmentedReader(path, num_files=1, report_hw_sat=False, **kwargs)[source]
Bases:
TSReaderBase
Class to create a streamer for segmented decimated time series, i.e. ‘td_24k’
These files have a sub header
- class mth5.io.phoenix.readers.Header(**kwargs)[source]
Bases:
object
The header is 128 bytes with a specific format. This reads in the 128 bytes and provides properties to read each attribute of the header in the correct way.
- property attenuator_gain
- property battery_voltage_v
- property board_model_main
- property board_model_revision
- property bytes_per_sample
- property ch_board_model
- property ch_board_serial
- property ch_firmware
- property channel_id
- property channel_main_gain
- channel_metadata()[source]
translate metadata to channel metadata :return: DESCRIPTION :rtype: TYPE
- property channel_type
- property decimation_node_id
- property detected_channel_type
- property file_sequence
- property file_type
- property file_version
- property frag_period
- property frame_rollover_count
- property frame_size
- property frame_size_bytes
- property future1
- property future2
- property gps_elevation
- property gps_horizontal_accuracy
In millimeters
- property gps_lat
- property gps_long
- property gps_vertical_accuracy
In millimeters
- property hardware_configuration
- property header_length
- property instrument_serial_number
- property instrument_type
- property intrinsic_circuitry_gain
This function will adjust the intrinsic circuitry gain based on the sensor range configuration in the configuration fingerprint
For this, we consider that for the Electric channel, calibration path, or H-legacy sensors all go through a 1/4 gain stage, and then they get a virtial x2 gain from Single-ended-diff before the A/D. In the case of newer sensors (differential) instead of a 1/4 gain stage, there is only a 1/2 gain stage
Therefore, in the E,cal and legacy sensor case the circuitry gain is 1/2, while for newer sensors it is 1
Note
Circuitry Gain not directly configurable by the user
- property lp_frequency
- property max_signal
- property min_signal
- property missing_frames
- property preamp_gain
- property recording_id
- property recording_start_time
The actual data recording starts 1 second after the set start time. This is cause by the data logger starting up and initializing filter. This is taken care of in the segment start time
See https://github.com/kujaku11/PhoenixGeoPy/tree/main/Docs for more information.
- Returns
DESCRIPTION
- Return type
TYPE
- property sample_rate
- property sample_rate_base
- property sample_rate_exp
- property saturated_frames
- property timing_flags
- property timing_sat_count
- property timing_stability
- property timing_status
- property total_circuitry_gain
- property total_selectable_gain
- class mth5.io.phoenix.readers.NativeReader(path, num_files=1, scale_to=1, header_length=128, last_frame=0, ad_plus_minus_range=5.0, channel_type='E', report_hw_sat=False, **kwargs)[source]
Bases:
TSReaderBase
Native sampling rate ‘Raw’ time series reader class, these are the .bin files. They are formatted with a header of 128 bytes then frames of 64.
Each frame is 20 x 3 byte (24-bit) data point then a 4 byte footer.
- property npts_per_frame
- read()[source]
Read the full data file.
Note
This uses
numpy.lib.stride_tricks.as_strided
which can be unstable if the bytes are not the correct length. See notes by numpy.Got this solution from: https://stackoverflow.com/questions/12080279/how-do-i-create-a-numpy-dtype-that-includes-24-bit-integers?msclkid=3398046ecd6511ec9a37394f28c5aaba
- Returns
scaled data and footer
- Return type
tuple (data, footer)
- read_frames(num_frames)[source]
Read the given amount of frames from the data.
Note
that seek is not reset so if you iterate this the stream reads from the last tell.
- Parameters
num_frames (integer) – Number of frames to read
- Returns
Scaled data from the given number of frames
- Return type
np.ndarray(dtype=float)
- read_sequence(start=0, end=None)[source]
Read sequence of files into a single array
- Parameters
start (integer, optional) – sequence start, defaults to 0
end (integer, optional) – sequence end, defaults to None
- Returns
scaled data
- Return type
np.ndarray(dtype=float32)
- Returns
footer
- Return type
np.ndarray(dtype=int32)
- class mth5.io.phoenix.readers.ReceiverMetadataJSON(fn=None, **kwargs)[source]
Bases:
object
A container for the recmeta.json file used to control the recording
- property channel_map
- property e1_metadata
- property e2_metadata
- property fn
- property h1_metadata
- property h2_metadata
- property h3_metadata
- property h4_metadata
- property h5_metadata
- property h6_metadata
- read(fn=None)[source]
read a config.json file that is in the Phoenix format
- Parameters
fn (TYPE, optional) – DESCRIPTION, defaults to None
- Returns
DESCRIPTION
- Return type
TYPE
- property run_metadata
- property station_metadata
- property survey_metadata
- class mth5.io.phoenix.readers.TSReaderBase(path, num_files=1, header_length=128, report_hw_sat=False, **kwargs)[source]
Bases:
Header
Generic reader that all other readers will inherit
- property base_dir
parent directory of file :rtype:
pathlib.Path
- Type
return
- property base_path
full path of file :rtype:
pathlib.Path
- Type
return
- property file_extension
file extension :rtype: string
- Type
return
- property file_name
name of the file :rtype: string
- Type
return
- property file_size
file size in bytes :rtype: integer
- Type
return
- property instrument_id
instrument ID :rtype: string
- Type
return
- property max_samples
Max number of samples in a file which is:
(total number of bytes - header length) / frame size * n samples per frame
- Returns
max number of samples in a file
- Return type
int
- open_file_seq(file_seq_num=None)[source]
Open a file in the sequence given the sequence number :param file_seq_num: sequence number to open, defaults to None :type file_seq_num: integer, optional :return: [True] if next file is now open, [False] if it is not :rtype: boolean
- open_next()[source]
Open the next file in the sequence :return: [True] if next file is now open, [False] if it is not :rtype: boolean
- property seq
sequence number of the file :rtype: int
- Type
return
- property sequence_list
get all the files in the sequence sorted by sequence number