Auto-setup

From MCEWiki
Revision as of 12:51, 7 January 2011 by Mhasse (talk | contribs)

Overview

The python-based auto-setup provides a more modular, flexible approach to tuning than the previous IDL code. The actions of acquisition, analysis, and plotting have been carefully separated. The analysis code has been centralized to reduce code duplication. Objects have been introduced to manage the locations of data and outputs to improve flexibility. Tools are provided to assist with loading and analyzing existing tuning data.

Currently the python auto-setup still relies on scripts such as ramp_sa_bias and the mux_lock C programs to acquire the tuning data. Inside the python environment, data is loaded and manipulated as numpy arrays.


Obtaining python auto_setup

As of this writing the python auto_setup is in a pre-alpha stage of development. It runs, however, so it will likely evolve quickly to be totally working. It can be obtained by checking out the py_auto_setup branch of mce_script:

 svn checkout svn://e-mode.phas.ubc.ca/mce_script/branch/py_auto_setup

Script-level support

Pass "-h" to any of the scripts below to get a usage message.

auto_setup

The executable script auto_setup can be used to tune SQUID arrays from the command line.

plot_tuning

The executable script plot_tuning can be used create plots from existing tuning data.


The "auto_setup" module

The following classes may be useful for off-line analysis of tuning data. Note that the *Ramp and *Servo classes all inherit from the RCData class, takes a slightly eccentric approach to indexing the data it contains.

class util.FileSet and

The FileSet class can be used to locate and group tuning data files, so that they can be more easily loaded as *Ramp and *Servo objects. Use like this:

import auto_setup as ast
tuning_dir = '/data/cryo/current_data/1234560000'
fs = ast.util.FileSet(tuning_dir)
for stage in ['sa_ramp', 'sq2_servo', 'sq1_servo', 'sq1_ramp']:
  print fs.stage_all(stage)

This will print out the data files associated with each tuning stage. They can be loaded and combined using a join method, e.g.:

sa_ramps = [SARamp(f) for f in fs.stage_all('sa_ramp')]  # individual ramps per RC
sa_ramp = SARamp.join(sa_ramps)                          # single, coherent ramp data object

Note that this join procedure isn't necessary if there is only one data file per squid stage (the default in modern python auto_setup). Older code acquired tuning data on each readout card individually; so the join procedure outlined should permit convenient loading of legacy data.


class SARamp

class SQ2Servo

class SQ1Servo

class SQ1Ramp

class RCData

This class stores time-ordered data for some set of detectors. Tuning data sets can be quite complex (consider a multi-bias, all-row SQ1 Servo for example) and so a certain convention has been adopted to indicate different structuring of the data. In all cases, the data themselves are stored in a 2-d numpy array, with the second index representing the time index and the first index encapsulating all other degrees of freedom (row, column, bias index,...). The underlying data shape is contained in the attribute data_shape. This is not to be confused with data.shape, which is the actual numpy dimensionality of the data array.

Form of data data_shape data.shape gridded rows cols
One time-stream per channel (n_row, n_col, n_time) (n_row*n_col, n_time) True list of rows (size n_row) list of columns (size n_col)
Multi-bias data; n_bias time-stream per channel (n_bias, n_row, n_col, n_time) (n_bias*n_row*n_col, n_time) True list of rows (size n_chan) list of columns (size n_chan)
One time stream for some set of row, column pairs (1, n_chan, n_time) (n_chan, n_time) False list of rows (size n_chan) list of columns (size n_chan)
Multi-bias data; for some set of row, column pairs (n_bias, 1, n_chan, n_time) (n_bias*n_chan, n_time) False list of rows (size n_chan) list of columns (size n_chan)