Class NeXusUtils

java.lang.Object
gda.data.nexus.NeXusUtils

public class NeXusUtils extends Object
Utility methods for dealing with NeXus files.
  • Constructor Details

    • NeXusUtils

      public NeXusUtils()
  • Method Details

    • getRank

      public static int getRank(Detector detector) throws DeviceException
      Returns the number of dimensions (rank) required for the data section in a NeXus file. e.g. A single channel counterTimer would have a rank=1. A multi channel counterTimer would have a rank=2. A two dimensional detector (CCD) would have a rank=3.
      Parameters:
      detector -
      Returns:
      int
      Throws:
      DeviceException
    • getRank

      public static int getRank(int[] detectorDataDimensions)
      Returns the number of dimensions (rank) required for the data section in a NeXus file. e.g. A single channel counterTimer would have a rank=1. A multi channel counterTimer would have a rank=2. A two dimensional detector (CCD) would have a rank=3.
      Parameters:
      detectorDataDimensions -
      Returns:
      int
    • getRank

      public static int getRank(int width, int height)
      Returns the number of dimensions (rank) required for the data section in a NeXus file. e.g. A single channel counterTimer would have a rank=1. A multi channel counterTimer would have a rank=2. A two dimensional detector (CCD) would have a rank=3.
      Parameters:
      width -
      height -
      Returns:
      int
    • getDim

      public static int[] getDim(Detector detector) throws DeviceException
      Returns the dimensions array for a given detector that can be used by the NeXus API to create a data section.
      Parameters:
      detector -
      Returns:
      int[]
      Throws:
      DeviceException
    • getDim

      public static int[] getDim(int[] dimension)
      Returns the dimensions array for a given width/height of data that can be used by the NeXus API to create a data section.
      Parameters:
      dimension -
      Returns:
      int[]
    • writeXESraw

      public static void writeXESraw(NexusFile file, String entryName) throws NexusException, IOException
      Routine for writing the elements required for the XESraw definition to a given NX_ENTRY
      Parameters:
      file -
      entryName -
      Throws:
      NexusException
      IOException
    • write_NXinstrument

      public static void write_NXinstrument(NexusFile file, GroupNode group) throws NexusException
      Creates an NXinstrument entry at the current position in the NeXus file.
      Parameters:
      file - The NeXus file handle
      group -
      Throws:
      NexusException
    • write_NXuser

      public static void write_NXuser(NexusFile file, GroupNode group) throws NexusException
      Creates an NXuser(s) entry at the current position in the NeXus file.
      Parameters:
      file - The NeXus file handle
      group -
      Throws:
      NexusException
    • write_NXsource

      public static void write_NXsource(NexusFile file, GroupNode group) throws NexusException
      Parameters:
      file -
      Throws:
      NexusException
    • findMetaItems

      public static boolean findMetaItems(ArrayList<String> list) throws DeviceException
      Parameters:
      list -
      Returns:
      true if any of the items in the list are defined in the metadata list.
      Throws:
      DeviceException
    • write_NXmonochromator

      public static void write_NXmonochromator(NexusFile file, GroupNode group) throws NexusException
      Parameters:
      file -
      Throws:
      NexusException
    • write_NXinsertion_device

      public static void write_NXinsertion_device(NexusFile file, GroupNode group) throws NexusException
      Parameters:
      file -
      Throws:
      NexusException
    • write_NXbending_magnet

      public static void write_NXbending_magnet(NexusFile file, GroupNode group) throws NexusException
      Parameters:
      file -
      group -
      Throws:
      NexusException
    • write_NXsample

      public static void write_NXsample(NexusFile file, GroupNode group) throws NexusException
      Parameters:
      file -
      Throws:
      NexusException
    • writeSAS

      public static void writeSAS(NexusFile file, String entryName)
      Routine for writing the elements required for Small Angle Scattering definition to a given NX_ENTRY.
      Parameters:
      file -
      entryName -
    • writeXAS

      public static void writeXAS(NexusFile file, String entryName)
      Routine for writing the elements required for XAS/EXAFS definition to a given NX_ENTRY.
      Parameters:
      file -
      entryName -