Class MandelbrotDetector

All Implemented Interfaces:
INexusDevice<NXdetector>, IActivatable, IPausableDevice<MandelbrotModel>, IResettableDevice, IRunnableDevice<MandelbrotModel>, IRunnableEventDevice<MandelbrotModel>, IWritableDetector<MandelbrotModel>, IDeviceRoleActor, IConfigurable<MandelbrotModel>, ILevel, IModelProvider<MandelbrotModel>, INameable, IScanAttributeContainer, IValidator<MandelbrotModel>

A dummy detector which must be set up with references to two Scannables representing X and Y positions. When used in a step scan, this detector generates a value of 0 if the point (x, y) is in the Mandelbrot set, and greater than zero otherwise.

Note: values will always be high if used at (x, y) positions more than 2 units away from the origin.

  • Field Details

  • Constructor Details

  • Method Details

    • clean

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

      public void configure(MandelbrotModel model) throws ScanningException
      Description copied from interface: IConfigurable
      Call to configure the device. If the model provided is invalid, a scanning exception will be thrown.
      Specified by:
      configure in interface IConfigurable<MandelbrotModel>
      Overrides:
      configure in class AbstractRunnableDevice<MandelbrotModel>
      Parameters:
      model -
      Throws:
      ScanningException
    • run

      public void run(IPosition pos) 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<MandelbrotModel>
      Throws:
      ScanningException
      InterruptedException
    • write

      public boolean write(IPosition pos) throws ScanningException
      Description copied from interface: IWritableDetector
      For GDA9 detectors, returns a boolean for the readout completed, true for complete, false for error. Generally detectors running in GDA9 will be IDetector. For GDA8 detectors, the readout will be overridden.
      Specified by:
      write in interface IWritableDetector<MandelbrotModel>
      Returns:
      true for a successful readout. If false the events will not be fired and the scan will continue.
      Throws:
      ScanningException
    • _isScanFinallyCalled

      public boolean _isScanFinallyCalled()