Notes
Outline
Python Applications for beamline control/analysis
Tim Mooney
ca_util.py      – thin layer above CaChannel
plot.py           – display 1D of a scan
readMDA.py – read MDA file format
detView.py    – display images from 2D scan
ca_util.py
Automatic dictionary:
         PV name :  CaChannel object
caget(PVname)
caput(PVname, value)
caputw(PVname, value)
camonitor(PVname, python function, user args)
caunmonitor(PVname)
plot.py
readMDA.py
from readMDA import *
d = readMDA(filename, max_dimension, verbose, help)
returns a list:
      d[0] – dictionary of scan-environment variables (mostly PV names)
            e.g., d[0][‘2idd:mca1.R2LO’] = (‘ROI_2_LEFT:’,’’,[342])
      d[n>0] one dimension of the scan, with the following fields:
      time            - date & time at which scan was started
      scan_name - name of scan record that acquired this dimension
      curr_pt       - number of data points actually acquired
      npts            - number of data points requested
      nd               - number of detectors for this scan dimension
      d[]              - list of detector-data structures
      np               - number of positioners for this scan dimension
      p[]              - list of positioner-data structures
      nt                - number of detector triggers for this scan dimension
      t[]               - list of trigger-info structures
readMDA.py
each detector-data structure (e.g., d[1].d[0]) has the following fields:
      desc           - description of this detector
      data           - data list
      unit            - engineering units associated with this detector
      fieldName - scan-record field (e.g., 'D01')
each positioner-data structure (e.g., d[1].p[0]) has the following fields:
      desc                    - description of this positioner
      data                    - data list
      step_mode          - scan mode (e.g., Linear, Table, On-The-Fly)
      unit                     - engineering units associated with this positioner
      fieldName          - scan-record field (e.g., 'P1')
      name                  - name of EPICS PV (e.g., 'xxx:m1.VAL')
      readback_desc   - description of this positioner
      readback_unit    - engineering units associated with this positioner
      readback_name  - name of EPICS PV (e.g., 'xxx:m1.VAL')
detView.py
Requires numeric.py
from readMDA import *
from detView import *
d=readMDA(“2idd_0004.mda”)
detView(d[2].d[0:15],scale=(2,2),columns=5)