uwacan.recordings.calibrate_raw_data#
- calibrate_raw_data(raw_data, sensitivity=None, gain=None, adc_range=None, file_range=None)[source]#
Calibrates raw data read from files into physical units.
There are three conversion steps handled in this calibration function:
The transducer conversion from physical quantity
qinto voltageuAmplification of the transducer voltage
uto ADC voltagevConversion from ADC voltage
vto digital valuesdin the file.
The sensitivity and gain inputs to this function are in decibels, converted to linear values as
s = 10 ** (sensitivity / 20)andg = 10 ** (gain / 20). Theadc_rangeis specified as the peak voltage that the ADC can handle, which should be recorded asfile_rangein the raw data.The equations that govern this are
u = q * s, sensitivitysin V/Q, e.g. V/Pa.v = u * g, gaingis unitless.d / d_ref = v / v_ref, relating file values to ADC voltage input.
for a final expression of
q = d * (v_ref / d_ref / s / g). All conversion factors default to 1 if not given.- Parameters:
- raw_dataarray_like
The raw input data read from a file.
- sensitivityarray_like
Sensitivity of the sensor, in dB re. V/Q, where Q is the desired physical unit.
- gainarray_like
The gain applied to the voltage from the sensor, in dB.
- adc_rangearray_like
The peak voltage that the ADC can handle.
- file_rangearray_like
The peak value that the raw data contains, corresponding to the
adc_range.
- Returns:
- qarray_like
The calibrated values, as per the equations above.