Class XspressHdfWriter

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

public class XspressHdfWriter extends ScannableBase
Create an hdf file with various 1-dimensional datasets in it; datasets grow slowly. Created with SWMR mode enabled so that SwmrFileReader *should* be able to open it and retrieve latest datasets as they grow... for testing Xspress4BufferedDetector, since although simulated area detector creates Hdf file, it is not similar enough to Xspress hdf file to be useful for testing...
  • Constructor Details

    • XspressHdfWriter

      public XspressHdfWriter()
  • Method Details

    • asynchronousMoveTo

      public void asynchronousMoveTo(Object position)
      Description copied from class: ScannableBase
      Trigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.
      Specified by:
      asynchronousMoveTo in interface Scannable
      Overrides:
      asynchronousMoveTo in class ScannableBase
      Parameters:
      position - Position to move to should have an element for each input field.
    • rawGetPosition

      public Object rawGetPosition() throws DeviceException
      Description copied from class: ScannableBase
      [Consider abstract] Read the position in its internal (user) representation.
      Overrides:
      rawGetPosition in class ScannableBase
      Returns:
      the value represented by this Scannable
      Throws:
      DeviceException
      See Also:
    • setDefaultNames

      public void setDefaultNames()
      Set the default list of dataset names to match Xspress3,4 NDAttribute datasets :
      Chan1Sca0, Chan1Sca1, Chan0Sca2... Chan2Sca0, Chan2Sca1 etc...

      Ranges of the loops over channel and scaler number are set by

      invalid reference
      numChannels
      and numScalers (channel starts from 1, scalers start from 0).
    • writeData

      public void writeData()
      Start writing data to hdf file asynchronously and return immediately. (calls writeHdfFile() in background thread).
    • writeHdfFile

      public void writeHdfFile() throws NexusException, InterruptedException, org.eclipse.january.DatasetException
      Write data into hdf file. numFrames of data will be written for each dataset name given in datasetNames. Up to numFrames frames of data will be written, with pause of timePerFrame between each frame. Use getCurrentFrameNumber() to monitor progress and call stop() to writing to stop writing frames early.
      Throws:
      NexusException
      InterruptedException
      org.eclipse.january.DatasetException
      See Also:
      • invalid reference
        #writeData()
    • isBusy

      public boolean isBusy()
      Description copied from interface: Scannable
      Check if the Scannable is moving/operating.
      Returns:
      true - if operation carried out by moveTo has not completed yet
    • stop

      public void stop()
      Description copied from class: ScannableBase
      Stop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      stop in interface Scannable
      Overrides:
      stop in class ScannableBase
      See Also:
    • getFileName

      public String getFileName()
    • setFileName

      public void setFileName(String fileName)
    • getTimePerFrame

      public double getTimePerFrame()
    • setTimePerFrame

      public void setTimePerFrame(double timePerFrame)
    • getNumFrames

      public int getNumFrames()
    • setNumFrames

      public void setNumFrames(int numFrames)
    • getCurrentFrameNumber

      public int getCurrentFrameNumber()
    • getDatasetNames

      public List<String> getDatasetNames()
    • setDatasetNames

      public void setDatasetNames(List<String> datasetNames)
    • getPathToGroup

      public String getPathToGroup()
    • setPathToGroup

      public void setPathToGroup(String pathToGroup)
    • getNumScalers

      public int getNumScalers()
    • setNumScalers

      public void setNumScalers(int numScalers)
    • getNumElements

      public int getNumElements()
    • setNumElements

      public void setNumElements(int numElements)
    • setNumFramesToAppendEachTime

      public void setNumFramesToAppendEachTime(int numFramesToAppendEachTime)
    • getDefaultDataNameFormat

      public String getDefaultDataNameFormat()
    • setDefaultDataNameFormat

      public void setDefaultDataNameFormat(String defaultDataNameFormat)
    • isWrite2dData

      public boolean isWrite2dData()
    • setWrite2dData

      public void setWrite2dData(boolean write2dData)