Package gda.scan

Class ConcurrentScan

All Implemented Interfaces:
IConcurrentScanChild, NestableScan, Scan, ScanChild, Serializable
Direct Known Subclasses:
AbstractContinuousScanLine, TestScan

public class ConcurrentScan extends ConcurrentScanChild
Similar to 'scan' in CLAM (but order of arguments not the same). This moves several scannable objects simultaneously, the same number of steps. After each movement data is collected from items in the allDetectors list.

Expect arguments in the following format:

scannable1 start stop step scannable2 [start] [[stop] step] scannable3 [start] [[stop] step]

The number of steps is calculated from scannable1.

For subsequent scannables: if only 'start' then they are moved only to that position. If no start value given then the current position will be used (so this scannable will not be moved, but will be included in any output from the scan.

If a step value given then the scannable will be moved each time

If a stop value is also given then this is treated as a nested scan containing one scannable. This scan will be run in full at each node of the main scan. If there are multiple nested scans then they are nested inside each other to create a multidimensional scan space (rasta scan).

If LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY is set to true Scannables will be moved to the next point in a scan while detectors from the current point are read out (e.g. if a scan contains motors and detectors, the motors will be moved to the next point while the detectors are read out).

CAUTION: If this feature is enabled then all the detectors on the beamline must latch counts somewhere before Detector.waitWhileBusy() returns so that Detector.readout() is not effected by any concurrent motor or shutter movements.

More precisely, when moving to the next point, Scannables at each subsequent level are moved until a level which contains a detector is encountered. The scan command thread then waits until the detectors from the current point have read out completely and the resulting ScanDataPoint has been added to the pipeline before continuing to operate devices at the level containing the a detector. The scan command thread will also wait at the end of each line for the Detector readout to complete before calling the atScanEnd() hooks and starting the next line.

NOTE that as a consequence of using this feature, an exception thrown while reading out a detector won't be thrown in the main scan command thread until after the next point's 'motors' have moved.

Detectors must work as follows to take advantage of this feature:

  • Detector.collectData() should cause the hardware to start collecting immediately and as its interface says return immediately. If there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.
  • Detector.waitWhileBusy() should return as soon as the exposure completes and it is safe to move motors. i.e. counts must be safely latched either in hardware or software before returning.
  • Detector.readout() should block until the detector is ready to start collecting again. The value returned must not be effected by any concurrent motor or shutter movements.
See Also:
  • Field Details

    • RETURNTOSTARTINGPOSITION

      public static final String RETURNTOSTARTINGPOSITION
      Name of flag in Jython namespace which, if set to true, then this scan will return all the scannables to their initial positions at the end of this type of scan
      See Also:
    • numberSteps

      protected int numberSteps
      The number of steps or movements (this dimension only)
  • Constructor Details

  • Method Details

    • reportDevicesByLevel

      public String reportDevicesByLevel()
    • doCollection

      public void doCollection() throws Exception
      Description copied from interface: Scan
      The method in which the work of the scan is performed. This method assumes that the data handler has already been created and the baton claimed.
      Specified by:
      doCollection in interface Scan
      Specified by:
      doCollection in class ScanBase
      Throws:
      Exception
    • createScanDataPoint

      protected ScanDataPoint createScanDataPoint() throws DeviceException
      Overrides:
      createScanDataPoint in class ScanBase
      Throws:
      DeviceException
    • callAtPointStartHooks

      protected void callAtPointStartHooks() throws DeviceException
      Throws:
      DeviceException
    • endScan

      protected void endScan() throws DeviceException, InterruptedException
      Description copied from class: ScanBase
      This should be called by all scans when they have finished, including when an exception has been raised.
      Overrides:
      endScan in class ScanBase
      Throws:
      DeviceException
      InterruptedException
    • getNumberPoints

      public int getNumberPoints()
      Gets the number of points visited by this scan
      Returns:
      the number of points in visited by this scan
    • getUserListedScannablesToScan

      public List<Scannable> getUserListedScannablesToScan()
      Returns:
      List of scannables to be scanned in the order presented to the constructor
    • getUserListedScannables

      public List<Scannable> getUserListedScannables()
      Returns:
      List of scannables in the order presented to the constructor
    • getDimension

      public int getDimension()
      Description copied from class: ScanBase
      default implementation. Classes that derive from ScanBase which want to support the reporting of scan dimensions -@see getDimensions need to override this method
      Specified by:
      getDimension in interface Scan
      Overrides:
      getDimension in class ScanBase
      Returns:
      the number of points of this scan object - the whole scan execution can be a hierarchy of parent scan objects and layers of child scan objects
      See Also:
    • isReturnScannablesToOrginalPositions

      public boolean isReturnScannablesToOrginalPositions()
    • setReturnScannablesToOrginalPositions

      public void setReturnScannablesToOrginalPositions(boolean returnScannablesToOrginalPositions)
    • isSendUpdateEvents

      public boolean isSendUpdateEvents()
    • setSendUpdateEvents

      public void setSendUpdateEvents(boolean sendUpdateEvents)
    • setStatus

      void setStatus(Scan.ScanStatus status)
      To allow nests of scans to share a common status with each other.
      Parameters:
      status -