debug module

smurf_iv

class pysmurf.client.debug.smurf_iv.SmurfIVMixin(log=None, epics_root=None, offline=False, pub_root=None, script_id=None, **kwargs)[source]
analyze_iv(v_bias, resp, make_plot=True, show_plot=False, save_plot=True, basename=None, band=None, channel=None, R_sh=None, plot_dir=None, high_current_mode=False, bias_group=None, grid_on=False, R_op_target=0.007, pA_per_phi0=None, bias_line_resistance=None, plotname_append='', **kwargs)[source]

Analyzes the IV curve taken with run_iv()

Parameters
  • v_bias (float array) – The commanded bias in voltage. Length n_steps.

  • resp (float array) – The TES phase response in radians. Of length n_pts (not the same as n_steps).

  • make_plot (bool, optional, default True) – Whether to make the plot.

  • show_plot (bool, optional, default False) – Whether to show the plot.

  • save_plot (bool, optional, default True) – Whether to save the plot.

  • basename (str or None, optional, default None) – The basename of the IV plot. If None, uses the current timestamp.

  • band (int or None, optional, default None) – The 500 MHz band the data was taken in. This is only for plotting.

  • channel (int or None, optional, default None) – The SMuRF channel. Only used for plotting.

  • R_sh (float or None, optional, default None) – The shunt resistance in ohms. If not supplied, will try to read from config file.

  • plot_dir (str or None, optional, default None) – Path to the plot directory where plots are to be saved. If None, uses self.plot_dir.

  • high_current_mode (bool, optional, default False) – Whether the data was taken in high current mode. This is important for knowing what current actually enters the cryostat.

  • grid_on (bool, optional, default False) – Whether to plot with grids on.

  • pA_per_phi0 (float or None, optional, default None) – The conversion for phi0 to pA. If None, attempts to read it from the config file.

  • bias_line_resistance (float or None, optional, default None) – The resistance of the bias lines in Ohms. If None, reads from config.

  • plotname_append (str, optional, default '') – An optional string to append the plot names.

Returns

R_sh – Shunt resistance.

Return type

float

analyze_iv_from_file(fn_iv_raw_data, make_plot=True, show_plot=False, save_plot=True, plotname_append='', R_sh=None, phase_excursion_min=3.0, grid_on=False, R_op_target=0.007, pA_per_phi0=None, channel=None, band=None, datafile=None, output_dir=None, plot_dir=None, bias_line_resistance=None)[source]
Function to analyze a load curve from its raw file. Can be used to

analyze IV’s/generate plots separately from issuing commands.

Parameters
  • fn_iv_raw_data (str) – *_iv_raw_data.npy file to analyze.

  • make_plot (bool, optional, default True) – Whether or not to make plots. Usually this is the slowest part.

  • show_plot (bool, optional, default False) – Whether or not to show plots.

  • save_plot (bool, optional, default True) – Whether or not to save plots.

  • plotname_append (str, optional, default '') – Appended to the default plot filename.

  • phase_excursion_min (float, optional, default 3.0) – abs(max - min) of phase in radians. Analysis ignores any channels without this phase excursion.

  • grid_on (bool, optional, default False) – Whether to draw the grid on the PR plot.

  • R_op_target (float, optional, default 0.007) – Target operating resistance. Function will generate a histogram indicating bias voltage needed to achieve this value.

  • pA_per_phi0 (float or None, optional, default None) – The conversion for phi0 to pA. If None, attempts to read it from the config file.

  • channel (int array or None, optional, default None) – Which channels to analyze. Defaults to all the channels that are on and exceed phase_excursion_min.

  • datafile (str or None, optional, default None) – The full path to the data. This is used for offline mode where the data was copied to a new directory. The directory is usually loaded from the .npy file, and this overwrites it.

  • output_dir (str of None, optional, default None) – The full path of where to save the output of the IV analysis. Useful if the data has been moved from the original format.

  • plot_dir (str or None, optional, default None) – The full path to the plot directory. This is usually loaded with the input numpy dictionary. This overwrites this.

  • bias_line_resistance (float or None, optional, default None) – The resistance of the bias lines in Ohms.

analyze_plc_from_file(fn_plc_raw_data, make_plot=True, show_plot=False, save_plot=True, R_sh=None, phase_excursion_min=1.0, channels=None)[source]

Function to analyze a partial load curve from its raw file. Basically the same as the run_iv analysis but without fitting the superconducting branch.

Parameters
  • fn_plc_raw_data (str) – *_plc_raw_data.npy file to analyze

  • make_plot (bool, optional, default True) – Whether to make plots. This is slow.

  • show_plot (bool, optional, default False) – Whether to show plots.

  • save_plot (bool, optional, default True) – Whether to save plots.

  • R_sh (float or None, optional, default None) – Shunt resistance; defaults to the value in the config file.

  • phase_excursion_min (float, optional, default 1.0) – abs(max-min) of phase in radian. Analysis will ignore any channels that do not meet this criterion.

  • channels (int array or None, optional, default None) – Which channels to analyze. Defaults to all channels that are on and exceed phase_excursion_min.

estimate_bias_voltage(iv_file, target_r_frac=0.5, normal_resistance=None, normal_resistance_frac=0.25, show_plot=False, save_plot=True, make_plot=True)[source]

Attempts to estimate the bias point per bias group. You must run identify_bias_group first (or manually input which channels are in which bias group), otherwise this doesn’t know how to group things.

Parameters
  • iv_file (str) – Full path to an IV file.

  • target_r_frac (float, optional, default 0.5) – The target fractional resistance.

  • normal_resistance (float or None, optional, default None) – The expected normal resistance. This is used for eliminating bad (non-transitioning) TESs. This is only used if not None.

  • normal_resistance_frac (float, optional, default 0.25) – The fractional deviation from the input normal_resistance that the normal resistance can deviate to be considered a good TES.

  • show_plot (bool, optional, default False) – Whether to show the plot.

  • save_plot (bool, optional, default True) – Whether to save the plot.

  • make_plot (bool, optional, default True) – Whether to make the plot.

Returns

target – An array of size n_bias_groups with the target bias voltage for each group.

Return type

float array

estimate_opt_eff(iv_fn_hot, iv_fn_cold, t_hot=293.0, t_cold=77.0, channels=None, dPdT_lim=(0.0, 0.5))[source]
Estimate optical efficiency between two sets of load curves. Returns

per-channel plots and a histogram.

Parameters
  • iv_fn_hot (str) – Timestamp/filename of load curve taken at higher temp.

  • iv_fn_cold (str) – Timestamp/filename of load curve taken at cooler temp.

  • t_hot (float, optional, default 293.0) – Temperature in K of hotter load curve.

  • t_cold (float, optional, default 77.0) – Temperature in K of cooler load curve.

  • channels (int array or None, optional, default None) – Which channels to analyze. If None, defaults to the ones populated in the colder load curve.

  • dPdT_lim (len 2 tuple, optional, default (0.0, 0.5)) – Min, max allowed values for dPdT. If calculated val is outside this range, channel is excluded from histogram and added to outliers. Units are pW/K.

partial_load_curve_all(bias_high_array, bias_low_array=None, wait_time=0.1, bias_step=0.1, show_plot=False, analyze=True, make_plot=True, save_plot=True, channels=None, overbias_voltage=None, overbias_wait=1.0, phase_excursion_min=1.0)[source]

Take a partial load curve on all bias groups. Function will step up to bias_high value, then step down. Will NOT change TES bias relay (ie, will stay in high current mode if already there). Will hold at the bias_low point at the end, so different bias groups may have different length ramps.

Parameters
  • bias_high_array (float array)) – (n_bias_groups,) array of voltage biases, in bias group order

  • bias_low_array (float array or None, optional, default None) – (n_bias_groups,) array of voltage biases, in bias group order. Defaults to whatever is currently set.

  • wait_time (float, optional, default 0.1) – Time in seconds to wait at each commanded bias value.

  • bias_step (float, optional, default 0.1) – Interval size to step the commanded voltage bias in volts.

  • show_plot (bool, optional, default False) – Whether to show plots.

  • analyze (bool, optional, default True) – Whether to analyze the data.

  • make_plot (bool, optional, default True) – Whether to generate plots.

  • save_plot (bool, optional, default True) – Whether to save generated plots.

  • channels (int array or None, optional, default None) – Which channels to analyze. Default to anything. that exceeds phase_excursion_min.

  • overbias_voltage (float or None, optional, default None) – Value in volts at which to overbias. If None, won’t overbias. If value is set, uses high current mode.

  • overbias_wait (float, optional, default 1.0) – If overbiasing, time to hold the overbiased voltage in high current mode.

  • phase_excursion_min (float, optional, default 1.0) – Minimum change in phase to be analyzed, defined as abs(phase_max - phase_min). Units radians.

run_iv(bias_groups=None, wait_time=0.1, bias=None, bias_high=1.5, bias_low=0, bias_step=0.005, show_plot=False, overbias_wait=2.0, cool_wait=30, make_plot=True, save_plot=True, plotname_append='', channels=None, band=None, high_current_mode=True, overbias_voltage=8.0, grid_on=True, phase_excursion_min=3.0, bias_line_resistance=None, do_analysis=True)[source]

Takes a slow IV

Steps the TES bias down slowly. Starts at bias_high to bias_low with step size bias_step. Waits wait_time between changing steps. If this analyzes the data, the outputs are stored to output_dir.

Parameters
  • bias_groups (numpy.ndarray or None, optional, default None) – Which bias groups to take the IV on. If None, defaults to the groups in the config file.

  • wait_time (float, optional, default 0.1) – The amount of time between changing TES biases in seconds.

  • bias (float array or None, optional, default None) – A float array of bias values. Must go high to low.

  • bias_high (float, optional, default 1.5) – The maximum TES bias in volts.

  • bias_low (float, optional, default 0) – The minimum TES bias in volts.

  • bias_step (float, optional, default 0.005) – The step size in volts.

  • show_plot (bool, optional, default False) – Whether to show plots.

  • overbias_wait (float, optional, default 2.0) – The time to stay in the overbiased state in seconds.

  • cool_wait (float, optional, default 30.0) – The time to stay in the low current state after overbiasing before taking the IV.

  • make_plot (bool, optional, default True) – Whether to make plots.

  • save_plot (bool, optional, default True) – Whether to save the plot.

  • plotname_append (str, optional, default '') – Appended to the default plot filename.

  • channels (int array or None, optional, default None) – A list of channels to make plots.

  • band (int array or None, optional, default None) – The bands to analyze.

  • high_current_mode (bool, optional, default True) – The current mode to take the IV in.

  • overbias_voltage (float, optional, default 8.0) – The voltage to set the TES bias in the overbias stage.

  • grid_on (bool, optional, default True) – Grids on plotting. This is Ari’s fault.

  • phase_excursion_min (float, optional, default 3.0) – The minimum phase excursion required for making plots.

  • bias_line_resistance (float or None, optional, default None) – The resistance of the bias lines in Ohms. If None, loads value in config file

  • do_analysis (bool, optional, default True) – Whether to do the pysmurf IV analysis

Returns

output_path – Full path to IV analyzed file.

Return type

str

smurf_noise

class pysmurf.client.debug.smurf_noise.SmurfNoiseMixin(log=None, epics_root=None, offline=False, pub_root=None, script_id=None, **kwargs)[source]
NET_CMB(NEI, V_b, R_tes, opt_eff, f_center=150000000000.0, bw=32000000000.0, R_sh=None, high_current_mode=False)[source]

Converts current spectral noise density to NET in uK rt(s). Assumes NEI is white-noise level.

Parameters
  • NEI (float) – Current spectral density in pA/rtHz.

  • V_b (float) – Commanded bias voltage in V.

  • R_tes (float) – Resistance of TES at bias point in Ohm.

  • opt_eff (float) – Optical efficiency (in the range 0-1).

  • f_center (float, optional, default 150e9) – Center optical frequency of detector in Hz, e.g., 150 GHz for E4c.

  • bw (float, optional, default 32e9) – Effective optical bandwidth of detector in Hz, e.g., 32 GHz for E4c.

  • R_sh (float or None, optional, default None) – Shunt resistance in Ohm; defaults to stored config figure.

  • high_current_mode (bool, optional, default False) – Whether the bias voltage was set in high-current mode.

Returns

NET (float)

Return type

The noise equivalent temperature in units of uKrts

analyze_noise_all_vs_noise_solo(ret, fs=None, nperseg=1024, make_channel_plot=False)[source]

Analyzes the data from noise_all_vs_noise_solo

Parameters

ret (dict) – The returned values from noise_all_vs_noise_solo.

analyze_noise_vs_bias(bias, datafile, channel=None, band=None, nperseg=8192, detrend='constant', fs=None, save_plot=True, show_plot=False, make_timestream_plot=False, data_timestamp=None, psd_ylim=(10.0, 1000.0), bias_group=None, smooth_len=15, show_legend=True, freq_range_summary=None, R_sh=None, high_current_mode=True, iv_data_filename=None, NEP_ylim=(10.0, 1000.0), f_center_GHz=150.0, bw_GHz=32.0, xlabel_override=None, unit_override=None)[source]

Analysis script associated with noise_vs_bias. Will convert to NEP if an IV curve is given (use optional argument iv_data_filename).

Must provide band, channel pairs of equal dimensions. Or both band and channel inputs must be None.

To do:

1. Break plotting into smaller functions. This function is too large. 2. Save summary values (the things plotted in the histograms) so they can be accessed later.

Must provide band, channel pairs of equal dimensions. Or both band and channel inputs must be None.

Parameters
  • bias (float array) – The bias in voltage. Can also pass an absolute path to a txt containing the bias points.

  • datafile (str array) – The paths to the datafiles. Must be same length as bias array. Can also pass an absolute path to a txt containing the names of the datafiles.

  • channel (int array) – The channels to analyze. If provided, band must be provided as well. Default None.

  • band (int) – The band where the data is taken. If provided, channel must be provided as well. Default None.

  • nperseg (int) – Passed to scipy.signal.welch. Number of elements per segment of the PSD.

  • detrend (str) – Passed to scipy.signal.welch.

  • fs (float) – Passed to scipy.signal.welch. The sample rate.

  • save_plot (bool) – Whether to save the plot. Default is True.

  • show_plot (bool) – Whether to how the plot. Default is False.

  • data_timestamp (str) – The string used as a save name. Default is None.

  • bias_group (int or int array) – which bias groups were used. Default is None.

  • smooth_len (int) – length of window over which to smooth PSDs for plotting

  • show_legend (bool) – Whether to show the legend. Default True.

  • freq_range_summary (tup) – frequencies between which to take mean noise for summary plot of noise vs. bias; if None, then plot white-noiselevel from model fit

  • R_sh (float or None) – The shunt resistance in Ohms. If None, loads from config file. Default None.

  • iv_data_filename (str) – Full path to the iv datafile. This is used fro converting between NEI and NEP. Default None.

  • high_current_mode (bool) – Whether the noise data was taken in high current mode. Default True.

  • NEP_ylim (tuple) – The ylim range for the NEP plots. Default (10., 1000.)

  • f_center_GHz (float) – The band center in GHz. Used to convert from NEP to NET. Default 150 GHz.

  • bw_GHz (float) – The bandwidth in GHz. Used to convert from NEP to NET. Default 32 GHz.

  • xlabel_override (str or None) – If not None, overrides the xlabel. Default None.

  • unit_override (str or None) – If not None, overrides the unit label. Default None.

analyze_noise_vs_tone(tone, datafile, channel=None, band=None, nperseg=8192, detrend='constant', fs=None, save_plot=True, show_plot=False, make_timestream_plot=False, data_timestamp=None, psd_ylim=(10.0, 1000.0), bias_group=None, smooth_len=11, show_legend=True, freq_range_summary=None)[source]

Analysis script associated with noise_vs_tone. Writes outputs and plots to output_dir and plot_dir respectively.

Parameters
  • tone (str) – The full path to the tone file.

  • datafile (str) – The full path to the text file holding all the data files.

  • channel (int array or None, optional, default None) – The channels to analyze.

  • band (int or None, optional, default None) – The band where the data is taken.

  • nperseg (int, optional, default 2**13) – Passed to scipy.signal.welch. Number of elements per segment of the PSD.

  • detrend (str, optional, default 'constant') – Passed to scipy.signal.welch.

  • fs (float or None, optional, default None) – Passed to scipy.signal.welch. The sample rate.

  • save_plot (bool, optional, default True) – Whether to save the plot.

  • show_plot (bool, optional, default False) – Whether to how the plot.

  • data_timestamp (str or None, optional, default None) – The string used as a save name.

  • bias_group (int or int array or None, optional, default None) – Which bias groups were used.

  • smooth_len (int, optional, default 11) – Length of window over which to smooth PSDs for plotting.

  • show_legend (bool, optional, default True) – Whether to show the legend.

  • freq_range_summary (tuple or None, optional, default None) – frequencies between which to take mean noise for summary plot of noise vs. bias; if None, then plot white-noise level from model fit.

analyze_psd(f, Pxx, fs=None, p0=None, flux_ramp_freq=None, filter_a=None, filter_b=None)[source]

Return model fit for a PSD. p0 (float array): initial guesses for model fitting: [white-noise level in pA/rtHz, exponent of 1/f^n component, knee frequency in Hz]

Parameters
  • f (float array) – The frequency information.

  • Pxx (float array) – The power spectral data.

  • fs (float or None, optional, default None) – Sampling frequency. If None, loads in the current sampling frequency.

  • p0 (float array or None, optional, default None) – Initial guess for fitting PSDs. If None, sets to p0 = [100.0,0.5,0.01].

  • flux_ramp_freq (float, optional, default None) – The flux ramp frequency in Hz.

Returns

  • popt (float array) – The fit parameters - [white_noise_level, n, f_knee].

  • pcov (float array) – Covariance matrix.

  • f_fit (float array) – The frequency bins of the fit.

  • Pxx_fit (float array) – The amplitude.

get_NEI_to_NEP_factor(iv_band_data, b, ch, v_bias)[source]

This function uses the IV curve to estimate dI/dP. It interpolates between IV points to get the value at the desired v_bias. Returns the absolute value of the responsivity. To get NEP, just multiply NEI x factor.

Parameters
  • iv_band_data (dict) – The IV dictionary.

  • b (int) – The band number

  • ch (int) – The channel to extract the data from.

  • v_bias (float) – Commanded bias voltage at which to estimate NEP.

Returns

factor – The conversion factor to multiply the NEI to get NEP.

Return type

float

get_biases_from_file(fn_biases, dtype=<class 'float'>)[source]

For, e.g., noise_vs_bias, the list of commanded bias voltages is recorded in a txt file. This function simply extracts those values and returns them as a list.

Parameters

fn_biases (str) – Full path to txt containing list of bias voltages.

Returns

biases – Floats of commanded bias voltages.

Return type

list of float

get_datafiles_from_file(fn_datafiles)[source]

For, e.g., noise_vs_bias, the list of datafiles is recorded in a txt file. This function simply extracts those filenames and returns them as a list.

Parameters

fn_datafiles (str) – Full path to txt containing names of data files.

Returns

datafiles – Strings of data-file names.

Return type

list of str

get_iv_data(iv_data_filename, band, high_current_mode=False)[source]

Takes IV data and extracts responsivities as a function of commanded bias voltage.

Parameters
  • iv_data_filename (str) – Filename of output of IV analysis.

  • band (int) – Band from which to extract responsivities.

  • high_current_mode (bool, optional, default False) – Whether or not to return the IV bias voltages so that they look like the IV was taken in high-current mode.

Returns

iv_band_data – Dictionary with IV information for band.

Return type

dict

get_si_data(iv_band_data, b, ch)[source]

Convenience function for getting the responsivitiy from the IV data.

Parameters
  • iv_band_data (dict) – The IV dictionary.

  • b (int) – The band number

  • ch (int) – The channel to extract the data from.

Returns

  • v_bias (float) – The bias voltage.

  • si (float) – The responsivity.

noise_all_vs_noise_solo(band, meas_time=10.0)[source]

Measures the noise with all the resonators on, then measures every channel individually.

Parameters
  • band (int) – The band number.

  • meas_time (float, optional, default 10.0) – The measurement time per resonator in seconds.

noise_svd(d, mask, mean_subtract=True)[source]

Calculates the SVD modes of the input data. Only uses the data called out by the mask

Parameters
  • d (float array) – The raw data.

  • mask (int array) – The channel mask.

  • mean_subtract (bool, optional, default True) – Whether to mean subtract before taking the SVDs.

Returns

  • u (float array) – The SVD coefficients.

  • s (float array) – The SVD amplitudes.

  • vh (float array) – The SVD modes.

noise_vs(band, var, var_range, meas_time=30, analyze=False, channel=None, nperseg=8192, detrend='constant', fs=None, show_plot=False, psd_ylim=None, make_timestream_plot=False, only_overbias_once=False, **kwargs)[source]

Generic script for analyzing noise vs some variable. This is called by noise_vs_bias and noise_vs_tone.

Parameters
  • band (int) – The 500 MHz band to analyze.

  • var (dict) – A dictionary values to use in the analysis. The values depend on which variable is being varied.

  • var_range (float array) – The range of the test variable.

  • meas_time (float, optional, default 30.0) – The measurement time in seconds.

  • analyze (bool, optional, default False) – Whether to analyze the data.

  • channel (int array or None, optional, default None) – The channels to analyze.

  • nperseg (int, optional, default 2**13) – The number of segments in the PSD.

  • detrend (str, optional, default 'constant') – The type of filtering to use before using the PSD. See the documentation of scipy.signal.welch.

  • fs (float or None, optional, default None) – The sample frequency.

  • show_plot (bool, optional, default False) – Whether to show the plot.

  • psd_ylim (float array or None, optional, default None) – The ylim to use in the plot. If None, uses the default plot value.

  • make_timestream_plot (bool, optional, default False) – Whether to plot the timestream.

  • only_overbias_once (bool, optional, default False) – Whether to only overbias at the beginning of the measurement (as opposed to between every step).

noise_vs_amplitude(band, amplitude_high=11, amplitude_low=9, step_size=1, amplitudes=None, meas_time=30.0, analyze=False, channel=None, nperseg=8192, detrend='constant', fs=None, show_plot=False, make_timestream_plot=False, psd_ylim=None)[source]

No description

Parameters

band (int) – The band to take noise vs bias data on.

noise_vs_bias(bias_group, band=None, channel=None, bias_high=1.5, bias_low=0.0, step_size=0.25, bias=None, high_current_mode=True, overbias_voltage=9.0, meas_time=30.0, analyze=False, nperseg=8192, detrend='constant', fs=None, show_plot=False, cool_wait=30.0, psd_ylim=(10.0, 1000.0), make_timestream_plot=False, only_overbias_once=False, overbias_wait=1)[source]

This ramps the TES voltage from bias_high to bias_low and takes noise measurements. You can make it analyze the data and make plots with the optional argument analyze=True. Note that the analysis is a little slow. band and channel inputs only dictate what plots are made. Data is taken on every band and channel that is on.

Parameters
  • bias_group (int or int array) – which bias group(s) to bias/read back.

  • band (int or None, optional, default None) – The band to take noise vs bias data on.

  • channel (int or None, optional, default None) – The channel to run analysis on. Note that data is taken on all channels. This only affects what is analyzed. You can always run the analyze script later.

  • bias_high (float, optional, default 1.5) – The bias voltage to start at.

  • bias_low (float, optional, default 0.0) – The bias votlage to end at.

  • step_size (float, optional, default 0.25) – The step in voltage.

  • bias (float array or None, optional, default None) – The array of bias values to step through. If None, uses values in defined by bias_high, bias_low, and step_size.

  • overbias_voltage (float, optional, default 9.0) – Voltage to set the overbias in volts.

  • meas_time (float, optional, default 30.0) – The amount of time to take data at each TES bias.

  • analyze (bool, optional, default False) – Whether to analyze the data.

  • nperseg (int, optional, default 2**13) – The number of samples per segment in the PSD.

  • detrend (str, optional, default 'constant') – Whether to detrend the data before taking the PSD. Default is to remove a constant.

  • fs (float or None, optional, default None) – The sample frequency.

  • show_plot (bool, optional, default False) – Whether to show analysis plots.

  • only_overbias_once (bool, optional, default False) – Whether or not to overbias right before each TES bias step.

noise_vs_tone(band, tones=None, meas_time=30, analyze=False, bias_group=None, lms_freq_hz=None, fraction_full_scale=0.72, meas_flux_ramp_amp=False, n_phi0=4, make_timestream_plot=True, new_master_assignment=True, from_old_tune=False, old_tune=None)[source]

Takes timestream noise at various tone powers.

Operates on one band at a time because it needs to retune between taking another timestream at a different tone power.

Parameters
  • band (int) – The 500 MHz band to run

  • tones (int array or None, optional, default None) – The tone amplitudes. If None, uses np.arange(10,15).

  • meas_time (float, optional, default 30.0) – The measurement time per tone power in seconds.

  • analyze (bool, optional, default False) – Whether to analyze the data.

  • bias_group (int array or None, optional, default None) – The bias groups to analyze.

  • lms_freq_hz (float or None, optional, default None) – The tracking frequency in Hz. If None, measures the tracking frequency.

  • fraction_full_scale (float, optional, default 0.72) – The amplitude of the flux ramp.

  • meas_flux_ramp_amp (bool or None, optional, default False) – Whether to measure the flux ramp amplitude.

  • n_phi0 (float, optional, default 4.0) – The number of phi0 to use if measuring flux ramp.

  • make_timestream_plot (bool, optional, default True) – Whether to make the timestream plot.

  • new_master_assignment (bool, optional, default True) – Whether to make a new master channel assignemnt. This will only make one for the first tone. It needs to keep the channel assignment the same after that for the analysis.

  • from_old_tune (bool, optional, default False) – Whether to tune from an old tune.

  • old_tune (str or None, optional, default None) – The tune file if using old tune.

plot_svd_modes(vh, n_row=4, n_col=5, figsize=(10, 7.5), save_plot=False, save_name=None, show_plot=False, sharey=True)[source]

Plots the first N modes where N is n_row x n_col.

Parameters
  • vh (float array) – SVD modes from noise_svd.

  • n_row (int, optional, default 4) – The number of rows in the figure.

  • n_col (int, optional, default 5) – The number of columns in the figure.

  • figsize (tuple of float, optional, default (10.0,7.5)) – The size of the figure.

  • save_plot (bool, optional, default False) – Whether to save the plot.

  • save_name (str or None, optional, default None) – The name of the file.

  • show_plot (bool, optional, default False) – Whether to show the plot.

  • sharey (bool, optional, default True) – Whether the subplots share y.

plot_svd_summary(u, s, save_plot=False, save_name=None, show_plot=False)[source]

Requires seaborn to be installed. Plots a heatmap of the coefficients and the log10 of the amplitudes.

Parameters
  • u (float array) – SVD coefficients from noise_svd.

  • s (float array) – SVD amplitudes from noise_svd.

  • save_plot (bool, optional, default False) – Whether to save the plot.

  • save_name (str or None, optional, default None) – The name of the file.

  • show_plot (bool, optional, default False) – Whether to show the plot.

remove_svd(d, mask, u, s, vh, modes=3)[source]

Removes the requsted SVD modes

Parameters
  • d (float array) – The input data.

  • u (float array) – The SVD coefficients.

  • s (float array) – The SVD amplitudes.

  • mask (int array) – The channel mask.

  • vh (float arrry) – The SVD modes.

  • modes (int or int array, optional, default 3) – The modes to remove. If int, removes the first N modes. If array, uses the modes indicated in the array.

Returns

diff – The difference of the input data matrix and the requested SVD modes.

Return type

float array

take_noise_high_bandwidth(band, channel, freq=None, tone_power=None, nsamp=33554432, nperseg=262144, make_plot=True, show_plot=False, save_plot=True, band_off=True, run_serial_gradient_descent=True, run_serial_eta_scan=True, save_psd=False)[source]

This script is shamelessly stolen from Max. This tunes up a single resonator and takes data in single_channel_readout mode, with is 2.4 MHz. The flux ramp is off in this measurement.

To Do - add conversion to dBc

ability to set eta parameters

Parameters
  • band (int) – The 500 MHz band number

  • channel (int) – The channel in the 500 MHz band

  • freq (float, optional, default None) – The tone frequency in MHz. If provided, overrides band and channel. The script will choose the best band/channel pair to use.

  • tone_power (int, optional, default None) – The RF probe tone power. If None, loads the value that is currently designated for the channel.

  • nsamp (int, optional, default 2**25) – The number of samples to take.

  • nperseg (int, optional, default 2**18) – The number of samples used in the PSD estimator. See scipy.signal.welch

  • make_plot (bool, optional, default True) – Whether to make the plot

  • show_plot (bool, optional, default False,) – Whether to show the plot.

  • save_plot (bool, optional, default True) – Whether to save the plot.

  • band_off (bool, optional, defaualt True) – Whether to turn off all the other tones in the band before taking the measurement.

  • run_serial_gradient_descent (bool, optional, default True) – Whether to run serial_gradient_descent after turning on the tone.

  • run_serial_eta_scan (bool, optional, default True) – Whether to run serial_eta_scan after turning on the tone.

  • save_psd (bool, optional, default True) – Whether to save the PSD.

  • Ret

  • ---

  • ff (float array) – The frequency bins

  • pxx (float array) – The PSD values in pA^2/Hz

take_noise_psd(meas_time, channel=None, nperseg=4096, detrend='constant', fs=None, low_freq=None, high_freq=None, make_channel_plot=True, make_summary_plot=True, save_data=False, show_plot=False, grid_on=False, datafile=None, downsample_factor=None, write_log=True, reset_filter=True, reset_unwrapper=True, return_noise_params=False, plotname_append='')[source]

Takes a timestream of noise and calculates its PSD. It also attempts to fit a white noise and 1/f component to the data. It takes into account the sampling frequency and the downsampling filter and downsampler.

Parameters
  • meas_time (float) – The amount of time to observe in seconds.

  • channel (int array or None, optional, default None) – The channels to plot. Note that this script always takes data on all the channels. This only sets the ones to plot. If None, plots all channels that are on.

  • nperseg (int, optional, default 2**12) – The number of elements per segment in the PSD.

  • detrend (str, optional, default 'constant') – Extends the scipy.signal.welch detrend.

  • fs (float or None, optional, default None) – Sample frequency. If None, reads it in.

  • make_channel_plot (bool, optional, default True) – Whether to make the individual channel plots.

  • make_summary_plot (bool, optional, default True) – Whether to make the summary plots.

  • save_data (bool, optional, default False) – Whether to save the band averaged data as a text file.

  • show_plot (bool, optional, default False) – Show the plot on the screen.

  • datafile (str or None, optional, default None) – If data has already been taken, can point to a file to bypass data taking and just analyze.

  • downsample_factor (int or None, optional, default None) – The datarate is the flux ramp rate divided by the downsample_factor.

  • write_log (bool, optional, default True) – Whether to write to the log file (or the screen if the logfile is not defined).

  • reset_filter (bool, optional, default True) – Whether to reset the filter before taking data.

  • reset_unwrapper (bool, optional, default True) – Whether to reset the unwrapper before taking data.

  • plotname_append (str, optional, default '') – Appended to the default plot filename.

Returns

datafile – The full path to the raw data.

Return type

str

turn_off_noisy_channels(band, noise, cutoff=150)[source]

Turns off channels with noise level above a cutoff.

Parameters
  • band (int) – The band to search

  • noise (float array) – The noise floors. Presumably calculated using take_noise_psd.

  • cutoff (float, optional, default 150.0) – The value to cut at in the same units as noise.