mth5.io.phoenix.readers package

Subpackages

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

close()[source]

Close the file

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

run_metadata()[source]

translate to run metadata

Returns

DESCRIPTION

Return type

TYPE

property sample_rate
property sample_rate_base
property sample_rate_exp
property saturated_frames
station_metadata()[source]

translate to station metadata

property timing_flags
property timing_sat_count
property timing_stability
property timing_status
property total_circuitry_gain
property total_selectable_gain
unpack_header(stream)[source]

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
has_obj()[source]
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
station_metadata()[source]
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
get_ch_index(tag)[source]
get_ch_metadata(index)[source]

get channel metadata from index

get_ch_tag(index)[source]
property h1_metadata
property h2_metadata
property h3_metadata
property h4_metadata
property h5_metadata
property h6_metadata
has_obj()[source]
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
mth5.io.phoenix.readers.phx_json.read_json_to_object(fn)[source]

read a json file directly into an object

Parameters

fn (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

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
has_obj()[source]
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
station_metadata()[source]
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

to_channel_ts()[source]

convert to a ChannelTS object

Returns

DESCRIPTION

Return type

TYPE

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

read_segment(metadata_only=False)[source]

Read in a single segment

Parameters

metadata_only (TYPE, optional) – DESCRIPTION, defaults to False

Returns

DESCRIPTION

Return type

TYPE

to_channel_ts()[source]

convert to a ChannelTS object

Returns

DESCRIPTION

Return type

TYPE

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

run_metadata()[source]

translate to run metadata

Returns

DESCRIPTION

Return type

TYPE

property sample_rate
property sample_rate_base
property sample_rate_exp
property saturated_frames
station_metadata()[source]

translate to station metadata

property timing_flags
property timing_sat_count
property timing_stability
property timing_status
property total_circuitry_gain
property total_selectable_gain
unpack_header(stream)[source]
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)

skip_frames(num_frames)[source]

Skip frames of the stream

Parameters

num_frames (integer) – number of frames to skip

Returns

end of file

Return type

boolean

to_channel_ts()[source]

convert to a ChannelTS object

Returns

DESCRIPTION

Return type

TYPE

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
get_ch_index(tag)[source]
get_ch_metadata(index)[source]

get channel metadata from index

get_ch_tag(index)[source]
property h1_metadata
property h2_metadata
property h3_metadata
property h4_metadata
property h5_metadata
property h6_metadata
has_obj()[source]
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

close()[source]

Close the file

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