Class DummyCounterTimer

All Implemented Interfaces:
CounterTimer, Detector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, gda.observable.IObserver, Serializable, Runnable

public class DummyCounterTimer extends TFGCounterTimer implements Runnable, gda.observable.IObserver
Can be used as a substitute for a CounterTimer for testing purposes. Not all the methods work though it can be used in scans and will produce either totally random data or a set of Gaussians depending on the setting of the useGaussian flag. The widths and heights of the Gaussians and a level of random noise applied to them are all controlled by xml parameters.
See Also:
  • Constructor Details

    • DummyCounterTimer

      public DummyCounterTimer()
      Constructor.
  • Method Details

    • 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 CounterTimerBase
      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.
      Specified by:
      collectData in interface Detector
      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
    • countAsync

      public void countAsync(double time)
    • 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
      Overrides:
      getStatus in class CounterTimerBase
      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
      See Also:
    • isTimeChannelRequired

      public boolean isTimeChannelRequired()
      Returns:
      boolean timeChannelRequired
    • setTimeChannelRequired

      public void setTimeChannelRequired(boolean timeChannelRequired)
      Parameters:
      timeChannelRequired -
    • start

      public void start() throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer this initiates framing.
      Specified by:
      start in interface CounterTimer
      Overrides:
      start in class CounterTimerBase
      Throws:
      DeviceException
    • addFrameSet

      public void addFrameSet(int frameCount, double requestedLiveTime, double requestedDeadTime) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer a single frameSet object is created for a specified live and dead time. A count for identical frames is specified by the frameCount.
      Specified by:
      addFrameSet in interface CounterTimer
      Overrides:
      addFrameSet in class CounterTimerBase
      Parameters:
      frameCount - number of frames required of this type
      requestedLiveTime - frame live time in milliseconds
      requestedDeadTime - frame dead time in milliseconds
      Throws:
      DeviceException
    • addFrameSet

      public void addFrameSet(int frameCount, double requestedLiveTime, double requestedDeadTime, int deadPort, int livePort, int deadPause, int livePause) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer a single frameSet object is created for a specified live and dead time. A count for identical frames is specified by the frameCount.
      Specified by:
      addFrameSet in interface CounterTimer
      Overrides:
      addFrameSet in class CounterTimerBase
      Parameters:
      frameCount - requested number of frames required of this type
      requestedLiveTime - requested frame live time in milliseconds
      requestedDeadTime - requested frame dead time in milliseconds
      deadPort - wait period output level 0 or 1
      livePort - run period output level 0 or 1
      deadPause - pause before wait period 0 or 1
      livePause - pause before run period 0 or 1
      Throws:
      DeviceException
    • clearFrameSets

      public void clearFrameSets() throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer all current frameSets are cleared.
      Specified by:
      clearFrameSets in interface CounterTimer
      Overrides:
      clearFrameSets in class CounterTimerBase
      Throws:
      DeviceException
    • readChans

      public double[] readChans()
    • readChannel

      public double[] readChannel(int startFrame, int frameCount, int channel) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer read out a specified channel, beginning from the specified start frame number using the requested frame count.
      Specified by:
      readChannel in interface CounterTimer
      Parameters:
      startFrame - starting frame number (1st=0)
      frameCount - number of frames to read the counter data out from
      channel - read this channel
      Returns:
      array of requested readout counter-timer data
      Throws:
      DeviceException
    • readFrame

      public double[] readFrame(int startChannel, int channelCount, int frame) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer read out a specified frame, beginning from the specified start channel number using the requested channel count.
      Specified by:
      readFrame in interface CounterTimer
      Parameters:
      startChannel - starting channel number (1st=0)
      channelCount - number of channels to read the counter data out from
      frame - read this frame
      Returns:
      array of requested readout counter-timer data
      Throws:
      DeviceException
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • setCollectionTime

      public void setCollectionTime(double collectionTime) throws DeviceException
      Overrides the DetectorBase method in order to set up the counters for the dummy data. This is the only place to do this but means that the dummy data mechanisms really only work in scans.
      Specified by:
      setCollectionTime in interface Detector
      Overrides:
      setCollectionTime in class DetectorBase
      Parameters:
      collectionTime - the collectionTime in mS
      Throws:
      DeviceException
    • getNoiseLevel

      public double getNoiseLevel()
      Returns:
      Returns the noiseLevel.
    • setNoiseLevel

      public void setNoiseLevel(double noiseLevel)
      Parameters:
      noiseLevel - The noiseLevel to set.
    • getGaussianWidth

      public double getGaussianWidth()
      Returns:
      Returns the gaussianWidth.
    • setGaussianWidth

      public void setGaussianWidth(double gaussianWidth)
      Parameters:
      gaussianWidth - The gaussianWidth to set.
    • getGaussianHeight

      public double getGaussianHeight()
      Returns:
      Returns the gaussianHeight.
    • setGaussianHeight

      public void setGaussianHeight(double gaussianHeight)
      Parameters:
      gaussianHeight - The gaussianHeight to set.
    • isUseGaussian

      public boolean isUseGaussian()
      Returns:
      Returns the useGaussian.
    • setUseGaussian

      public void setUseGaussian(boolean useGaussian)
      Parameters:
      useGaussian - The useGaussian to set.
    • update

      public void update(Object theObserved, Object changeCode)
      Specified by:
      update in interface gda.observable.IObserver
    • getDataDecimalPlaces

      public int getDataDecimalPlaces()
      Returns:
      number of decimal places
    • setDataDecimalPlaces

      public void setDataDecimalPlaces(int dataDecimalPlaces)
      Parameters:
      dataDecimalPlaces -
    • isReadoutFileName

      public boolean isReadoutFileName()
      Returns:
      readout filename
    • setReadoutFileName

      public void setReadoutFileName(boolean readoutFileName)
      Parameters:
      readoutFileName -
    • prepareForCollection

      public void prepareForCollection(Scan scan)
    • clearAndStart

      public void clearAndStart()
    • 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
    • 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
    • getTotalChans

      public int getTotalChans()
    • setTotalChans

      public void setTotalChans(int totalChans)