Class XspressHdfWriter
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.scannable.ScannableBase
uk.ac.gda.devices.detector.xspress4.XspressHdfWriter
- All Implemented Interfaces:
Device,Scannable,Configurable,Findable,gda.observable.IObservable
Create an hdf file with various 1-dimensional datasets in it; datasets grow slowly.
Created with SWMR mode enabled so that SwmrFileReader *should* be able to open it
and retrieve latest datasets as they grow... for testing Xspress4BufferedDetector,
since although simulated area detector creates Hdf file, it is not similar enough to
Xspress hdf file to be useful for testing...
-
Field Summary
Fields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidasynchronousMoveTo(Object position) Trigger a move/operation and return immediately.intintintintdoublebooleanisBusy()Check if the Scannable is moving/operating.boolean[Consider abstract] Read the position in its internal (user) representation.voidsetDatasetNames(List<String> datasetNames) voidsetDefaultDataNameFormat(String defaultDataNameFormat) voidSet the default list of dataset names to match Xspress3,4 NDAttribute datasets :
Chan1Sca0, Chan1Sca1, Chan0Sca2...voidsetFileName(String fileName) voidsetNumElements(int numElements) voidsetNumFrames(int numFrames) voidsetNumFramesToAppendEachTime(int numFramesToAppendEachTime) voidsetNumScalers(int numScalers) voidsetPathToGroup(String pathToGroup) voidsetTimePerFrame(double timePerFrame) voidsetWrite2dData(boolean write2dData) voidstop()Stop the current move/operation.voidStart writing data to hdf file asynchronously and return immediately.voidWrite data into hdf file.Methods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, externalToInternal, getExtraNames, getInputNames, getLevel, getOutputFormat, getPosition, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, throwExceptionIfInvalidTarget, toFormattedString, toString, validateScannable, valueUnavailableString, waitWhileBusy, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
configure, isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObservers
-
Constructor Details
-
XspressHdfWriter
public XspressHdfWriter()
-
-
Method Details
-
asynchronousMoveTo
Description copied from class:ScannableBaseTrigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.- Specified by:
asynchronousMoveToin interfaceScannable- Overrides:
asynchronousMoveToin classScannableBase- Parameters:
position- Position to move to should have an element for each input field.
-
rawGetPosition
Description copied from class:ScannableBase[Consider abstract] Read the position in its internal (user) representation.- Overrides:
rawGetPositionin classScannableBase- Returns:
- the value represented by this Scannable
- Throws:
DeviceException- See Also:
-
setDefaultNames
public void setDefaultNames()Set the default list of dataset names to match Xspress3,4 NDAttribute datasets :
Chan1Sca0, Chan1Sca1, Chan0Sca2... Chan2Sca0, Chan2Sca1 etc...Ranges of the loops over channel and scaler number are set by
andinvalid reference
numChannelsnumScalers(channel starts from 1, scalers start from 0). -
writeData
public void writeData()Start writing data to hdf file asynchronously and return immediately. (callswriteHdfFile()in background thread). -
writeHdfFile
public void writeHdfFile() throws NexusException, InterruptedException, org.eclipse.january.DatasetExceptionWrite data into hdf file.numFramesof data will be written for each dataset name given indatasetNames. Up tonumFramesframes of data will be written, with pause oftimePerFramebetween each frame. UsegetCurrentFrameNumber()to monitor progress and callstop()to writing to stop writing frames early.- Throws:
NexusExceptionInterruptedExceptionorg.eclipse.january.DatasetException- See Also:
-
isBusy
public boolean isBusy()Description copied from interface:ScannableCheck if the Scannable is moving/operating.- Returns:
- true - if operation carried out by moveTo has not completed yet
-
stop
public void stop()Description copied from class:ScannableBaseStop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
stopin interfaceScannable- Overrides:
stopin classScannableBase- See Also:
-
getFileName
-
setFileName
-
getTimePerFrame
public double getTimePerFrame() -
setTimePerFrame
public void setTimePerFrame(double timePerFrame) -
getNumFrames
public int getNumFrames() -
setNumFrames
public void setNumFrames(int numFrames) -
getCurrentFrameNumber
public int getCurrentFrameNumber() -
getDatasetNames
-
setDatasetNames
-
getPathToGroup
-
setPathToGroup
-
getNumScalers
public int getNumScalers() -
setNumScalers
public void setNumScalers(int numScalers) -
getNumElements
public int getNumElements() -
setNumElements
public void setNumElements(int numElements) -
setNumFramesToAppendEachTime
public void setNumFramesToAppendEachTime(int numFramesToAppendEachTime) -
getDefaultDataNameFormat
-
setDefaultDataNameFormat
-
isWrite2dData
public boolean isWrite2dData() -
setWrite2dData
public void setWrite2dData(boolean write2dData)
-