Page History
...
Code Block | ||
---|---|---|
| ||
from psana import DataSource from psmon import publish from psmon.plots import Image,XYPlot import os from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() os.environ['PS_SRV_NODES']='1' if rank==4: # hack for now to eliminate use of publish.local below publish.init() # we will remove this for batch processing and use "psplot" instead # publish.local = True def my_smalldata(data_dict): if 'unaligned_andor_norm' in data_dict: andor_norm = data_dict['unaligned_andor_norm'][0] myplot = XYPlot(0,"Andor (normalized)",range(len(andor_norm)),andor_norm) publish.send('ANDOR',myplot) ds = DataSource(exp='rixx1003821',run=46,dir='/cds/data/psdm/prj/public01/xtc',intg_det='andor_vls',batch_size=1) for myrun in ds.runs(): andor = myrun.Detector('andor_vls') timing = myrun.Detector('timing') smd = ds.smalldata(filename='mysmallh5.h5',batch_size=1000, callbacks=[my_smalldata]) norm = 0 ndrop_inhibit = 0 for nstep,step in enumerate(myrun.steps()): print('step:',nstep) for nevt,evt in enumerate(step.events()): andor_img = andor.raw.value(evt) # also need to check for events missing due to damage # (or compare against expected number of events) ndrop_inhibit += timing.raw.inhibitCounts(evt) smd.event(evt, mydata=nevt) # high rate data saved to h5 # need to check Matt's new timing-system data on every # event to make sure we haven't missed normalization # data due to deadtime norm+=nevt # fake normalization if andor_img is not None: print('andor data on evt:',nevt,'ndrop_inhibit:',ndrop_inhibit) # check that the high-read readout group (2) didn't # miss any events due to deadtime if ndrop_inhibit[2]!=0: print('*** data lost due to deadtime') # need to prefix the name with "unaligned_" so # the low-rate andor dataset doesn't get padded # to align with the high rate datasets smd.event(evt, mydata=nevt, unaligned_andor_norm=(andor_img/norm)) norm=0 ndrop_inhibit=0 |
Practice Session Nov. 8, 2023
With rix scientists. Executive summary of starting plan: we will run continuous sequences for all running. At the start all the andors will run at the same rate at either 1,10,100Hz in some combination of FVB,crop,full-frame mode.
To calculate readout time: Take difference of "accumulate period" and "exposure time" reported by the IOC (we don't understand difference between accumulate period and acquire period, but they have always been the same historically).
to do:
- rix specifies ~3 modes for both andors running at same rate (1,10,100) for the 3 andor modes. kristjan will send that matt.
- longer term: there will be an additional ~7 patterns for the two andors running at different rates
- how do we detect that mps problem? (will kill some shots). But Matt thinks it doesn't break the machine's TPG sequencing pattern
- need to fix gateway timeouts for seqprogram
- how do we say all-laser-on or all laser off in rixgeneratory.py?
dir/norm will always be the same rate/exposure
third vls andor is what may cause us to want 3 different rates
archon will be treated like an andor for rate/exposure
longer term epixm will be different has timing gap of 200us (exposure 20us min, readout 150us). may not have to shutter the camera because the signal is so low?
4 potential andor modes:
- crop mode
- full vertical binning
- full frame
- don't use partial vertical binning for now
rixgeneratory assumes the first one is the slow camera. times are in seconds. bunch_period in buckets. laser_onoff is counted in terms of the slow camera images (the first on in the list). This shows generating one event code, but lists can be given to generating different andor trigger rates:
python ~rixopr/git/lcls2_102323/psdaq/psdaq/seq/rixgeneratory.py --periods 0.1 --readout_time 0.005 --bunch_period 28 --laser_onoff 2 2
(ps-4.6.1) rix-daq:scripts> python ~rixopr/git/lcls2_102323/psdaq/psdaq/seq/rixgeneratory.py --periods 0.1 --readout_time 0.005 --bunch_period 28 --laser_onoff 2 2
Generating one repeating bunch train for one camera
d {'period': 3250, 'readout': 163}
** Wrote beam.py **
factors of 3250 : [3250]
** Wrote laser.py **
# period 91000 args.period [91000]
** Wrote codes.py **
(ps-4.6.1) rix-daq:scripts>
beam.py is simulation of accelerator
laser.py triggers laser
To view event code patterns: seqplot --seq 1:beam.py 2:codes.py 3:laser.py --time 1.0
took rixc00121 run 49 with 31kHz piranha/timing and 10Hz dir/norm andor.
run 50 is a scan with same