From 420596d862623ae80c36e7d399815d6e404912c6 Mon Sep 17 00:00:00 2001 From: gac-x07mb Date: Mon, 8 Aug 2022 10:01:25 +0200 Subject: [PATCH] --- config/config.properties | 4 +- config/devices.properties | 35 +- config/settings.properties | 2 +- config/variables.properties | 8 +- devices/X07MB-ES-MA1:TRZ1.VAL.properties | 16 + devices/dummy.properties | 16 + script/BaseScanDefinition.json | 1 + script/EnergyScan_ma.py | 204 ++++++++--- script/Users/BaseScanDefinition.json | 1 + .../CopyFromXtreme}/local_xtreme.py | 0 ...018_0905_090323_BeamMovementsMicroscope.py | 0 script/Users/Thomas/Run_OTF_MA.py | 331 ++++++++++++++++++ .../{Mono_pitch.py => Users/Thomas/ScanID.py} | 0 script/{ => Users/Thomas}/example_1.py | 0 script/{ => Users/Thomas}/otf.py | 0 script/{ => Users/Thomas}/points_q_0.py | 0 script/{ => Users/Thomas}/test2.py | 0 script/{ => Users/Thomas}/test3.py | 0 script/{ => Users/Thomas}/test4.py | 0 script/Users/Thomas/test_cawait.py | 22 ++ script/Users/Thomas/test_classes.py | 7 + script/Users/Thomas/test_loca;.py | 3 + script/Users/Thomas/test_local.py | 13 + script/Users/Thomas/test_otf.py | 4 + script/Users/Utilities/Mono_pitch.py | 139 ++++++++ script/Users/scandef.dat | 0 script/local.py | 159 ++++++++- script/scandef.dat | 0 script/test/DemoCpython.py | 7 +- script/test/TestMscan.py | 4 +- 30 files changed, 891 insertions(+), 85 deletions(-) create mode 100644 devices/X07MB-ES-MA1:TRZ1.VAL.properties create mode 100644 devices/dummy.properties create mode 100644 script/BaseScanDefinition.json create mode 100644 script/Users/BaseScanDefinition.json rename script/{ => Users/CopyFromXtreme}/local_xtreme.py (100%) rename script/{ => Users/Thomas}/2018_0905_090323_BeamMovementsMicroscope.py (100%) create mode 100644 script/Users/Thomas/Run_OTF_MA.py rename script/{Mono_pitch.py => Users/Thomas/ScanID.py} (100%) rename script/{ => Users/Thomas}/example_1.py (100%) rename script/{ => Users/Thomas}/otf.py (100%) rename script/{ => Users/Thomas}/points_q_0.py (100%) rename script/{ => Users/Thomas}/test2.py (100%) rename script/{ => Users/Thomas}/test3.py (100%) rename script/{ => Users/Thomas}/test4.py (100%) create mode 100644 script/Users/Thomas/test_cawait.py create mode 100644 script/Users/Thomas/test_classes.py create mode 100644 script/Users/Thomas/test_loca;.py create mode 100644 script/Users/Thomas/test_local.py create mode 100644 script/Users/Thomas/test_otf.py create mode 100644 script/Users/Utilities/Mono_pitch.py create mode 100644 script/Users/scandef.dat create mode 100644 script/scandef.dat diff --git a/config/config.properties b/config/config.properties index d285220..f600c71 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,4 +1,4 @@ -#Fri Mar 04 14:41:39 CET 2022 +#Fri Mar 04 14:44:43 CET 2022 autoSaveScanData=true simulation=false dataScanSaveOutput=false @@ -35,7 +35,7 @@ logLevelConsole=Off filePermissionsConfig=Default scanStreamerPort=-1 dataScanSaveSetpoints=false -versionTrackingManual=false +versionTrackingManual=true dataTransferMode=Off userManagement=false instanceName= diff --git a/config/devices.properties b/config/devices.properties index 17cf67f..7ea0d78 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,28 +1,29 @@ current=ch.psi.pshell.epics.ChannelDouble|ARIDI-PCT:CURRENT|Read||true ROT=ch.psi.pshell.epics.Motor|X07MB-ES-MA1:ROT|||true -TRSCANH=ch.psi.pshell.epics.Motor|X07MA-ES3-MA1:TRSCAN||| +TRSCANH=ch.psi.pshell.epics.Motor|X07MB-ES3-MA1:TRSCANH|||true TRSCANH_RBV=ch.psi.pshell.epics.ChannelDouble|X07MB-ES3-MA1:TRSCANH.RBV|||true ScanX=ch.psi.pshell.epics.Motor|X07MB-ES-MA1:ScanX|||true ScanX_RBV=ch.psi.pshell.epics.ChannelDouble|X07MB-ES-MA1:ScanX.RBV||| channel=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2-SAI_03:CUR-MEAN|||true ScanY=ch.psi.pshell.epics.Motor|X07MB-ES-MA1:ScanY|||true ScanY_RBV=ch.psi.pshell.epics.ChannelDouble|X07MB-ES-MA1:ScanY.RBV||| -keith_1=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2-SAI_07:MEAN|||true -keith_2=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2-SAI_08:MEAN|||true -keith_3=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2-SAI_06:MEAN|||true +keith_1=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2:SAI_07|Read||true +keith_2=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2:SAI_08|Read||true +keith_3=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2:SAI_06|Read||true +keith_4=ch.psi.pshell.epics.ChannelDouble|X07MB-OP2:SAI_05|Read||true mca_1=ch.psi.pshell.epics.ChannelIntegerArray|X07MB-XMAP:mca1|||true trigger=ch.psi.pshell.epics.ChannelInteger|X07MB-OP2:INTR-COUNT|||true -pol_mode=ch.psi.pshell.epics.DiscretePositioner|X07MA-ID:MODE|||true -pol_offset=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ENERGY-OFFS|||true -pol_angle=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ALPHA|||true -pol_done=ch.psi.pshell.epics.ChannelString|X07MA-ID:DONE|Read||true -energy_ma=ch.psi.pshell.epics.ChannelDouble|X07MA-PHS-E:GO.A|||true -energy_ma_rbv=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|Read||true -energy_ma_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PHS:alldone|Read||true -cadc1=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL0|Read||true -cadc2=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL1|Read||true -cadc3=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL2|Read||true -cadc4=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL3|Read||true -cadc5=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL4|Read||true -beam_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||true +id_pol_mode=ch.psi.pshell.epics.DiscretePositioner|X07MA-ID:MODE|||true +id_pol_offset=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ENERGY-OFFS|||true +id_pol_angle=ch.psi.pshell.epics.ChannelDouble|X07MA-ID:ALPHA|||true +id_pol_done=ch.psi.pshell.epics.ChannelString|X07MA-ID:DONE|Read||true +ma_energy=ch.psi.pshell.epics.ChannelDouble|X07MA-PHS-E:GO.A|||true +ma_energy_rbv=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|Read||true +ma_energy_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PHS:alldone|Read||true +ma_cadc1=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL0|Read||true +ma_cadc2=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL1|Read||true +ma_cadc3=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL2|Read||true +ma_cadc4=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL3|Read||true +ma_cadc5=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL4|Read||true +sls_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||true id_error=ch.psi.pshell.epics.ChannelInteger|X07MA-ID-PLC:ERROR|||true diff --git a/config/settings.properties b/config/settings.properties index e53173b..bfe979c 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,2 +1,2 @@ -#Fri Mar 04 14:34:24 CET 2022 +#Mon Aug 08 10:01:14 CEST 2022 FdaBrowser=true diff --git a/config/variables.properties b/config/variables.properties index af46ff7..b232f2b 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Fri Mar 04 14:16:42 CET 2022 -LastRunDate=220304 -FileSequentialNumber=582 -DaySequentialNumber=7 +#Sat Apr 09 07:19:57 CEST 2022 +LastRunDate=220409 +FileSequentialNumber=2614 +DaySequentialNumber=114 diff --git a/devices/X07MB-ES-MA1:TRZ1.VAL.properties b/devices/X07MB-ES-MA1:TRZ1.VAL.properties new file mode 100644 index 0000000..4f8cebe --- /dev/null +++ b/devices/X07MB-ES-MA1:TRZ1.VAL.properties @@ -0,0 +1,16 @@ +#Fri Mar 11 14:42:24 CET 2022 +offset=0.0 +maxValue=NaN +rotation=false +precision=-1 +scale=1.0 +estbilizationDelay=0 +maxSpeed=NaN +resolution=NaN +startRetries=1 +minValue=NaN +unit=null +defaultSpeed=NaN +sign_bit=0 +monitorByPosition=false +minSpeed=NaN diff --git a/devices/dummy.properties b/devices/dummy.properties new file mode 100644 index 0000000..23d620b --- /dev/null +++ b/devices/dummy.properties @@ -0,0 +1,16 @@ +#Fri Mar 11 14:43:09 CET 2022 +offset=0.0 +maxValue=10.0 +rotation=false +precision=2 +scale=1.0 +estbilizationDelay=0 +maxSpeed=10.0 +resolution=NaN +startRetries=1 +minValue=-10.0 +unit=mm +defaultSpeed=1.0 +sign_bit=0 +monitorByPosition=false +minSpeed=0.1 diff --git a/script/BaseScanDefinition.json b/script/BaseScanDefinition.json new file mode 100644 index 0000000..0dbcd3a --- /dev/null +++ b/script/BaseScanDefinition.json @@ -0,0 +1 @@ +{"Configuration": {"beamline": "X07MB", "scan_type": "SPECTRA", "DAQ_XMAP": 0}, "r_indices": ["ScanX", "ScanY", "TRZ1"], "detectors_to_plot": ["no_Plot", "PL_KEITHLEY1", "PL_KEITHLEY2", "PL_KEITHLEY3", "PL_BL_TEMP", "PL_MONO_ENC", "PL_MONO_TEMP"], "ID_MONO_ENC": ["ROLL1_V", "PITCH2_V", "ROLL2_V", "ROLL1_MUR", "PITCH2_MUR", "ROLL2_MUR", "ROLL1_DIFF", "PITCH2_DIFF", "ROLL2_DIFF", "ROLL1_VOLT", "PITCH2_VOLT", "ROLL2_VOLT", "T1_VAL", "T1_RBV", "T1_DIFF", "T1_REP", "T2_VAL", "T2_RBV", "T2_DIFF", "T2_REP", "THETA_VAL", "THETA_RBV", "THETA_DIFF", "THETA_REP"], "scan_type": "SPECTRA", "e_ex_E_edge": [4050.0], "detectors": ["no_Detector", "KEITHLEY1", "KEITHLEY2", "KEITHLEY3", "MONO_ENC", "MONO_TEMP"], "e_f": [2465.0], "CH_ES1_PRESS": ["X07MB-ES1-MF1:PRESSURE", "X07MB-ES1-MC1:PRESSURE", "X07MB-OP-KBMF1:PRESSURE", "X07MB-OP-SL2MF1:PRESSURE"], "e_i": [2400.0], "CH_User_detector": ["noUserDetector"], "e_n_cycles": [5], "p_label": ["P1", "P2"], "CH_XBPM4": ["X07MB-OP2-SAI_19:CUR-MEAN", "X07MB-OP2-SAI_20:CUR-MEAN", "X07MB-OP2-SAI_21:CUR-MEAN", "X07MB-OP2-SAI_22:CUR-MEAN"], "p_data": [[10.0, 10.5], [-4.0, -4.1]], "CH_XBPM3": ["X07MB-OP2-SAI_14:CUR-MEAN", "X07MB-OP2-SAI_15:CUR-MEAN", "X07MB-OP2-SAI_16:CUR-MEAN", "X07MB-OP2-SAI_17:CUR-MEAN"], "SDD": {"n_roi": -1, "Id_XMAP_roi_by_name": -1, "n_roi_for_xas_index": 3, "n_det_fluo": -1, "XMAP_save_only_xas_roi": 0, "ch_base_vortex_mca": "NoSDD", "XMAP_name_convention": "ROI", "XMAP_save_spectra": 1, "n_roi_for_xas": 3, "hardware_sdd": "NoSDD", "ch_base_vortex_dxp": "NoSDD", "XMAP_roi_numbers": -1, "ch_base_vortex": "NoSDD", "d_list_fluo": [-1]}, "Pre_Actions": [{"channel_name": "X07MB-OP2:START-CSMPL", "delay": "0.05", "data_type": "Integer", "value": 0, "operation": "put"}, {"channel_name": "X07MB-OP2:TOTAL-CYCLES", "delay": "0.05", "data_type": "Double", "value": 1.0, "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL", "delay": "0.7", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-OP-WV1:WT_SET", "delay": "0.05", "data_type": "String", "value": "1", "operation": "put"}], "Detector_Groups": {"ID_XBPM4_POS": ["XBPM4_POSX", "XBPM4_POSY"], "ID_MONO_ENC": ["ROLL1_V", "PITCH2_V", "ROLL2_V", "ROLL1_MUR", "PITCH2_MUR", "ROLL2_MUR", "ROLL1_DIFF", "PITCH2_DIFF", "ROLL2_DIFF", "ROLL1_VOLT", "PITCH2_VOLT", "ROLL2_VOLT", "T1_VAL", "T1_RBV", "T1_DIFF", "T1_REP", "T2_VAL", "T2_RBV", "T2_DIFF", "T2_REP", "THETA_VAL", "THETA_RBV", "THETA_DIFF", "THETA_REP"], "CH_MONO_TEMP": ["X07MB-OP-MOTHETA:TC1", "X07MB-OP-MOTRX:TC1", "X07MB-OP-MOC2:TC_Z", "X07MB-OP-MOC2:TC_Y", "X07MB-OP-MO:TC1", "X07MB-OP-MO:TC2", "X07MB-OP-MO:TC3", "X07MB-OP-MO:TC4", "X07MB-OP-MO:TC5", "X07MB-OP-MO:TC6", "X07MB-OP-MO:TC7", "X07MB-OP-MO:TC8", "X07MB-OP-MO:TC9", "X07MB-OP-MO:TC10", "X07MB-OP-MO:TC11", "X07MB-OP-MO:TC12", "X07MB-OP-MO:TC13", "X07MB-OP-MO:TC14", "X07MB-OP-MO:TC15", "X07MB-OP-MO:TC16"], "CH_ES1_PRESS": ["X07MB-ES1-MF1:PRESSURE", "X07MB-ES1-MC1:PRESSURE", "X07MB-OP-KBMF1:PRESSURE", "X07MB-OP-SL2MF1:PRESSURE"], "CH_XBPM4_POS": ["X07MB-OP-BPM4:POSX", "X07MB-OP-BPM4:POSY"], "CH_XBPM4": ["X07MB-OP2-SAI_19:CUR-MEAN", "X07MB-OP2-SAI_20:CUR-MEAN", "X07MB-OP2-SAI_21:CUR-MEAN", "X07MB-OP2-SAI_22:CUR-MEAN"], "CH_BL_PRESS": ["X07MA-FE-CH2MP1:PRESSURE", "X07MB-OP-MI1MP1:PRESSURE", "X07MA-OP-CMMP:PRESSURE", "X07MA-OP-SCMP:PRESSURE", "X07MB-OP-IP1MP1:PRESSURE", "X07MB-OP-SL1MP1:PRESSURE", "X07MB-OP-FI1MP1:PRESSURE", "X07MB-OP-BM1MP1:PRESSURE", "X07MB-OP-IP2MP1:PRESSURE", "X07MB-OP-BM2MF1:PRESSURE", "X07MB-OP-MOMF1:PRESSURE"], "CH_XBPM3": ["X07MB-OP2-SAI_14:CUR-MEAN", "X07MB-OP2-SAI_15:CUR-MEAN", "X07MB-OP2-SAI_16:CUR-MEAN", "X07MB-OP2-SAI_17:CUR-MEAN"], "ID_XBPM3_POS": ["XBPM3_POSX", "XBPM3_POSY"], "ID_ES1_PRESS": ["ES1MF1", "ES1MC1", "OPKBMF1", "OPSL2MF1"], "CH_MONO_ENC": ["X07MB-OP-MO:C1-EC_ROZ", "X07MB-OP-MO:C2-EC_ROX", "X07MB-OP-MO:C2-EC_ROZ", "X07MB-OP-MO:C1-ROZ.DRBV", "X07MB-OP-MO:C2-ROX.DRBV", "X07MB-OP-MO:C2-ROZ.DRBV", "X07MB-OP-MO:C1-ROZ.DIFF", "X07MB-OP-MO:C2-ROX.DIFF", "X07MB-OP-MO:C2-ROZ.DIFF", "X07MB-OP-MO:C1-EC_ROZ.VAL", "X07MB-OP-MO:C2-EC_ROX.VAL", "X07MB-OP-MO:C2-EC_ROZ.VAL", "X07MB-OP-MO:C2-TRZ.VAL", "X07MB-OP-MO:C2-TRZ.RBV", "X07MB-OP-MO:C2-TRZ.DIFF", "X07MB-OP-MO:C2-TRZ.REP", "X07MB-OP-MO:C2-TRY.VAL", "X07MB-OP-MO:C2-TRY.RBV", "X07MB-OP-MO:C2-TRY.DIFF", "X07MB-OP-MO:C2-TRY.REP", "X07MB-OP-MO:THETA.VAL", "X07MB-OP-MO:THETA.RBV", "X07MB-OP-MO:THETA.DIFF", "X07MB-OP-MO:THETA.REP"], "ID_XBPM4": ["XBPM4_SAI19_CUR_MEAN", "XBPM4_SAI20_CUR_MEAN", "XBPM4_SAI21_CUR_MEAN", "XBPM4_SAI22_CUR_MEAN"], "ID_XBPM3": ["XBPM3_SAI14_CUR_MEAN", "XBPM3_SAI15_CUR_MEAN", "XBPM3_SAI16_CUR_MEAN", "XBPM3_SAI17_CUR_MEAN"], "CH_BL_TEMP": ["X07MB-OP-MI1:TC1", "X07MB-OP-MI1:TC3", "X07MA-OP-CMMI:TC1", "X07MA-OP-CMB:TC1", "X07MA-OP-SC:TC1", "X07MA-FE-SH1:TC1", "X07MA-FE-SH1:TC2", "X07MA-FE-SH1:TC3", "X07MA-FE-SH1:TC4", "X07MA-FE-SV1:TC1", "X07MA-FE-SV1:TC2", "X07MA-FE-SV1:TC3", "X07MA-FE-SV1:TC4", "X07MB-OP-SH1:TC_X1", "X07MB-OP-SH1:TC_X2", "X07MB-OP-SV1:TC_Y1", "X07MB-OP-SV1:TC_Y2"], "ID_CAM1_POS": ["CentroidX_RBV", "CentroidY_RBV", "SigmaX_RBV", "SigmaY_RBV", "SigmaXY_RBV"], "ID_BL_PRESS": ["CH2MP1", "MI1MP", "CMMP", "SCMP", "IP1MP1", "SL1MP1", "FI1MP1", "BM1MP1", "IP2MP1", "BM2MF1", "MOMF1"], "ID_MONO_TEMP": ["MONO_THETA_TC1", "MONO_TRX_TC1", "MONO_C2_TC_Z", "MONO_C2_TC_Y", "MONO_TC1", "MONO_TC2", "MONO_TC3", "MONO_TC4", "MONO_TC5", "MONO_TC6", "MONO_TC7", "MONO_TC8", "MONO_TC9", "MONO_TC10", "MONO_TC11", "MONO_TC12", "MONO_TC13", "MONO_TC14", "MONO_TC15", "MONO_TC16"], "CH_CAM1_POS": ["X07MB-PS1:Stats1:CentroidX_RBV", "X07MB-PS1:Stats1:CentroidY_RBV", "X07MB-PS1:Stats1:SigmaX_RBV", "X07MB-PS1:Stats1:SigmaY_RBV", "X07MB-PS1:Stats1:SigmaXY_RBV"], "ID_BL_TEMP": ["MI1TC1", "MI1TC3", "CMMITC1", "CMBTC1", "SCTC1", "FE_SH1TC1", "FE_SH1TC2", "FE_SH1TC3", "FE_SH1TC4", "FE_SV1TC1", "FE_SV1TC2", "FE_SV1TC3", "FE_SV1TC4", "SL1_SH1TC_X1", "SL1_SH1TC_X2", "SL1_SV1TC_Y1", "SL1_SV1TC_Y2"], "CH_XBPM3_POS": ["X07MB-OP-BPM3:POSX", "X07MB-OP-BPM3:POSY"]}, "r_active": [1], "e_ex_ncy": [-1], "n_exafs": 0, "r_channel_rbv": {"TRZ1": "X07MB-ES-MA1:TRZ1.RBV", "ScanX": "X07MB-ES-MA1:ScanX.RBV", "ScanY": "X07MB-ES-MA1:ScanY.RBV"}, "r_delta_y": [0.007], "r_delta_x": [0.007], "ID_MONO_TEMP": ["MONO_THETA_TC1", "MONO_TRX_TC1", "MONO_C2_TC_Z", "MONO_C2_TC_Y", "MONO_TC1", "MONO_TC2", "MONO_TC3", "MONO_TC4", "MONO_TC5", "MONO_TC6", "MONO_TC7", "MONO_TC8", "MONO_TC9", "MONO_TC10", "MONO_TC11", "MONO_TC12", "MONO_TC13", "MONO_TC14", "MONO_TC15", "MONO_TC16"], "ID_BL_TEMP": ["MI1TC1", "MI1TC3", "CMMITC1", "CMBTC1", "SCTC1", "FE_SH1TC1", "FE_SH1TC2", "FE_SH1TC3", "FE_SH1TC4", "FE_SV1TC1", "FE_SV1TC2", "FE_SV1TC3", "FE_SV1TC4", "SL1_SH1TC_X1", "SL1_SH1TC_X2", "SL1_SV1TC_Y1", "SL1_SV1TC_Y2"], "e_ex_active": [-1], "p_channel_rbv": ["X07MB-ES-MA1:ScanX.RBV", "X07MB-ES-MA1:ScanY.RBV"], "User_detector_fda_id": ["noUserDetector"], "Energy_Scan": {"e_ex_t": [-1], "e_ex_k_i": [-1], "e_ex_k_f": [-1], "e_ex_E_edge": [4050.0], "e_ex_icy": [-1], "Energy_Cycles": [5], "e_f": [2465.0], "e_i": [2400.0], "e_n_cycles": [5], "channel_rbv": "X07MB-OP-MO:E-GET", "Energy_Scan_Positions": [[2400.0, 5], [2402.0, 5], [2404.0, 5], [2406.0, 5], [2408.0, 5], [2410.0, 5], [2412.0, 5], [2414.0, 5], [2416.0, 5], [2418.0, 5], [2420.0, 5], [2422.0, 5], [2424.0, 5], [2426.0, 5], [2428.0, 5], [2430.0, 5], [2432.0, 5], [2434.0, 5], [2436.0, 5], [2438.0, 5], [2440.0, 5], [2442.0, 5], [2444.0, 5], [2446.0, 5], [2448.0, 5], [2450.0, 5], [2452.0, 5], [2454.0, 5], [2456.0, 5], [2458.0, 5], [2460.0, 5], [2462.0, 5], [2464.0, 5], [2466.0, 5]], "alias": "Energy", "e_ex_ncy": [-1], "n_exafs": 0, "Energy_Ranges": [[2400.0, 2465.0, 2.0]], "e_ex_active": [-1], "channel_name": "X07MB-OP-MO:E-SET", "e_ex_ncy_f": [-1], "delay": 0, "e_ex_nst": [-1], "data_type": "double", "e_ex_e_i": [-1], "e_ex_d_i": [-1], "e_delta": [2.0], "e_ex_e_f": [-1]}, "r_channel": {"TRZ1": "X07MB-ES-MA1:TRZ1.VAL", "ScanX": "X07MB-ES-MA1:ScanX.VAL", "ScanY": "X07MB-ES-MA1:ScanY.VAL"}, "e_ex_ncy_f": [-1], "All_Sensors": [], "r_energies_active": [1], "Detector_Actions": [{"channel_name": "X07MB-OP2:SMPL", "delay": "0.075", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL-DONE", "delay": "0.00", "data_type": "Integer", "value": "1", "operation": "wait"}], "CH_MONO_TEMP": ["X07MB-OP-MOTHETA:TC1", "X07MB-OP-MOTRX:TC1", "X07MB-OP-MOC2:TC_Z", "X07MB-OP-MOC2:TC_Y", "X07MB-OP-MO:TC1", "X07MB-OP-MO:TC2", "X07MB-OP-MO:TC3", "X07MB-OP-MO:TC4", "X07MB-OP-MO:TC5", "X07MB-OP-MO:TC6", "X07MB-OP-MO:TC7", "X07MB-OP-MO:TC8", "X07MB-OP-MO:TC9", "X07MB-OP-MO:TC10", "X07MB-OP-MO:TC11", "X07MB-OP-MO:TC12", "X07MB-OP-MO:TC13", "X07MB-OP-MO:TC14", "X07MB-OP-MO:TC15", "X07MB-OP-MO:TC16"], "DAQ_XMAP": 0, "filename": "R5_S4", "e_channel": "X07MB-OP-MO:E-SET", "e_ex_nst": [-1], "CH_MONO_ENC": ["X07MB-OP-MO:C1-EC_ROZ", "X07MB-OP-MO:C2-EC_ROX", "X07MB-OP-MO:C2-EC_ROZ", "X07MB-OP-MO:C1-ROZ.DRBV", "X07MB-OP-MO:C2-ROX.DRBV", "X07MB-OP-MO:C2-ROZ.DRBV", "X07MB-OP-MO:C1-ROZ.DIFF", "X07MB-OP-MO:C2-ROX.DIFF", "X07MB-OP-MO:C2-ROZ.DIFF", "X07MB-OP-MO:C1-EC_ROZ.VAL", "X07MB-OP-MO:C2-EC_ROX.VAL", "X07MB-OP-MO:C2-EC_ROZ.VAL", "X07MB-OP-MO:C2-TRZ.VAL", "X07MB-OP-MO:C2-TRZ.RBV", "X07MB-OP-MO:C2-TRZ.DIFF", "X07MB-OP-MO:C2-TRZ.REP", "X07MB-OP-MO:C2-TRY.VAL", "X07MB-OP-MO:C2-TRY.RBV", "X07MB-OP-MO:C2-TRY.DIFF", "X07MB-OP-MO:C2-TRY.REP", "X07MB-OP-MO:THETA.VAL", "X07MB-OP-MO:THETA.RBV", "X07MB-OP-MO:THETA.DIFF", "X07MB-OP-MO:THETA.REP"], "CH_BL_TEMP": ["X07MB-OP-MI1:TC1", "X07MB-OP-MI1:TC3", "X07MA-OP-CMMI:TC1", "X07MA-OP-CMB:TC1", "X07MA-OP-SC:TC1", "X07MA-FE-SH1:TC1", "X07MA-FE-SH1:TC2", "X07MA-FE-SH1:TC3", "X07MA-FE-SH1:TC4", "X07MA-FE-SV1:TC1", "X07MA-FE-SV1:TC2", "X07MA-FE-SV1:TC3", "X07MA-FE-SV1:TC4", "X07MB-OP-SH1:TC_X1", "X07MB-OP-SH1:TC_X2", "X07MB-OP-SV1:TC_Y1", "X07MB-OP-SV1:TC_Y2"], "e_ex_d_i": [-1], "All_Positioner": [{"channel_name": "X07MB-ES-MA1:ScanX.VAL", "done_switch": 0, "label": ["P1", "P2"], "done": "X07MB-ES-MA1:ScanX.DMOV", "delay": 0.0, "channel_rbv": "X07MB-ES-MA1:ScanX.RBV", "data_type": "double", "alias": "ScanX", "operation": "put", "value": [10.0, 10.5]}, {"channel_name": "X07MB-ES-MA1:ScanY.VAL", "done_switch": 0, "label": ["P1", "P2"], "done": null, "delay": 0.0, "channel_rbv": "X07MB-ES-MA1:ScanY.RBV", "data_type": "double", "alias": "ScanY", "operation": "put", "value": [-4.0, -4.1]}], "r_id": {"TRZ1": "TRZ1", "ScanX": "ScanX", "ScanY": "ScanY"}, "ID_CAM1_POS": ["CentroidX_RBV", "CentroidY_RBV", "SigmaX_RBV", "SigmaY_RBV", "SigmaXY_RBV"], "ID_BL_PRESS": ["CH2MP1", "MI1MP", "CMMP", "SCMP", "IP1MP1", "SL1MP1", "FI1MP1", "BM1MP1", "IP2MP1", "BM2MF1", "MOMF1"], "CH_INITIAL": ["NO_INITIAL_VALUES"], "p_channel": ["X07MB-ES-MA1:ScanX.VAL", "X07MB-ES-MA1:ScanY.VAL"], "CH_XBPM3_POS": ["X07MB-OP-BPM3:POSX", "X07MB-OP-BPM3:POSY"], "e_ex_t": [-1], "e_ex_k_i": [-1], "e_ex_k_f": [-1], "e_ex_icy": [-1], "e_channel_rbv": "X07MB-OP-MO:E-GET", "r_num": [1], "CH_XBPM4_POS": ["X07MB-OP-BPM4:POSX", "X07MB-OP-BPM4:POSY"], "New_Sensors": [{"channel_name": "X07MB-ES-MA1:ScanY.RBV", "Subset_1": false, "Det_type": "ScalarDetector", "data_type": "double", "alias": "MYSCANY_RBV"}], "r_ll_y": [-4.499999999999998], "r_ll_x": [10.524999999999988], "ID_ES1_PRESS": ["ES1MF1", "ES1MC1", "OPKBMF1", "OPSL2MF1"], "n_e": 1, "p_done_switch": [0, 0], "e_active": [1], "r_done_switch": {"TRZ1": 0, "ScanX": 0, "ScanY": 0}, "r_done": {"TRZ1": "X07MB-ES-RONTEC:TRX.DMOV", "ScanX": "X07MB-ES-MA1:ScanX.DMOV", "ScanY": "X07MB-ES-MA1:ScanY.DMOV"}, "n_p": 2, "p_positioner_active": [1, 1, 0, 0, 0, 0], "beamline": "X07MB", "ID_XBPM4_POS": ["XBPM4_POSX", "XBPM4_POSY"], "Post_Actions": [{"channel_name": "X07MB-OP2:START-CSMPL", "delay": "0.1", "data_type": "String", "value": "1", "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL", "delay": "0.1", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-ES1-PP2:VO5", "delay": 0.1, "data_type": "String", "alias": "Light_ON", "operation": "put", "value": 5}], "r_energy_cycles": [3], "CH_BL_PRESS": ["X07MA-FE-CH2MP1:PRESSURE", "X07MB-OP-MI1MP1:PRESSURE", "X07MA-OP-CMMP:PRESSURE", "X07MA-OP-SCMP:PRESSURE", "X07MB-OP-IP1MP1:PRESSURE", "X07MB-OP-SL1MP1:PRESSURE", "X07MB-OP-FI1MP1:PRESSURE", "X07MB-OP-BM1MP1:PRESSURE", "X07MB-OP-IP2MP1:PRESSURE", "X07MB-OP-BM2MF1:PRESSURE", "X07MB-OP-MOMF1:PRESSURE"], "ID_XBPM3_POS": ["XBPM3_POSX", "XBPM3_POSY"], "CH_INITIAL_V": [0], "number_of_executions": 2, "ID_XBPM4": ["XBPM4_SAI19_CUR_MEAN", "XBPM4_SAI20_CUR_MEAN", "XBPM4_SAI21_CUR_MEAN", "XBPM4_SAI22_CUR_MEAN"], "p_done": ["X07MB-ES-MA1:ScanX.DMOV", null], "r_ur_x": [10.874999999999968], "ID_XBPM3": ["XBPM3_SAI14_CUR_MEAN", "XBPM3_SAI15_CUR_MEAN", "XBPM3_SAI16_CUR_MEAN", "XBPM3_SAI17_CUR_MEAN"], "e_ex_e_i": [-1], "e_delta": [2.0], "e_ex_e_f": [-1], "r_energies": [2500.0], "p_id": ["ScanX", "ScanY"], "r_ur_y": [-4.625], "CH_CAM1_POS": ["X07MB-PS1:Stats1:CentroidX_RBV", "X07MB-PS1:Stats1:CentroidY_RBV", "X07MB-PS1:Stats1:SigmaX_RBV", "X07MB-PS1:Stats1:SigmaY_RBV", "X07MB-PS1:Stats1:SigmaXY_RBV"]} \ No newline at end of file diff --git a/script/EnergyScan_ma.py b/script/EnergyScan_ma.py index cbf0cb4..6cd454e 100644 --- a/script/EnergyScan_ma.py +++ b/script/EnergyScan_ma.py @@ -1,45 +1,85 @@ #Debugging -if get_exec_pars().args is None: - E1 = 974 - E2 = 978 - TIME = 1 #min +if get_exec_pars().innerArgs is None: + E1 = 500 + E2 = 600 + + TIME = 5 #min DELAY = 0.0 #s MODE = None #'LINEAR' #'CIRC +' OFFSET = None - NAME = 'Test' + NAME = 'Circp' ALPHA= None #0 + + print "\nStart energy scan..." print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE),(str(ALPHA)+"deg") if (MODE=="LINEAR") else "" +set_exec_pars(reset=True, name= NAME,open=False) + -set_exec_pars(reset=True, name= NAME) #Pre-actions -wait_beam() -wait_id_ok() -set_pol(MODE, ALPHA, OFFSET) -set_energy_ma(float(E1)) -caput(energy_ma_rbv.channelName+".N", 10) # set energy readback averaging to 10 pts +#wait_beam() # +#wait_id_ok() -print "Setup OTF" -caput('E1', E1) -caput('E2', E2) -caput('TIME', TIME) -caput('FOLDER', "OTF/" + get_context().setup.expandPath("OTF/{year}_{month}/{date}")) -caput('FILE', NAME) +call_mscan=True +move_mono=True # if true, X-Tremeo runs, if false channel defiend under Ch runs + +if move_mono == True: + set_pol(MODE, ALPHA, OFFSET) + set_energy_ma(float(E1)) + caput(ma_energy_rbv.channelName+".N", 10) # set energy readback averaging to 10 pts +else: + print(' do not move mono ') + + #Ch=Channel('X07MB-ES-MA1:TRZ1.VAL', name="Setpoint", monitored=True) + Ch=ChannelDouble('SETPOINT','X07MB-ES-MA1:TRZ1.VAL') + #Ch_rbv=Channel('X07MB-ES-MA1:TRZ1.RBV', name="Readback",monitored=True) + Ch_rbv=ChannelDouble('X07MB-ES-MA1:TRZ1.RBV','X07MB-ES-MA1:TRZ1.RBV') + Ch_rbv.monitored=True + Ch_rbv.initialize() + Ch.monitored=True + Ch.initialize() + + E0=Ch_rbv.read() + E1=E0 + E2=E0+.1 + print(E0,E1,E2) + #E1=970 + #E2=970 +# endexcept + + +# next +if move_mono == True: + print "Setup OTF" + caput('E1', E1) + caput('E2', E2) + caput('TIME', TIME) + caput('FOLDER', "OTF/" + get_context().setup.expandPath("OTF/{year}_{month}/{date}")) + caput('FILE', NAME) +#endif time.sleep(max(DELAY, 0.1)) #Scan print "Start OTF" scan_completed = False + try: while True: - caput('START', '1') + if move_mono == True: + caput('START', '1') + else: + print('mono off') + #Ch.putq(E2) # if defin es as channel + Ch.write(E2) # if defines as ChannelDouble + #endif waiting = True - + + class Time(Readable): def __init__(self): self.start = time.time() @@ -49,48 +89,126 @@ try: class norm_tey(Readable): def read(self): - return float(cadc1.take())/float(cadc2.take()) - + return float(ma_cadc1.take())/float(ma_cadc2.take()) + #enddef + #enf class norm_tey + class norm_diode(Readable): def read(self): - return float(cadc3.take())/float(cadc2.take()) + return float(ma_cadc3.take())/float(ma_cadc2.take()) + #enddef + #enf class - snaps = (pol_mode, pol_angle,pol_offset) + #class norm_K2_I0(Readable): + # def read(self): + # return float(keith_2.take())/float(keith_3.take()) + # #enddef + ##enf class + + #class norm_keithley(Readable): + # def read(self): + # return float(keith_2.take())/float(keith_1.take()) + # #enddef + ##enf class + + # define channels for PGM paramters + + #ID_ENERY_TAKE=ID_ENERGY.take() + #,ma_mono_m1_rbv,ma_mono_m2_rbv + if move_mono == True: + position=ma_energy_rbv + else: + position=Ch_rbv + + snaps = (id_pol_mode, id_pol_angle,id_pol_offset,PH.ma_exitslit_rbv,ID_OFFSET,ES3_MF1_PRESSURE) #,ES1_userCalc1_T2) diags = (current.cache) #Must use cache because mscan evensts are called from monitor callback tread (or else async=False). Sensors are automatically handled. - sensors = [energy_ma_rbv, cadc1, cadc2, cadc3, cadc4, cadc5, norm_tey(), norm_diode(), tm] + sensors = [position, ma_cadc1, ma_cadc2, ma_cadc3, ma_cadc4, ma_cadc5,norm_tey(), norm_diode()]#,ES1_userCalc1_T2]#, ID_ENERGY,ma_mono_m1_rbv,ma_mono_m2_rbv] + + + tm.setAlias("time") - cadc1.setAlias("tey_raw") - cadc2.setAlias("i0") - cadc3.setAlias("diode_raw") + ma_cadc1.setAlias("tey_raw") + ma_cadc2.setAlias("i0") + ma_cadc3.setAlias("diode_raw") def monitoring_task(): global scan_completed - time.sleep(1.0) - wait_channel('START', 'STOP', type = 's') + time.sleep(.1) + print('monitoring_task',move_mono) + + if move_mono == True: + print('call wait channel') + wait_channel('START', 'STOP', type = 's') + print('after wait channel') + else: + #wait_channel(Ch_rbv.get_channel_name(), E2, range=0.02) + # something is strang with the waiting and comparing... + # progam explicitly + #wait_channel(Ch_rbv.name, E2, comparator=.02) + while abs(Ch_rbv.read()-E2)>0.02: + print('still waiting',Ch_rbv.read()-E2) + time.sleep(.1) + #print('after while ') + #print('WAIT for ',E2) + #Ch_rbv.waitValueInRange(E2, timeout=None, comparator=0.02) #todo: in next version + #Ch_rbv.waitValueInRange(E2, 0.01, -1) + #endif + scan_completed = True + print('Scan completed ') get_exec_pars().currentScan.abort() - + print('after abort in monitoring_task') + + monitoring_future = fork(monitoring_task)[0] - print "Scanning...", + print("Scanning...\n") try: - mscan( energy_ma_rbv, sensors, -1, None, \ - range="auto",domain_axis=energy_ma_rbv.name, \ - enabled_plots=["norm_tey", "norm_diode", cadc1, cadc3, cadc2], \ - snaps=snaps, diags=diags) - finally: - monitoring_future.cancel(True) - + if call_mscan==True: + print('call mscan ') + mscan( position, sensors, -1, None, \ + range="auto",domain_axis=position.name, \ + enabled_plots=["norm_tey", "norm_diode",ma_cadc1, ma_cadc3, ma_cadc2], \ + snaps=snaps, diags=diags) + print('.....mscan done ') + else: + print('-------------------------------------') + print('DO NOT CALL mscan ') + print('-------------------------------------') + #endelse + finally: + if not scan_completed: + print('... cancel monitoring_future..') + monitoring_future.cancel(True) + print('monitoring is done',monitoring_future.isDone()) print "Finished Energy scan." if after_sample(): #Repeat if id error and not ABORT_ON_ID_ERROR: break -except: +except: #n if not scan_completed: print sys.exc_info() - print("Aborting...") - while caget('START') == 'START': - caput('START', '0') - time.sleep(0.1) + if move_mono == True: + print("Aborting...") + while caget('START') == 'START': + caput('START', '0') + time.sleep(0.1) raise + #endif +#endexcept +print('-------DONE --------------') +# Finally, if mon is not use +# return to initial position + +if move_mono == False: + time.sleep(1) + print('------- MOVING BACK FINISHED --------------') + Ch.write(E0) + while abs(Ch_rbv.read()-E0)>0.02: + print('Driving motor back ',Ch_rbv.read()-E0) + time.sleep(.1) + + print('------- MOVING BACK FINISHED --------------') + time.sleep(2) +#endif diff --git a/script/Users/BaseScanDefinition.json b/script/Users/BaseScanDefinition.json new file mode 100644 index 0000000..0dbcd3a --- /dev/null +++ b/script/Users/BaseScanDefinition.json @@ -0,0 +1 @@ +{"Configuration": {"beamline": "X07MB", "scan_type": "SPECTRA", "DAQ_XMAP": 0}, "r_indices": ["ScanX", "ScanY", "TRZ1"], "detectors_to_plot": ["no_Plot", "PL_KEITHLEY1", "PL_KEITHLEY2", "PL_KEITHLEY3", "PL_BL_TEMP", "PL_MONO_ENC", "PL_MONO_TEMP"], "ID_MONO_ENC": ["ROLL1_V", "PITCH2_V", "ROLL2_V", "ROLL1_MUR", "PITCH2_MUR", "ROLL2_MUR", "ROLL1_DIFF", "PITCH2_DIFF", "ROLL2_DIFF", "ROLL1_VOLT", "PITCH2_VOLT", "ROLL2_VOLT", "T1_VAL", "T1_RBV", "T1_DIFF", "T1_REP", "T2_VAL", "T2_RBV", "T2_DIFF", "T2_REP", "THETA_VAL", "THETA_RBV", "THETA_DIFF", "THETA_REP"], "scan_type": "SPECTRA", "e_ex_E_edge": [4050.0], "detectors": ["no_Detector", "KEITHLEY1", "KEITHLEY2", "KEITHLEY3", "MONO_ENC", "MONO_TEMP"], "e_f": [2465.0], "CH_ES1_PRESS": ["X07MB-ES1-MF1:PRESSURE", "X07MB-ES1-MC1:PRESSURE", "X07MB-OP-KBMF1:PRESSURE", "X07MB-OP-SL2MF1:PRESSURE"], "e_i": [2400.0], "CH_User_detector": ["noUserDetector"], "e_n_cycles": [5], "p_label": ["P1", "P2"], "CH_XBPM4": ["X07MB-OP2-SAI_19:CUR-MEAN", "X07MB-OP2-SAI_20:CUR-MEAN", "X07MB-OP2-SAI_21:CUR-MEAN", "X07MB-OP2-SAI_22:CUR-MEAN"], "p_data": [[10.0, 10.5], [-4.0, -4.1]], "CH_XBPM3": ["X07MB-OP2-SAI_14:CUR-MEAN", "X07MB-OP2-SAI_15:CUR-MEAN", "X07MB-OP2-SAI_16:CUR-MEAN", "X07MB-OP2-SAI_17:CUR-MEAN"], "SDD": {"n_roi": -1, "Id_XMAP_roi_by_name": -1, "n_roi_for_xas_index": 3, "n_det_fluo": -1, "XMAP_save_only_xas_roi": 0, "ch_base_vortex_mca": "NoSDD", "XMAP_name_convention": "ROI", "XMAP_save_spectra": 1, "n_roi_for_xas": 3, "hardware_sdd": "NoSDD", "ch_base_vortex_dxp": "NoSDD", "XMAP_roi_numbers": -1, "ch_base_vortex": "NoSDD", "d_list_fluo": [-1]}, "Pre_Actions": [{"channel_name": "X07MB-OP2:START-CSMPL", "delay": "0.05", "data_type": "Integer", "value": 0, "operation": "put"}, {"channel_name": "X07MB-OP2:TOTAL-CYCLES", "delay": "0.05", "data_type": "Double", "value": 1.0, "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL", "delay": "0.7", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-OP-WV1:WT_SET", "delay": "0.05", "data_type": "String", "value": "1", "operation": "put"}], "Detector_Groups": {"ID_XBPM4_POS": ["XBPM4_POSX", "XBPM4_POSY"], "ID_MONO_ENC": ["ROLL1_V", "PITCH2_V", "ROLL2_V", "ROLL1_MUR", "PITCH2_MUR", "ROLL2_MUR", "ROLL1_DIFF", "PITCH2_DIFF", "ROLL2_DIFF", "ROLL1_VOLT", "PITCH2_VOLT", "ROLL2_VOLT", "T1_VAL", "T1_RBV", "T1_DIFF", "T1_REP", "T2_VAL", "T2_RBV", "T2_DIFF", "T2_REP", "THETA_VAL", "THETA_RBV", "THETA_DIFF", "THETA_REP"], "CH_MONO_TEMP": ["X07MB-OP-MOTHETA:TC1", "X07MB-OP-MOTRX:TC1", "X07MB-OP-MOC2:TC_Z", "X07MB-OP-MOC2:TC_Y", "X07MB-OP-MO:TC1", "X07MB-OP-MO:TC2", "X07MB-OP-MO:TC3", "X07MB-OP-MO:TC4", "X07MB-OP-MO:TC5", "X07MB-OP-MO:TC6", "X07MB-OP-MO:TC7", "X07MB-OP-MO:TC8", "X07MB-OP-MO:TC9", "X07MB-OP-MO:TC10", "X07MB-OP-MO:TC11", "X07MB-OP-MO:TC12", "X07MB-OP-MO:TC13", "X07MB-OP-MO:TC14", "X07MB-OP-MO:TC15", "X07MB-OP-MO:TC16"], "CH_ES1_PRESS": ["X07MB-ES1-MF1:PRESSURE", "X07MB-ES1-MC1:PRESSURE", "X07MB-OP-KBMF1:PRESSURE", "X07MB-OP-SL2MF1:PRESSURE"], "CH_XBPM4_POS": ["X07MB-OP-BPM4:POSX", "X07MB-OP-BPM4:POSY"], "CH_XBPM4": ["X07MB-OP2-SAI_19:CUR-MEAN", "X07MB-OP2-SAI_20:CUR-MEAN", "X07MB-OP2-SAI_21:CUR-MEAN", "X07MB-OP2-SAI_22:CUR-MEAN"], "CH_BL_PRESS": ["X07MA-FE-CH2MP1:PRESSURE", "X07MB-OP-MI1MP1:PRESSURE", "X07MA-OP-CMMP:PRESSURE", "X07MA-OP-SCMP:PRESSURE", "X07MB-OP-IP1MP1:PRESSURE", "X07MB-OP-SL1MP1:PRESSURE", "X07MB-OP-FI1MP1:PRESSURE", "X07MB-OP-BM1MP1:PRESSURE", "X07MB-OP-IP2MP1:PRESSURE", "X07MB-OP-BM2MF1:PRESSURE", "X07MB-OP-MOMF1:PRESSURE"], "CH_XBPM3": ["X07MB-OP2-SAI_14:CUR-MEAN", "X07MB-OP2-SAI_15:CUR-MEAN", "X07MB-OP2-SAI_16:CUR-MEAN", "X07MB-OP2-SAI_17:CUR-MEAN"], "ID_XBPM3_POS": ["XBPM3_POSX", "XBPM3_POSY"], "ID_ES1_PRESS": ["ES1MF1", "ES1MC1", "OPKBMF1", "OPSL2MF1"], "CH_MONO_ENC": ["X07MB-OP-MO:C1-EC_ROZ", "X07MB-OP-MO:C2-EC_ROX", "X07MB-OP-MO:C2-EC_ROZ", "X07MB-OP-MO:C1-ROZ.DRBV", "X07MB-OP-MO:C2-ROX.DRBV", "X07MB-OP-MO:C2-ROZ.DRBV", "X07MB-OP-MO:C1-ROZ.DIFF", "X07MB-OP-MO:C2-ROX.DIFF", "X07MB-OP-MO:C2-ROZ.DIFF", "X07MB-OP-MO:C1-EC_ROZ.VAL", "X07MB-OP-MO:C2-EC_ROX.VAL", "X07MB-OP-MO:C2-EC_ROZ.VAL", "X07MB-OP-MO:C2-TRZ.VAL", "X07MB-OP-MO:C2-TRZ.RBV", "X07MB-OP-MO:C2-TRZ.DIFF", "X07MB-OP-MO:C2-TRZ.REP", "X07MB-OP-MO:C2-TRY.VAL", "X07MB-OP-MO:C2-TRY.RBV", "X07MB-OP-MO:C2-TRY.DIFF", "X07MB-OP-MO:C2-TRY.REP", "X07MB-OP-MO:THETA.VAL", "X07MB-OP-MO:THETA.RBV", "X07MB-OP-MO:THETA.DIFF", "X07MB-OP-MO:THETA.REP"], "ID_XBPM4": ["XBPM4_SAI19_CUR_MEAN", "XBPM4_SAI20_CUR_MEAN", "XBPM4_SAI21_CUR_MEAN", "XBPM4_SAI22_CUR_MEAN"], "ID_XBPM3": ["XBPM3_SAI14_CUR_MEAN", "XBPM3_SAI15_CUR_MEAN", "XBPM3_SAI16_CUR_MEAN", "XBPM3_SAI17_CUR_MEAN"], "CH_BL_TEMP": ["X07MB-OP-MI1:TC1", "X07MB-OP-MI1:TC3", "X07MA-OP-CMMI:TC1", "X07MA-OP-CMB:TC1", "X07MA-OP-SC:TC1", "X07MA-FE-SH1:TC1", "X07MA-FE-SH1:TC2", "X07MA-FE-SH1:TC3", "X07MA-FE-SH1:TC4", "X07MA-FE-SV1:TC1", "X07MA-FE-SV1:TC2", "X07MA-FE-SV1:TC3", "X07MA-FE-SV1:TC4", "X07MB-OP-SH1:TC_X1", "X07MB-OP-SH1:TC_X2", "X07MB-OP-SV1:TC_Y1", "X07MB-OP-SV1:TC_Y2"], "ID_CAM1_POS": ["CentroidX_RBV", "CentroidY_RBV", "SigmaX_RBV", "SigmaY_RBV", "SigmaXY_RBV"], "ID_BL_PRESS": ["CH2MP1", "MI1MP", "CMMP", "SCMP", "IP1MP1", "SL1MP1", "FI1MP1", "BM1MP1", "IP2MP1", "BM2MF1", "MOMF1"], "ID_MONO_TEMP": ["MONO_THETA_TC1", "MONO_TRX_TC1", "MONO_C2_TC_Z", "MONO_C2_TC_Y", "MONO_TC1", "MONO_TC2", "MONO_TC3", "MONO_TC4", "MONO_TC5", "MONO_TC6", "MONO_TC7", "MONO_TC8", "MONO_TC9", "MONO_TC10", "MONO_TC11", "MONO_TC12", "MONO_TC13", "MONO_TC14", "MONO_TC15", "MONO_TC16"], "CH_CAM1_POS": ["X07MB-PS1:Stats1:CentroidX_RBV", "X07MB-PS1:Stats1:CentroidY_RBV", "X07MB-PS1:Stats1:SigmaX_RBV", "X07MB-PS1:Stats1:SigmaY_RBV", "X07MB-PS1:Stats1:SigmaXY_RBV"], "ID_BL_TEMP": ["MI1TC1", "MI1TC3", "CMMITC1", "CMBTC1", "SCTC1", "FE_SH1TC1", "FE_SH1TC2", "FE_SH1TC3", "FE_SH1TC4", "FE_SV1TC1", "FE_SV1TC2", "FE_SV1TC3", "FE_SV1TC4", "SL1_SH1TC_X1", "SL1_SH1TC_X2", "SL1_SV1TC_Y1", "SL1_SV1TC_Y2"], "CH_XBPM3_POS": ["X07MB-OP-BPM3:POSX", "X07MB-OP-BPM3:POSY"]}, "r_active": [1], "e_ex_ncy": [-1], "n_exafs": 0, "r_channel_rbv": {"TRZ1": "X07MB-ES-MA1:TRZ1.RBV", "ScanX": "X07MB-ES-MA1:ScanX.RBV", "ScanY": "X07MB-ES-MA1:ScanY.RBV"}, "r_delta_y": [0.007], "r_delta_x": [0.007], "ID_MONO_TEMP": ["MONO_THETA_TC1", "MONO_TRX_TC1", "MONO_C2_TC_Z", "MONO_C2_TC_Y", "MONO_TC1", "MONO_TC2", "MONO_TC3", "MONO_TC4", "MONO_TC5", "MONO_TC6", "MONO_TC7", "MONO_TC8", "MONO_TC9", "MONO_TC10", "MONO_TC11", "MONO_TC12", "MONO_TC13", "MONO_TC14", "MONO_TC15", "MONO_TC16"], "ID_BL_TEMP": ["MI1TC1", "MI1TC3", "CMMITC1", "CMBTC1", "SCTC1", "FE_SH1TC1", "FE_SH1TC2", "FE_SH1TC3", "FE_SH1TC4", "FE_SV1TC1", "FE_SV1TC2", "FE_SV1TC3", "FE_SV1TC4", "SL1_SH1TC_X1", "SL1_SH1TC_X2", "SL1_SV1TC_Y1", "SL1_SV1TC_Y2"], "e_ex_active": [-1], "p_channel_rbv": ["X07MB-ES-MA1:ScanX.RBV", "X07MB-ES-MA1:ScanY.RBV"], "User_detector_fda_id": ["noUserDetector"], "Energy_Scan": {"e_ex_t": [-1], "e_ex_k_i": [-1], "e_ex_k_f": [-1], "e_ex_E_edge": [4050.0], "e_ex_icy": [-1], "Energy_Cycles": [5], "e_f": [2465.0], "e_i": [2400.0], "e_n_cycles": [5], "channel_rbv": "X07MB-OP-MO:E-GET", "Energy_Scan_Positions": [[2400.0, 5], [2402.0, 5], [2404.0, 5], [2406.0, 5], [2408.0, 5], [2410.0, 5], [2412.0, 5], [2414.0, 5], [2416.0, 5], [2418.0, 5], [2420.0, 5], [2422.0, 5], [2424.0, 5], [2426.0, 5], [2428.0, 5], [2430.0, 5], [2432.0, 5], [2434.0, 5], [2436.0, 5], [2438.0, 5], [2440.0, 5], [2442.0, 5], [2444.0, 5], [2446.0, 5], [2448.0, 5], [2450.0, 5], [2452.0, 5], [2454.0, 5], [2456.0, 5], [2458.0, 5], [2460.0, 5], [2462.0, 5], [2464.0, 5], [2466.0, 5]], "alias": "Energy", "e_ex_ncy": [-1], "n_exafs": 0, "Energy_Ranges": [[2400.0, 2465.0, 2.0]], "e_ex_active": [-1], "channel_name": "X07MB-OP-MO:E-SET", "e_ex_ncy_f": [-1], "delay": 0, "e_ex_nst": [-1], "data_type": "double", "e_ex_e_i": [-1], "e_ex_d_i": [-1], "e_delta": [2.0], "e_ex_e_f": [-1]}, "r_channel": {"TRZ1": "X07MB-ES-MA1:TRZ1.VAL", "ScanX": "X07MB-ES-MA1:ScanX.VAL", "ScanY": "X07MB-ES-MA1:ScanY.VAL"}, "e_ex_ncy_f": [-1], "All_Sensors": [], "r_energies_active": [1], "Detector_Actions": [{"channel_name": "X07MB-OP2:SMPL", "delay": "0.075", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL-DONE", "delay": "0.00", "data_type": "Integer", "value": "1", "operation": "wait"}], "CH_MONO_TEMP": ["X07MB-OP-MOTHETA:TC1", "X07MB-OP-MOTRX:TC1", "X07MB-OP-MOC2:TC_Z", "X07MB-OP-MOC2:TC_Y", "X07MB-OP-MO:TC1", "X07MB-OP-MO:TC2", "X07MB-OP-MO:TC3", "X07MB-OP-MO:TC4", "X07MB-OP-MO:TC5", "X07MB-OP-MO:TC6", "X07MB-OP-MO:TC7", "X07MB-OP-MO:TC8", "X07MB-OP-MO:TC9", "X07MB-OP-MO:TC10", "X07MB-OP-MO:TC11", "X07MB-OP-MO:TC12", "X07MB-OP-MO:TC13", "X07MB-OP-MO:TC14", "X07MB-OP-MO:TC15", "X07MB-OP-MO:TC16"], "DAQ_XMAP": 0, "filename": "R5_S4", "e_channel": "X07MB-OP-MO:E-SET", "e_ex_nst": [-1], "CH_MONO_ENC": ["X07MB-OP-MO:C1-EC_ROZ", "X07MB-OP-MO:C2-EC_ROX", "X07MB-OP-MO:C2-EC_ROZ", "X07MB-OP-MO:C1-ROZ.DRBV", "X07MB-OP-MO:C2-ROX.DRBV", "X07MB-OP-MO:C2-ROZ.DRBV", "X07MB-OP-MO:C1-ROZ.DIFF", "X07MB-OP-MO:C2-ROX.DIFF", "X07MB-OP-MO:C2-ROZ.DIFF", "X07MB-OP-MO:C1-EC_ROZ.VAL", "X07MB-OP-MO:C2-EC_ROX.VAL", "X07MB-OP-MO:C2-EC_ROZ.VAL", "X07MB-OP-MO:C2-TRZ.VAL", "X07MB-OP-MO:C2-TRZ.RBV", "X07MB-OP-MO:C2-TRZ.DIFF", "X07MB-OP-MO:C2-TRZ.REP", "X07MB-OP-MO:C2-TRY.VAL", "X07MB-OP-MO:C2-TRY.RBV", "X07MB-OP-MO:C2-TRY.DIFF", "X07MB-OP-MO:C2-TRY.REP", "X07MB-OP-MO:THETA.VAL", "X07MB-OP-MO:THETA.RBV", "X07MB-OP-MO:THETA.DIFF", "X07MB-OP-MO:THETA.REP"], "CH_BL_TEMP": ["X07MB-OP-MI1:TC1", "X07MB-OP-MI1:TC3", "X07MA-OP-CMMI:TC1", "X07MA-OP-CMB:TC1", "X07MA-OP-SC:TC1", "X07MA-FE-SH1:TC1", "X07MA-FE-SH1:TC2", "X07MA-FE-SH1:TC3", "X07MA-FE-SH1:TC4", "X07MA-FE-SV1:TC1", "X07MA-FE-SV1:TC2", "X07MA-FE-SV1:TC3", "X07MA-FE-SV1:TC4", "X07MB-OP-SH1:TC_X1", "X07MB-OP-SH1:TC_X2", "X07MB-OP-SV1:TC_Y1", "X07MB-OP-SV1:TC_Y2"], "e_ex_d_i": [-1], "All_Positioner": [{"channel_name": "X07MB-ES-MA1:ScanX.VAL", "done_switch": 0, "label": ["P1", "P2"], "done": "X07MB-ES-MA1:ScanX.DMOV", "delay": 0.0, "channel_rbv": "X07MB-ES-MA1:ScanX.RBV", "data_type": "double", "alias": "ScanX", "operation": "put", "value": [10.0, 10.5]}, {"channel_name": "X07MB-ES-MA1:ScanY.VAL", "done_switch": 0, "label": ["P1", "P2"], "done": null, "delay": 0.0, "channel_rbv": "X07MB-ES-MA1:ScanY.RBV", "data_type": "double", "alias": "ScanY", "operation": "put", "value": [-4.0, -4.1]}], "r_id": {"TRZ1": "TRZ1", "ScanX": "ScanX", "ScanY": "ScanY"}, "ID_CAM1_POS": ["CentroidX_RBV", "CentroidY_RBV", "SigmaX_RBV", "SigmaY_RBV", "SigmaXY_RBV"], "ID_BL_PRESS": ["CH2MP1", "MI1MP", "CMMP", "SCMP", "IP1MP1", "SL1MP1", "FI1MP1", "BM1MP1", "IP2MP1", "BM2MF1", "MOMF1"], "CH_INITIAL": ["NO_INITIAL_VALUES"], "p_channel": ["X07MB-ES-MA1:ScanX.VAL", "X07MB-ES-MA1:ScanY.VAL"], "CH_XBPM3_POS": ["X07MB-OP-BPM3:POSX", "X07MB-OP-BPM3:POSY"], "e_ex_t": [-1], "e_ex_k_i": [-1], "e_ex_k_f": [-1], "e_ex_icy": [-1], "e_channel_rbv": "X07MB-OP-MO:E-GET", "r_num": [1], "CH_XBPM4_POS": ["X07MB-OP-BPM4:POSX", "X07MB-OP-BPM4:POSY"], "New_Sensors": [{"channel_name": "X07MB-ES-MA1:ScanY.RBV", "Subset_1": false, "Det_type": "ScalarDetector", "data_type": "double", "alias": "MYSCANY_RBV"}], "r_ll_y": [-4.499999999999998], "r_ll_x": [10.524999999999988], "ID_ES1_PRESS": ["ES1MF1", "ES1MC1", "OPKBMF1", "OPSL2MF1"], "n_e": 1, "p_done_switch": [0, 0], "e_active": [1], "r_done_switch": {"TRZ1": 0, "ScanX": 0, "ScanY": 0}, "r_done": {"TRZ1": "X07MB-ES-RONTEC:TRX.DMOV", "ScanX": "X07MB-ES-MA1:ScanX.DMOV", "ScanY": "X07MB-ES-MA1:ScanY.DMOV"}, "n_p": 2, "p_positioner_active": [1, 1, 0, 0, 0, 0], "beamline": "X07MB", "ID_XBPM4_POS": ["XBPM4_POSX", "XBPM4_POSY"], "Post_Actions": [{"channel_name": "X07MB-OP2:START-CSMPL", "delay": "0.1", "data_type": "String", "value": "1", "operation": "put"}, {"channel_name": "X07MB-OP2:SMPL", "delay": "0.1", "data_type": "Integer", "value": 1, "operation": "put"}, {"channel_name": "X07MB-ES1-PP2:VO5", "delay": 0.1, "data_type": "String", "alias": "Light_ON", "operation": "put", "value": 5}], "r_energy_cycles": [3], "CH_BL_PRESS": ["X07MA-FE-CH2MP1:PRESSURE", "X07MB-OP-MI1MP1:PRESSURE", "X07MA-OP-CMMP:PRESSURE", "X07MA-OP-SCMP:PRESSURE", "X07MB-OP-IP1MP1:PRESSURE", "X07MB-OP-SL1MP1:PRESSURE", "X07MB-OP-FI1MP1:PRESSURE", "X07MB-OP-BM1MP1:PRESSURE", "X07MB-OP-IP2MP1:PRESSURE", "X07MB-OP-BM2MF1:PRESSURE", "X07MB-OP-MOMF1:PRESSURE"], "ID_XBPM3_POS": ["XBPM3_POSX", "XBPM3_POSY"], "CH_INITIAL_V": [0], "number_of_executions": 2, "ID_XBPM4": ["XBPM4_SAI19_CUR_MEAN", "XBPM4_SAI20_CUR_MEAN", "XBPM4_SAI21_CUR_MEAN", "XBPM4_SAI22_CUR_MEAN"], "p_done": ["X07MB-ES-MA1:ScanX.DMOV", null], "r_ur_x": [10.874999999999968], "ID_XBPM3": ["XBPM3_SAI14_CUR_MEAN", "XBPM3_SAI15_CUR_MEAN", "XBPM3_SAI16_CUR_MEAN", "XBPM3_SAI17_CUR_MEAN"], "e_ex_e_i": [-1], "e_delta": [2.0], "e_ex_e_f": [-1], "r_energies": [2500.0], "p_id": ["ScanX", "ScanY"], "r_ur_y": [-4.625], "CH_CAM1_POS": ["X07MB-PS1:Stats1:CentroidX_RBV", "X07MB-PS1:Stats1:CentroidY_RBV", "X07MB-PS1:Stats1:SigmaX_RBV", "X07MB-PS1:Stats1:SigmaY_RBV", "X07MB-PS1:Stats1:SigmaXY_RBV"]} \ No newline at end of file diff --git a/script/local_xtreme.py b/script/Users/CopyFromXtreme/local_xtreme.py similarity index 100% rename from script/local_xtreme.py rename to script/Users/CopyFromXtreme/local_xtreme.py diff --git a/script/2018_0905_090323_BeamMovementsMicroscope.py b/script/Users/Thomas/2018_0905_090323_BeamMovementsMicroscope.py similarity index 100% rename from script/2018_0905_090323_BeamMovementsMicroscope.py rename to script/Users/Thomas/2018_0905_090323_BeamMovementsMicroscope.py diff --git a/script/Users/Thomas/Run_OTF_MA.py b/script/Users/Thomas/Run_OTF_MA.py new file mode 100644 index 0000000..d418cc8 --- /dev/null +++ b/script/Users/Thomas/Run_OTF_MA.py @@ -0,0 +1,331 @@ +import traceback +import imp +import os +#from CaChannel import * +#from epicsMotor import * +#from epicsPV import * +import time +import string +import sys +import json + + +# TO DO: Energy scan has onlz 1 positioner +# need to generalize definition of scans to several paraller positiner, +# to be able to use Create_Channels, alteratively need a dedicate channel creation for each scan type +# tricky, code should stay simple +# options. +# Define channel generation for each chanenl separatelz +# generalze scand to 1d and 2d with seveal posittioner in each dimension. +# this will get complicated ..... + +import X_X07MB_Pscan as PS +import X_X07MB_lib as PL +imp.reload(PS) # always reload module +imp.reload(PL) # always reload module + +E_start = 970 +E_end = 975 + +time_of_scan = 1 # time in minutes + +delay = 0.2 +mode = None +offset = None +alpha = None +filename = None + +NoRead=0 + + +def before_pass(): + get_context().dataManager.provider.embeddedAtributes = False + # Called at begining pf scan + print('before_pass') + SC.PerformActions('Pre_Actions') + pars=get_exec_pars() + print('pars.output : ') + print(pars.output) + print('pars.scanPath: ') + print(pars.scanPath) + print('pars.name: (filename) ') + print(pars.name) + # missing + # NEED TO SET path for Moench here +#end before_pass + + +def before_read(): + # Cannot call routine in class in rscan call, need to go via local routine + #print('before_read') + # SC.DetectorActions() excecutes all standard action as defied in GUI + SC.PerformActions('Detector_Actions') + #print('.... done before_read ' ) + + # alternativly use caput here explicitly... + # if needed +#end before read + +def after_read(rec,scan): + print('ENTER after_read .................' ) + # Called after reading + # calculate default dead time corrections and writ to file + SC.after_read_dtc(rec,scan) + print('.... done after_read ' ) + return +#end after_read init + +def after_pass(): + # Called after scan + print('after_pass') + + SC.PerformActions('Post_Actions') + print('................ done after_pass') +#end after pass + + +def before_region(index,scan): + print (index) + +# make some reset +try: + del SC +except: + SC=0 +#endexept +# originbal tag for data saving +# '{data}/{year}/{month}/{day}/{year}_{month}{day}_{time}_{name}' +# ........... FIrst read the scan +# + +# ==================================================== +# +# SCRIPT STARTS HERE +# +# ==================================================== +if NoRead==0: + try: + SD = 0 + SD = PS.get_channels('SPECTRA') # READ SCAN DEFINITION FROM GUI USING OLD CODE + print('returned from PS.get_channels()') + SC=0 + SC=PL.PscanLib(SD,Channel,caput,caputq,caget,cawait,get_exec_pars,create_table,append_table) # create instance of library + + print('... done SC.Create_All_Sensors()') + SD.update({'All_Sensors':[]}) + except: + traceback.print_tb(sys.exc_info()[2]) + raise + # endexcept +# endif +print('dddddddddddddddddddddddddd') +# example add new sensor, similarly add pre and postactions to existing code + +New_Sensors=[] +New_Sensors.append({'channel_name': 'X07MB-ES-MA1:ScanY.RBV' + , 'Subset_1': False + , 'Det_type': 'ScalarDetector' + , 'alias': 'MYSCANY_RBV' + , 'data_type': 'double'}) + +# examples add post action light on + +SD['Post_Actions'].append({'channel_name': 'X07MB-ES1-PP2:VO5' + , 'data_type': 'String' + , 'alias': 'Light_ON' + , 'operation': 'put' + , 'delay' : 0.1 + , 'value' : 5 }) + +# END OF USER INPUT + +# .... add new sensors to list +try: + try: + del AllSensors + except: + AllSensors=0 + #endecsept + All_Sensors = SC.Create_Sensor_List() # Create instance for all sensors + SC.Add_New_Sensors(New_Sensors) # Add user sensors +except: + traceback.print_tb(sys.exc_info()[2]) + raise +# endexcept + +# STRUCTUALR INCONSITENCY NEED TO CREATE List of sensors first +# without making Channel command.... ! +# +# TEST SAVE SCAN DEFINITION...Needs to be before definition +# SD is full GUI definiton of the scan try to save and reread this definiton + +SD.update({'New_Sensors' : New_Sensors}) +f=open('scandef.dat','w') +# Method to save abnd restore full scan definition... +with open('BaseScanDefinition.json', 'w') as fp: + json.dump(SD, fp,ensure_ascii=True) +#endwith +with open('BaseScanDefinition.json', 'r') as dd: + SD_reread=json.load(dd) +# .. this works, reread is unicode not string, but code seems still to work if all entries are in unicode + +# step I: CREATE ALL SENSORS AND STORE IN A LIST +print('++++++++++++++++++++++++++') +AllSensors=0 +try: + # Code for beamline save...... + SavePhoenix=PL.SavePhoenix(Channel,caput,caputq,caget,cawait) # Channel,caput,caputq,caget,cawait) + # SavePhoenix.write_beamline_data().. Works., move to before pass... + + SC.noprint=0 # chose printing from SD on / off + + # Now creat all epic s instances. print('... done SC.Create_All_Sensors()') + SD.update({'All_Sensors':All_Sensors}) + SC.Create_Channels('All_Sensors') + SC.Create_Channels('All_Positioner') + SC.Create_Channels('Detector_Actions') + SC.Create_Channels('Pre_Actions') + SC.Create_Channels('Post_Actions') + SC.Create_Channels('Energy_Scan') +except: + traceback.print_tb(sys.exc_info()[2]) + raise +# endexcept + +# ... create some abbreviations... +All_Sensors = SC.All_Sensors +All_Positioner = SD['All_Positioner'] +Pre_Actions = SD['Pre_Actions'] +Post_Actions = SD['Post_Actions'] +Detector_Actions = SD['Detector_Actions'] +Energy_Scan = SD['Energy_Scan'] + + +#............SOME OUTPUT +#print('----------- All_Positioner ---') +#print(' ') +#print(SD['All_Positioner']) +#print(' ------------ Pre_Action -------- ') +#print(' ') +#print(SD['Pre_Actions']) +#print(' ------------ Post_Action -------- ') +#print(' ') +#print(SD['Post_Actions']) +#print(' ') +#print(' ----------- Detector_Action--------- ') +#print(' ') +#print(SD['Detector_Actions']) +## ............. MISSING CREATE POSTACTIONS:::::: + +# STEP II read the energy position +print('') +print('..................................... positioner Energy ID? readback automatically saved? ') +print('initial energies e_i ',SD['e_i']) +print('final energies e_f ',SD['e_f']) +print('DELTA E e_delta ',SD['e_delta']) +print('DWELL TIME e_n_cycles',SD['e_n_cycles']) +print(SD['Energy_Scan']['Energy_Ranges']) + +#try: +# EnergyRanges,Cycles = SC.PositionerEnergyScan() +#except: +# traceback.print_tb(sys.exc_info()[2]) +# raise +# endexcept nowcall +#print(EnergyRanges,Cycles) + +# STEP II ... read the detector actions + +# Step IV perform the Preaction +#P=SC.DetectorActions() + +print(All_Sensors) +print('Energy_Ranges') +print(SD['Energy_Scan']['Energy_Ranges']) + +pars=get_exec_pars() +print('pars.output') +print(pars.output) +print('pars.scanPath') +print(pars.scanPath) +print(' ') +print('---------------') +print(' ') +print(' CALL SCAN NOW ') +print(' ') + +p=set_exec_pars(name=SD['filename']) + +get_context().dataManager.provider.embeddedAtributes = False + +time.sleep(.2) +print(' -') +print(' -') +print('-----------DATA READ START SCAN ----------------- ') +print(' -') +print(' -') + + +# make sure that X07MB trigger is on other wise there is no reading of the data + +ContSample=Channel('X07MB-OP2:START-CSMPL') +SingleSample=Channel('X07MB-OP2:SMPL') +ContSample.put('1') +time.sleep(.2) +SingleSample.put(1) + +for i_n in range(SD['number_of_executions']): + for i in range(len(All_Positioner[0]['value'])): # loop in number of points + # set all positioner + time.sleep(.2) + print('--------- set next positioner -----------',i) + for j in range(len(All_Positioner)): # set positioner + time.sleep(.2) + print('--------- set positioner -----------',j) + + t0=time.time() + ThisPositioner = All_Positioner[j]['Channel'] + ThisPosition = All_Positioner[j]['value'][i] + print('next,i,j',i,j) + print('name',All_Positioner[j]['channel_name']) + print('value',All_Positioner[j]['value'][i]) + print(time.time()-t0) + # .............. SET NEW POSITIONER + #ThisPositioner.write(ThisPosition) + ThisPositioner.put(ThisPosition) + #ThisPositioner.putq(ThisPosition) # simultaneous walk no waiting.. + print(time.time()-t0) + print('wait .2 seconds') + time.sleep(.2) + + #endfor loop set positioner + # generate filename + filename=SD['filename']+'_'+All_Positioner[0]['label'][i] + filename=set_exec_pars(name=SD['filename']+'_'+All_Positioner[0]['label'][i]) + pars=get_exec_pars() + + print('filename this run : ') + print(pars.name) + print(filename) + + + print('--------------- NEXT CALL TO OTF ----------------') + try: + print('in try') + print('filenname',filename) + print('start') + # make sure that our trigger is set to 'on' + + print('---CALL OTF ----',i_n,i,'\n') + otf(E_start, E_end, time_of_scan, delay=0.0, mode = None, offset = None, alpha = None, name = filename) + print('---OTF DONE ----') + + except: + print('exception') + traceback.print_tb(sys.exc_info()[2]) + raise + # END EXecpt + #endfor + #endfor +#endfor +print('... scan finished ') diff --git a/script/Mono_pitch.py b/script/Users/Thomas/ScanID.py similarity index 100% rename from script/Mono_pitch.py rename to script/Users/Thomas/ScanID.py diff --git a/script/example_1.py b/script/Users/Thomas/example_1.py similarity index 100% rename from script/example_1.py rename to script/Users/Thomas/example_1.py diff --git a/script/otf.py b/script/Users/Thomas/otf.py similarity index 100% rename from script/otf.py rename to script/Users/Thomas/otf.py diff --git a/script/points_q_0.py b/script/Users/Thomas/points_q_0.py similarity index 100% rename from script/points_q_0.py rename to script/Users/Thomas/points_q_0.py diff --git a/script/test2.py b/script/Users/Thomas/test2.py similarity index 100% rename from script/test2.py rename to script/Users/Thomas/test2.py diff --git a/script/test3.py b/script/Users/Thomas/test3.py similarity index 100% rename from script/test3.py rename to script/Users/Thomas/test3.py diff --git a/script/test4.py b/script/Users/Thomas/test4.py similarity index 100% rename from script/test4.py rename to script/Users/Thomas/test4.py diff --git a/script/Users/Thomas/test_cawait.py b/script/Users/Thomas/test_cawait.py new file mode 100644 index 0000000..03498e8 --- /dev/null +++ b/script/Users/Thomas/test_cawait.py @@ -0,0 +1,22 @@ +ch=Channel('X07MB-ES-MA1:ScanY.VAL') +ch_rbv=Channel('X07MB-ES-MA1:ScanY.RBV') +pos=ch_rbv.get() +ch.put(0.0) +print('ch.name',ch.name) +print('arive at 0 ') +ch.putq(1.4) +print('caget before cawait ',caget('X07MB-ES-MA1:ScanY.RBV')) + +#ScanY_RBV.waitValueInRange(.5,.01,3000) +#ch.waitValueInRange(.5,.01,1000) +#2nd try + +#print('after wait_for_value ',caget('X07MB-ES-MA1:ScanY.RBV')) + + +#cawait('X07MB-ES-MA1:ScanY.RBV', '0.5', timeout = 6,type='s') + +cawait('X07MB-ES-MA1:ScanY.RBV', 0.5, timeout = 6) + +print('caget after wait ',caget('X07MB-ES-MA1:ScanY.RBV')) + diff --git a/script/Users/Thomas/test_classes.py b/script/Users/Thomas/test_classes.py new file mode 100644 index 0000000..deeafe9 --- /dev/null +++ b/script/Users/Thomas/test_classes.py @@ -0,0 +1,7 @@ + +Ch=Channel('X07MB-ES-MA1:TRZ1.VAL', name="Setpoint", monitored=True) +mca=0 +mca=ChannelIntegerArray('mca','X07MB-XMAP:mca1')#, name="MCA", monitored=True) +#mca=ChannelIntegerArray('this_mca','X07MB-XMAP:mca1')#, name="MCA", monitored=True) + +mot=DummyMotor('dummy', monitored=True) \ No newline at end of file diff --git a/script/Users/Thomas/test_loca;.py b/script/Users/Thomas/test_loca;.py new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/script/Users/Thomas/test_loca;.py @@ -0,0 +1,3 @@ + + + diff --git a/script/Users/Thomas/test_local.py b/script/Users/Thomas/test_local.py new file mode 100644 index 0000000..2d1a5b7 --- /dev/null +++ b/script/Users/Thomas/test_local.py @@ -0,0 +1,13 @@ +Ch=Channel('X07MB-ES-MA1:TRZ1.VAL', name="Setpoint", monitored=True) +mca=0 + +Ch=ChannelDouble('SETPOINT','X07MB-ES-MA1:TRZ1.VAL') +Ch.monitored=True +Ch.initialize() + +#Ch_rbv=Channel('X07MB-ES-MA1:TRZ1.RBV', name="Readback",monitored=True) +Ch_rbv=ChannelDouble('READBACK','X07MB-ES-MA1:TRZ1.RBV') +Ch_rbv.monitored=True +Ch_rbv.initialize() +#P=PH() +PH.waitForValue(Ch_rbv,10.2,.02) diff --git a/script/Users/Thomas/test_otf.py b/script/Users/Thomas/test_otf.py new file mode 100644 index 0000000..853d077 --- /dev/null +++ b/script/Users/Thomas/test_otf.py @@ -0,0 +1,4 @@ +E_start=835 +E_end=890 +time_of_scan=5 +otf(E_start, E_end, time_of_scan, delay=0.3, mode = None, offset = None, alpha = None, name = 'TEST') \ No newline at end of file diff --git a/script/Users/Utilities/Mono_pitch.py b/script/Users/Utilities/Mono_pitch.py new file mode 100644 index 0000000..2ed383d --- /dev/null +++ b/script/Users/Utilities/Mono_pitch.py @@ -0,0 +1,139 @@ +#Script imported from: Mono_pitch.xml + +#Pre-actions +caput('X07MB-OP2:START-CSMPL', '0') +sleep(0.1) +caput('X07MB-XMAP:StopAll', '1') +sleep(0.1) +caput('X07MB-XMAP:PresetMode', '0') +sleep(0.1) +caput('X07MB-XMAP:PresetReal', '0') +sleep(0.1) +caput('X07MB-OP2:TOTAL-CYCLES', '1') +sleep(0.1) +print('dd') + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['Pitch'], ['bm3', 'bm4', 'Filter_RY', 'Harmonic', 'TC_Y', 'TC_Z', 'T_THETA', 'Id_OFF', 'Id_energy', 'E_Mono', 'Bragg_Id_theo', 'Theta_rbv', 'Theta_offset', 'Delta_E', 'Delta_theta', 'XX'] , [-10700.0], [-10750.0], [25]) +scan.start() + +#Creating channels: dimension 1 +#LinearPositioner Pitch +Pitch = Channel('X07MB-OP-MO:C2-ROX.VAL', type = 'd') +PitchReadback = Channel('X07MB-OP-MO:C2-ROX.RBV', type = 'd') +#ScalarDetector bm3 +bm3 = Channel('X07MB-OP2-SAI_03:MEAN', type = 'd') +#ScalarDetector bm4 +bm4 = Channel('X07MB-OP2-SAI_04:MEAN', type = 'd') +#ScalarDetector Filter_RY +Filter_RY = Channel('X07MB-OP-FI:ROY.VAL', type = 'd') +#ScalarDetector Harmonic +Harmonic = Channel('X07MA-ID:HARMONIC', type = 'd') +#ScalarDetector TC_Y +TC_Y = Channel('X07MB-OP-MOC2:TC_Y', type = 'd') +#ScalarDetector TC_Z +TC_Z = Channel('X07MB-OP-MOC2:TC_Z', type = 'd') +#ScalarDetector T_THETA +T_THETA = Channel('X07MB-OP-MOTHETA:TC1', type = 'd') +#ScalarDetector Id_OFF +Id_OFF = Channel('X07MA-ID:ENERGY-OFFS', type = 'd') +#ScalarDetector Id_energy +Id_energy = Channel('X07MA-ID:ENERGY', type = 'd') +#ScalarDetector E_Mono +E_Mono = Channel('X07MB-OP-MO:E-GET', type = 'd') +#ScalarDetector Bragg_Id_theo +Bragg_Id_theo = Channel('X07MB-OP-MO:BRAGG-CALC', type = 'd') +#ScalarDetector Theta_rbv +Theta_rbv = Channel('X07MB-OP-MO:THETA.RBV', type = 'd') +#ScalarDetector Theta_offset +Theta_offset = Channel('X07MB-OP-MO:THETA.OFF', type = 'd') + +#Dimension 1 +#Dimension Guard +cawait('ACOAU-ACCU:OP-MODE', 6, type = 'l') +#LinearPositioner Pitch +for setpoint1 in frange(-10700.0, -10750.0, -2.0, True): + if setpoint1 > -10700.0 or setpoint1 < -10750.0: + break + Pitch.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = PitchReadback.get() + if abs(readback1 - setpoint1) > 10.0 : # TODO: Check accuracy + print readback1, setpoint1 + raise Exception('Actor Pitch could not be set to the value ' + str(setpoint1)) + #Detector bm3 + #Detector X07MB-OP2-SAI_03:MEAN pre-actions + caput('X07MB-OP2:SMPL', '1') + sleep(0.1) + cawait('X07MB-OP2:SMPL-DONE', 1, type = 'l') + detector1 = bm3.get() + #Detector bm4 + detector2 = bm4.get() + #Detector Filter_RY + detector3 = Filter_RY.get() + #Detector Harmonic + detector4 = Harmonic.get() + #Detector TC_Y + detector5 = TC_Y.get() + #Detector TC_Z + detector6 = TC_Z.get() + #Detector T_THETA + detector7 = T_THETA.get() + #Detector Id_OFF + detector8 = Id_OFF.get() + #Detector Id_energy + detector9 = Id_energy.get() + #Detector E_Mono + detector10 = E_Mono.get() + #Detector Bragg_Id_theo + detector11 = Bragg_Id_theo.get() + #Detector Theta_rbv + detector12 = Theta_rbv.get() + #Detector Theta_offset + detector13 = Theta_offset.get() + #Manipulation Delta_E + #Variable Mappings + a = detector10 + b = detector9 + Delta_E = a-b + #Manipulation Delta_theta + #Variable Mappings + a = detector11 + b = detector12 + Delta_theta = a-b + #Manipulation XX + #Variable Mappings + a = detector11 + b = detector12 + XX = a*b + print(XX) + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11, detector12, detector13, Delta_E, Delta_theta, E_Mono, XX]) + +#Closing channels +Pitch.close() +PitchReadback.close() +bm3.close() +bm4.close() +Filter_RY.close() +Harmonic.close() +TC_Y.close() +TC_Z.close() +T_THETA.close() +Id_OFF.close() +Id_energy.close() +E_Mono.close() +Bragg_Id_theo.close() +Theta_rbv.close() +Theta_offset.close() + +scan.end() + + +#Post-actions +caput('X07MB-OP2:START-CSMPL', '1') +sleep(0.1) +caput('X07MB-OP2:START-CSMPL', '1') +sleep(0.3) +caput('X07MB-OP2:SMPL', '1') +sleep(0.3) +caput('X07MB-OP2:SMPL', '1') +sleep(0.3) diff --git a/script/Users/scandef.dat b/script/Users/scandef.dat new file mode 100644 index 0000000..e69de29 diff --git a/script/local.py b/script/local.py index 5566e74..9e5a405 100644 --- a/script/local.py +++ b/script/local.py @@ -5,21 +5,147 @@ import ch.psi.fda.ProcessorFDA as ProcessorFDA import ntpath + +##################################################################### +# +# +# PHOENIX SPECIFIC DEFINITIONS +# +# +###################################################################### + +class PH_class(): + """ + Phoenix utility class in local.py + + Collection of soem usefull tools + + """ + + + + + def __init__(self): + self.show=True + + def pm(self,pp,*args): + if self.show==True: + print(pp,args) + + def help(self): + print('PH.__dict__') + print(self.__dict__ ) + + def init_ChannelDouble(self,alias,Ch_Epics,monitored=False): + Ch=ChannelDouble(alias,Ch_Epics) + Ch.monitored=monitored + Ch.initialize() + Ch.monitored=monitored + Ch.initialize() + + return Ch + + def initMA(self): + # initialize default channels forma beamline + self.ma_exitslit_rbv=self.init_ChannelDouble('ma_exitslit_rbv','X07MA-OP-SL1SV1:TR_ISAP') + #self.ma_exitslit_rbv=self.init_ChannelDouble('id_offset','X07MA-ID:ENERGY-OFFS') + + def WaitForID(self): + + while ID_DONE.read() != 'DONE': + print('wait for ID') + time.sleep(0.05) + time.sleep(1) + + + + def waitForValue(self,chan,val,comp,timeout=10): + """ + + waitForValue, waits until a value is reaced within + workarond of unclear operation of cawait and different definiton + of wait fior different device types + + chan.read()-val)>comp + + checks for class + currently works for ch.psi.pshell.epics.ChannelDouble only + + """ + self.pm(type(chan)) + t0=time.time() + waiting=True + if type(chan) == ch.psi.pshell.epics.ChannelDouble: + while (abs(chan.read()-val)>comp) and waiting : + self.pm('waitin',chan.getChannelName(),chan.read(),val,waiting,time.time()-t0) + time.sleep(.1) + if time.time()-t0 > timeout: + waiting=False + #endif + #endwhile + #endif + + + #if type(chan)==ch.psi.pshell.epics.ChannelInteger: + # while chan.read() == val: + # self.pm('still waiting',chan.read(),) + # time.sleep(.1) + # #endwhile + ##endif + self.pm('DONE') + return +# initit class + + +PH=PH_class() +PH.initMA() # use only if PHOENIX II is operated + +# define some stadard channels + +ID_OFFSET=PH.init_ChannelDouble('ID_OFFSET','X07MA-ID:ENERGY-OFFS') +ID_ENERGY=PH.init_ChannelDouble('ID_ENERGY','X07MA-ID:ENERGY-READ') + +ID_MODE=ChannelString('ID_MODE','X07MA-ID:MODE') +ID_MODE.initialize() + +ID_DONE=ChannelString('ID_DONE','X07MA-ID:DONE') +ID_DONE.initialize() + +ID_ALPHA=ChannelString('ID_ALPHA','X07MA-ID:ALPHA') +ID_ALPHA.initialize() + +ma_exitslit_rbv=PH.init_ChannelDouble('ma_exitslit_rbv','X07MA-OP-SL1SV1:TR_ISAP') + +ma_mono_m1_rbv=PH.init_ChannelDouble('ma_mono_m1_rbv','X07MA:m1.RBV') +ma_mono_m2_rbv=PH.init_ChannelDouble('ma_mono_m2_rbv','X07MA:m2.RBV') + + +ma_mono_m2_rbv=PH.init_ChannelDouble('ma_mono_m2_rbv','X07MA:m2.RBV') + +ES3_MF1_PRESSURE=PH.init_ChannelDouble('ES3_MF1_PRESSURE','X07MB-ES3-MF1:PRESSURE') + +################ DEFINITIONS FOR OTF NO_BEAM_CHECK = False ABORT_ON_ID_ERROR = False + #Layout get_context().dataManager.provider.embeddedAtributes=False #Device initialization -energy_ma.setBlockingWrite(True) -pol_mode.setpoint.setBlockingWrite(True) -pol_offset.setBlockingWrite(True) -pol_angle.setBlockingWrite(True) +ma_energy.setBlockingWrite(True) +id_pol_mode.setpoint.setBlockingWrite(True) +id_pol_offset.setBlockingWrite(True) +id_pol_angle.setBlockingWrite(True) +#Pseudo-devices +dev=ChannelDouble('Example','X07MB-ES-MA1:TRZ1.RBV') +dev.monitored=True +add_device(dev, True) + #Utilities def run_fda(file_name, arguments={}): """ @@ -28,9 +154,12 @@ def run_fda(file_name, arguments={}): ProcessorFDA().execute(file_name,arguments) -def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, name = None): +def otf(start, end, duration, delay=0.0, mode = None, offset = None, alpha = None, name = None): """ """ + print('in otf',name) + print('start, end,duration',start, end, duration) + if name is None: name = get_exec_pars().name @@ -38,15 +167,18 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n name = name[:38] print('WARNING: Sample name too long. Name has been truncated.') - run("EnergyScan_ma", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "NAME":name, "ALPHA":float(alpha) if alpha is not None else None}) + print('in otf, call run \n') + time.sleep(.5) + run("EnergyScan_ma", {"E1":start, "E2":end, "TIME":duration, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "NAME":name, "ALPHA":float(alpha) if alpha is not None else None}) + print('in otf, after run \n') def has_beam(): """ """ - return beam_status.readback.read() !="Machine Down" + return sls_status.readback.read() !="Machine Down" def wait_beam(): """ @@ -74,9 +206,10 @@ def wait_pol_done(delay=1.0): time.sleep(0.5) print "Done" -def wait_channel(name, value, timeout=None, type='s'): +def wait_channel(name, value, timeout=None, type=None, comparator=None): print "Waiting " + str(name) + " = " + str(value),"... " - cawait(name, value, timeout = timeout, type=type) + cawait(name, value, timeout = timeout, type=type, comparator=comparator) + print "waiting done" def is_id_error(): return (id_error.read()==0) @@ -102,20 +235,20 @@ def wait_id_ok(): def set_pol(mode=None, alpha=None, offset=None): if mode is not None: print "Set pol mode: ", mode - pol_mode.write(mode) + id_pol_mode.write(mode) if MODE == 'LINEAR': if alpha is not None: print "Set pol alpha: ", alpha - pol_angle.write(alpha) + id_pol_angle.write(alpha) wait_pol_done(1.0) if offset is not None: print "Set pol offset: ", offset - pol_offset.write(offset) + id_pol_offset.write(offset) def set_energy_ma(value): print "Setting energy ma to: ", value - energy_ma.write(float(E1)) # no need to add wait command. This commands sets and waits. + ma_energy.write(float(E1)) # no need to add wait command. This commands sets and waits. print "Done" ################################################################################################### diff --git a/script/scandef.dat b/script/scandef.dat new file mode 100644 index 0000000..e69de29 diff --git a/script/test/DemoCpython.py b/script/test/DemoCpython.py index 0659f53..ba34555 100644 --- a/script/test/DemoCpython.py +++ b/script/test/DemoCpython.py @@ -1,9 +1,12 @@ -run("CPython/GaussFit_wrapper") +#run("CPython/GaussFit_wrapper") + +from jeputils import import_py +import_py("CPython/GaussFit", "profile_gauss_stats") x=[-200.30429237268825, -200.2650700434188, -200.22115208318002, -199.9457671375377, -199.86345548879072, -199.85213073174933, -199.35687977133284, -199.13811861090275, -197.97304970346386, -197.2952215624348, -195.09076092936948, -192.92276048970703, -191.96871876227698, -189.49577852322938, -187.9652790409825, -183.63756456925222, -180.04899765472996, -178.43839623242422, -174.07311671294445, -172.0410133577918, -165.90824309893102, -160.99771795989466, -159.30176653939253, -154.27688897558514, -152.0854103810786, -145.75652847587313, -140.80843828908465, -139.23982133191495, -134.27073891256106, -132.12649284133064, -125.95947209775511, -121.00309550337462, -119.26736932643232, -114.2706655484383, -112.07393889578914, -105.72295990367157, -100.8088439880125, -99.2034906238494, -94.30042325164636, -92.15010048151461, -85.92203653534293, -81.03913275494665, -79.27412793784428, -74.33487658582118, -72.06274362408762, -65.76562628131825, -60.91255356825276, -59.20334389560392, -54.33286972659312, -52.19387171350535, -45.94978737932291, -41.03014719193582, -39.301602568238906, -34.35572209014114, -32.04464301272608, -25.8221033382824, -20.922074315528747, -19.21590299233186, -14.31090212502093, -12.217203140101386, -5.9283722049240435, -0.9863587170369246, 0.7408048387279834, 5.71126832601389, 7.972628957879352, 14.204559894256546, 19.11839959633025, 20.8218087836657, 25.678748486941828, 27.822718344586864, 34.062659474970715, 38.9745656819391, 40.77409719734158, 45.72080631619803, 47.974156754056835, 54.23453768983539, 59.12020360609568, 60.77306570712026, 65.70734521458867, 67.8344660434617, 74.03187028154134, 78.96532114824849, 80.76070945985495, 85.74802197591286, 87.9140889204674, 94.18082276873524, 99.25790470037091, 100.68454787413205, 105.7213026221542, 107.79483801526698, 113.99555681638138, 119.0707052529143, 120.72715813056156, 125.77551384921307, 127.91257836719551, 134.2011330887875, 139.23043006997628, 140.71673537840158, 145.76288138835983, 147.80216629676042, 154.06420451405637, 159.0846626604798, 160.76183155710717, 165.73699067536242, 167.9265357747636, 173.96705069576544, 178.2522282751915, 179.9042617354548, 183.54586165856657, 185.23269803071796, 189.41678143751972, 191.87149157986588, 192.8741468985015, 195.0241934550453, 195.966634211846, 197.9821647518146, 198.99006812859284, 199.33202054855676, 199.91897441965887, 200.11536227958896, 200.22280936469997, 200.25181179127208] y=[11.0, 6.0, 8.0, 5.0, 11.0, 7.0, 18.0, 11.0, 12.0, 10.0, 8.0, 6.0, 16.0, 4.0, 12.0, 9.0, 15.0, 14.0, 8.0, 20.0, 15.0, 8.0, 9.0, 11.0, 13.0, 12.0, 13.0, 15.0, 13.0, 20.0, 10.0, 7.0, 17.0, 11.0, 20.0, 13.0, 13.0, 23.0, 14.0, 10.0, 17.0, 15.0, 20.0, 16.0, 14.0, 13.0, 18.0, 22.0, 9.0, 20.0, 12.0, 14.0, 17.0, 19.0, 14.0, 14.0, 23.0, 19.0, 15.0, 20.0, 20.0, 21.0, 20.0, 23.0, 22.0, 15.0, 10.0, 17.0, 21.0, 15.0, 23.0, 23.0, 25.0, 18.0, 16.0, 21.0, 22.0, 16.0, 16.0, 14.0, 19.0, 20.0, 18.0, 20.0, 23.0, 13.0, 16.0, 20.0, 25.0, 15.0, 15.0, 17.0, 22.0, 26.0, 19.0, 30.0, 25.0, 17.0, 17.0, 23.0, 16.0, 27.0, 21.0, 21.0, 26.0, 27.0, 21.0, 17.0, 20.0, 20.0, 21.0, 19.0, 25.0, 19.0, 13.0, 23.0, 20.0, 20.0, 18.0, 20.0, 19.0, 25.0] -[off, amp, com, sigma] = profile_gauss_stats(x, y, off=None, amp=None, com=None, sigma=None) +[off, amp, com, sigma] = profile_gauss_stats(to_array(x,'d'), to_array(y,'d'), off=None, amp=None, com=None, sigma=None) print "Gauss: ", [off, amp, com, sigma] from mathutils import Gaussian diff --git a/script/test/TestMscan.py b/script/test/TestMscan.py index 3bea4a4..925ffcc 100644 --- a/script/test/TestMscan.py +++ b/script/test/TestMscan.py @@ -1,6 +1,3 @@ -#Pre-actions -#Scan -print "Start OTF" scan_completed = False try: while True: @@ -41,6 +38,7 @@ try: print "Scanning...", try: mscan( energy_ma_rbv, sensors, -1, None, \ + range="auto", domain_axis=tm.alias, \ #energy_ma_rbv.name, enabled_plots=["norm_tey", "norm_diode", cadc1, cadc3, cadc2], \ snaps=snaps, diags=diags) finally: