microcalorimetry.analysis

This module contains high-level routines for performing microcalorimetry analysis.

This module should contain static functions which take in configuration objects, and primative types (strings, numbers) that are then used to process the data. Where possible, they should use math functions defined in the math module.

These functions should be interfaceable via either a command line interface or a GUI where the user can only enter string-like inputs.

These function should utilize DataModelContainers when referring to inputs that represent inputs that cant be described by a short string (i.e. something convenient for a command line interface). This enables the passing of in-memory representations of data via the DataModelContainers so that it isn’t required to serialize the output of one function in order to pass it to the input of another.

Functions

make_correction_factor(...)

Calculate the correction factor for a given sensor model.

gc_from_model(→ tuple[microcalorimetry.configs.GC, ...)

Supply a parsed RF sweep and a python function to generate a GC model.

review_correction_factor(...)

Review a correction factor model.

fit_thermoelectric(→ tuple[rmellipse.uobjects.RMEMeas, ...)

Fit sensitivity coefficients to a dcsweep measurement of a thermoelectric.

make_eta(...)

Make an effective efficiency measurement.

review_eta(eta[, historical_data, repeatability_model, k])

Make review plots of effective efficiency data.

make_eta_repeatability_model(...)

Generate a historical repeatability model from sensor data.

make_classical_eta_unc_model(...)

Generate a classical uncertainty model for an eta measurement.

dc_lead_correction(→ tuple[microcalorimetry.configs.Eta])

Applies a dc lead correction for bolometer mounts.

apply_uncertainty_model(→ microcalorimetry.configs.Eta)

Applies uncertainty models of effective efficiency measurements.

compression_check(...)

Check the compression ratio of of a measurement.

Package Contents

microcalorimetry.analysis.make_correction_factor(gc_regressor_rows: microcalorimetry.configs.CorrectionFactorModelInputs, correction_terms: int, calc_thermal_weights: bool = False, make_plots: bool = True, nominals: bool = False, cache_s11: bool = True) tuple[microcalorimetry.configs.GC, list[matplotlib.pyplot.Figure]][source]

Calculate the correction factor for a given sensor model.

The normal_standards and special_standards are used to generate the regressor matrix. All possible combinations of connect cycles that use the same splitter_id are used to build the regressor matrix.

Parameters:
gcinputs: configs.CorrectionFactorDataInputs

Dictionary of CorrectionFactorDataInputs.

correction_termsint

Number of terms in correction factor. Usually 1.

calc_thermal_weightsbool, optional

If true, returns thermal weighting coefficients isntead of the correction factors (g_ci = wi/W0) where W0 is the sensitivity of the calorimeter.

make_plotsbool, optional

Makes plots. The default is True.

nominalsbool, optional

If true, propagates uncertainties.

cache_s11bool, optional

If true, read ins every s-parameter file once to avoid redundant loading of files, memory intensive.

Returns:
gcRMEMeas

Correction factor in RMEMeas format.

figslist[Figure]

Matplotlib figures generated (if asked to make plots.)

microcalorimetry.analysis.gc_from_model(frequency: numpy.array, model: microcalorimetry.configs.PythonFunction, terms: int = 1) tuple[microcalorimetry.configs.GC, matplotlib.pyplot.Figure][source]

Supply a parsed RF sweep and a python function to generate a GC model.

Parameters:
frequencynp.array

Frequencies to evaluate model at.

modelconfigs.PythonFunction

Python function that takes in a frequency (GHz) list and outputs correction factor values with the same shape.

termsint, optional

How many terms int he gc model. Default is 1.

Returns:
gcconfigs.GC

Correction factor object.

figplt.Figure

Plot of the generated GC.

Raises:
NotImplementedError

Only 1 term currently supported.

microcalorimetry.analysis.review_correction_factor(gc: microcalorimetry.configs.GC, units: str = '', budget: bool = True) list[matplotlib.pyplot.Figure, Ellipsis][source]

Review a correction factor model.

Parameters:
gcconfigs.GC

Correction factor model.

unitsstr, optional

Units string for y-axis. The default is ‘’.

budgetbool, optional

Plot the uncertainty budget. The default is True.

Returns:
list[plt.Figure,…]

List of figures generated.

microcalorimetry.analysis.fit_thermoelectric(parsed_dcsweep: microcalorimetry.configs.ParsedDCSweep, thermometer_corrected: bool = False, constrain_zero: bool = False, p_of_e: bool = False, deg: int = 2, make_plots: bool = False) tuple[rmellipse.uobjects.RMEMeas, matplotlib.pyplot.Figure][source]

Fit sensitivity coefficients to a dcsweep measurement of a thermoelectric.

Takes in a parsed dc measurement and generates sensitivity coefficients.

Parameters:
parsed_dcsweepmicrocalorimetry.configs.ParsedDCSweep

Steps parsed from sensitivity measurement. The first field is the applied voltage, the second field is the applied current, and the last field is the measure thermopile voltage.

thermometer_correctedbool, optional

Use a thermometer corrected model. Requires a thermometer voltage and current to be present in the parsed DC sweep. The default is False.

constrain_zerobool, optional

Constrains the fit to zero, only applies to non-thermometer corrected models. The default is False.

p_of_ebool, optional

Fit power as a function of thermopile voltage if True. If False, fits thermopile voltage as a function of power. Only applies to non thermometer corrected models. The default is False.

degint, optional

Fit degrees of polynomial for non thermometer corrected models. Only applies to non thermometer corrected models. The default is 2.

make_plotsbool, optional

Output plots if True.

Returns:
sensitivityRMEMeas

Sensitivity coefficients

figureslist[plt.Figure]

List of figures generated (empty if not made). Fit and residuals.

microcalorimetry.analysis.make_eta(gc: microcalorimetry.configs.GC, s11: microcalorimetry.configs.S11, parsed_rfsweep: microcalorimetry.configs.ParsedRFSweep, repeatability_model: microcalorimetry.configs.Eta = None, extra_eta_uncertainties: list[pathlib.Path] = None, lead_correction: list[float] = None, historical_data: microcalorimetry.configs.EtaHistorical = None, clrm_sensitivity: microcalorimetry.configs.ThermoelectricFitCoefficients = None, propagate_uncertainties: bool = True, make_plots: bool = True) tuple[list[matplotlib.pyplot.Figure] | None, microcalorimetry.configs.Eta][source]

Make an effective efficiency measurement.

Parameters:
gcconfigs.GC

Calorimetric correction factor terms.

s11configs.S11

Reflection coefficient of the sensor.

parsed_rfsweepconfigs.ParsedRFSweep

Parsed RF sweep output.

repeatability_modelconfigs.Eta, optional

Supply a repeatability model of the microcalorimeter to apply as uncertainty mechanisms and use in review charts. The default is None.

extra_eta_uncertaintieslist[Path], optional

Supply additional uncertainty models of eta that should be applied after the correction. The default is None.

lead_correctionlist[float], optional

Applies a dc lead correction if provided (and lead resistance is larger than zero) to account for heat lost in the 4-wire connection of a bolometer mount. First value is the total lead resistance of the force and sensor connections. The second value is the bolometer resistance. For example, [0.2, 200] means 0.2 Ohm lead resistance and 200 ohm bolometer resistance.

historical_dataconfigs.EtaHistorical, optional

Supply a historical Eta configuration object to use a reference measurements in the review charts. The default is None.

clrm_sensitivityconfigs.ThermoelectricFitCoefficients, optional

If provided, assumes the correction factor is weighted by the calorimeters sensitivity and provide in units of (V/W). These coefficents will be used to calculate the dimensionless correction factor. The default is None.

propagate_uncertaintiesbool, optional

Propagate uncertainties from the correction factor and the model of the sensors reflection coefficient during calculation. The default is True.

make_plotsbool, optional

Make plots during the analsysis,otherwise figs will be an empty list. The default is True. Plots are made by passing off to the review eta function.

Returns:
figList[plt.Figure] | None

Any figures generated.

etaRMEMeas

Effective efficiency.

microcalorimetry.analysis.review_eta(eta: microcalorimetry.configs.Eta, historical_data: microcalorimetry.configs.EtaHistorical = None, repeatability_model: microcalorimetry.configs.Eta = None, k: int = 2)[source]

Make review plots of effective efficiency data.

Parameters:
etaconfigs.Eta

Effective efficiency being reviewed.

historical_dataconfigs.EtaHistorical

Historical data to review against.

repeatability_modelconfigs.Eta

Model of calorimeter’s repeatability to plot.

kint, optional

Expansion factor, by default 2

microcalorimetry.analysis.make_eta_repeatability_model(historical_data: list[microcalorimetry.configs.EtaHistorical], make_plots: bool = True, coverage: float = 2, min_points: int = 3) tuple[microcalorimetry.configs.Eta, list[matplotlib.pyplot.Figure], rmellipse.uobjects.RMEMeas][source]

Generate a historical repeatability model from sensor data.

Parameters:
historical_datalist[configs.EtaHistorical]

List of EtaHistorical configuration objects for different sensors.

make_plotsbool, optional

Generate figures if True.

coverageint, optional

Attempts to have the repeatability uncertainty meet this coverage factor frequency point by frequency point. The default is 3.

min_pointsint, optional

Minimum number of required samples per frequency point to be included as part of the fit. The default is 3.

Returns:
hist_modelRMEMeas

RMEMeas object of eff centered at 0 with uncertainties describing historical repeatability. Can be added to an effective efficiency measurement to add repeatability uncertainties.

figplt.Figure

Figure reporting the model. None if no figure

coeffsRMEMeas

Fit coefficients generated from the repeatability model.

microcalorimetry.analysis.make_classical_eta_unc_model(frequency: numpy.array, model: microcalorimetry.configs.PythonFunction, u_type: str, correlate_frequencies: bool = True, make_plots: bool = True) tuple[microcalorimetry.configs.Eta, matplotlib.pyplot.Figure][source]

Generate a classical uncertainty model for an eta measurement.

uA_model and uB_model are python functions that take in a frequency list and output a standard uncertainty (Type A and B respectively).

This model can be used to apply uncertainties to an eta calculate after it has been calculated. Is is zero nominal, so uncertainties are added to an eta measurement by simply adding it to to an effective efficiency measurement.

Uncertainties are assumed to be independent across frequency.

Parameters:
frequencynp.array

Frequency in GHz.

modelconfigs.PythonFunction

Python function that outputs type B uncertainty.

u_typestr

Type of uncertainty (A or B)

correlate_frequenciesbool, optional

Treat uncertainties as correlated if True. The default is True.

make_plotsbool, optional

If True, make plots.

Returns:
eta_uncconfigs.Eta

Eta configuration object with zero nominal and uncertainties derived from uA_model and uB_model.

figplt.Figure | None

Matplotlib figure object generated.

microcalorimetry.analysis.dc_lead_correction(eta: microcalorimetry.configs.Eta, R_lead: float, R_bolo: float) tuple[microcalorimetry.configs.Eta][source]

Applies a dc lead correction for bolometer mounts.

Accounts for heat lost in the 4-wire connection of a bolometer mount biasing the measurement.

Parameters:
etaconfigs.Eta

Path to an effective efficiency measurement to apply the correction to.

R_leadfloat

Sum of resistance for Force and Sense leads of sensor.

R_bolofloat

Bolometer resistance, usually 200 ohms for bolometer sensors.

Returns:
eta

Corrected eta value

microcalorimetry.analysis.apply_uncertainty_model(eta: microcalorimetry.configs.Eta, model: microcalorimetry.configs.Eta) microcalorimetry.configs.Eta[source]

Applies uncertainty models of effective efficiency measurements.

Uncertainties are applied by adding model to eta, assuming model is zero nominal.

Parameters:
etaconfigs.Eta

Eta that will have unertainties applied.

modelconfigs.Eta

Model of uncertainties that will be applied to eta. Should be nominaly zero.

Returns:
etaconfigs.Eta

Same nominal as the input eta, but with new uncertainties.

microcalorimetry.analysis.compression_check(power: microcalorimetry.configs.RFSweep, power_minus_1dB: microcalorimetry.configs.RFSweep, k: int = 2) tuple[microcalorimetry.configs.RFSweep, matplotlib.pyplot.Figure][source]

Check the compression ratio of of a measurement.

Requires a parsed rfsweep at desired power, and another at the same frequency list backed off on the source by 1 dBm.

Parameters:
powerconfigs.RFSweep

Power of sensor at desired output.

power_minus_1dBconfigs.RFSweep

Power measured by sensor backed off by 1dB at source from desired output.

kint, optional

Expansion factor to plot. The default is 2.

Returns:
compression_ratioRMEMeas

Compression ratio.

figplt.Figure

Figure object.