Skip to content

Commit

Permalink
Added @async and Hardware-Locking for center_to_beam
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovico86 authored and Matthias Vogelgesang committed Dec 12, 2013
1 parent fa91ead commit 13f397a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions concert/processes.py
Expand Up @@ -489,6 +489,7 @@ def drift_to_beam(cam, xmotor, zmotor, pixelsize, tolerance=5,
return False


@async
def center_to_beam(cam, xmotor, zmotor, pixelsize, xborder, zborder,
xstep=None, zstep=None, thres=1000, tolerance=5,
max_iterations=100):
Expand All @@ -505,18 +506,19 @@ def center_to_beam(cam, xmotor, zmotor, pixelsize, xborder, zborder,
'center2beam(...)'.
"""

if not find_beam(cam, xmotor, zmotor, pixelsize, xborder, zborder,
xstep, zstep, thres):
message = "Unable to find the beam"
LOG.debug('center_to_beam: '+message)
raise ProcessException(message)
else:
LOG.debug('center_to_beam: switch to drift_to_beam')
if not drift_to_beam(cam, xmotor, zmotor, pixelsize, tolerance,
max_iterations):
message = "Maximum iterations reached"
with cam, xmotor, zmotor:
if not find_beam(cam, xmotor, zmotor, pixelsize, xborder, zborder,
xstep, zstep, thres):
message = "Unable to find the beam"
LOG.debug('center_to_beam: '+message)
raise ProcessException(message)
else:
LOG.debug('center_to_beam: switch to drift_to_beam')
if not drift_to_beam(cam, xmotor, zmotor, pixelsize, tolerance,
max_iterations):
message = "Maximum iterations reached"
LOG.debug('center_to_beam: '+message)
raise ProcessException(message)


class ProcessException(Exception):
Expand Down

0 comments on commit 13f397a

Please sign in to comment.