Class DummyDetector

All Implemented Interfaces:
Detector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, Serializable
Direct Known Subclasses:
DummyHardwareTriggeredDetector, DummyHardwareTriggerProvider, DummyNexusDetector, SimpleDummyNexusDetector

public class DummyDetector extends DetectorBase

A Dummy detector that will create random data at each point. It supports collection time so it will "acquire" for as long as requested.

It is intended to be the detector equivalent of DummyScannable used for testing scanning. e.g

   ds = DummyScannable('ds')
   dd = DummyDetector('dd')
   scan ds 0 10 1 dd 0.1
 
See Also:
  • Field Details

    • random

      protected final Random random
  • Constructor Details

    • DummyDetector

      public DummyDetector()
      No arg constructor for subclasses and Spring. Does not configure.
    • DummyDetector

      public DummyDetector(String name)
      Constructor for easy use from Jython e.g.
       dd = DummyDetector('dd')
      Constructs and configures the detector
      Parameters:
      name -
  • Method Details

    • 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.
      Returns:
      true if readout() returns filenames
      Throws:
      DeviceException
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Overrides:
      reconfigure in class ConfigurableBase
      Throws:
      FactoryException
    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default implementation for classes that do not have to do any specific configuration.
      Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • 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.
      Throws:
      DeviceException
    • acquireData

      protected Object acquireData()
    • waitWhileBusy

      public void waitWhileBusy() throws DeviceException, InterruptedException
      Description copied from class: ScannableBase
      Returns when operation carried out by moveTo has completed If this is to be overriden, isBusy must also be valid. Although the pos and scan command currently use this method to determine if the Scannable is busy, this must not be relied upon.
      Specified by:
      waitWhileBusy in interface Detector
      Specified by:
      waitWhileBusy in interface Scannable
      Overrides:
      waitWhileBusy in class ScannableBase
      Throws:
      DeviceException
      InterruptedException
    • getStatus

      public int getStatus() throws DeviceException
      Description copied from interface: Detector
      Returns the current collecting state of the device.
      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.

      Returns:
      the data collected
      Throws:
      DeviceException
    • getDescription

      public String getDescription() throws DeviceException
      Specified by:
      getDescription in interface Detector
      Overrides:
      getDescription in class DetectorBase
      Returns:
      A description of the detector.
      Throws:
      DeviceException
    • getDetectorID

      public String getDetectorID() throws DeviceException
      Specified by:
      getDetectorID in interface Detector
      Overrides:
      getDetectorID in class DetectorBase
      Returns:
      A identifier for this detector.
      Throws:
      DeviceException
    • getDetectorType

      public String getDetectorType() throws DeviceException
      Specified by:
      getDetectorType in interface Detector
      Overrides:
      getDetectorType in class DetectorBase
      Returns:
      The type of detector.
      Throws:
      DeviceException
    • getMaxDataValue

      public double getMaxDataValue()
    • setMaxDataValue

      public void setMaxDataValue(double maxDataValue)
      Sets the max data value. The data returned will be between 0 and this value
      Parameters:
      maxDataValue -
    • setRandomSeed

      public void setRandomSeed(long seed)
      Allows the random seed to be set for reproducible testing.
      Parameters:
      seed -