diff --git a/script/local.py b/script/local.py index fae8dcc..122a7f3 100644 --- a/script/local.py +++ b/script/local.py @@ -18,8 +18,13 @@ class MyInterlock1 (Interlock): def open_shutter(): + """ + """ shutter.write("On") + time.sleep(0.1) def close_shutter(): + """ + """ shutter.write("Off") \ No newline at end of file diff --git a/script/test/DetectorTriggering.py b/script/test/DetectorTriggering.py index 87e688d..4f56a47 100644 --- a/script/test/DetectorTriggering.py +++ b/script/test/DetectorTriggering.py @@ -1,3 +1,5 @@ +COUNT_ID = 0 + def count (count_time): waitmove count_em (count_time) # triggers the counting process @@ -14,7 +16,6 @@ def count (count_time): def count_em (count_time): -# ======== while (mythen.is_acquiring()): mythen.stop() time.sleep(0.25) @@ -33,6 +34,21 @@ def count_em (count_time): +def user_precount(): + open_shutter() + autoCalcExposure() + global PIX_IS_ON + if ((PIX_IS_ON) && (pixconnected())): + pixsetexpose(count_time) + pixgetfilefmt() + pixsnap() + + + +def user_postcount(): + pass + + # define new count_end, chk_counts, and chk_xray macros: def count_end 'user_count_end' def chk_counts 'user_chk_counts' @@ -118,25 +134,21 @@ def waitcount(count_time): # get_counts - lowest level counter reading macro. #- -def get_counts(): -# ========== - +def get_counts(count_time): + global COUNT_ID S[0] = mythen.get_acquire_time(readback=False) S[1] = mythen.get_total_counts() - # S[2] is detector counts from image.mac - S[3] = S[2] / COUNT_TIME / epics_get("X04SA-ES2-FI:TRANSM") - - S[5] = epics_get ("X04SA-ES2-FI:TRANSM") + # S[2] is detector counts from image.mac ###TOFO + S[3] = S[2] / count_time / transm.getValue() + S[5] = transm.getValue() - COUNT_ID++ # increment the exposure ID + COUNT_ID = COUNT_ID+1 # increment the exposure ID # set threshold counts in case auto-level support is available - if ((whatis("AUTO_THRESH1") & 0x08000000) == 0) { + if "AUTO_THRESH1" in globals(): AUTO_THRESH1_COUNT = (S[2]>=AUTO_THRESH1)?S[2]:0 AUTO_THRESH2_COUNT = (S[2]>=AUTO_THRESH2)?S[2]:0 AUTO_THRESH3_COUNT = (S[2]>=AUTO_THRESH3)?S[2]:0 - AUTO_THRESH4_COUNT = (S[2]>=AUTO_THRESH4)?S[2]:0 - } - + AUTO_THRESH4_COUNT = (S[2]>=AUTO_THRESH4)?S[2]:0 user_getcounts -}' +