Class NXDetectorData

java.lang.Object
gda.device.detector.NXDetectorData
All Implemented Interfaces:
NexusTreeProvider, PlottableDetectorData, GDANexusDetectorData, Serializable
Direct Known Subclasses:
NXDetectorDataWithFilepathForSrs

public class NXDetectorData extends Object implements GDANexusDetectorData
Basic class which wrappers up a lot of nexus calls so that detectors can integrate more easily
See Also:
  • Field Details

  • Constructor Details

    • NXDetectorData

      public NXDetectorData(String[] extraNames, String[] outputFormat, String detectorName)
    • NXDetectorData

      public NXDetectorData(Scannable detector)
      Passing in the detector helps setting up the plotable data array and does some useful checking
      Parameters:
      detector -
    • NXDetectorData

      public NXDetectorData()
      Basic constructor
    • NXDetectorData

      public NXDetectorData(INexusTree tree)
      Constructor, which is based on an initial NexusTree
      Parameters:
      tree -
  • Method Details

    • getNexusTree

      public INexusTree getNexusTree()
      Specified by:
      getNexusTree in interface NexusTreeProvider
      Returns:
      the nexustree
    • getDetTree

      public INexusTree getDetTree(String detName)
      returns the names detectors tree
      Specified by:
      getDetTree in interface GDANexusDetectorData
      Parameters:
      detName - if null or empty it returns the first
      Returns:
      the NexusTree associated with the named detector
    • addData

      public INexusTree addData(String parent, NexusGroupData data)
      Parameters:
      parent -
      data -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String parent, NexusGroupData data, String units)
      Parameters:
      parent -
      data -
      units -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String parent, String dataName, NexusGroupData data)
      Parameters:
      parent -
      data -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String parent, String dataName, NexusGroupData data, String units)
      Parameters:
      parent -
      dataName -
      data -
      units -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String parent, String dataName, NexusGroupData data, String units, boolean isDetectorEntryData)
      Parameters:
      parent -
      dataName -
      data -
      units -
      isDetectorEntryData -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String parent, NexusGroupData data, String units, Integer signalVal)
      Parameters:
      parent -
      data -
      units -
      signalVal -
      Returns:
      The node added.
    • addData

      public static INexusTree addData(INexusTree parent, String dataName, NexusGroupData data, String units, Integer signalVal)
      Parameters:
      parent -
      dataName -
      data -
      units -
      signalVal -
      Returns:
      The node added.
    • addData

      public INexusTree addData(String detName, String dataName, NexusGroupData data, String units, Integer signalVal)
    • addData

      public INexusTree addData(String detName, NexusGroupData data, String units, Integer signalVal, String interpretation)
      Adds the specified data to the named detector
      Parameters:
      detName - The name of the detector to add data to
      data - The implementation of NexusGroupData to be reported as the data
      units - - if not null a units attribute is added
      signalVal - - if not null a signal attribute is added
    • addData

      public INexusTree addData(String detName, String dataName, NexusGroupData data, String units, Integer signalVal, String interpretation)
      Adds the specified data to the named detector
      Parameters:
      detName - The name of the detector to add data to
      data - The implementation of NexusGroupData to be reported as the data
      units - - if not null a units attribute is added
      signalVal - - if not null a signal attribute is added
      interpretation - - if not null an interpretation string
    • addData

      public INexusTree addData(String detName, String dataName, NexusGroupData data, String units, Integer signalVal, String interpretation, boolean isPointDependent)
    • addData

      public static INexusTree addData(INexusTree parent, String dataName, NexusGroupData data, String units, Integer signalVal, String interpretation, boolean isPointDependent)
    • addFileName

      public void addFileName(String detName, String filename)
      Add the string as a NXNote - used when the detector writes data to a file itself to be agglomerated into the NExus file later.
      Parameters:
      detName - The name of the detector to add data to
      filename - filename
    • addFileNames

      public NexusTreeNode addFileNames(String detName, String nodeName, String[] filenames, boolean isPointDependent, boolean isDetectorEntryData)
      Adds a DATA_FILE_SDS_NAME SDS item for the collection of filenames as a child of the portion of the tree for a detector. This is useful when a detector creates its own data file or a collection of data files
      Parameters:
      detName - The name of the detector to add data to
      nodeName - The name of the created
      filenames - filenames collection of filenames to add to section
      isPointDependent - boolean to signal is the data is to be provided for each point in a scan.
      isDetectorEntryData - Flag to indicate that when writing this value to a file the entry is to linked to the NXEntry/NXDetector section as a variable of the scan
    • addScanFileLink

      @Deprecated(since="GDA 9.21") public void addScanFileLink(String detName, String linkTargetPath)
      Deprecated.
      use addExternalFileLink(String, String, int) instead as NexusScanDataWriter requires the rank of the external data node in order to correctly tag the NXdata group according to the 2014 format.
      Create exactly one file link under a node named "data".
      Parameters:
      detName - the detector name
      linkTargetPath - the path of the node to link to in the external file in the format nxfile://externalFilePath#nodePathWithinFile", getFilepath(), getInternalPath()
    • addExternalFileLink

      public void addExternalFileLink(String detName, String linkTargetPath, int dataRank)
      Create exactly one file link under a node named "data". Note: This method should not be called
      Parameters:
      detName - the detector name
      linkTargetPath - the path of the node to link to in the external file in the format nxfile://externalFilePath#nodePathWithinFile", getFilepath(), getInternalPath()
    • addExternalFileLink

      @Deprecated(since="GDA 9.21") public void addExternalFileLink(String detName, String linkNodeName, String linkTargetPath, boolean isPointDependent, boolean isDetectorEntryData)
      Deprecated.
      use the version of this method that takes dataRank, as this is required by NexusScanDataWriter
      Create a link node with the given name to the given external file path.
      Parameters:
      detName - the detector name
      linkNodeName - the name of the link node in the detector tree
      linkTargetPath - the path of the node to link to in the external file in the format nxfile://externalFilePath#nodePathWithinFile", getFilepath(), getInternalPath()
    • addExternalFileLink

      public void addExternalFileLink(String detName, String linkNodeName, String linkTargetPath, int dataRank)
      Create a link node with the given name to the given external file path.
      Parameters:
      detName - the detector name
      linkNodeName - the name of the link node in the detector tree
      linkTargetPath - the path of the node to link to in the external file in the format nxfile://externalFilePath#nodePathWithinFile", getFilepath(), getInternalPath()
      dataRank - the rank of the external dataset, required by NexusScanDataWriter for correct tagging of the NXdata group according to the 2014 format.
    • addExternalFileLink

      @Deprecated(since="GDA 9.21") public void addExternalFileLink(String detName, String linkNodeName, String linkTargetPath, boolean isPointDependent, boolean isDetectorEntryData, int dataRank)
      Deprecated.
      call addExternalFileLink(String, String, String, int) instead, as isPointDependent is always ignored and NexusDataWriter also ignores isDetectorEntryData (NexusScanDataWriter does not).
      Create a link node with the given name to the given external file path.
      Parameters:
      detName - the detector name
      linkNodeName - the name of the link node in the detector tree
      linkTargetPath - the path of the node to link to in the external file in the format nxfile://externalFilePath#nodePathWithinFile", getFilepath(), getInternalPath()
      isPointDependent - ignored as we simply create a link
      isDetectorEntryData - true for the linked data set to also be linked to from an NXdata group, false otherwise. Note that NexusDataWriter
      dataRank - the rank of the external dataset, required by NexusScanDataWriter for correct tagging of the NXdata group according to the 2014 format.
    • addAxis

      public void addAxis(String detName, String name, NexusGroupData axis_sds, Integer axisValue, Integer primaryValue, String units, boolean isPointDependent)
      Adds the specified Axis to the named detector. Note: This method tags the
      Parameters:
      detName - The name of the detector to add data to
      name - The name of the Axis
      axis_sds - The implementation of NexusGroupData to be reported as the axis data
      axisValue - The dimension which this axis relates to from the detector point of view, i.e. 1 is the first detector axis, scan dimensions will be added as required by the DataWriter
      primaryValue - The importance of this axis, 1 is the most relevant, then 2 etc.
      units - The units the axis is specified in
      isPointDependent - If this data should be added to the nexus at every point set this to true, if its a one off, make this false
    • addElement

      public void addElement(String detName, String name, NexusGroupData axisSDS, String units, boolean isPointDependent)
      Adds the specified Axis to the named detector
      Parameters:
      detName - The name of the detector to add data to
      name - The name of the Axis
      axisSDS - The values of the Axis, i.e the actual values
      units - The units the axis is specified in
      isPointDependent - If this data should be added to the nexus at every point set this to true, if its a one off, make this false
    • addNote

      public void addNote(String detName, String note)
      Adds a simple note to the detector
      Parameters:
      detName - the name of the detector
      note - the string contents of the note
    • addNote

      public void addNote(INexusTree detTree, String note)
      Adds a simple note to the detector
      Parameters:
      detTree -
      note -
    • getData

      public NexusGroupData getData(String detName, String dataName, String className)
      Specified by:
      getData in interface GDANexusDetectorData
      Parameters:
      detName -
      dataName - name of the child whose data is to be returned. If null or empty the first detector entry is used
      className - class name of the child whose data is to be returned e.g. NexusExtractor.SDSClassName
      Returns:
      NexusGroupData
    • setPrioritisedData

      public void setPrioritisedData(String detName, String dataName, String className)
      Specified by:
      setPrioritisedData in interface GDANexusDetectorData
      Parameters:
      detName -
      dataName - name of the child whose data should have their priority changed.
      className - class name of the child whose data is to be changed e.g. NexusExtractor.SDSClassName
    • setPlottableValue

      public void setPlottableValue(String forExtraName, Double value)
      Sets the Double in the PlottableDataArray the is associated with the passed in extraName to the value handed in.
      Parameters:
      forExtraName -
      value -
    • getDoubleVals

      public Double[] getDoubleVals()
      Specified by:
      getDoubleVals in interface PlottableDetectorData
      Returns:
      Array of doubles - the length must match the length of the detector's extraNames. null items are allowed and will not be plotted.
    • setDoubleVals

      @Deprecated(since="GDA 8.32") public void setDoubleVals(Double[] vals)
      Deprecated.
      Use this to set the plottable Double values, if you prefer that over the convenience methods that use the scannable constructor of this class. Consider checking your extraNames and providing an outputFormat as well then. Using this method makes it difficult in inheriting classes to provide additional information, hence the use is not recommended. Use setPlottableValue instead.
      Parameters:
      vals -
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOutputFormat

      public String[] getOutputFormat()
      Specified by:
      getOutputFormat in interface GDANexusDetectorData
    • getExtraNames

      public String[] getExtraNames()
      Specified by:
      getExtraNames in interface GDANexusDetectorData
    • mergeIn

      Specified by:
      mergeIn in interface GDANexusDetectorData