mth5.io.phoenix package

Subpackages

Submodules

mth5.io.phoenix.phoenix_collection module

Phoenix file collection

Created on Thu Aug 4 16:48:47 2022

@author: jpeacock

class mth5.io.phoenix.phoenix_collection.PhoenixCollection(file_path=None, **kwargs)[source]

Bases: Collection

A class to collect the various files in a Phoenix file system and try to organize them into runs.

assign_run_names(df, zeros=4)[source]

Assign run names by looping through start times.

For continous data a single run is assigned as long as the start and end times of each file align. If there is a break a new run name is assigned.

For segmented data a new run name is assigned to each segment

Parameters
  • df (pandas.DataFrame) – Dataframe returned by to_dataframe method

  • zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

Dataframe with run names

Return type

pandas.DataFrame

get_runs(sample_rates, run_name_zeros=4, calibration_path=None)[source]

Get a list of runs contained within the given folder. First the dataframe will be developed from which the runs are extracted.

For continous data all you need is the first file in the sequence. The reader will read in the entire sequence.

For segmented data it will only read in the given segment, which is slightly different from the original reader.

Parameters
  • sample_rates – list of sample rates to read, defaults to [150, 24000]

  • run_name_zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

List of run dataframes with only the first block of files

Return type

OrderedDict

Example
>>> from mth5.io.phoenix import PhoenixCollection
>>> phx_collection = PhoenixCollection(r"/path/to/station")
>>> run_dict = phx_collection.get_runs(sample_rates=[150, 24000])
to_dataframe(sample_rates=[150, 24000], run_name_zeros=4, calibration_path=None)[source]

Get a dataframe of all the files in a given directory with given columns. Loop over station folders.

Parameters
  • sample_rates (list of integers, optional) – list of sample rates to read, defaults to [150, 24000]

  • run_name_zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

Dataframe with each row representing a single file

Return type

pandas.DataFrame

mth5.io.phoenix.read module

Created on Fri May 6 12:39:34 2022

@author: jpeacock

mth5.io.phoenix.read.open_phoenix(file_name, **kwargs)[source]

Will put the file into the appropriate container

Parameters

file_name (string or pathlib.Path) – full path to file to open

Returns

The appropriate container based on file extension

Return type

mth5.io.phoenix.read.read_phoenix(file_name, **kwargs)[source]

Read a Phoenix file into a ChannelTS object :param file_name: DESCRIPTION :type file_name: TYPE :return: DESCRIPTION :rtype: TYPE

Module contents

class mth5.io.phoenix.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.PhoenixCollection(file_path=None, **kwargs)[source]

Bases: Collection

A class to collect the various files in a Phoenix file system and try to organize them into runs.

assign_run_names(df, zeros=4)[source]

Assign run names by looping through start times.

For continous data a single run is assigned as long as the start and end times of each file align. If there is a break a new run name is assigned.

For segmented data a new run name is assigned to each segment

Parameters
  • df (pandas.DataFrame) – Dataframe returned by to_dataframe method

  • zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

Dataframe with run names

Return type

pandas.DataFrame

get_runs(sample_rates, run_name_zeros=4, calibration_path=None)[source]

Get a list of runs contained within the given folder. First the dataframe will be developed from which the runs are extracted.

For continous data all you need is the first file in the sequence. The reader will read in the entire sequence.

For segmented data it will only read in the given segment, which is slightly different from the original reader.

Parameters
  • sample_rates – list of sample rates to read, defaults to [150, 24000]

  • run_name_zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

List of run dataframes with only the first block of files

Return type

OrderedDict

Example
>>> from mth5.io.phoenix import PhoenixCollection
>>> phx_collection = PhoenixCollection(r"/path/to/station")
>>> run_dict = phx_collection.get_runs(sample_rates=[150, 24000])
to_dataframe(sample_rates=[150, 24000], run_name_zeros=4, calibration_path=None)[source]

Get a dataframe of all the files in a given directory with given columns. Loop over station folders.

Parameters
  • sample_rates (list of integers, optional) – list of sample rates to read, defaults to [150, 24000]

  • run_name_zeros (integer, optional) – Number of zeros in the run name, defaults to 4

Returns

Dataframe with each row representing a single file

Return type

pandas.DataFrame

class mth5.io.phoenix.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.open_phoenix(file_name, **kwargs)[source]

Will put the file into the appropriate container

Parameters

file_name (string or pathlib.Path) – full path to file to open

Returns

The appropriate container based on file extension

Return type

mth5.io.phoenix.read_phoenix(file_name, **kwargs)[source]

Read a Phoenix file into a ChannelTS object :param file_name: DESCRIPTION :type file_name: TYPE :return: DESCRIPTION :rtype: TYPE