Class NexusScanMetadataWriter
- All Implemented Interfaces:
INexusDevice<NXcollection>
- Direct Known Subclasses:
SolsticeScanMetadataWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int[]protected org.eclipse.january.dataset.ILazyWriteableDatasetprotected org.eclipse.january.dataset.ILazyWriteableDatasetstatic final int[]protected org.eclipse.january.dataset.ILazyWriteableDatasetprotected org.eclipse.january.dataset.ILazyWriteableDatasetprotected org.eclipse.january.dataset.ILazyWriteableDatasetprotected org.eclipse.january.dataset.ILazyWriteableDatasetprotected org.eclipse.january.dataset.ILazyWriteableDatasetprotected NexusScanInfoprotected ZonedDateTimestatic final int[]The chunk size for single values needs to be 2, as 1 doesn't work, instead defaulting to 4096, which is 32k for double-type datasets.static final int[]protected org.eclipse.january.dataset.ILazyWriteableDataset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.january.dataset.DatasetcreateDataset(Object data, String datasetName) protected NXcollectioncreateNexusObject(NexusScanInfo scanInfo) Returns an object that performs a custom modification to anNXentry.getName()Returns the name of this nexus device.Returns the object provider required for writing correct NeXus files.booleanvoidmodifyEntry(NXentry entry) voidpointFinished(org.eclipse.january.dataset.SliceND scanSlice) voidpointStarted(org.eclipse.january.dataset.SliceND scanSlice) voidvoidsetHardwareScan(boolean hardwareScan) voidsetNexusObjectProviders(List<NexusObjectProvider<?>> nexusObjectProviders) voidsetNexusObjectProviders(Map<NexusScanInfo.ScanRole, List<NexusObjectProvider<?>>> nexusObjectProviderMap) voidsetStartTime(ZonedDateTime startTime) voidwritePosition(org.eclipse.january.dataset.SliceND scanSlice, int scanPointNum) protected voidwriteScalarData(String datasetName, org.eclipse.january.dataset.ILazyWriteableDataset dataset, Object data) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.dawnsci.nexus.INexusDevice
getNexusProviders, register
-
Field Details
-
SCALAR_SHAPE
public static final int[] SCALAR_SHAPE -
SINGLE_SHAPE
public static final int[] SINGLE_SHAPE -
ONE_D_UNLIMITED_SHAPE
public static final int[] ONE_D_UNLIMITED_SHAPE -
SINGLE_CHUNKING
public static final int[] SINGLE_CHUNKINGThe chunk size for single values needs to be 2, as 1 doesn't work, instead defaulting to 4096, which is 32k for double-type datasets. -
uniqueKeysDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset uniqueKeysDataset -
scanFinishedDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset scanFinishedDataset -
scanDurationDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset scanDurationDataset -
scanDeadTimeDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset scanDeadTimeDataset -
scanDeadTimePercentDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset scanDeadTimePercentDataset -
scanEndTimeDataset
protected org.eclipse.january.dataset.ILazyWriteableDataset scanEndTimeDataset -
pointStartTimeStamps
protected org.eclipse.january.dataset.ILazyWriteableDataset pointStartTimeStamps -
pointEndTimeStamps
protected org.eclipse.january.dataset.ILazyWriteableDataset pointEndTimeStamps -
scanInfo
-
scanStartTime
-
-
Constructor Details
-
NexusScanMetadataWriter
public NexusScanMetadataWriter() -
NexusScanMetadataWriter
-
-
Method Details
-
getName
Description copied from interface:INexusDeviceReturns the name of this nexus device.- Specified by:
getNamein interfaceINexusDevice<NXcollection>- Returns:
- name of nexus device
-
setHardwareScan
public void setHardwareScan(boolean hardwareScan) -
isHardwareScan
public boolean isHardwareScan() -
setNexusObjectProviders
public void setNexusObjectProviders(Map<NexusScanInfo.ScanRole, List<NexusObjectProvider<?>>> nexusObjectProviderMap) -
setNexusObjectProviders
-
getNexusProvider
Description copied from interface:INexusDeviceReturns 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 orINexusDevice.getNexusProviders(NexusScanInfo)must be overridden to create and return the nexus object(s) for thisINexusDevice.- Specified by:
getNexusProviderin interfaceINexusDevice<NXcollection>- 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
-
createNexusObject
-
writePosition
public void writePosition(org.eclipse.january.dataset.SliceND scanSlice, int scanPointNum) -
pointStarted
public void pointStarted(org.eclipse.january.dataset.SliceND scanSlice) -
pointFinished
public void pointFinished(org.eclipse.january.dataset.SliceND scanSlice) -
createDataset
-
scanFinished
- Throws:
NexusException
-
writeScalarData
protected void writeScalarData(String datasetName, org.eclipse.january.dataset.ILazyWriteableDataset dataset, Object data) throws NexusException - Throws:
NexusException
-
getCustomNexusModification
Description copied from interface:INexusDeviceReturns 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.- Specified by:
getCustomNexusModificationin interfaceINexusDevice<NXcollection>- Returns:
- a
CustomNexusEntryModificationthat makes a custom modification, ornullif this device should not make custom modifications
-
modifyEntry
-
setStartTime
-