Skip to content

egse.calibration

This module provides functions to calibrate sensor values.

Functions:

Name Description
apply_gain_offset

Applies the given gain and offset to the given counts.

callendar_van_dusen

Solves the Callendar - van Dusen equation for temperature.

chebychev

Solves the Chebychev equation for temperature.

counts_to_resistance

Converts the given counts for the given sensor to resistance.

counts_to_temperature

Converts the given counts for the given sensor to temperature.

resistance_to_temperature

Converts the given resistance for the given sensor to temperature.

solve_temperature

Solves the temperature from the temperature -> resistance polynomial.

apply_gain_offset

apply_gain_offset(counts, gain, offset)

Applies the given gain and offset to the given counts.

Parameters:

Name Type Description Default
counts float

Uncalibrated, raw data [ADU]

required
gain float

Gain to apply

required
offset float

Offset to apply

required

Returns:

Type Description
float

Counts after applying the given gain and offset.

callendar_van_dusen

callendar_van_dusen(
    resistance, ref_resistance, standard, setup
)

Solves the Callendar - van Dusen equation for temperature.

Parameters:

Name Type Description Default
resistance float

Resistance [Ohm] for which to calculate the temperature

required
ref_resistance float

Resistance [Ohm] for a temperature of 0°C

required
standard str

Sensor standard

required
setup Setup

Setup

required

Returns:

Type Description
float

Temperature [°C] corresponding to the given resistance.

chebychev

chebychev(resistance, sensor_info)

Solves the Chebychev equation for temperature.

Implemented as specified in the calibration certificate of the LakeShore Cernox sensors.

Parameters:

Name Type Description Default
resistance float

Resistance [Ohm] for which to calculate the temperature

required
sensor_info navdict

Calibration information

required

Returns:

Type Description
float

Temperature [°C] corresponding to the given resistance.

counts_to_resistance

counts_to_resistance(sensor_name, counts, sensor_info)

Converts the given counts for the given sensor to resistance.

Parameters:

Name Type Description Default
sensor_name str

Sensor name

required
counts float

Uncalibrated, raw data [ADU]

required
sensor_info NavigableDict

Calibration information for the given sensor (type)

required

Returns:

Type Description
float

Resistance [Ohm] for the given sensor.

counts_to_temperature

counts_to_temperature(
    sensor_name, counts, sensor_info, setup
)

Converts the given counts for the given sensor to temperature.

This conversion can be done as follows:

- (1) Directly from counts to temperature, by applying the gain and offset;
- (2) Directly from counts to temperature, by applying a function;
- (3) From counts, via resistance, to temperature.

Parameters:

Name Type Description Default
sensor_name str

Sensor name

required
counts float

Uncalibrated, raw data [ADU]

required
sensor_info NavigableDict

Calibration information for the given sensor (type)

required
setup Setup

Setup

required

Returns:

Type Description
float

Calibrated temperature [°C] for the given sensor

resistance_to_temperature

resistance_to_temperature(
    sensor_name, resistance, sensor_info, setup
)

Converts the given resistance for the given sensor to temperature.

Parameters:

Name Type Description Default
sensor_name str

Sensor name

required
resistance float

Resistance [Ohm]

required
sensor_info NavigableDict

Calibration information for the given sensor (type)

required
setup Setup

Setup

required

Returns:

Type Description
floaf

Temperature [°C] for the given sensor.

solve_temperature

solve_temperature(
    temperature_to_resistance_coefficients, resistance
)

Solves the temperature from the temperature -> resistance polynomial.

For the given temperature -> resistance polynomial and the given resistance, we determine what the corresponding temperature is by:

  • Finding the roots of polynomial(temperature) = resistance;
  • Discarding the roots with an imaginary component;
  • Selecting the remaining root in the relevant temperature regime (here: [-200°C, 200°C]).