diff --git a/Readme.md b/Readme.md index 9b3dbb2..e3a69c1 100644 --- a/Readme.md +++ b/Readme.md @@ -114,245 +114,84 @@ ssh -L 10002:localhost:2332 root@$PPMAC 'uname -a' Deltatau host in config: localhost:10001:10002 (instead SAR-CPPM-EXPMX1) -``` - ------------------------------------ SCRATCH ----------------------------------- - -14.9.22 external code: ----------------------- -``` - ssh gac-cristall@saresc-cons-03 pw: ValToira_2021 -cd Documents/swissmx_cristallina/scripts/ - -Jungfrau stuff: -https://docs.google.com/document/d/1892j2eMsoFmufg-gdXKcSbOLcTDxLHULiNw-iZWAIVc/edit -'Beam synchronous DAQ with run_control' - -Check: -~/Documents/swissmx_cristallina/scripts/Chip_align.py -sys.path.insert(0, os.path.expanduser("/photonics/home/gac-cristall/Documents/swissmx_cristallina/slic/")) -from slic.core.acquisition import SFAcquisition - - -# 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 -] - -daq = SFAcquisition( - "cristallina", "p20516", - default_detectors=detectors, default_channels=bs_channels, default_pvs=epics_channels, - rate_multiplicator=1, append_user_tag_to_data_dir=True -) - - -if acquire == "True": - daq.acquire( run_name, n_pulses=n_pulses, wait=False) - - - - -Beam synchronous DAQ with with daq_control (command line) -Python script: -> python /sf/jungfrau/applications/daq_client/daq_client.py -h -> python /sf/jungfrau/applications/daq_client/daq_client.py -p p19739 -t no_beam_test -c /sf/cristallina/config/channel_lists/channel_list_bs -e /sf/cristallina/config/channel_lists/channel_list_ca -f /sf/cristallina/config/jungfrau/jf_1d5M.json --start_pulseid 15382163895 --stop_pulseid 15382163905 - - -``` - - -cd /tmp/; git clone https://github.com/malcolmreynolds/transformations.git -cd /tmp/transformations.git --> modify __init__.py -> .transformation (add dot) -setup.py install --user - - -cd /tmp/; git clone https://github.com/spyder-ide/qtawesome.git -cd /tmp/qtawesome - -#To have epics channels we must be connected to the ESC network -EPICS_CA_ADDR_LIST='129.129.244.255 sf-saresc-cagw.psi.ch:5062 sf-saresc-cagw.psi.ch:5066' -cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/oldRepos/app/src -python swissmx.py ``` -caQtDM -macro 'P=SAR-EXPMX' /photonics/home/gac-cristall/Documents/swissmx_cristallina/gui/SwissMX_ChipMotion.ui -caQtDM -macro 'P=SAR-EXPMX' ESB_MX_exp.ui - -Camera: -caget SARES30-CAMS156-SMX-OAV:CAMERASTATUS -caget SARES30-CAMS156-SMX-OAV:PICTURE - -Zoom: -caget SAR-EXPMX-FETURA:POS_RB - - -wlp2s0: MAC: 80:38:fb:d6:01:78 wlan-corp 129.129.64.249 -enx00e04c680519: MAC: 00:e0:4c:68:05:19 - - -Benchmark -> VideoSpeedTest - -rsync -vai /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/SwissMX/ saresc-cons-02:/tmp/zamofing_t/ - - -/opt/gfa/python-3.5/latest/bin/python camera.py --base-pv SARES30-CAMS156-SMX-OAV - -BASE=~/Documents/prj/SwissFEL/epics_ioc_modules/LakeShore -cd $BASE/iocBoot/iocLakeShore1 -../../bin/UB20-x86_64/LakeShore st.cmd - - - -[saresc-cons-02 ~]$ ioc records 'SARES30-CAMS156-SMX-OAV:.*' - - -SARES30-CAMS156-SMX-OAV:PICTURE waveform CCD Picure Col SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:FPICTURE waveform CCD Picture SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:RF_FPICTURE waveform Reduced frequency FPICTURE SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:WIDTH ai Nr. of Pixel width SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:HEIGHT ai Nr. of Pixel height SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:EXPOSURE ao Exposure SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:CAMROI_X_START ao ROI X Start SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:CAMROI_X_END ao ROI X End SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:CAMROI_Y_START ao ROI Y Start SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:CAMROI_Y_END ao ROI Y End SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:BINX ao Binning X SARES30-CPCW-CAMS156-SMX-OAV office -SARES30-CAMS156-SMX-OAV:BINY ao Binning Y SARES30-CPCW-CAMS156-SMX-OAV office - -waveform: - Native DBF type: DBF_SHORT - Number of elements: 5000 - -SARES30-CAMS156-SMX-OAV:WIDTH 2448 -SARES30-CAMS156-SMX-OAV:HEIGHT 2048 - -caqtdm camsf -caqtdm -macro 'NAME=SARES30-CAMS156-SMX-OAV,CAMNAME=SARES30-CAMS156-SMX-OAV' /sf/controls/config/qt/Camera/CameraMiniView_RF.ui -caqtdm -macro 'NAME=SARES30-CAMS156-SMX-OAV,CAMNAME=SARES30-CAMS156-SMX-OAV' /sf/controls/config/qt/Camera/CameraExpert_RF.ui -caqtdm -macro'P=SAR-EXPMX' ESB_MX_exp.ui -03 last file: /sf/controls/config/qt/Camera/CameraMiniView_RF.ui, macro: NAME=SARES30-CAMS156-SMX-OAV,CAMNAME=SARES30-CAMS156-SMX-OAV -07-07-2022 12:14:03 last file: /sf/controls/config/qt/Camera/CameraMiniView_RF.ui, macro: NAME=SARES30-CAMS156-SMX-OAV,CAMNAME=SARES30-CAMS156-SMX-OAV -mkdir EpicsSim -cd EpicsSim -makeBaseApp.pl -t ioc SwissMxSim -makeBaseApp.pl -a UB20-x86_64 -i -t ioc -p SwissMxSim SwissMxSim +``` +----------------------------------- SCRATCH ----------------------------------- -cd ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/EpicsSim/iocBoot/iocSwissMxSim -./st.cmd +-0.952 +pp_comm.py_: + @property + def fast_gather(self): + tries to connect to port and to query_types(), if fails starts the fast gather process. -EPICS_CA_ADDR_LIST=localhost -ipython3 -import epics -p = epics.PV('SwissMxSim:PICTURE', auto_monitor=False) -print(p.info) -import numpy as np -a=np.arange(10000,dtype=np.uint16) -p.put(a) -print(p.get()) -https://pyepics.github.io/pyepics/arrays.html +triggerSync.c: +root@:/opt/ppmac# LD_LIBRARY_PATH=/opt/ppmac/libppmac/ /tmp/triggerSync + +usage: +/tmp/triggerSync pt2ptTime timeOfs mode + +pt2ptTime: time in ms (float value) from point to point == frequency if FEL +timeOfs: time offset in ms (float value) for motion relative to the FEL timing + +The program changes the speed of motion +pshm->Coord[1].DesTimeBase= (default serverPeriod= 0.2?) + +SIMFLAG0 (pshm->Coord[1].Q[10]) -> start trigger +SIMFLAG1 (pshm->Coord[1].Q[11]) -> FEL pulse trigger +//Power PMAC Software Reference Manual.pdf Gate3[i].Chan[j].Status -> page 919 UserFlag +#define FLAG0 (gate3_1->Chan[0].Status&0x800) -> start trigger +#define FLAG1 (gate3_1->Chan[1].Status&0x800) -> FEL pulse trigger + + +mode: + bit0:1: sync mode + bit1:2: simulate start trigger + bit2:4: simulate frame trigger + bit3:8: verbose + +simulate start trigger: +set pshm->Coord[1].Q[10]=1 to simulate a Jungfrau aquire start + +simulate frame trigger +is output to pshm->Coord[1].Q[11] + 1: synchronize real frame and start triggers + 3: synchronize real frame and simulated start triggers + 6: simulated frame and start triggers (no sync) + 7: synchronize simulated frame and start triggers + +in simulate mode: +set pshm->Coord[1].Q[10]=1 to simulate a Jungfrau aquire start +set pshm->Coord[1].Q[10]=2 to stop simulate trigger generation +Coord[1].Q[11] is the simulated frame trigger + +in synchronize mode +Coord[1].Q[0]=-2 : trigsync_func start, Wait for 'arm' trigger +Coord[1].Q[0]=-1 : got 'arm' trigger, wait frame trigger +Coord[1].Q[0]= 0 : got frame trigger 0 +Coord[1].Q[0] is incremented at each trigger +sync task ends when Gather.Enable==0 -caput SAR-EXPMX:MOT_FX.RBV -2.700 -caput SAR-EXPMX:MOT_FY.RBV -7.450 -caput SAR-EXPMX:MOT_CZ.RBV 1.509 - #ZAC: orig. code - - git dt 98297263 swissmx.py - git dt 7445a5aa CustomROI.py app_config.py app_utils.py epics_widgets/MotorTweak.py epics_widgets/SmaractMotorTweak.py - - -zamofing_t@ganymede:~$ PPMAC=SAR-CPPM-EXPMX1 -zamofing_t@ganymede:~$ gpasciiCommander --host $PPMAC -i - - -> &1p -X10194.8 Y-88923 - --8892.32 10193.94 1000.950000000004 - -> #1..8-> -&1#1->y -#2->x -&1#5->0.08084227555726195x+0.0370261645412808399y+157.349115566995778 - - -plane=0.0808X+0.037Y+0.15 - -0.0808*10193.94-8892.32+ 0.037* + 1000.950000000004 - -plane=0.0808*-8.8923 +0.037Y+0.15 - - -> cpx X10194 Y-8892 - -> &1p -X10193.88 Y-8892 - -> #1,2,5p --8892.02 10193.9 -996.5999999999985 - - --> z has wrong sign ! - ----------------- -avoid constand RBV event: -caput SAR-ESPMX:MOT_FX 0.001 -caput SAR-ESPMX:MOT_FY 0.001 ----------- TODO ---------- - -caput SAR-EXPMX:MOT_FX.VELO 0.001 -caput SAR-EXPMX:MOT_FX.MDEL 0.001 -caput SAR-EXPMX:MOT_FY.MDEL 0.001 -caput SAR-EXPMX:MOT_CZ.MDEL 0.001 - - - --faster autofocus: - - move at constant speed and acquire as fast as possible instead stop and go motion - -- find fiducials: - - fix openCV version problems - -- configuration: use the current config as default values - -- automation: towards automatic alignement - - if idx==0: - #go=UsrGO.Fiducial(bm_pos+bm_sz/2-(20, 20), (40, 40),(fx,fy,bz)) - l=.120 - go=UsrGO.Fiducial((fx-l/2,fy-l/2), (l, l),bz) - go.sigRegionChangeFinished.connect(self.cb_fiducial_update_z) - grp=self._goTracked - grp.addItem(go) - mft._tree.setData(grp.childItems()) - - - ="geometry/find_fiducial" - GEO_FND_FID,GEO_AUTOFOC="geometry/autofocus" +// /tmp/triggerSync 40 11 trigger all 40 ms, simulated start, use real frame triggers, verbose +// /tmp/triggerSync 40 14 trigger all 40 ms, simulated start and frame triggers, no sync, verbose +// /tmp/triggerSync 40 15 trigger all 40 ms, simulated start and frame triggers, with sync, verbose +// /tmp/triggerSync 40 7 trigger all 40 ms, simulated start and frame triggers, with sync, minimal verbose +78x78 points =6084pts a 10ms =60 sec. -> 70 sec. +-> we are at 100 Hz !!! +``` diff --git a/app_config.py b/app_config.py index 51e2bd6..d46aa91 100644 --- a/app_config.py +++ b/app_config.py @@ -121,8 +121,7 @@ class AppCfg(QSettings): if AppCfg.DT_HOST not in keys: dflt.append((AppCfg.DT_HOST, 'SAR-CPPM-EXPMX1')) if AppCfg.DT_MISC not in keys: - dflt.append((AppCfg.DT_MISC,{'show_plots':True, 'vel_scl':1.0, 'pt2pt_time':10.0, 'time_ofs':0.0, 'sync_mode':1, 'sync_flag':3, 'verbose':0xff})) - + dflt.append((AppCfg.DT_MISC,{'show_plots':True, 'vel_scl':1.0, 'pt2pt_time':10.0, 'time_ofs':0.03, 'time_cor':0.0005, 'sync_mode':1, 'sync_flag':3, 'verbose':0xff})) if AppCfg.DAQ_DET not in keys: dflt.append((AppCfg.DAQ_DET, { "name" : "JF17T16V01", @@ -363,7 +362,8 @@ verbose bits: {'name':'show_plots', 'value':dt_misc['show_plots'], 'type':'bool', 'title':'show plots after collection'}, {'name':'vel_scl', 'value':dt_misc['vel_scl'], 'type':'float', 'limits':(0, 1), 'step':0.1, 'title':'velocity_scale', 'tip':"scale between smooth(1.0) and stop and go(0.0)"}, {'name':'pt2pt_time', 'value':dt_misc['pt2pt_time'], 'type':'float', 'step':0.1,'tip':"time in ms from point to point"}, - {'name':'time_ofs', 'value':dt_misc['time_ofs'], 'type':'float', 'step':0.01,'tip':"time osset of trigger to at position ???"}, + {'name':'time_ofs', 'value':dt_misc['time_ofs'], 'type':'float', 'step':0.001,'decimals':4,'tip':"time offset for triggerSync (once)"}, + {'name':'time_cor', 'value':dt_misc['time_cor'], 'type':'float', 'step':0.0001,'decimals':5,'tip':"time correction for triggerSync (each frame)"}, {'name':'sync_mode', 'value':dt_misc['sync_mode'], 'type':'int', 'tip':tip_sync_mode}, {'name':'sync_flag', 'value':dt_misc['sync_flag'], 'type':'int', 'tip':tip_sync_flag}, {'name':'verbose', 'value':dt_misc['verbose'], 'type':'int', 'tip':tip_verbose}, diff --git a/psi_device.py b/psi_device.py index e9ba8e2..5f86514 100644 --- a/psi_device.py +++ b/psi_device.py @@ -82,7 +82,10 @@ class Jungfrau: app=QApplication.instance() cfg=app._cfg run=cfg.value(AppCfg.DAQ_RUN) - self._pulse_id_start=int(self._pv_pulse_id.value) + try: + self._pulse_id_start=int(self._pv_pulse_id.value) + except TypeError as e: + _log.warning(f'failed to get _pulse_id_start: {e}') if self._daq is not None: self._daq.acquire(run['prefix'], n_pulses=n_pulses+run['padding'], wait=False) pass @@ -90,8 +93,12 @@ class Jungfrau: 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}') + try: + self._pulse_id_end=int(self._pv_pulse_id.value) + except TypeError as e: + _log.warning(f'failed to get _pulse_id_start: {e}') + else: + _log.debug(f'pulse_id: {self._pulse_id_start}..{self._pulse_id_end}') if __name__ == "__main__": diff --git a/swissmx.py b/swissmx.py index bd16d3b..f787552 100755 --- a/swissmx.py +++ b/swissmx.py @@ -2109,7 +2109,6 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch) jf=app._jungfrau except AttributeError: app._jungfrau=jf=psi_device.Jungfrau() - sp=dt._shapepath sp.verbose=dt_misc['verbose'] sp.points=kwargs['points'] @@ -2127,7 +2126,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch) dlg.setLabelText("Setup Gather/Sync");dlg+=5 sp.setup_gather() - sp.setup_sync(verbose=sp.verbose&0x40, timeOfs=dt_misc['time_ofs']) + sp.setup_sync(verbose=sp.verbose&0x40, timeOfs=dt_misc['time_ofs'], timeCor=dt_misc['time_cor']) try: p=geo._fitPlane #X has inverted sign ! @@ -2153,9 +2152,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch) sp.homing() # homing if needed sp.run() # start motion program sp.wait_armed() # wait until motors are at first position - + #time.sleep(1.0) # wait armed does not wor yet ?!? jf.acquire(sp.points.shape[0]) - sp.trigger(0.0) # send a start trigger (if needed) after given time + sp.trigger(0.5) # send a start trigger (if needed) after given time if not dt._comm is None: dlg.setLabelText("run motion/acquisition") dlg.setMaximum(sp.points.shape[0])