resistics.calibrate.calibrator module¶
-
class
resistics.calibrate.calibrator.
Calibrator
(calDirectory: str)[source]¶ Bases:
resistics.common.base.ResisticsBase
Class for calibrating a time dataset
- Attributes
- calExtlist
Accepted calibration extensions
- calFormatslist
The calibration file formats of the respective extensions
- calDirstr
Directory path of calibration files
- calFileslist[str]
List of calibration files found in calibration directory
- numCalFilesint
Number of found calibration files in calibration directory
- useTheoreticalbool
Flag to use theoretical calibration function
Methods
__init__(calDirectory)
Initialise with calibration directory
setCalDir(calDirectory)
Set the calibration directory path
findCalFiles()
Find calibration files in calibration directory
calibrate(timeData, sensor, serial, chopper)
Calibrate time data
getCalFile(sensor, serial, chopper)
Get index of matching calibration flile in calFiles list
calibrateChan(data, fs, calData)
Calibrate an individual channel
interpolateCalData(calData, f, spline)
Interpolate calibration data to same frequencies as channel data
getTheoreticalCalData(sensor)
Get theoretical calibration data
printList()
Class status returned as list of strings
-
calibrate
(self, timeData: resistics.time.data.TimeData, sensor: Dict[str, str], serial: Dict[str, int], chopper: Dict[str, bool]) → resistics.time.data.TimeData[source]¶ Calibrate time data
For each channel in timeData, searches for a matching calibration file based on sensor type, serial number and chopper. If a calibration file is found, the channel is calibrated using the data in the file. If useTheoretical is False and no file is found, the data is not calibrated
todo: If no calibration file is found and the channel is a magnetic data channel, a theoretical function can be used
- Parameters
- timeDataTimeData
TimeData object
- sensorDict
Dictionary of sensor information with channels as the key and sensor as the value (sensor is a string)
- serial :
Dictionary of serial information with channels as the key and sensor as the value (serial is a number)
- chopper :
Dictionary of chopper information with channels as the key and sensor as the value (chopper is a bool)
- Returns
- timeDataTimeData
Calibration TimeData object
-
calibrateChan
(self, data: numpy.ndarray, sampleFreq: float, calData: resistics.calibrate.data.CalibrationData) → numpy.ndarray[source]¶ Calibrate a channel
Perform fourier transform of channel data, deconvolve (division) sensor impulse response and inverse fourier transform.
- Parameters
- datanp.ndarray
Channel data
- sampleFreqfloat
Sampling frequency Hz
- calDataCalibrationData
Calibration data
- Returns
- outnp.ndarray
Calibrated channel data
-
getCalFile
(self, sensor, serial, chopper) → int[source]¶ Get calibration file for a sensor, serial and chopper combination
- Parameters
- sensorstr
Channel data
- serialint
Sampling frequency Hz
- chopperbool
Calibration data
- Returns
- calFilestr
The mathing calibration file
- calFormatstr
The calibration format
-
getTheoreticalCalData
(self, sensor: str) → numpy.ndarray[source]¶ Get theoretical calibration data for magnetic channels
- Parameters
- sensorstr
Sensor type
- Returns
- outnp.ndarray
Theoretical calibration information
-
interpolateCalData
(self, calData: resistics.calibrate.data.CalibrationData, f: numpy.ndarray) → numpy.ndarray[source]¶ Interpolation calibration data on to frequency points
- Parameters
- calDataCalibrationData
Calibration data
- fnp.ndarray
Frequency array where calibration data is defined
- Returns
- outnp.ndarray
Calibration data interpolated to the frequency array f