Skip to content

Instantly share code, notes, and snippets.

@danielballan
Created April 6, 2015 15:28
Show Gist options
  • Select an option

  • Save danielballan/fac61a7aa2b5b05ca14f to your computer and use it in GitHub Desktop.

Select an option

Save danielballan/fac61a7aa2b5b05ca14f to your computer and use it in GitHub Desktop.
"""This adds a new function for performing a dscan
with all detectors using the same integration time.
It was deployed in HXN 03id on 2015-04-06 in their
IPython profile under `50-scans.py`."""
def synchronize(detectors, integration_time):
# EpicsScaler calls it preset_time;
# AreaDetector calls it exposure_time.
attrs = ['preset_time', 'exposure_time']
for det in detectors:
for attr in attrs:
try:
setattr(det, attr, integration_time)
except AttributeError:
pass
# TODO Raise better.
def sync_dscan(positioners, start, stop, step, acquisition_time):
"""Perform a normal dscan, but first sync acquisition time.
Parameters
----------
positioners : same as dscan
start : same as dscan
stop : same as dscan
step : same as dscan
acquisition_time : sensor integration time in seconds
"""
synchronize(dscan.detectors, acquisition_time)
return dscan(positioners, start, stop, step)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment