Package gda.hrpd.data

Class EpicsCVscanDataWriter

All Implemented Interfaces:
DataWriter, Configurable, Findable

public class EpicsCVscanDataWriter extends FindableConfigurableBase implements DataWriter
This class writes files of tabulated data from Multiple Analyser Crystal Detectors, along with a header and footer if needed, in ASCII format. The files created use names which are an increment from the last name.
  • Field Details

    • thisFileNumber

      protected int thisFileNumber
      the current file number being written to, which is managed by the NumTracker Class
    • fileExtension

      protected String fileExtension
      file extension to use
    • filePrefix

      protected String filePrefix
      file prefix to use (if any)
    • fileSuffix

      protected String fileSuffix
      file suffix to use (if any)
    • currentFileName

      protected String currentFileName
      the full file name of the current data file
  • Constructor Details

    • EpicsCVscanDataWriter

      public EpicsCVscanDataWriter()
      Constructor which determines the name of the next file and creates it.
  • Method Details

    • getSampleInfo

      public gda.hrpd.SampleInfo getSampleInfo()
    • setSampleInfo

      public void setSampleInfo(gda.hrpd.SampleInfo saminfo)
    • getBeamInfo

      public Beam getBeamInfo()
    • setBeamInfo

      public void setBeamInfo(Beam beam)
    • getBeamlineInfo

      public BeamlineInfo getBeamlineInfo()
    • setBeamlineInfo

      public void setBeamlineInfo(BeamlineInfo bli)
    • getMetadata

      public Metadata getMetadata()
    • setMetadata

      public void setMetadata(Metadata metadata)
    • configure

      public void configure()
      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
    • addData

      public void addData(IScanDataPoint dataPoint)
      Description copied from interface: DataWriter
      for incremental addition of data
      Specified by:
      addData in interface DataWriter
      Parameters:
      dataPoint - Object
    • addRawData

      public String addRawData(File file, int rows, ArrayList<Scannable> parentScannables, String motorName, ArrayList<Detector> allDetectors, double[] path1, int[][] data, double scantime, double monitorValue)
      MAC specific data writer
      Parameters:
      rows -
      parentScannables -
      motorName -
      allDetectors -
      path1 -
      data -
      scantime -
      Returns:
      filename
    • addRebinnedData

      public String addRebinnedData(File file, int rows, ArrayList<Scannable> parentScannables, double[] tth, double[] count, double[] counterror, double scantime, double monitorValue)
    • completeCollection

      public void completeCollection()
      Writes any file footers and closes file.
      Specified by:
      completeCollection in interface DataWriter
    • writeHeader

      public void writeHeader(FileWriter filewriter)
      Standard header for synchrotron experiments at beamline I11 at DLS written in the format of name/key-value pair, placed in between the markers of invalid input: '&DLS' and invalid input: '&END'
       &DLS
       <dt>
       CarouselNo=1
       SampleID=S537
       SampleName=Silicon
       Description='Silicon Standard'
       Title='Calibration SampleInfo Scan'
       Comment='any comments added by the users'
       RunNumber=245
       Date=dd-mmm-yy
       Time=hr:min:sec
       BeamlineInfo=I11
       Project=HRPD
       Experiment=MAC
       Wavelength=1.2
       Temperature=295
       SamplePosition=20.0
       </dt>
       &END
       
    • writeColumnHeadings

      public void writeColumnHeadings(FileWriter filewriter)
      This should be extended by inheriting classes.
    • writeFooter

      public void writeFooter()
      This should be extended by inheriting classes.
    • getDataDir

      public String getDataDir()
      Returns the full path of the folder which data files are written to.
      Returns:
      the full path of the folder which data files are written
    • getDelimiter

      public String getDelimiter()
      Get the delimiter used between columns
      Returns:
      the delimiter used between columns
    • setDelimiter

      public void setDelimiter(String delimiter)
      Set the delimiter used between columns (default is a tab '\t')
      Parameters:
      delimiter - String
    • getFileNumber

      public int getFileNumber()
      Returns the number of the last file written to.
      Returns:
      long
    • incrementFileNumber

      public int incrementFileNumber()
    • getCurrentFileName

      public String getCurrentFileName()
      return the scan file name with prefix and/or suffix if specified, without extension specifier.
      Specified by:
      getCurrentFileName in interface DataWriter
      Returns:
      root part of the MAC file name.
    • setHeader

      public void setHeader(String header)
      Description copied from interface: DataWriter
      Sets the header of the datahandler
      Specified by:
      setHeader in interface DataWriter
      Parameters:
      header - String
    • setComment

      public void setComment(String comment)
    • getCurrentScanIdentifier

      public int getCurrentScanIdentifier()
      Description copied from interface: DataWriter
      Get the current scan identifier (ie scan number)
      Specified by:
      getCurrentScanIdentifier in interface DataWriter
      Returns:
      String
    • addDataWriterExtender

      public void addDataWriterExtender(IDataWriterExtender dataWriterExtender)
      Description copied from interface: DataWriter
      Adds an additional IDataWriterExtender to handle DataWriter events
      Specified by:
      addDataWriterExtender in interface DataWriter
      Parameters:
      dataWriterExtender -
    • getHeader

      public ArrayList<String> getHeader()
      Description copied from interface: DataWriter
      header is a publicly accessible string which will be written to the file (or saved to a database) during the prepareForCollection method. Before this method is called, the header object may be added to using these accessor methods.
      Specified by:
      getHeader in interface DataWriter
      Returns:
      an ArrayList containing header information
    • removeDataWriterExtender

      public void removeDataWriterExtender(IDataWriterExtender dataWriterExtender)
      Description copied from interface: DataWriter
      Remove a IDataWriterExtender to handle DataWriter events.
      Specified by:
      removeDataWriterExtender in interface DataWriter
      Parameters:
      dataWriterExtender -
    • setHeader

      public void setHeader(ArrayList<String> header)
      Description copied from interface: DataWriter
      Sets the header of the datahandler
      Specified by:
      setHeader in interface DataWriter
      Parameters:
      header - ArrayList
    • configureScanNumber

      public void configureScanNumber(int scanNumber) throws Exception
      Description copied from interface: DataWriter
      method used to allow filewriter to configure the scanNumber based on the supplied value or internally if null It is called by the ScanBase.prepareScanForCollection
      Specified by:
      configureScanNumber in interface DataWriter
      Parameters:
      scanNumber -
      Throws:
      Exception