diff --git a/script/local.py b/script/local.py index 85d3bdf..45f9571 100644 --- a/script/local.py +++ b/script/local.py @@ -49,41 +49,43 @@ def trigger_detectors(position, scan): pix_is_on = pixel in scan.readables mythen.abort() open_shutter() - if (count_time != 0): + try: + if (count_time != 0): + if pix_is_on: + pixel.set_expose(count_time) + pixel.start() + + if (count_time > 0): + mythen.set_acquire_time(count_time) + mythen.set_acquire_mode("Single") + mythen.start() + else: + print "Preset monitor counting is not supported\!" + + #waitcount if pix_is_on: - pixel.set_expose(count_time) - pixel.start() - - if (count_time > 0): - mythen.set_acquire_time(count_time) - mythen.set_acquire_mode("Single") - mythen.start() - else: - print "Preset monitor counting is not supported\!" - - #waitcount - if pix_is_on: - pixel.wait_finished() - - i = 0 - while (mythen.is_acquiring()): - time.sleep (0.05) - i += 1 - if (i * 0.05 >= count_time * 2): - print "MYTHEN Izero times out, status: " + str(mythen.get_status()) - break - - - #count_end() - # update the IMAGE_FILENAME and COUNT_ID variables - if pix_is_on: - image_filename = pixel.get_image_filename() - count_id = pixel.doUpdate() - #pixel.logwrite() - else : - image_filename = None - count_id = + 1 - close_shutter() + pixel.wait_finished() + + i = 0 + while (mythen.is_acquiring()): + time.sleep (0.05) + i += 1 + if (i * 0.05 >= count_time * 2): + print "MYTHEN Izero times out, status: " + str(mythen.get_status()) + break + + + #count_end() + # update the IMAGE_FILENAME and COUNT_ID variables + if pix_is_on: + image_filename = pixel.get_image_filename() + count_id = pixel.doUpdate() + #pixel.logwrite() + else : + image_filename = None + count_id = + 1 + finally: + close_shutter() def save_metadata(rec):