python applications for beamline control/analysis tim mooney ca_util.py – thin layer above...
TRANSCRIPT
![Page 1: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/1.jpg)
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
![Page 2: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/2.jpg)
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)
![Page 3: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/3.jpg)
plot.py
![Page 4: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/4.jpg)
readMDA.pyfrom 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
![Page 5: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/5.jpg)
readMDA.pyeach 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')
![Page 6: 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](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f295503460f94c41b61/html5/thumbnails/6.jpg)
detView.pyRequires numeric.py
from readMDA import *
from detView import *
d=readMDA(“2idd_0004.mda”)
detView(d[2].d[0:15],scale=(2,2),columns=5)