def inner(): # Prepare TIFF plugin if filepath is not None and filename is not None: fp = filepath if fp[-1] != '/': fp+= '/' print("Saving files as", "".join((fp, filename, "_XXX.tif"))) print("First file number:", cam_8.tiff.file_number.get()) yield from bp.mv( tiff.enable, 1, tiff.auto_increment, 1, tiff.file_path, fp, tiff.file_name, filename, tiff.file_template, "%s%s_%3.3d.tif", tiff.file_write_mode, 1, # Capture mode tiff.num_capture, steps, ) # Prepare statistics plugin yield from bp.mv( stats.enable, 1, stats.compute_centroid, 1 ) # Prepare Camera yield from bp.mv(cam.acquire, 0) # Stop camera... yield from bp.sleep(.5) # ...and wait for the pipeline to empty. yield from bp.mv( cam.trigger_mode, "Sync In 1", # External Trigger cam.array_counter, 0, ) yield from bp.abs_set(cam.acquire, 1) # wait=False yield from bp.abs_set(tiff.capture, 1) # Move to the starting positions yield from bp.mv( slt_gap, gap, # Move gap to desired position slt_ctr, start - move_slack, # Move slits to the beginning of the motion stats.ts_control, "Erase/Start", # Prepare statistics Time Series ) # Set Slits Center velocity for the scan yield from bp.mv(slt_ctr.velocity, speed) # Go yield from bp.kickoff(flyer, wait=True) st = yield from bp.complete(flyer) yield from bp.abs_set(slt_ctr, end + move_slack) while not st.done: yield from bp.collect(flyer, stream=True) yield from bp.sleep(0.2) yield from bp.sleep(1) yield from bp.collect(flyer, stream=True) yield from bp.mv(stats.ts_control, "Stop")
def step_scan_pcharge(mymotor, motor_min, motor_max, motor_step, pcharge): "Step mymotor from min -> max with a step size of step and collect for a given pcharge" for num in np.arange(motor_min, motor_max, motor_step): yield from abs_set(mymotor, num, wait=True) yield from bp.kickoff(detector, wait=True) yield from _waitfor_proton_charge(pcharge) yield from bp.complete(detector, wait=True) yield from bp.collect(detector) yield from bp.trigger_and_read([mymotor, bs_neutrons_roi, bs_pcharge])
def inner(): print('Beamline Ready... waiting for HPLC Injected Signal') yield from kickoff(hplc, wait=True) print('Acquiring data...') for mo in monitors: yield from monitor(mo) status = yield from complete(hplc, wait=False) while True: yield from trigger_and_read(detectors) # one 'primary' event per loop if status.done: break for mo in monitors: yield from unmonitor(mo) print('Collecting the data...') yield from collect(hplc)
def inner(): print('Beamline Ready... waiting for HPLC Injected Signal') yield from kickoff(hplc, wait=True) print('Acquiring data...') for mo in monitors: yield from monitor(mo) status = yield from complete(hplc, wait=False) while True: yield from trigger_and_read( detectors) # one 'primary' event per loop if status.done: break for mo in monitors: yield from unmonitor(mo) print('Collecting the data...') yield from collect(hplc)
def continuous_step_scan(mymotor, motor_min, motor_max, motor_step, collection_time): "Step mymotor, produce a single file." # Move to start position yield from abs_set(mymotor, motor_min, wait=True) # Start yield from bp.kickoff(detector, wait=True) # and immediately pause yield from bp.pause(detector, wait=True) for num in range(motor_min, motor_max, motor_step): yield from abs_set(mymotor, num, wait=True) yield from abs_set(bs_adned_reset_counters, 1, wait=True) yield from bp.resume(detector, wait=True) yield from bp.sleep(collection_time) yield from bp.pause(detector, wait=True) yield from bp.complete(detector, wait=True) yield from bp.collect(detector)
def _time_plan(collection_time): '''Plan to collect for a period of time''' yield from bp.kickoff(detector, wait=True) yield from bp.sleep(collection_time) yield from bp.complete(detector, wait=True) yield from bp.collect(detector)
def pcharge_plan(pcharge): '''Plan to collection for a given beam current''' yield from bp.kickoff(detector, wait=True) yield from waitfor_proton_charge(pcharge) yield from bp.complete(etector, wait=True) yield from bp.collect(detector)