DAQ Software
Note, python indexes start at 0 and not 1.
All software is operated from extlw/run directory.
Data Structure
Data is recorded in ASCII text files with the extension '.dat'. Filenames are of the format YYYYMMDD_HHMM_suf.dat, where 'suf' is a suffix denoting the purpose of the data file.
Suffix |
Purpose |
lws |
Laser-wire scan of any kind |
otr |
OTR data of any kind |
log |
Data that is not specifically as a scan |
pos |
A single sample of data for positions |
tst |
A file used for testing purposes |
eg. 20121201_1106_lws.dat
Data structure consists of
token 1 > s
token 2 > s
token 3 > s(array)
token 1 > s
token 2 > s
token 3 > s
etc
where s is a sample for that token - this can be a single number or array. For each sample, all tokens are recorded on a new line. Values are separated by a single space ' '. eg: 'cbpmamp> 2031' or cbpmx> 123 32 4245 432 ....'.
This data can be cleverly searched in the command line using egrep (extended grep).
egrep '\<string\>' filename.dat
where string is typically a variable name:
- egrep '\<cherenkov\>' 20120406_0026_tst.dat
- cherenkov> 215.0
- cherenkov> 218.0
- cherenkov> 214.0
- cherenkov> 213.0
Control
ApdControl
FltControl
IpMoverControl
PhaseControl
TdxControl
Acquisition
IpMoverScan
File : IpMoverScan.py
Class : IpMoverScan()
Methods : scan(axis, npulse, start, stop, nstep)
axis = 'chaver' 'chahor' 'manver' 'manang' - use ' marks as well!
npulse = number of pulses to record at each position - should be >= 5. Will be corrected to five if less (to avoid mover issue)
start = start value
stop = stop value
nstep = number of steps to split range into
ie import IpMoverScan
a = IpMoverScan.IpMoverScan()
a.scan('chaver',10,900,1000,50)
PhaseScan
lwLog
File : lwLog.py
Class : none
Methods :
Log(npulse)
lwAcq
File : lwAcq.py
Class : Acq()
Methods :
log(npulsemax)
reset()
callback(value)
Shell Scripts (for EDM integration)
All of which are used by the EDM using a 'shell command' button
ie ./BpmLog.py
All should be run from the extlw/run directory ie the edm should have been started from here.
ApdOpen / Close
File : ApdOpen.py, ApdClose.py
Description :
BpmLog
File : BpmLog.py
Description :
still to be finished.
FltMoveAbs
File : FltMoveAbs.py
Description :
Log
File : Log.py
Description :
gets number of pulses to log from extlw:edm:logn
creates instance of lwLog.Log and logs the appropriate number of pulses
Should be changed to use lwAcq!
ManAngMoveAbs
File : ManAngMoveAbs.py
Description :
Starts an instance of IpMoverControl.IpMoverControl('manang')
gets extlw:edm:manang
sets the absolute position
ManVerMoveAbs
File : ManVerMoveAbs.py
Description :
Starts an instance of IpMoverControl.IpMoverControl('manver')
gets extlw:edm:manver
sets the aboslute position
PhaseMoveAbs
File : PhaseMoveAbs.py
Description :
Starts an instance of PhaseControl.PhaseControl()
gets extlw:emd:phase
sets voltage
SavePos.py
File : SavePos.py
Description :
Records ip:cham:ver:pos, ip:cham:hor:pos, ip:man:ver:pos, ip:man:angl:pos, extlw:phasev
into a text file : '../dat/raw/poisitions_timestamp.dat
Scan
File : Scan.py
Description :
A lot of stuff happens
StopLaser
File : StopLaser.py
Description :
Puts extlw:laser:flt:cmdval 0.0015
Puts extlw:laser:flt:cmd moveabs
Pushes flash lamp delay up to 1.5ms which means it's only the absorbed RGA power (best we can do) which is <1mJ.
Data
lwData
File: lwData
Class : Data()
Methods : array() extend(lwData instance) read(filename) write(filename)
ie
import lwData
a = lwData.Data()
a.read('../dat/raw/lwLog_date.dat')
a.info
info printed out here
a.camac
camac variables (as described below) printed out as [[allvariablespulse1],[allvariablespulse2,...] so
a.camac[0] gives you all the camac data from the first pulse
a.camac[0,0] gives you extlw:cherenkov from the first pulse
a.camac[:,0] gives you extlw:cherenkov for EVERY pulse in the data
Example: (after loading data above)
xdata = a.ipmove[:,0]
ydata = a.camac[:,2]
plot(xdata,ydata)
This plots extlw:cherenkov (y) against ip:cham:ver:pos
Data structure is as follows:
.info |
description, npulse, start, stop, |
.ipmove |
ip:man:ver:pos, ip:man:angl:pos, ip:cham:ver:pos, ip:cham:hor:pos |
.opmove |
description |
.camac |
extlw:cherenkov, extlw:TD2:1:read, extlw:TD2:2:read, extlw:TD4:1:read, extlw:TD2:3:read, extlw:phasev, extlw:cherenkov:cnorm |
.cbpmamp |
REF1:amp |
.cbpmx |
cbpm:xpos |
.cbpmy |
cbpm:ypos |
.atf |
extlw:atfcharge, extlw:wsdetector |
.laser |
description |
.ipmov |
ip:man:ver:pos, ip:man:angl:pos, ip:cham:hor:pos, ip:cham:ver:pos |
Note, the order of what is stored in each part is described in lwAcq.py
!!! TODO - why are there 'ipmov' and 'ipmove' with cham:hor and ver swapped round? !!!
lwAnaData
Analysis
lwAna1
File : lwAna1.py
Class : AnalysisOnline(datafile)
Methods :
XYdata(xaxis,yaxis)
Avg(nparray,npulse)
Std(nparray,npulse)
AverageData(xdata,ydata)
BpmAverageData(xdata,ydata)
LowerErrorBarLimit(data,errdata,limit)
PlotArea(xdata,ydata)
PlotAreaAvg(xdata,ydata,xerrdata,yerrdata)
PlotFitLegLoc(area)
Fit(model,params)
PlotDataOnline(title)
PlotAvgDataOnline(title)
PlotFitDataOnline(title)
PlotBpmGlobal(title)
PlotBpmLocal(title)
AnaDataWrite()
Class : Scatter(xdata,ydata,title,xaxislabel,yaxislabel)
Methods:
PlotArea(xdata,ydata)
Plot(filename)
Class : ScatterErrorBar(avgxdata,avgydata,stdxdata,stdydata,title,xaxislabel,yaxislabel)
Methods :
PlotAreaAvg(xdata,ydata,xerrdata,yerrdata)
Plot(filename)
Class : ScatterErrorBarPlusFit(avgxdata,avgydata,stdxdata,stdydata,xdata,yfitdata,xaxislabel,yaxislabel)
Methods :
PlotAreaAvg(xdata,ydata,xerrdata,yerrdata)
Plot(filename)
CHANGES
If changes are made to the order of anything please note here along with date, so previous data files can be interpreted properly.