resistics_readers.metronix.ats module

Classes for reading Metronix time series data

resistics_readers.metronix.ats.get_chan_type(chan: str)str[source]

Get the channel type

Parameters

chan (str) – The name of the channel

Returns

The channel type

Return type

str

pydantic model resistics_readers.metronix.ats.TimeReaderATS[source]

Bases: resistics.time.TimeReader

Data reader for ATS formatted data

For ATS files, header information is XML formatted. The end time in ATS header files is actually one sample past the time of the last sample. TimeReaderATS handles this and gives a last time corresponding to the actual timestamp of the last sample.

Notes

The raw data units for ATS data are in counts. To get data in field units, ATS data is first multipled by the least significat bit (lsb) defined in the metadata files,

\[data = data * lsb,\]

giving data in mV. The lsb includes the gain removal, so no separate gain removal needs to be performed.

For electrical channels, there is additional step of dividing by the electrode spacing, which is provided in metres. The extra factor of a 1000 is to convert this to km to give mV/km for electric channels

\[data = \frac{1000 * data}{spacing}\]

Finally, to get magnetic channels in nT, the magnetic channels need to be calibrated.

Show JSON schema
{
   "title": "TimeReaderATS",
   "description": "Data reader for ATS formatted data\n\nFor ATS files, header information is XML formatted. The end time in ATS\nheader files is actually one sample past the time of the last sample.\nTimeReaderATS handles this and gives a last time corresponding to the actual\ntimestamp of the last sample.\n\nNotes\n-----\nThe raw data units for ATS data are in counts. To get data in field units,\nATS data is first multipled by the least significat bit (lsb) defined in the\nmetadata files,\n\n.. math::\n\n    data = data * lsb,\n\ngiving data in mV. The lsb includes the gain removal, so no separate gain\nremoval needs to be performed.\n\nFor electrical channels, there is additional step of dividing by the\nelectrode spacing, which is provided in metres. The extra factor of a 1000\nis to convert this to km to give mV/km for electric channels\n\n.. math::\n\n    data = \\frac{1000 * data}{spacing}\n\nFinally, to get magnetic channels in nT, the magnetic channels need to be\ncalibrated.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "apply_scalings": {
         "title": "Apply Scalings",
         "default": true,
         "type": "boolean"
      },
      "extension": {
         "title": "Extension",
         "default": ".ats",
         "type": "string"
      },
      "chan_input_key": {
         "title": "Chan Input Key",
         "default": "./recording/input/ADU07Hardware/channel_config/channel",
         "type": "string"
      },
      "chan_output_key": {
         "title": "Chan Output Key",
         "default": "./recording/output/ProcessingTree1/output/ATSWriter",
         "type": "string"
      }
   }
}

field extension: Union[str, None] = '.ats'

The data file extension

field chan_input_key: str = './recording/input/ADU07Hardware/channel_config/channel'

The xml path to input channel information

field chan_output_key: str = './recording/output/ProcessingTree1/output/ATSWriter'

The xml path to output channel information

read_metadata(dir_path: pathlib.Path)resistics.time.TimeMetadata[source]

Read the time series data metadata and return

Parameters

dir_path (Path) – Path to time series data directory

Returns

Metadata for time series data

Return type

TimeMetadata

Raises
  • TimeDataReadError – If extension is not defined

  • MetadataReadError – If incorrect number of xml files found

  • MetadataReadError – If there is a mismatch between number of channels and actual channels found

  • TimeDataReadError – If not all data files exist

  • TimeDataReadError – if the data files have the wrong extension

read_data(dir_path: pathlib.Path, metadata: resistics.time.TimeMetadata, read_from: int, read_to: int)resistics.time.TimeData[source]

Get unscaled data from an ATS file

The raw data units for ATS are counts.

Other notes:

  • ATS files have a header of size 1024 bytes

  • A byte offset of 1024 is therefore applied when reading data

Parameters
  • dir_path (path) – The directory path to read from

  • metadata (TimeMetadata) – Time series data metadata

  • read_from (int) – Sample to read data from

  • read_to (int) – Sample to read data to

Returns

A TimeData instance

Return type

TimeData

scale_data(time_data: resistics.time.TimeData)resistics.time.TimeData[source]

Get ATS data in physical units

Resistics will always provide physical samples in field units. That means:

  • Electrical channels in mV/km

  • Magnetic channels in mV

  • To get magnetic fields in nT, calibration needs to be performed

The raw data units for ATS data are in counts. To get data in field units, ATS data is first multipled by the least significat bit (lsb) defined in the header files,

\[data = data * lsb,\]

giving data in mV. The lsb includes the gain removal, so no separate gain removal needs to be performed.

For electrical channels, there is additional step of dividing by the electrode spacing, which is provided in metres. The extra factor of a 1000 is to convert this to km to give mV/km for electric channels

\[data = \frac{1000 * data}{spacing}\]

To get magnetic channels in nT, the magnetic channels need to be calibrated.

Parameters

time_data (TimeData) – TimeData read in from file

Returns

TimeData scaled to give physically meaningful units

Return type

TimeData