mth5.io.phoenix.readers.native package

Submodules

mth5.io.phoenix.readers.native.native_reader module

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

class mth5.io.phoenix.readers.native.native_reader.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

Module contents

class mth5.io.phoenix.readers.native.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