Class DetectorCollectionScannable

All Implemented Interfaces:
Configurable, INexusDevice<NXcollection>, IActivatable, IBoundable<Object>, ILevel, INameable, IScanAttributeContainer, IScannable<Object>, ITimeoutable, ITolerable<Object>, IPositionListenable

public class DetectorCollectionScannable extends AbstractScannable<Object> implements INexusDevice<NXcollection>, Configurable
Class to allow a snapshot of latest detector data to be recorded in the Nexus file as metadata at the start of a scan.
  • Constructor Details

    • DetectorCollectionScannable

      public DetectorCollectionScannable()
  • Method Details

    • configure

      public void configure()
      Register with NexusDeviceService so NexusDataWriter can access it and use it to write metadata.
      Specified by:
      configure in interface Configurable
    • configureAndCollect

      public void configureAndCollect()
      This is invoked shortly before the main scan is configured - If no detector is set then throw an exception here to prevent issues when the snapshot is attempted to be taken
    • getNexusProvider

      public NexusObjectProvider<NXcollection> getNexusProvider(NexusScanInfo info) throws NexusException
      Description copied from interface: INexusDevice
      Returns the object provider required for writing correct NeXus files.

      In this method you should prepare the LazyDatasets the device will fill during the scan. You can also write out static device metadata, which will not change during the scan.

      Use the methods on NexusNodeFactory to create a NeXus object which matches the device e.g. a NXdetector. final NXdetector detector = NexusNodeFactory.createNXdetector();

      On the detector object you can create LazyDatasets and keep references which you can later use during the scan to write data. e.g. imageData = detector.initializeLazyDataset(NXdetector.NX_DATA, info.getRank() + 2, Double.class); You should also set chunking on the LazyDatasets you create e.g. imageData.setChunking(info.createChunk(detectorXSize, detectorYSize));.

      In this method you can also write static metadata such as the detector exposure e.g. detector.setField("exposure_time", model.getExposure());. Or static datasets such as the image axis data detector.setDataset("image_x_axis", DatasetFactory.createLinearSpace(DoubleDataset.class, minX, maxX, xPoints)); For fields that are defined in the NXDL base class definition for the returned nexus object, a setXXX or setXXXScalar method may be used as appropriate, e.g. detector.setLocalName(DatasetFactory.createFromObject("my detector")); or detector.setLocalNameScalar("my detector");

      If this device is a 'metadata scannable', then the device should write its data at this point directly into the returned nexus object. This can be done with the NXobject.setField(String, Object) method, or the setXXXScalar methods for fields defined in the appropriate NXDL base class definition.

      The default implementation of this method throws UnsupportedOperationException. One of either this method or INexusDevice.getNexusProviders(NexusScanInfo) must be overridden to create and return the nexus object(s) for this INexusDevice.

      Specified by:
      getNexusProvider in interface INexusDevice<NXcollection>
      Parameters:
      info - information about the scan which can be useful when creating datasets e.g. info.getRank()
      Returns:
      The NXobject created using the nodeFactory to represent this device
      Throws:
      NexusException - if the nexus object could not be created for any reason
    • getPosition

      public Object getPosition() throws ScanningException
      Description copied from interface: IBoundable
      The position is the value which should be: 1. Greater than or equal to the lower 2. Less than or equal to the upper. 3. One of the permitted values, if they are not null.
      Specified by:
      getPosition in interface IBoundable<Object>
      Returns:
      Throws:
      ScanningException - if the position cannot be read for any reason
    • setPosition

      public Object setPosition(Object value, IPosition position) throws ScanningException
      Description copied from interface: IScannable
      Moves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8
      Specified by:
      setPosition in interface IScannable<Object>
      Parameters:
      value - that this scalar should take.
      position - if within in a scan or null if not within a scan.
      Returns:
      the new position attained by the device, if known. (Saves additional call to getPosition()) If not know the demand value is returned. NOTE if null is returned the system will call getPosition() again.
      Throws:
      ScanningException
    • abort

      public void abort() throws ScanningException, InterruptedException
      Description copied from interface: IScannable
      Call to terminate a movement before it is complete, for example when ScannablePositioner#abort is called due to an exception with another IScannable's movement
      Specified by:
      abort in interface IScannable<Object>
      Throws:
      ScanningException
      InterruptedException
    • isConfigured

      public boolean isConfigured()
      Description copied from interface: Configurable
      Checks to see if the object is already configured.
      Specified by:
      isConfigured in interface Configurable
      Returns:
      return true if configured false otherwise
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Throws:
      FactoryException
    • isConfigureAtStartup

      public boolean isConfigureAtStartup()
      Description copied from interface: Configurable
      Indicates whether this object should be configured at startup.

      Moved from ConditionallyConfigurable which has been deleted

      Specified by:
      isConfigureAtStartup in interface Configurable
    • getGroupName

      public String getGroupName()
    • setGroupName

      public void setGroupName(String groupName)
    • getDetector

      public Detector getDetector()
    • setDetector

      public void setDetector(Detector detector)