Class ADDetector
- All Implemented Interfaces:
Detector,NexusDetector,Device,Scannable,PositionCallableProvider<NexusTreeProvider>,Configurable,Findable,gda.observable.IObservable,Serializable,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
AdDetectorExtRoiDraw,ADPco,AravisCamera,HardwareTriggerableADDetector,VGScientaAnalyser,VGScientaAnalyserCamOnly
Scannable Detector driver for Epics Area Detectors suitable for use within Scans that support detectors implementing
PositionCallableProvider.
The NexusTreeProvider returned by the call method of the PositionCallableProvider implements GDANexusDetectorData which provides plottable
and printable data as well as binary detector data and detector metadata. If configured to return filepaths the object supports
NXDetectorDataWithFilepathForSrs which will result in the filepath being returned as the first Scannable extra field and printed to the terminal and
SRS files.
- A Base plugin that supports the source of the data, e.g. camera, The base is used to setup the acquisition, exposure time trigger mode, and start/stop acquisition. The result of an acquisition is a chunk of binary data.
- A NDArray plugin that makes the binary data available over channel access.
- A file writer plugin that will write the binary data to a file of some format. Either 1 file per acquisition or 1 file per collection of acquisitions.
- Camera base + PV
- Camera base + file writer
NXCollectionStrategyPlugin- used to handle the camera baseNDArray- handles the PV to read the binary dataNXFileWriterPlugin- used to handle the file writer plugin
getPositionCallable() is the creation of an object that has sufficient information to allow creation of a NexusTreeProvider in
its call method. This object can take data from:
- The NDArray object if present and selected
- An NDStats, that represents the NDStats plugin, if present and selected
- The ADTriggeringStrategy object if selected
- The FileWriter if selected
- Another NexusTreeProvider that provides meta data if present.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final Stringprotected booleanFields inherited from class gda.device.detector.DetectorBase
collectionTimeFields 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, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDoubleItemToNXData(NXDetectorData data, String name, Double val) protected final voidaddMultipleDoubleItemsToNXData(NXDetectorData data, String[] nameArray, Double[] valArray) voidprotected voidappendDataAxes(NXDetectorData data) This stub adds rather stupid axes.protected voidvoidasynchronousMoveTo(Object collectionTime) Default implementation is to set the collection time and to call the collectData methodvoidHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred.voidCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).voidCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)protected voidvoidTells the detector to begin to collect a set of data, then returns immediately.voidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.protected voidExtra name for each element in the stats and centroid statistics, if the instance is set to compute these.protected Stringprotected NXDetectorDatabooleanReturns a value which indicates whether the detector creates its own files.final voidDefault which should be overridden by subclasses.int[]Returns the current position of the Scannable.intReturns the current collecting state of the device.booleanisBusy()Check if the Scannable is moving/operating.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidfinal voidDefault which should be overridden by subclasses.readout()Returns the latest data collected as well as general detector informationprotected voidreadoutArrayIntoNXDetectorData(NXDetectorData data, NDArray ndArray, String detectorName) voidreset()voidvoidsetCheckFileExists(boolean checkFileExists) voidsetCollectionStrategy(NXCollectionStrategyPlugin collectionStrategy) voidsetComputeCentroid(boolean computeCentroid) voidsetComputeStats(boolean computeStats) voidsetDataChunking(int[] dataChunking) voidsetDescription(String description) voidsetDetectorID(String detectorID) voidsetDetectorType(String detectorType) voidsetDisableCallbacks(boolean disableCallbacks) voidsetFileWriter(NXFileWriterPlugin fileWriter) voidsetMetaDataProvider(NexusTreeProvider metaDataProvider) voidsetNdArray(NDArray ndArray) voidvoidsetNdOverlays(List<NDOverlaySimple> ndOverlays) voidsetNdPython(NDPython ndPython) voidsetNdStats(NDStats ndStats) voidsetReadAcquisitionPeriod(boolean readAcquisitionPeriod) voidsetReadAcquisitionTime(boolean readAcquisitionTime) voidsetReadArray(boolean readArray) voidsetReadCapturedFramesCount(boolean readCapturedFramesCount) voidsetReadFilepath(boolean readFilepath) voidsetUsePipeline(boolean usePipeline) voidstop()Stop the current move/operation.voidReturns when operation carried out by moveTo has completedMethods inherited from class gda.device.detector.DetectorBase
checkPositionValid, getCollectionTime, getDataDimensions, setCollectionTime, toFormattedStringMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, atScanLineStart, externalToInternal, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, throwExceptionIfInvalidTarget, toString, validateScannable, valueUnavailableString, 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
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
isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Detector
getCollectionTime, getDataDimensions, getFileStructure, setCollectionTimeMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanLineEnd, atScanLineStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, toFormattedString
-
Field Details
-
FILEPATH_EXTRANAME
- See Also:
-
afterPropertiesSetCalled
protected boolean afterPropertiesSetCalled -
firstReadoutInScan
protected boolean firstReadoutInScan
-
-
Constructor Details
-
ADDetector
public ADDetector()
-
-
Method Details
-
setCollectionStrategy
-
setAdBase
-
setNdStats
-
setNdArray
-
setNdFile
-
setNdPython
-
setNdOverlays
-
setDescription
-
setDetectorType
-
setComputeStats
public void setComputeStats(boolean computeStats) -
setComputeCentroid
public void setComputeCentroid(boolean computeCentroid) -
setReadArray
public void setReadArray(boolean readArray) -
setReadAcquisitionTime
public void setReadAcquisitionTime(boolean readAcquisitionTime) -
setReadAcquisitionPeriod
public void setReadAcquisitionPeriod(boolean readAcquisitionPeriod) -
setReadFilepath
public void setReadFilepath(boolean readFilepath) -
getCollectionStrategy
-
getAdBase
-
getNdStats
-
getNdArray
-
getNdFile
-
getNdPython
-
getNdOverlays
-
isComputeStats
public boolean isComputeStats() -
isComputeCentroid
public boolean isComputeCentroid() -
isReadArray
public boolean isReadArray() -
isReadAcquisitionTime
public boolean isReadAcquisitionTime() -
isReadAcquisitionPeriod
public boolean isReadAcquisitionPeriod() -
isReadFilepath
public boolean isReadFilepath() -
createsOwnFiles
Description copied from interface:DetectorReturns a value which indicates whether the detector creates its own files. If it does (return true) the readout() method returns the name of the latest file created as a string. If it does not (return false) the readout() method will return the data directly.- Specified by:
createsOwnFilesin interfaceDetector- Returns:
- true if readout() returns filenames
- Throws:
DeviceException
-
getMetaDataProvider
-
setMetaDataProvider
-
getFileWriter
-
setFileWriter
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
reset
- Throws:
Exception
-
configureExtraNamesAndOutputFormat
protected void configureExtraNamesAndOutputFormat()Extra name for each element in the stats and centroid statistics, if the instance is set to compute these. -
asynchronousMoveTo
Description copied from class:DetectorBaseDefault implementation is to set the collection time and to call the collectData method- Specified by:
asynchronousMoveToin interfaceScannable- Overrides:
asynchronousMoveToin classDetectorBase- Parameters:
collectionTime- Position to move to should have an element for each input field.- Throws:
DeviceException- See Also:
-
isBusy
Description copied from class:DetectorBaseCheck if the Scannable is moving/operating. default implementation is to call the getStatus method- Specified by:
isBusyin interfaceScannable- Overrides:
isBusyin classDetectorBase- Returns:
- true - if operation carried out by moveTo has not completed yet
- Throws:
DeviceException- See Also:
-
getPosition
Description copied from class:DetectorBaseReturns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it. Also, if createsOwnFiles attempts to register the file with all FileRegistrars (primarily for data archiving). Note that this method will be called if the detector is triggered from a 'pos' command but not if the detector is triggered by the scan command (which ignores the detector's scannable interface).- Specified by:
getPositionin interfaceScannable- Overrides:
getPositionin classDetectorBase- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException- See Also:
-
prepareForCollection
Description copied from class:DetectorBaseDefault which should be overridden by subclasses.- Specified by:
prepareForCollectionin interfaceDetector- Overrides:
prepareForCollectionin classDetectorBase- Throws:
DeviceException- See Also:
-
atScanStart
Description copied from class:ScannableBaseCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanStartin interfaceScannable- Overrides:
atScanStartin classScannableBase- Throws:
DeviceException- See Also:
-
collectData
Description copied from interface:DetectorTells the detector to begin to collect a set of data, then returns immediately. Should cause the hardware to start collecting immediately: if there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.- Specified by:
collectDatain interfaceDetector- Throws:
DeviceException
-
endCollection
Description copied from class:DetectorBaseDefault which should be overridden by subclasses.- Specified by:
endCollectionin interfaceDetector- Overrides:
endCollectionin classDetectorBase- Throws:
DeviceException- See Also:
-
atScanEnd
Description copied from class:ScannableBaseCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See
Scannable.atCommandFailure()Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanEndin interfaceScannable- Overrides:
atScanEndin classScannableBase- Throws:
DeviceException- See Also:
-
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- Throws:
DeviceException- See Also:
-
atCommandFailure
Description copied from class:ScannableBaseHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred. However not called when the command is aborted using an InterruptionException. If a Scan is aborted then onlyScannable.stop()will be called by the Scan or pos command.Useful for telling Scannables which hold state during a scan for example, to reset themselves. Used for example by CoordinatedMotionScannables. This hook should be used not in the same way as the stop hook. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
- Specified by:
atCommandFailurein interfaceScannable- Overrides:
atCommandFailurein classScannableBase- Throws:
DeviceException- See Also:
-
prepareForArrayAndStatsCollection
- Throws:
DeviceException
-
getStatus
Description copied from interface:DetectorReturns the current collecting state of the device.- Specified by:
getStatusin interfaceDetector- Returns:
- BUSY if the detector has not finished the requested operation(s), IDLE if in an completely idle state and STANDBY if temporarily suspended.
- Throws:
DeviceException
-
waitWhileBusy
Description copied from class:ScannableBaseReturns when operation carried out by moveTo has completed If this is to be overriden, isBusy must also be valid. Although the pos and scan command currently use this method to determine if the Scannable is busy, this must not be relied upon.- Specified by:
waitWhileBusyin interfaceDetector- Specified by:
waitWhileBusyin interfaceScannable- Overrides:
waitWhileBusyin classScannableBase- Throws:
InterruptedExceptionDeviceException
-
getDescription
- Specified by:
getDescriptionin interfaceDetector- Overrides:
getDescriptionin classDetectorBase- Returns:
- A description of the detector.
- Throws:
DeviceException
-
getDetectorID
- Specified by:
getDetectorIDin interfaceDetector- Overrides:
getDetectorIDin classDetectorBase- Returns:
- A identifier for this detector.
- Throws:
DeviceException
-
setDetectorID
-
getDetectorType
- Specified by:
getDetectorTypein interfaceDetector- Overrides:
getDetectorTypein classDetectorBase- Returns:
- The type of detector.
- Throws:
DeviceException
-
clearCachedCallable
protected void clearCachedCallable() -
addDoubleItemToNXData
-
addMultipleDoubleItemsToNXData
protected final void addMultipleDoubleItemsToNXData(NXDetectorData data, String[] nameArray, Double[] valArray) -
readout
Description copied from interface:NexusDetectorReturns the latest data collected as well as general detector information- Specified by:
readoutin interfaceDetector- Specified by:
readoutin interfaceNexusDetector- Returns:
- the data collected
- Throws:
DeviceException
-
createFileName
- Throws:
Exception
-
setDisableCallbacks
public void setDisableCallbacks(boolean disableCallbacks) -
isDisableCallbacks
public boolean isDisableCallbacks() -
isUsePipeline
public boolean isUsePipeline() -
setUsePipeline
public void setUsePipeline(boolean usePipeline) -
isCheckFileExists
public boolean isCheckFileExists() -
setCheckFileExists
public void setCheckFileExists(boolean checkFileExists) -
getPositionCallable
- Specified by:
getPositionCallablein interfacePositionCallableProvider<NexusTreeProvider>- Throws:
DeviceException
-
createNXDetectorData
- Throws:
ExceptionDeviceException
-
appendDataAxes
This stub adds rather stupid axes. Overriding classes are highly encouraged to do better.- Parameters:
data-- Throws:
Exception
-
readoutArrayIntoNXDetectorData
protected void readoutArrayIntoNXDetectorData(NXDetectorData data, NDArray ndArray, String detectorName) throws Exception, DeviceException - Throws:
ExceptionDeviceException
-
getDataChunking
public int[] getDataChunking() -
setDataChunking
public void setDataChunking(int[] dataChunking) -
appendNXDetectorDataFromCollectionStrategy
- Throws:
Exception
-
isReadCapturedFramesCount
public boolean isReadCapturedFramesCount() -
setReadCapturedFramesCount
public void setReadCapturedFramesCount(boolean readCapturedFramesCount)
-