Interface INexusDevice<N extends NXobject>
- Type Parameters:
N- the type of nexus object to be created, a sub-interface ofNXobject, e.g.NXdetector
- All Known Subinterfaces:
IGDAScannableNexusDevice<N>,INexusDeviceDecorator<N>,INexusMetadataDevice<N>,IWritableNexusDevice<N>
- All Known Implementing Classes:
AbstractAreaDetectorRunnableDevice,AbstractDetectorNexusDeviceAdapter,AbstractMalcolmDevice,AbstractNexusContextAppender,AbstractNexusDecorator,AbstractNexusDeviceAdapter,AbstractNexusMetadataDevice,AbstractScannableNexusDevice,AbstractTransformationsAppender,AbstractWriteRegionsImmediatelyNXDetector,AreaDetectorRunnableDevice,AreaDetectorRunnableDeviceProxy,AreaDetectorRunnableDeviceWaitForArray,AreaDetectorWritingFilesRunnableDevice,BeamNexusDevice,BeforeScanSnapshotWriter,CalibrationFrameCollector,CompositeNexusScannable,CompoundNexusContextAppender,ConfiguredScannableNexusDevice,ConstantVelocityDevice,CounterTimerNexusDevice,DarkImageDetector,DefaultScannableNexusDevice,DetectorCollectionScannable,DetectorTransformationsAppender,DummyMalcolmDevice,DummyMalcolmTriggeredDetector,ElectronAnalyserRunnableDevice,FileCreatorDetectorNexusDevice,FrameCollectingScannable,GenericDetectorNexusDevice,InsertionDeviceNexusDevice,JythonScannableNexusWrapper,LegacyNexusDetectorNexusDevice,MalcolmDevice,MandelbrotDetector,MeasurementGroupWriter,MockNeXusScannable,MockNeXusSlit,MockStringNexusScannable,MonochromatorNexusDevice,NexusDetectorNexusDevice,NexusMetadataAppender,NexusMetadataDevice,NexusNodeCopyAppender,NexusObjectAppender,NexusScanMetadataWriter,NexusSlitsWrapper,NexusTemplateAppender,NexusTemplateDevice,NXObjectScannable,NXSampleScannable,PosDetector,PositionerTransformationsAppender,ProcessingMalcolmDevice,RandomIntDetector,RandomLineDevice,RunnableDeviceProxy,ScannableNexusWrapper,SimpleNexusDevice,SimpleNexusMetadataAppender,SimpleNexusMetadataDevice,SolsticeScanMetadataWriter,SourceNexusDevice,SpecsPhoibosSolsticeAnalyser,UserNexusDevice,VGScientaAnalyserNXDetector,XmapRunnableDevice,XmapRunnableDeviceBase,XmapWritingFilesRunnableDevice,ZebraRunnableDevice
AbstractNexusObjectProvider-
Method Summary
Modifier and TypeMethodDescriptiondefault CustomNexusEntryModificationReturns an object that performs a custom modification to anNXentry.getName()Returns the name of this nexus device.default NexusObjectProvider<N> Returns the object provider required for writing correct NeXus files.default List<NexusObjectProvider<N>> Returns the object providers required for writing correct NeXus files.default voidregister()Registers thisINexusDevicewith theINexusDeviceService.
-
Method Details
-
getName
String getName()Returns the name of this nexus device.- Returns:
- name of nexus device
-
getNexusProvider
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
NexusNodeFactoryto create a NeXus object which matches the device e.g. aNXdetector.final NXdetector detector = NexusNodeFactory.createNXdetector();On the detector object you can create
In this method you can also write static metadata such as the detector exposure e.g.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 theLazyDatasets you create e.g.imageData.setChunking(info.createChunk(detectorXSize, detectorYSize));.detector.setField("exposure_time", model.getExposure());. Or static datasets such as the image axis datadetector.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"));ordetector.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 thesetXXXScalarmethods for fields defined in the appropriate NXDL base class definition.The default implementation of this method throws
UnsupportedOperationException. One of either this method orgetNexusProviders(NexusScanInfo)must be overridden to create and return the nexus object(s) for thisINexusDevice.- Parameters:
info- information about the scan which can be useful when creating datasets e.g.info.getRank()- Returns:
- The
NXobjectcreated using thenodeFactoryto represent this device - Throws:
NexusException- if the nexus object could not be created for any reason
-
getNexusProviders
Returns the object providers required for writing correct NeXus files. Implement this method if your device needs to create multiple nexus objects. These can implementNexusObjectProviderThe default implementation of this method calls
getNexusProvider(NexusScanInfo)and returns aListwhose sole element is theNexusObjectProviderreturned from that method. One of either this method orgetNexusProviders(NexusScanInfo)must be overridden to create and return the nexus object(s) for thisINexusDevice.- Parameters:
info- information about the scan which can be useful when creating datasets e.g.info.getRank()- Returns:
- The
NXobjectcreated using thenodeFactoryto represent this device - Throws:
NexusException- if the nexus object could not be created for any reason
-
getCustomNexusModification
Returns an object that performs a custom modification to anNXentry.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
NXdatagroups. 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
, so this method create links to nodes created in that method if appropriate.invalid reference
#createNexusObject(NexusNodeFactory, NexusScanInfo)The easiest way to implement this method is to make this object itself also implement
CustomNexusEntryModification. This method can then be overridden to simply returnthis.- Returns:
- a
CustomNexusEntryModificationthat makes a custom modification, ornullif this device should not make custom modifications
-
register
default void register()Registers thisINexusDevicewith theINexusDeviceService. Clients may use this to registerINexusDevices to be looked up later by name. Note that this is not necessary for most devices, if they can be found some other way. It is however nec forINexusDeviceDecorators to call this method in order to decorate a device with the same name whenis called, for example a device that adds metadata.invalid reference
INexusDeviceService#getNexusDevice(INexusDevice)
-