Tools¶
-
class
instrumental.tools.
DataSession
(name, meas_gen, overwrite=False)¶ A data-taking session.
Useful for organizing, saving, and live-plotting data while (automatically or manually) taking it.
-
__init__
(name, meas_gen, overwrite=False)¶ Create a DataSession.
Parameters: - name (str) – The name of the session. Used for naming the saved data file.
- meas_gen (generator) – A generator that, when iterated through, returns individual measurements as dicts. Each dict key is a string that is the name of what’s being measured, and its matching value is the corresponding quantity. Most often you’ll want to create this generator by writing a generator function.
- overwrite (bool) – If True, data with the same filename will be overwritten. Defaults to False.
-
create_plot
(vars, **kwargs)¶ Create a plot of the DataSession.
This plot is live-updated with data points as you take them.
Parameters: - vars (list of tuples) – vars to plot. Each tuple corresponds to a data series, with x-data, y-data, and optional format string. This is meant to be reminiscent of matplotlib’s plot function. The x and y data can each either be a string (representing the variable in the measurement dict with that name) or a function that takes kwargs with the name of those in the measurement dict and returns its computed value.
- **kwargs (keyword arguments) – used for formatting the plot. These are passed directly to the plot function. Useful for e.g. setting the linewidth.
-
save_summary
(overwrite=None)¶
-
start
()¶ Start collecting data.
This function blocks until all data has been collected.
-
-
instrumental.tools.
FSRs_from_mode_wavelengths
(wavelengths)¶
-
instrumental.tools.
diff
(unitful_array)¶
-
instrumental.tools.
do_ringdown_set
(set_name, base_dir=None)¶
-
instrumental.tools.
find_FSR
()¶
-
instrumental.tools.
fit_ringdown
(scope, channel=1, FSR=None)¶
-
instrumental.tools.
fit_ringdown_save
(subdir='', trace_num=0, base_dir=None)¶ Read a trace from the scope, save it and fit a ringdown curve.
Parameters: - subdir (string) – Subdirectory in which to save the data file.
- trace_num (int) – An index indicating which trace it is.
- base_dir (string) – The path of the toplevel data directory.
-
instrumental.tools.
fit_scan
(EOM_freq, scope, channel=1)¶
-
instrumental.tools.
fit_scan_save
(EOM_freq, subdir='', trace_num=0, base_dir=None)¶
-
instrumental.tools.
get_photo_fnames
()¶
-
instrumental.tools.
load_data
(fname, delimiter='\t')¶
-
instrumental.tools.
qappend
(arr, values, axis=None)¶ Append values to the end of an array-valued Quantity.