Instrument Analysis Utilities

zeustools.transmission module

class zeustools.transmission.AtmosphereTransmission

Bases: object

This class provides a method to calculate the sky transmission from APEX at arbitrary PWV and wavelength. It accomplishes this by using a downloaded copy of the APEX weather data (included with the package).

interp(freq, pwv)

interpolate the sky transmission at a given PWV and frequency.

Parameters
  • freq – frequency in GHz

  • pwv – pwv in mm

interp_internal_freq(pwv)

interpolate the sky transmission at a given PWV, using the frequency in the member variable observing_freq

Parameters

pwv – pwv in mm

class zeustools.transmission.FilterTransmission(filterType)

Bases: object

This class provides a good way to interpolate the transmission of the ZEUS-2 filters. For most of the filters, we have spreadsheets of their measured transmission, but for the zitex filter I digitized the plot of G110 zitex transmission from Benford 1999.

Create a FilterTransmission object providing one of the filter names/keys from the FILTER_NAMES dictionary, and then call the interp function with a wavelength in microns to get back its transmission at that wavelength.

interp(wl)

Run the interpolator at the given wavelength (in microns)

Parameters

wl – The desired wavelength or wavelengths to extract the transmission for.

Returns

numpy array of transmissions corresponding to the given wavelengths.

class zeustools.transmission.GratingTransmission(gratingType, fileName='grating_eff.csv', bounds=True)

Bases: FilterTransmission

The grating transmission files are a bit different from the filter data files. This class takes care of that difference, and gives you back an object that is for all intents and purposes identical to a FilterTransmission object

class zeustools.transmission.ZeusOpticsChain(config='2021')

Bases: object

This is the main way for you to handle transmission calculations. It takes into account all the filters in the system as well as the grating efficiency and the tuning ranges of the grating. You can also specify the time period you are interested in so that we can load the correct combination of filters and grating etc.

Parameters

config – This string lets you define the time period that you want. Currently available time periods are 2021 to load the configuration for APEX 2021, which includes the old “shiny” grating. 2019 loads the configuration at APEX in 2019, where we introduced the new k2586 350 micron bandpass filter. lab_2019 loads the configuration for the lab tests in 2019 and 2018, where the 350 micron bandpass filter was the “k2338” variety, and lab_late_2019 loads the config when the “w1018” bandpass filter was installed on the 350 micron array.

compute_transmission(wl, filters)

This is mostly an internal-use function. Given a combination of filters, multiply them all at the given wavelengths.

get_details_table(wl)
get_transmission_microns(wl, show_tuning_range=False)

Use this method for all your transmission computation needs! Once you have initialized the object, supply this method with a wavelength or array of wavelengths in order to compute the throughput at those wavelengths.

Parameters
  • wl – wavelength or numpy array of wavelengths of interest

  • show_tuning_range – Optional. If this is True, we will return “0” transmission for wavelengths that cannot be observed

Returns

numpy array of throughput fractions.

zeustools.transmission.airmass_factor(elev)

compute the airmass at a given elevation.

Parameters

elev – elevation / altitude in degrees

Returns

airmass. multiply this by pwv before calculating atmosphere transmission.

zeustools.iv_tools module

class zeustools.iv_tools.IVHelper

Bases: object

Load in an IV curve or several IV curves and perform useful operations with them

get_corrected_ivs(col, row, clean_again=True)

Returns all iv curves for col,row, currected to have normal y-intercept 0 and normal slope fixed

get_temperature_colorbar_norm()
load_directory(directory)

Given a directory containing IV curve data, this function will load the IV data and make it ready for processing. For best results, organize the folder so it only contains IV files and the associated run, out, and bias files. Also, each filename should contain the bath temperature it was taken at in the format 110mK

load_file(file, temp=None)
switch_to_real_units()

changes all internal data files from DAC units to real units As of now, this step is irreversible, so if you want to go back to DAC units you’ll have to reload the directory. But really, it should be easy since I keep the mce data array.

class zeustools.iv_tools.InteractiveIVPlotter(directory, power_temp=130, file=False, file_temp_override=None, real_units=True)

Bases: ZeusInteractivePlotter

bottom_flat()
bottom_plot()
build_data()
detectors_hist(title, bins=30, arrays=[350, 450], plot_rn=False, data_override=None, xlabel='none')
get_min_bias_and_resistance()
interactive_plot_power(array='all')
interactive_plot_rn()
power_resistance_plot(row, col, ax)
update_colorbar(sm, ax)
class zeustools.iv_tools.InteractiveThermalGPlotter(*args, **kwargs)

Bases: InteractiveIVPlotter

bottom_plot()
interactive_plot_g(array='all')
interactive_plot_n(array='all')
interactive_plot_tc(array='all')
power_bath_plot(row, col, ax)
thermal_hist_G(title, arrays=[350, 450], bins=30)
thermal_hist_Tc(title, arrays=[350, 450], bins=30)
class zeustools.iv_tools.InteractiveThermalPlotter(*args, **kwargs)

Bases: InteractiveIVPlotter

bottom_plot()
interactive_plot_g(array='all')
interactive_plot_k(array='all')
interactive_plot_n(array='all')
interactive_plot_tc(array='all')
power_bath_plot(row, col, ax)
zeustools.iv_tools.find_transition(bias, data)

Attempt to find the superconducting transition by fitting the normal branch and looking for deviations.

zeustools.iv_tools.find_transition_index(bias, data)
zeustools.iv_tools.fixed_slope_interceptor(bias, data, slope)
zeustools.iv_tools.linear_normal_fit(bias, data)
zeustools.iv_tools.psat_fitter(Tbath, n, K, T_c)
zeustools.iv_tools.psat_g_fitter(Tbath, n, g, T_c)
zeustools.iv_tools.super_remover(data)

Attempt to remove unlocked data from IV curves by finding the first jump of larger than 1e7

Parameters

data – masked array containing IV curve datacube.

zeustools.dac_converters module

The purpose of this module is to facilitate the conversion of DAC units to physical units. Here, when I say “Physical Parameters” I mean volts and amps.

This includes a lot of mostly hardcoded variables that describe the system. Most of this code comes from Carl’s calculator scripts, and has been thoroughly re-checked by CR, BP, and AV.

zeustools.dac_converters.MCE_BIAS_R = 467

most units ohms

zeustools.dac_converters.bias_dac_to_current(bias, bias_dac_bits=16, max_bias_voltage=5, dewar_bias_R=132, mce_bias_R=467)

Given bias dac values, return the bias current. This works in absolute because the bias DAC is absolute. However it does also work in relative, i.e. for converting bias step size.

zeustools.dac_converters.correct_signs(cube)
zeustools.dac_converters.fb_dac_to_tes_current(fb, butterworth_constant=1218, fb_dac_bits=14, max_fb_voltage=0.958, dewar_fb_R=5350, rel_fb_inductance=9)

Given feedback DAC values, return current values. This works both in absolute terms (i.e., if you are passing in shifted feedback values) and in relative terms because we’re only mulitplying.

zeustools.dac_converters.get_shunt_array(actpol_R=0.00018, cmb_R=0.00014, cmb_shunts=[0, 3, 4])
zeustools.dac_converters.mcefile_get_butterworth_constant(mce)
zeustools.dac_converters.real_units(bias, fb, col=0, whole_array=False, mce_bias_R=467, dewar_bias_R=132, cmb_shunts=[0, 3, 4], actpol_R=0.00018, cmb_R=0.00014, dewar_fb_R=5350, butterworth_constant=1218, rel_fb_inductance=9, max_bias_voltage=5, max_fb_voltage=0.958, bias_dac_bits=16, fb_dac_bits=14)

Given an array of biases and corresponding array of feedbacks (all in DAC units) calculate the actual current and voltage going through the TES. Note that to ensure consistency the Feedback DAC numbers should be shifted so that their zero values make sense.

Parameters
  • bias – Bias array in DAC units

  • fb – feedback array in DAC units

  • col – Optional. the MCE column that you are calculating for. This lets us select the correct resistor values

  • whole_array – Optional. If True, assumes that the value of the “fb” param is a whole mce data array, so we can handle resistors automatically.

  • cmb_shunts – List of columns assumed to have the “CMB6” style shunt chip though this is probably wrong, it makes things consistent. All other columns are assumed to have “actpol” style shunt chips.

  • dewar_fb_R – Although this is listed as the dewar feedback resistance, it is really the MCE + dewar in one. At present we use MCE_R=4000, Dewar_R=1280. Unit:ohms.

There are a lot of other parameters, and hopefully they’re explanitory enough. They are mostly intrinsic properties of the system, but until we are absolutely certain of their values we need to be able to tweak them a little.

Returns

(TES voltage array, TES current array) in Volts and Amps respectively.

Todo: Different chips may have different parameters. We currently handle this by assuming the array has a uniform normal resistance of 4 mOhm.

zeustools.bias_step_tools module

zeustools.bias_step_tools.bias_step_chop(mce)

Given an MCE SmallDataFile for data taken in bias step mode, compute the correct on/off chop signal matching bias low / bias high.

Parameters

mce – mce data file object

Returns

array containing square wave chop signal

zeustools.bias_step_tools.bias_step_di_di(mce)

Given an MCE SmallMCEFile object, compute the reistance of each pixel at the current bias point.

Parameters

mce – mce data file object

Returns

MCE shaped array contining dI_fb/dI_bias. target value is -0.05.

zeustools.bias_step_tools.bias_step_resistance(mce)

Given an MCE SmallMCEFile object, compute the reistance of each pixel at the current bias point.

Parameters

mce – mce data file object

Returns

MCE shaped array contining resistance values

zeustools.bias_step_tools.bs_interactive_plotter_factory(mce, didi=False)
zeustools.bias_step_tools.get_bias_array(mce)
zeustools.bias_step_tools.get_step_size(mce)
zeustools.bias_step_tools.naive_data_reduction(chop, cube)

Seriously stupid data reduction. Works only on the most well-behaved signals

zeustools.grating_cal module

class zeustools.grating_cal.GratingCalibrator

Bases: object

This class contains all the information needed to compute grating indices and wavelengths. This is mostly Carl’s code, and it is a duplicate of the functionality of his Excel spreadsheet.

alpha(Ig)
cal_index(n, wavelength, py, px, coeff)
cal_px(n, py, wavelength, alpha, coeff)
cal_py(n, px, wavelength, alpha, coeff)
cal_wavelength(n, alpha, py, px, coeff)
index(alpha)
order_to_coeffs(n)
phys_px_to_wavelength(spec, spat, array, index)

Given a location on the array and a grating index, compute the wavelength of light that should be falling on the detector.

Parameters can be numpy arrays or numbers, except for array.

Parameters
  • spec (int) – Spectral position on array.

  • spat (int) – Spatial position on the array.

  • array – Which array to use

  • index (int) – Grating index

Returns

wavelength of light falling on specified detector(s)

phys_to_coeffs(spec, array, return_order=False)

Given a location on the array, look up the correct set of coefficients for the best-fit grating model. Optionally return the grating order that falls onto the location you supplied.

Parameters
  • spec (int) – Spectral Position on the array

  • array (int) – Array name (i.e. 400, 200, micron arrays etc)

phys_wavelength_to_index(spec, spat, array, wavelength)

Given a location on the array and a wavelength of light, compute the grating index that should be used to obtain the specified wavelength.

Parameters can be numpy arrays or numbers, except for array.

Parameters
  • spec (int) – Spectral position on array.

  • spat (int) – Spatial position on the array.

  • array – Which array to use

  • wavelength – Wavelength in microns

Returns

Grating index

spat_wavelength_index_to_spec(spat, array, wavelength, index)

Given a spatial position on the array, a grating index, and a wavelength, compute the spectral position that should see the specified wavelength.

Parameters can be numpy arrays or numbers, except for array.

Parameters
  • spat (int) – Spatial position on the array.

  • array – Which array to use

  • wavelength – Wavelength in microns

  • index (int) – Grating index

Returns

Spectral position seeing the specified wavelength.

wavelength_to_coeffs(wavelength)
wavelength_to_order(wavelength)
zeustools.grating_cal.wavelength_v(source_velocity, line)
zeustools.grating_cal.wavelength_z(source_redshift, line)