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:

  1. The transducer conversion from physical quantity q into voltage u

  2. Amplification of the transducer voltage u to ADC voltage v

  3. Conversion from ADC voltage v to digital values d in the file.

The sensitivity and gain inputs to this function are in decibels, converted to linear values as s = 10 ** (sensitivity / 20) and g = 10 ** (gain / 20). The adc_range is specified as the peak voltage that the ADC can handle, which should be recorded as file_range in the raw data.

The equations that govern this are

  1. u = q * s, sensitivity s in V/Q, e.g. V/Pa.

  2. v = u * g, gain g is unitless.

  3. 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.