mth5.clients.nims

Classes

NIMSClient

Module Contents

class mth5.clients.nims.NIMSClient(data_path: str | pathlib.Path, sample_rates: list[int] = [1, 8], save_path: str | pathlib.Path | None = None, calibration_path: str | pathlib.Path | None = None, mth5_filename: str = 'from_nims.h5', **kwargs)[source]

Bases: mth5.clients.base.ClientBase

property calibration_path: pathlib.Path | None[source]

Path to calibration data.

Returns:

Path to calibration file, or None if not set.

Return type:

Path or None

Examples

>>> client = NIMSClient('data_dir')
>>> client.calibration_path = 'calib.dat'
>>> print(client.calibration_path)
PosixPath('calib.dat')
collection[source]
get_run_dict() dict[source]

Get run information from the NIMS collection.

Returns:

Dictionary of run information.

Return type:

dict

Examples

>>> client = NIMSClient('data_dir')
>>> runs = client.get_run_dict()
>>> print(list(runs.keys()))
['station1', 'station2']
get_survey(station_dict: dict) str[source]

Get survey name from a dictionary of a single station of runs.

Parameters:

station_dict (dict) – Dictionary of runs for a station.

Returns:

Survey name.

Return type:

str

Examples

>>> client = NIMSClient('data_dir')
>>> runs = client.get_run_dict()
>>> survey = client.get_survey(runs['station1'])
>>> print(survey)
'survey_name'
make_mth5_from_nims(survey_id: str = 'default_survey', combine: bool = True, **kwargs) str | pathlib.Path[source]

Make an MTH5 file from Phoenix NIMS files. Splits into runs, accounts for filters.

Parameters:
  • survey_id (str, optional) – Survey identifier. Default is “default_survey”.

  • combine (bool, optional) – Whether to combine runs. Default is True.

  • **kwargs – Additional keyword arguments to set as attributes.

Returns:

Path to the saved MTH5 file.

Return type:

str or Path

Examples

>>> client = NIMSClient('data_dir')
>>> mth5_path = client.make_mth5_from_nims(survey_id='survey1')
>>> print(mth5_path)
'output_dir/from_nims.h5'