Class BufferedScannablePositions

All Implemented Interfaces:
Detector, BufferedDetector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, Serializable

public class BufferedScannablePositions extends DetectorBase implements BufferedDetector
This BufferedDetector implementation can be used in a ContinuousScan to record scannable positions at regularly spaced time intervals. The motivation for this class is that the positions of 'extra scannables' added to ContinuousScan are only grabbed when the data is written rather than at the same time as the detector measurements. This class can be used to ensure that scannable positions are measured at *same* time as the detector measurements for time-based continuous scans.
  • At the start of the scan (in setContinuousMode(boolean)) a executor service is created that stores the current position of a scannable in a list.
  • The execution frequency/update interval is set by the time per point for the scan - i.e. from the total time and number of points in the continuous parameters. 11/1/2024
  • See Also:
    • Constructor Details

      • BufferedScannablePositions

        public BufferedScannablePositions()
    • Method Details

      • collectData

        public void collectData() throws DeviceException
        Description copied from interface: Detector
        Tells the detector to begin to collect a set of data, then returns immediately. Should cause the hardware to start collecting immediately: if there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.
        Specified by:
        collectData in interface Detector
        Throws:
        DeviceException
      • atScanEnd

        public void atScanEnd()
        Description copied from class: ScannableBase
        Called for every Scannable at the end of a group of nested scans (or a single scan if that is the case).

        Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See Scannable.atCommandFailure() Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.

        Specified by:
        atScanEnd in interface Scannable
        Overrides:
        atScanEnd in class ScannableBase
        See Also:
      • atScanStart

        public void atScanStart()
        Description copied from class: ScannableBase
        Called for every Scannable at the start of a group of nested scans (or a single scan if that is the case) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
        Specified by:
        atScanStart in interface Scannable
        Overrides:
        atScanStart in class ScannableBase
        See Also:
      • getStatus

        public int getStatus() throws DeviceException
        Description copied from interface: Detector
        Returns the current collecting state of the device.
        Specified by:
        getStatus in interface Detector
        Returns:
        BUSY if the detector has not finished the requested operation(s), IDLE if in an completely idle state and STANDBY if temporarily suspended.
        Throws:
        DeviceException
      • readout

        public Object readout() throws DeviceException
        Description copied from interface: Detector
        Returns the latest data collected. The size of the Object returned must be consistent with the values returned by getDataDimensions and getExtraNames.

        If LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY is true then motors may be moved while the detector readouts. The value returned must not be effected by any concurrent motor or shutter movements. See Detector.waitWhileBusy() and ConcurrentScan. Readout must block until the detector is ready to respond quickly to Detector.collectData() again.

        Specified by:
        readout in interface Detector
        Returns:
        the data collected
        Throws:
        DeviceException
      • createsOwnFiles

        public boolean createsOwnFiles() throws DeviceException
        Description copied from interface: Detector
        Returns a value which indicates whether the detector creates its own files. If it does (return true) the readout() method returns the name of the latest file created as a string. If it does not (return false) the readout() method will return the data directly.
        Specified by:
        createsOwnFiles in interface Detector
        Returns:
        true if readout() returns filenames
        Throws:
        DeviceException
      • clearMemory

        public void clearMemory() throws DeviceException
        Description copied from interface: BufferedDetector
        Clears the detector memory
        Specified by:
        clearMemory in interface BufferedDetector
        Throws:
        DeviceException
      • setContinuousMode

        public void setContinuousMode(boolean on) throws DeviceException
        Description copied from interface: BufferedDetector
        When in slave mode the detector will be triggered by an external signal to collect each frame of data.
        Specified by:
        setContinuousMode in interface BufferedDetector
        Parameters:
        on -
        Throws:
        DeviceException
      • isContinuousMode

        public boolean isContinuousMode() throws DeviceException
        Specified by:
        isContinuousMode in interface BufferedDetector
        Returns:
        true if the detector is ready to accept trigger pulses
        Throws:
        DeviceException
      • setContinuousParameters

        public void setContinuousParameters(ContinuousParameters parameters) throws DeviceException
        Description copied from interface: BufferedDetector
        Sets the parameters which define the continuous movement to use
        Specified by:
        setContinuousParameters in interface BufferedDetector
        Parameters:
        parameters -
        Throws:
        DeviceException
      • getContinuousParameters

        public ContinuousParameters getContinuousParameters() throws DeviceException
        Specified by:
        getContinuousParameters in interface BufferedDetector
        Returns:
        ContinuousParameters
        Throws:
        DeviceException
      • getNumberFrames

        public int getNumberFrames() throws DeviceException
        Specified by:
        getNumberFrames in interface BufferedDetector
        Returns:
        number of frames of data in memory which have been collected
        Throws:
        DeviceException
      • readFrames

        public Object[] readFrames(int startFrame, int finalFrame) throws DeviceException
        Description copied from interface: BufferedDetector
        An array of the data from the detector. Each element is one frame of data. The first frame is 0.
        Specified by:
        readFrames in interface BufferedDetector
        Parameters:
        startFrame -
        finalFrame -
        Returns:
        Object
        Throws:
        DeviceException
      • readAllFrames

        public Object[] readAllFrames() throws DeviceException
        Description copied from interface: BufferedDetector
        An array of the data from the detector. Each element is one frame of data.
        Specified by:
        readAllFrames in interface BufferedDetector
        Returns:
        Object
        Throws:
        DeviceException
      • maximumReadFrames

        public int maximumReadFrames() throws DeviceException
        Description copied from interface: BufferedDetector
        As certain detectors may cause memory issues if too many frames are attempted to be read in one go, this is the maximum for this detector based on its current configuration (i.e. after setContinuousMode(True) has been called.

        The lowest value returned from any of the detectors in a continuous scan will be the limit set.

        If there is no limit then this method should return Integer.MAX_VALUE.

        Specified by:
        maximumReadFrames in interface BufferedDetector
        Returns:
        int - the maximum number of frames which should be read at any one time from this detector
        Throws:
        DeviceException
      • getScannable

        public Scannable getScannable()
      • setScannable

        public void setScannable(Scannable scannable)
      • getOutputFormat

        public String[] getOutputFormat()
        Description copied from interface: Scannable
        Returns an array of strings which are the format strings to use when pretty printing parts of the output
        Specified by:
        getOutputFormat in interface Scannable
        Overrides:
        getOutputFormat in class ScannableBase
        Returns:
        string array
      • getExtraNames

        public String[] getExtraNames()
        Description copied from interface: Scannable
        Additional names for extra values that returned by getPosition().
        Specified by:
        getExtraNames in interface Scannable
        Overrides:
        getExtraNames in class ScannableBase
        Returns:
        array of names of the extra elements if the array returned by getPosition is larger than the array required by moveTo