towards cta part 2

This commit is contained in:
2024-01-23 13:11:23 +01:00
parent c270467e44
commit 5e954dec77
3 changed files with 135 additions and 13 deletions

View File

@@ -95,12 +95,6 @@ class Jungfrau:
if sim:
self._sim=True
return
app=QApplication.instance()
cfg=app._cfg
detectors = [ cfg.value(AppCfg.DAQ_DET) ]
bs_channels = cfg.value(AppCfg.DAQ_BS_CH)
pv_channels = cfg.value(AppCfg.DAQ_PV_CH)
loc=cfg.value(AppCfg.DAQ_LOC)
try:
self._pv_pulse_id=epics.PV('SAR-EXPMX-EVR0:RX-PULSEID')
self._pv_pulse_id.connect()
@@ -110,17 +104,24 @@ class Jungfrau:
def config(self,**kwargs):
if getattr(self,'_sim',False):
_log.info(f'simulated')
code_gen=kwargs['code_gen']
app=QApplication.instance() #temproary fix, couldnt access these in function, maybe the bt above needs to be self.detectors ... etc
cfg=app._cfg
detectors = [ cfg.value(AppCfg.DAQ_DET) ]
bs_channels = cfg.value(AppCfg.DAQ_BS_CH)
pv_channels = cfg.value(AppCfg.DAQ_PV_CH)
loc=cfg.value(AppCfg.DAQ_LOC)
code_gen=kwargs.get('code_gen',0)
if code_gen==3:
grid_cnt=kwargs['grid']['count']
kwargs['grid']['count']
self._cta=cta=CTASequencer("SAR-CCTA-ESC")
repetitions=grid_cnt[0]
cta_multiplier=grid_cnt[1]-1
repetitions=grid_cnt[0] #'x' or number of columns
cta_multiplier=grid_cnt[1]-1 #'y' or number of appertures in a column/number of rows
#kwargs['tmove'] kwargs['twait']
xray_seq=[0]*kwargs['twait']/kwargs['tmove']+[1] # multiplier is proportional to wait_time i.e. 10 ms = 1, 20 ms =2, 30 ms =3.
xray_seq=[0,]*(kwargs['twait']//kwargs['tmove'])+[1] # multiplier is proportional to wait_time i.e. 10 ms = 1, 20 ms =2, 30 ms =3.
cta.seq[200]=xray_seq*cta_multiplier # x-ray_shutter
cta.seq[215]=[1]*cta_multiplier*2 # laser_shutter
laser_seq=[1,]*(kwargs['twait']//kwargs['tmove'])+[1]
cta.seq[215]=laser_seq*cta_multiplier # laser_shutter
cta.cfg.repetitions=repetitions # self._cta.cfg.repetitions = n_pulses_run/cta_multiplier
cta.seq.upload()
self._daq=CTAAcquisition(cta, loc['end_station'], loc['p_group'], default_detectors=detectors,
@@ -147,7 +148,10 @@ class Jungfrau:
_log.warning(f'failed to get _pulse_id_start: {e}')
n_pulses_run = n_pulses + run['padding']
block_size = run['block_size']
self._daq.acquire(run['prefix'], n_pulses=min(n_pulses_run, block_size), n_repeat=ceil(n_pulses_run/block_size), wait=False, cell_name=run['cell_name'])
if type(self._daq) is CTAAcquisition:
self._daq.acquire(run['prefix'], n_pulses=min(n_pulses_run, block_size), n_block_size=block_size, wait=False, cell_name=run['cell_name'])
else:
self._daq.acquire(run['prefix'], n_pulses=min(n_pulses_run, block_size), n_repeat=ceil(n_pulses_run/block_size), wait=False, cell_name=run['cell_name'])
cfg.setValue(AppCfg.DAQ_RUN,run)
def gather_upload(self):