All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generated.docs.javadoc.org.eclipse.dawnsci.nexus.INexusDevice.html Maven / Gradle / Ivy






INexusDevice (h5jan API)












org.eclipse.dawnsci.nexus

Interface INexusDevice<N extends NXobject>

  • Type Parameters:
    N - the type of nexus object to be created, a sub-interface of NXobject, e.g. NXdetector


    public interface INexusDevice<N extends NXobject>
    Any device which can write NeXus should implement this interface. This can be done easily by extending AbstractNexusObjectProvider
    • Method Detail

      • getNexusProvider

        NexusObjectProvider<N> getNexusProvider(NexusScanInfo info)
                                         throws NexusException
        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, Dataset.FLOAT64); 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(minX, maxX, xPoints, Dataset.FLOAT64)); 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.

        Parameters:
        info - Information about the scan which can be useful when creating dataset 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
      • getCustomNexusModification

        default CustomNexusEntryModification getCustomNexusModification()
        Returns an object that performs a custom modification to an NXentry.

        NOTE: Use this method with caution as it can be used to break the central design concept of the new Nexus writing framework, namely that the nexus framework itself knows where to put the nexus groups for devices and build any required NXdata groups. It is currently used by the new Nexus framework to partially support legacy GDA8 spring configurations, in particular the 'locationmap'.

        The nexus framework will call this method after #createNexusObject(NexusNodeFactory, NexusScanInfo), so this method create links to nodes created in that method if appropriate.

        The easiest way to implement this method is to make this object itself also implement CustomNexusEntryModification. This method can then be overridden to simply return this.

        Returns:
        a CustomNexusEntryModification that makes a custom modification, or null if this device should not make custom modifications




© 2015 - 2024 Weber Informatics LLC | Privacy Policy