microcalorimetry.math.rfpower ============================= .. py:module:: microcalorimetry.math.rfpower .. autoapi-nested-parse:: Analysis functions used in RF power and calorimetery. .. !! processed by numpydoc !! Functions --------- .. autoapisummary:: microcalorimetry.math.rfpower.dcbias_eta_correction microcalorimetry.math.rfpower.compression_ratio microcalorimetry.math.rfpower.openloop_thermoelectric_power microcalorimetry.math.rfpower.temperature_corrected_thermoelectric_fit microcalorimetry.math.rfpower.apply_temperature_dependent_fit microcalorimetry.math.rfpower.thermopile_sensitivity microcalorimetry.math.rfpower.zeta_general microcalorimetry.math.rfpower.zeta_dcsub microcalorimetry.math.rfpower.effective_efficiency microcalorimetry.math.rfpower.p_comp microcalorimetry.math.rfpower.dc_substituted_power microcalorimetry.math.rfpower.gc_device_row microcalorimetry.math.rfpower.gc_correction_factor Module Contents --------------- .. py:function:: dcbias_eta_correction(eta: microcalorimetry.arrays.Eta, R_lead: float, R_bolo: float) Correct an effective efficiency measurment for DC biases. From CPEM 2010 paper. :param eta: Effective efficiency measurement. :type eta: xr.DataArray :param R_lead: Lead resistance of the Force and Sense leads of the sensor added together. :type R_lead: float :param R_bolo: Resistance of the bolometer, typically 200 Ohms for thermistor sensors. :type R_bolo: float .. !! processed by numpydoc !! .. py:function:: compression_ratio(power: xarray.DataArray, power_minus_1dB: xarray.DataArray) -> xarray.DataArray Calculate the compressionr ratio at power. :param power: Power (in Watts) measured by sensor. :type power: xr.DataArray :param power_minus_1dB: Power (in Watts) measured by sensor at source setting minus 1 dB. :type power_minus_1dB: xr.DataArray :returns: **ratio** -- Compression ratio. :rtype: xr.DataArray .. !! processed by numpydoc !! .. py:function:: openloop_thermoelectric_power(coeffs: microcalorimetry.arrays.KDCTemInd | microcalorimetry.arrays.KDCTempDep, e: xarray.DataArray, p_of_e: bool, temperature: xarray.DataArray | None = None) -> xarray.DataArray Calculate the openloop thermoelectric power from fit coefficients. This function can accept models that provide power as a polynomial function of voltage (or vice versa) or can be provided a temperature sensitive model of the thermoelectric if temperature readings are also provided. :param coeffs: Quadratic fit coefficients. Fit coefficients are along last dimension called "deg", coordinates are integer values corresponding to the polynomail power (i.e. deg = 2 corresponds to c_2 for y = c_2*x**^2 ). Fit coefficients can be power in terms of voltage (W/V^n) or voltage in terms of power (V/W^n). Alternativley, can take in temperature sensitive fit coefficients and a temperature reading. :type coeffs: xr.DataArray :param thermoelectric_voltage: Array of thermoelectric voltages to evaluate power at. :type thermoelectric_voltage: xr.DataArray :param p_of_e: If true, assumes fit is power in terms of the thermolectric voltage, by default True. :type p_of_e: bool :param temperature: If provided, assumed to be a temperature dependent thermoelectric model. Otherwise assumed to a straight forward polynomial. :type temperature: xr.DataArray | None, optional :returns: Evaluated thermoelectric power. :rtype: xr.DataArray .. !! processed by numpydoc !! .. py:function:: temperature_corrected_thermoelectric_fit(P: xarray.DataArray, T: xarray.DataArray, V: xarray.DataArray) -> microcalorimetry.arrays.KDCTempDep Fits power, voltage, and temperature to a temperature sensitive model. Power is in Watts and voltage is is Volts. Temperature can be any units provided it is proprtional to temperture and the same unit is units when using the fit later on. It is typically resistance for a resistance thermometer :param P: Power (Watts). :type P: xr.DataArray :param T: Temperatue :type T: xr.DataArray :param V: Volts (v). :type V: xr.DataArray :returns: Array of fit coefficients with names othe coefficients along a dimension called 'col'. :rtype: arrays.KDCTempDep .. !! processed by numpydoc !! .. py:function:: apply_temperature_dependent_fit(e: xarray.DataArray, temperature: xarray.DataArray, coeffs: microcalorimetry.arrays.KDCTempDep) -> xarray.DataArray Apply a temperature dependent fit. Shapes are assumed to be :param e: Thermopile voltage shape (...,N) :type e: xr.DataArray :param temperature: Temperature readings shape (...,N). :type temperature: xr.DataArray :param coeffs: Fit coefficients shape (...,10). Last dimension is called 'col' and contains the fit coefficients. :type coeffs: xr.DataArray :returns: Array of 1/k sensitivities corresponding to the the voltage and temperature readings provided. Power is metered as e/k, so multiple the voltages by the output of this function. :rtype: xr.DataArray .. !! processed by numpydoc !! .. py:function:: thermopile_sensitivity(e: xarray.DataArray, k: xarray.DataArray, deg: int = 2, kunc: numpy.array = None) -> xarray.DataArray Calculate the sensitivity of thermopile element using DC power. v, i, and e are typically estimates of the steady state values of a step response. Function performs a polynomial of requested degree. v, i, and e are assumed to be of shape (..., n) where all coordinates and dimensions are the same. The fitting is done across the n dimensions, and repeated across (...). :param e: DC voltage applied to a sensor. :type e: xr.DataArray :param k: (e-e_0)/p of the sensor. :type k: xr.DataArray :param constrain_zero: Constrain the offset to cross zero. :type constrain_zero: bool, optional :param p_of_e: If true, fits power in terms of thermopile voltage, if false fits thermopile voltage in terms of power. :type p_of_e: bool, optional :param deg: Degree of polynomial fit. The default is 2. :type deg: int, optional :param kunc: Uncertainty on power values. The default is None. If provided, used as weights for the ordinary least squares fitting. :type kunc: np.array, optional :returns: **sense** -- Resulting coefficients of the fit. :rtype: xr.DataArray .. !! processed by numpydoc !! .. py:function:: zeta_general(*, e_on: microcalorimetry.arrays.RFSweep, e_off: microcalorimetry.arrays.RFSweep, e_0: microcalorimetry.arrays.RFSweep, cal_k: microcalorimetry.arrays.KDCTemInd | microcalorimetry.arrays.KDCTempDep, p_of_e: bool, P2: microcalorimetry.arrays.RFSweep, P_dc_on_slow: microcalorimetry.arrays.RFSweep | float = 0, P_dc_off_slow: microcalorimetry.arrays.RFSweep | float = 0) -> microcalorimetry.arrays.RFSweep Calculate uncorrected effective efficiency for any sensor. Requires knowledge of calorimeter's sensitivity, This formulation is sensor agnostic. :param e_on: Thermopile voltage in the RF on state (of calorimeter). :type e_on: arrays.RFSweep :param e_off: Thermopile voltage in the RF off state (of calorimeter). :type e_off: arrays.RFSweep :param e_0: Time varying offset of the microcalorimeter's thermopile in the at the time of measurment. Typically inffered by interpolation. :type e_0: arrays.RFSweep :param cal_k: Thermopile sensitivity coefficients of the calorimeter. Last dimension called 'deg' with integer coordinates corresponding to the polynomial order. :type cal_k: arrays.RFSweep :param p_of_e: True means cal_k fits power in terms of thermopile voltage. False means cal_k fits thermopile voltage in terms of power. V/W or W/V. :type p_of_e: bool :param P2: Metered power of the sensor in the calorimeter :type P2: arrays.RFSweep :param P_dc_on_slow: DC power in the RF on state evalutated on the long term at the point P2 was taken. :type P_dc_on_slow: arrays.RFSweep :param P_dc_off_slow: DC power in the RF off state evaluated on the long term at the time P2 was taken (usually via interpolation). :type P_dc_off_slow: arrays.RFSweep :returns: Uncorrected effective efficiency. :rtype: arrays.RFSweep .. !! processed by numpydoc !! .. py:function:: zeta_dcsub(e_on: microcalorimetry.arrays.RFSweep, e_off: microcalorimetry.arrays.RFSweep, V_on: microcalorimetry.arrays.RFSweep, V_off: microcalorimetry.arrays.RFSweep, V_off_slow: microcalorimetry.arrays.RFSweep, I_on: microcalorimetry.arrays.RFSweep = None, I_off: microcalorimetry.arrays.RFSweep = None, I_off_slow: microcalorimetry.arrays.RFSweep = None) -> microcalorimetry.arrays.RFSweep Calculate uncorrected effective efficiency for a DC substitution type sensor. All in inputs are assumed to be data arrays of the same shape, and share common coordinates. :param e_on: Thermopile voltage in the RF on state. :type e_on: arrays.RFSweep :param e_off: Thermopile voltage in the RF off state. :type e_off: arrays.RFSweep :param V_on: DC voltage in the RF on state. :type V_on: arrays.RFSweep :param V_off: DC voltage in the RF off state. :type V_off: arrays.RFSweep :param V_off_slow: DC voltage in the RF off state. (estimated from equilibrium) :type V_off_slow: arrays.RFSweep :param I_on: DC current in the RF on state if power was measured with an SMU. If not provided only the voltage measurement will be used. :type I_on: arrays.RFSweep | None, optional :param I_off: DC current in the RF off state if power was measured with an SMU. If not provided only the voltage measurement will be used. The default is None. :type I_off: arrays.RFSweep | None, optional :param I_off_slow: DC current in the RF off state if power was measured with an SMU (in equilibrium). If not provided only the voltage measurement will be used. The default is None. :type I_off_slow: arrays.RFSweep | None, optional :returns: Uncorrected effective efficiency. :rtype: arrays.RFSweep .. !! processed by numpydoc !! .. py:function:: effective_efficiency(uncorrected_eta: microcalorimetry.arrays.RFSweep, gamma_s: microcalorimetry.arrays.S11, gc: microcalorimetry.arrays.GC) -> microcalorimetry.arrays.Eta Calculate effective efficiency. Currently only supports a 1 term model. :param uncorrected_eta: Uncorrected effective efficiency of a calorimetric measurement. :type uncorrected_eta: xr.DataArray :param gamma_s: Reflection coefficient of the standard in s1p_c format. :type gamma_s: xr.DataArray :param gc: Correction factor, either 1 term or 4 term model. :type gc: xr.DataArray :raises Exception: If not a 1 term correction factor, until support added.. :returns: Effective efficiency. :rtype: arrays.Eta .. !! processed by numpydoc !! .. py:function:: p_comp(dcsub_s: microcalorimetry.arrays.RFSweep, dcsub_3x: microcalorimetry.arrays.RFSweep, dcsub_3s: microcalorimetry.arrays.RFSweep, gamma_s: microcalorimetry.arrays.RFSweep, gamma_x: microcalorimetry.arrays.RFSweep, gamma_g: microcalorimetry.arrays.RFSweep) -> microcalorimetry.arrays.DCSweep Calculate the 'alpha' term, proportional to the power incident on sensor x. Used in the correction factor algorithm. :param dcsub_s: DC substituted power measured by the normal standard in the calorimeter. :type dcsub_s: arrays.RFSweep :param dcsub_3x: DC subtituted power measured by the side arm with sesnsor x in the calorimeter. :type dcsub_3x: arrays.RFSweep :param dcsub_3s: DC substituted power measured by the sid-arm with the normal standard in the calorimeter. :type dcsub_3s: arrays.RFSweep :param gamma_s: Reflection coefficient of standard s in s1p_c format. :type gamma_s: arrays.RFSweep :param gamma_x: Reflection coefficient of sensor x in s1p_c format. :type gamma_x: arrays.RFSweep :param gamma_g: Port-2-port mismatch of the spliter being used. :type gamma_g: arrays.RFSweep :returns: alpha_xs. :rtype: arrays.RFSweep .. !! processed by numpydoc !! .. py:function:: dc_substituted_power(V_on: microcalorimetry.arrays.RFSweep, V_off: microcalorimetry.arrays.RFSweep, R: microcalorimetry.arrays.RFSweep = None, I_on: microcalorimetry.arrays.RFSweep = None, I_off: microcalorimetry.arrays.RFSweep = None) -> microcalorimetry.arrays.RFSweep Calculate dc substituted power. R OR (I_on and I_off) must be provided to calculate the dc substituted power. :param V_on: DC voltage in the RF on state. :type V_on: arrays.RFSweep :param V_off: DC voltage in the RF off state. :type V_off: arrays.RFSweep :param R: Set-point resistance of the standard. The default is None. :type R: arrays.RFSweep, optional :param I_on: DC current in the RF on state. The default is None. :type I_on: arrays.RFSweep, optional :param I_off: DC current in the RF off state. The default is None. :type I_off: arrays.RFSweep, optional :raises Exception: If neither R nor Current measurements are provided, or if both are. :returns: dc substituted power. :rtype: arrays.RFSweep .. !! processed by numpydoc !! .. py:function:: gc_device_row(p_comp_x: microcalorimetry.arrays.RFSweep, p_cal_x: microcalorimetry.arrays.RFSweep, zeta_s: microcalorimetry.arrays.RFSweep, gamma_s: microcalorimetry.arrays.RFSweep, gamma_x: microcalorimetry.arrays.RFSweep, k_s: microcalorimetry.arrays.RFSweep, k_x: microcalorimetry.arrays.RFSweep, n_correction_terms: int = 1) -> tuple[xarray.DataArray, xarray.DataArray] Build a row in the correction factor regressor matrix. Returns (....,r,c) shaped data :param alpha_xs: alpha_xs term in the correction factor model for standard x. :type alpha_xs: arrays.RFSweep :param delta_x: power delta term in the correctionf factor model for sensor x. :type delta_x: arrays.RFSweep :param zeta_s: uncorrected effective efficiency of standard s. :type zeta_s: arrays.RFSweep :param gamma_s: reflection coefficient of standard s in the s1p_c format. :type gamma_s: arrays.RFSweep :param gamma_x: reflection coefficient of standard x in the s1p_c format. :type gamma_x: arrays.RFSweep :param k_s: Sensitivity of the microcalorimeter while standard s is inside. :type k_s: arrays.RFSweep :param k_x: Sensitivity of the microcalorimeter while standard x is inside. :type k_x: arrays.RFSweep :param n_correction_terms: Number of correction terms being calculated. The default is 1. :type n_correction_terms: int, optional :returns: * *xr.DataArray* -- Row in the correction factor regressor matrix with shape (...,1, n_correction_terms) * *xr.DataArray* -- Solution to the equation for the resulting row with shape (..., 1, n_correction_terms) .. !! processed by numpydoc !! .. py:function:: gc_correction_factor(regressor: xarray.DataArray, solution: xarray.DataArray, n_correction_terms: int = 1) -> xarray.DataArray Calculate calorimetric correction factor. :param regressor: Rows in the correction factor regressor matrix. :type regressor: xr.DataArray :param solution: Solutions to the regressor matrix :type solution: xr.DataArray :param n_correction_term: Number of correction factor terms to calculate. :type n_correction_term: int,optional :returns: Correction factor model. :rtype: xr.DataArray .. !! processed by numpydoc !!