add DAQ params, better autofocus

This commit is contained in:
2022-09-27 11:11:38 +02:00
parent d8399e901c
commit 30a9c77230
5 changed files with 145 additions and 54 deletions

View File

@@ -1,3 +1,9 @@
import logging
_log=logging.getLogger(__name__)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG,format='%(name)s:%(levelname)s:%(module)s:%(lineno)d:%(funcName)s:%(message)s ')
logging.getLogger('matplotlib').setLevel(logging.INFO)
import sys,os,socket
sys.path.insert(0, os.path.expanduser('..'))
hostname=socket.gethostname()
@@ -8,10 +14,6 @@ else:
sys.path.insert(0, os.path.expanduser("/photonics/home/gac-cristall/Documents/swissmx_cristallina/slic/"))
#from slic.core.acquisition import SFAcquisition
import logging
_log=logging.getLogger(__name__)
from PyQt5.QtWidgets import (QApplication,)
from app_config import AppCfg #settings, option, toggle_option
@@ -57,28 +59,17 @@ class Jungfrau:
# -f/sf/cristallina/config/jungfrau/jf_1d5M.json
# --start_pulseid 15382163895 --stop_pulseid 15382163905
#rsync -vai gac-cristall@saresc-cons-03:/sf/jungfrau/applications/daq_client/daq_client.py .
# setup slic parameters
detectors = [ { "name" : "JF17T16V01",
"adc_to_energy" : True,
"compression" : True,
"factor" : 11.33,
"geometry" : True,
"double_pixel_action" : "mask",
"remove_raw_files" : False
} ] #["JF17T16V01"]
bs_channels = [ # have timing signitures
"SARES30-LSCP1-CRISTA1:CH0:1",
# "SARES30-CAMS156-SMX-OAV:FPICTURE"
]
epics_channels = [ # no time signitures
]
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._daq=SFAcquisition(
"cristallina", "p20516",
default_detectors=detectors, default_channels=bs_channels, default_pvs=epics_channels,
loc['end_station'], loc['p_group'],
default_detectors=detectors, default_channels=bs_channels, default_pvs=pv_channels,
rate_multiplicator=1, append_user_tag_to_data_dir=True
)
except NameError as e:
@@ -87,14 +78,43 @@ class Jungfrau:
self._pv_pulse_id=epics.PV('SAR-EXPMX-EVR0:RX-PULSEID')
self._pv_pulse_id.connect()
def acquire(self,run_name, n_pulses, wait=False):
def acquire(self, n_pulses, wait=False):
app=QApplication.instance()
cfg=app._cfg
run=cfg.value(AppCfg.DAQ_RUN)
self._pulse_id_start=int(self._pv_pulse_id.value)
if self._daq is not None:
self._daq.acquire(run_name, n_pulses=n_pulses, wait=False)
self._daq.acquire(run['prefix'], n_pulses=n_pulses, wait=False)
pass
run['id']+=1
cfg.setValue(AppCfg.DAQ_RUN,run)
def gather_upload(self):
self._pulse_id_end=int(self._pv_pulse_id.value)
_log.debug(f'pulse_id: {self._pulse_id_start}..{self._pulse_id_end}')
if __name__ == "__main__":
import os
import argparse
if hostname=='ganymede':
# use EPICS locally
# os.environ['EPICS_CA_ADDR_LIST']='localhost'
# use EPICS if connected to ESC network
os.environ['EPICS_CA_ADDR_LIST']='129.129.244.255 sf-saresc-cagw.psi.ch:5062 sf-saresc-cagw.psi.ch:5066'
parser = argparse.ArgumentParser()
parser.add_argument("--mode", "-m", help="qt test", type=lambda x:int(x, 0), default=0)
args = parser.parse_args()
_log.info('Arguments:{}'.format(args.__dict__))
app=QApplication(sys.argv)
app._cfg=cfg=AppCfg()
if args.mode &0x01:
dt=Deltatau()
if args.mode&0x02:
jf=Jungfrau()
jf.acquire(n_pulses=100, wait=True)
jf.gather_upload()