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(...)

make_k_coeffs(...)

Load and analyze a sensitivity run.

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])

Corrects an effective efficiency measurmeent for losses in DC leads.

apply_uncertainty_model(→ microcalorimetry.configs.Eta)

Applies uncertainty models of effective efficiency measurements.

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 = '') list[matplotlib.pyplot.Figure, Ellipsis][source]
microcalorimetry.analysis.make_k_coeffs(parsed_dcsweep: microcalorimetry.configs.ParsedDCSweep, constrain_zero: bool = False, p_of_e: bool = False, deg: int = 2, make_plots: bool = False) tuple[dict[microcalorimetry.configs.ThermoelectricFitCoefficients], matplotlib.pyplot.Figure][source]

Load and analyze a sensitivity run.

Takes in a sensitivity experiment and generate sensitivity coefficients and other relevant data.

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.

constrain_zerobool, optional

Constrains the fit to zero. The default is False.

p_of_ebool, optional

Fit power as a function of thermopile voltage. The default is False.

degint, optional

Fit degrees of polynomial, the default is 2.

make_plotsbool, optional

Output plots if True, outputs None in place of figure otherwise.

Returns:
sensitivitydict[configs.ThermoelectricFitCoefficients]

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, historical_data: microcalorimetry.configs.EtaHistorical = None, thermal_weights: microcalorimetry.configs.ThermoelectricFitCoefficients = None, 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.

historical_dataconfigs.EtaHistorical, optional

Dictionary of key value pairs where values are configs.Eta. The default is None.

thermal_weightsconfigs.ThermoelectricFitCoefficients, optional

If provied, assumes gc are thermal weight coefficients and are scaled by the provided sensitivity coefficient before calculating effective efficiency. These should be thermopile sensitivity coefficients of the calorimeter calculated with the same model of sensor. The default is None.

uncertaintiesbool, optional

Propagate uncertainties during calculation, is faster to turn off during debugging or exploratory analysis. 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
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

Attempt to have the repeatability uncertainty meet this coverage factor. Applied frequency point by frequency point.

min_pointsint, optional

Minimum number of required samples per frequency points.

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, uA_model: microcalorimetry.configs.PythonFunction, uB_model: microcalorimetry.configs.PythonFunction) 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 respectivley).

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 measurmeent by simply adding it to to an effective efficiency measurement.

Uncertainties are assumed to be independent across frequency.

Parameters:
frequencynp.array

Frequency in GHz.

uA_modelconfigs.PythonFunction

Python function that outputs type A uncertainty.

uB_modelconfigs.PythonFunction

Python function that outputs type B uncertainty.

Returns:
eta_uncconfigs.Eta

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

figplt.Figure

Matplotlib figure object generated.

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

Corrects an effective efficiency measurmeent for losses in DC leads.

Parameters:
etaconfigs.Eta

_description_

R_leadfloat

Sum of lead 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

Has uncertainties that will be applied on to eta.

Returns:
etaconfigs.Eta

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