Class DummyMalcolmTriggeredDetector<T extends DummyMalcolmTriggeredModel>

java.lang.Object
org.eclipse.scanning.api.AbstractNameable
org.eclipse.scanning.api.device.AbstractRunnableDevice<T>
org.eclipse.scanning.example.malcolm.DummyMalcolmTriggeredDetector<T>
All Implemented Interfaces:
EventListener, INexusDevice<NXdetector>, IActivatable, IPausableDevice<T>, IResettableDevice, IRunnableDevice<T>, IRunnableEventDevice<T>, IDeviceRoleActor, IConfigurable<T>, ILevel, IModelProvider<T>, INameable, IScanAttributeContainer, IValidator<T>, IMalcolmEventListener

public class DummyMalcolmTriggeredDetector<T extends DummyMalcolmTriggeredModel> extends AbstractRunnableDevice<T> implements INexusDevice<NXdetector>, IMalcolmEventListener
A detector that can run alongside a malcolm device and writes data when the malcolm device performs a point of the inner scan. This simulates a real device that received hardware triggers when running alongside a malcolm device.
  • Constructor Details

  • Method Details

    • run

      public void run(IPosition position) throws ScanningException, InterruptedException
      Description copied from interface: IRunnableDevice
      Blocking call to execute the scan. The position specified may be null.
      Specified by:
      run in interface IRunnableDevice<T extends DummyMalcolmTriggeredModel>
      Throws:
      ScanningException
      InterruptedException
    • validate

      public T validate(T model) throws ValidationException
      Description copied from class: AbstractRunnableDevice
      If overriding don't forget the old super.validate(...)
      Specified by:
      validate in interface IValidator<T extends DummyMalcolmTriggeredModel>
      Overrides:
      validate in class AbstractRunnableDevice<T extends DummyMalcolmTriggeredModel>
      Parameters:
      model - - a model of type T to validate
      Returns:
      a valid model
      Throws:
      ValidationException
    • scanStart

      public void scanStart(ScanBean scanBean, SubscanModerator subscanModerator) throws ScanningException
      Throws:
      ScanningException
    • scanFinally

      public void scanFinally()
    • postConfigure

      public void postConfigure(ScanInformation scanInformation) throws Exception
      Throws:
      Exception
    • pointStart

      public void pointStart(IPosition outerPoint)
    • getNexusProvider

      public NexusObjectProvider<NXdetector> 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<T extends DummyMalcolmTriggeredModel>
      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
    • eventPerformed

      public void eventPerformed(MalcolmEvent event)
      Description copied from interface: IMalcolmEventListener
      Called when Malcolm notifies the service that something happened.
      Specified by:
      eventPerformed in interface IMalcolmEventListener
      Parameters:
      event -
    • hardwareTriggerReceived

      public void hardwareTriggerReceived()
    • writeLine

      public void writeLine() throws org.eclipse.january.DatasetException
      Throws:
      org.eclipse.january.DatasetException