Package gda.data.scan.datawriter
Class NexusScanDataWriter
java.lang.Object
gda.data.scan.datawriter.DataWriterBase
gda.data.scan.datawriter.NexusScanDataWriter
- All Implemented Interfaces:
DataWriter,IDataWriterExtender,INexusDataWriter
This nexus data writer makes use of the new nexus writing framework in the project
org.eclipse.dawnsci.nexus. Note, a new instance of this class should be
created for each scan.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringBoolean property specifying whether nxs/dat filenames should be prefixed with the beamline name; iftrue, files will be named (e.g.)"i23-999.nxs"instead of just"999.nxs"static final StringBoolean property specifying whether to create the nexus file at the start of the scan rather than after the first point (i.e.static final StringThe name of theNXentry.static final StringBoolean property specifying whether to enable SWMR mode (Single Write Multiple Read).static final StringCallLocalProperties.set(String, String)with property nameLocalProperties.GDA_DATA_SCAN_DATAWRITER_DATAFORMATand this value to use this nexus writer.Fields inherited from class gda.data.scan.datawriter.DataWriterBase
delimiter, header, terminalPrinter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddData(IScanDataPoint point) for incremental addition of datavoidCalled when data collection has been completedvoidconfigureScanNumber(int scanNumber) If filenumber not set then read from scandatapoint or from num trackerGet the absFilePath for this scanintGet the current scan identifier (ie scan number)Returns the full path of the folder which data files are written to.The file name of the nexus file being written by this writer.Returns aSwmrStatusobject specifying the state of SWMR mode (single-write multiple-read) for the nexus file written by this writer.voidCalled at the start of the scan with aScanInformationobject describing the scan (i.e.voidsetBeforeScanMetaData(INexusTree beforeScanMetadata) Add anINexusTreeto be written as before scan metadata.voidSets the header of the datahandlervoidsetNexusFileNameTemplate(String fileNameTemplate) Sets the template to use for the filename.Methods inherited from class gda.data.scan.datawriter.DataWriterBase
addData, addDataWriterExtender, completeCollection, getDetectorData, getDetectorData, getHeader, removeDataWriterExtender, setHeaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.data.scan.datawriter.DataWriter
addDataWriterExtender, getHeader, removeDataWriterExtender, setHeader
-
Field Details
-
PROPERTY_VALUE_DATA_FORMAT_NEXUS_SCAN
CallLocalProperties.set(String, String)with property nameLocalProperties.GDA_DATA_SCAN_DATAWRITER_DATAFORMATand this value to use this nexus writer. -
PROPERTY_NAME_BEAMLINE_PREFIX
Boolean property specifying whether nxs/dat filenames should be prefixed with the beamline name; iftrue, files will be named (e.g.)"i23-999.nxs"instead of just"999.nxs"- See Also:
-
PROPERTY_NAME_WRITE_SWMR
Boolean property specifying whether to enable SWMR mode (Single Write Multiple Read). If enabled, it is not possible to change the structure of the Nexus file after SWMR mode is enabled - this is done when the file is created by the first call toaddData(IScanDataPoint).- See Also:
-
PROPERTY_NAME_ENTRY_NAME
The name of theNXentry. By default the name 'entry' is used.NexusDataWriteruses the name 'entry1'. Setting this property to 'entry1' will allow the use of scripts and tools with that value hard-coded. This should be a temporary measure, the name 'entry' should be considered to be the Diamond standard.- See Also:
-
PROPERTY_NAME_CREATE_FILE_AT_SCAN_START
Boolean property specifying whether to create the nexus file at the start of the scan rather than after the first point (i.e. the first call toaddData(IScanDataPoint)). Detectors in a scan must implementIWritableNexusDeviceor overrideDetector.getFileStructure()to be compatible.- See Also:
-
FIELD_NAME_BEAMLINE
- See Also:
-
FIELD_NAME_END_STATION
- See Also:
-
DEFAULT_ENTRY_NAME
- See Also:
-
METADATA_ENTRY_NAME_INSTRUMENT
- See Also:
-
-
Constructor Details
-
NexusScanDataWriter
public NexusScanDataWriter()
-
-
Method Details
-
getCurrentFileName
Description copied from interface:DataWriterGet the absFilePath for this scan- Specified by:
getCurrentFileNamein interfaceDataWriter- Returns:
- String
-
getCurrentScanIdentifier
public int getCurrentScanIdentifier()Description copied from interface:DataWriterGet the current scan identifier (ie scan number)- Specified by:
getCurrentScanIdentifierin interfaceDataWriter- Returns:
- String
-
configureScanNumber
public void configureScanNumber(int scanNumber) Description copied from class:DataWriterBaseIf filenumber not set then read from scandatapoint or from num tracker- Specified by:
configureScanNumberin interfaceDataWriter- Overrides:
configureScanNumberin classDataWriterBase- Parameters:
scanNumber-
-
setNexusFileNameTemplate
Description copied from interface:INexusDataWriterSets the template to use for the filename. This should use the stringString.format(String, Object...)pattern, with a single format specifier%s, e.g.ixx-%d.nxs.- Specified by:
setNexusFileNameTemplatein interfaceINexusDataWriter- Parameters:
fileNameTemplate-
-
getNexusFileName
Description copied from interface:INexusDataWriterThe file name of the nexus file being written by this writer.- Specified by:
getNexusFileNamein interfaceINexusDataWriter- Returns:
- file name of nexus file
-
getDataDir
Description copied from interface:INexusDataWriterReturns the full path of the folder which data files are written to.- Specified by:
getDataDirin interfaceINexusDataWriter- Returns:
- the full path of the folder which data files are written
-
getSwmrStatus
Description copied from interface:INexusDataWriterReturns aSwmrStatusobject specifying the state of SWMR mode (single-write multiple-read) for the nexus file written by this writer. See the javadoc forSwmrStatusfor details.- Specified by:
getSwmrStatusin interfaceINexusDataWriter- Returns:
- the
SwmrStatus
-
setHeader
Description copied from interface:DataWriterSets the header of the datahandler- Specified by:
setHeaderin interfaceDataWriter- Parameters:
header- String
-
setBeforeScanMetaData
Description copied from interface:INexusDataWriterAdd anINexusTreeto be written as before scan metadata. TODO: do we need this method. It doesn't seem to be used, but may potentially be useful?- Specified by:
setBeforeScanMetaDatain interfaceINexusDataWriter- Parameters:
beforeScanMetadata-
-
scanStart
public void scanStart(ScanInformation scanInfo, List<Scannable> scannables, List<Detector> detectors) throws NexusException Description copied from interface:DataWriterCalled at the start of the scan with aScanInformationobject describing the scan (i.e. detector names, scannable names, scan dimensions) as well as the actual scannable and detector objects themselves- Specified by:
scanStartin interfaceDataWriter- Parameters:
scanInfo- describes the scanscannables- the scannables in the scandetectors- the detectors in the scan- Throws:
NexusException
-
addData
Description copied from interface:DataWriterfor incremental addition of data- Specified by:
addDatain interfaceDataWriter- Overrides:
addDatain classDataWriterBase- Parameters:
point- Object- Throws:
Exception
-
completeCollection
Description copied from interface:DataWriterCalled when data collection has been completed- Specified by:
completeCollectionin interfaceDataWriter- Overrides:
completeCollectionin classDataWriterBase- Throws:
Exception
-