Class NexusDetectorProcessor
- All Implemented Interfaces:
Detector,HardwareTriggerableDetector,HardwareTriggeredDetector,NexusDetector,Device,Scannable,PositionCallableProvider<GDANexusDetectorData>,Configurable,Findable,gda.observable.IObservable
-
Field Summary
Fields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIObserver(gda.observable.IObserver observer) voidasynchronousMoveTo(Object position) Trigger a move/operation and return immediately.voidHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred.voidvoidCalled by both the pos and scan commands at the start of each subsequent level move only on Scannables that will be moved as part that level's movement.voidCalled by both the pos and scan commands at the start of each subsequent level move on all Scannables that are part that level's movement.voidCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e.voidCalled on every Scannable at every data point, for scans which are broken down into individual points (i.e.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 end of every scanvoidCalled for every Scannable at the start of every scanvoidCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)checkPositionValid(Object position) Tests if the given object is meaningful to this Scannable and so could be used by one of the move commands.protected voidvoidclose()Close and unconfigure the device.voidTells the detector to begin to collect a set of data, then returns immediately.voidPerform operations that must be done after Spring initialisation i.e.booleanReturns a value which indicates whether the detector creates its own files.voiddeleteIObserver(gda.observable.IObserver observer) voidvoidMethod called at the end of collection to tell detector when a scan has finished.getAttribute(String attributeName) Get the value of the specified attributedoubleReturns the time, in seconds, the detector collects for during the next call to collectData()int[]Returns the dimensions of the data object returned by theDetector.readout()method.String[]Additional names for extra values that returned by getPosition().Get theHardwareTriggerProviderthat represents the controller this Detector is wired to.String[]gets a array of InputNames used by moveTo of this scannable.intgetLevel()get the operation level of this scannable.getName()Get the object name.String[]Returns an array of strings which are the format strings to use when pretty printing parts of the outputReturns the current position of the Scannable.intintReturns the current collecting state of the device.booleanDetectors that sample some value at the time of a trigger should return False.booleanTests if the scannable is at (or if appropriate, close to) the value positionToTest.booleanisBusy()Check if the Scannable is moving/operating.booleanIndicates whether this object should be configured at startup.booleanChecks to see if the object is already configured.booleanbooleanbooleanvoidTrigger a move/operation and block until completion.voidMethod called before a scan starts.readout()Returns the latest data collected as well as general detector informationvoidRe-initialisation of values and states.voidMethod to allow the correct setting of extraNames following enabling of processors Maybe the object should listen to the sub processorsvoidsetAttribute(String attributeName, Object value) Set any attribute the implementing classes may providevoidsetCollectionTime(double time) Sets the collection time, in seconds, to be used during the next call of collectData.voidsetDetector(NexusDetector detector) voidsetEnableProcessing(boolean enableProcessing) voidsetExtraNames(String[] names) Sets the array of names returned by getExtraNames of this scannable.voidsetHardwareTriggering(boolean b) Configure the Detector to trigger on hardware triggers, or not.voidsetInputNames(String[] names) sets the array of names returned by getInputNames method of this scannable.voidsetLevel(int level) Used for ordering the operations of Scannables during scansvoidsetMergeWithDetectorData(boolean mergeWithDetectorData) voidSet or change the name of the object (as defined in XML).voidsetNumberImagesToCollect(int numberImagesToCollect) Tell the detector how many scan points to collect.voidsetOutputFormat(String[] names) Sets the array of strings describing how best to format the positions from this scannablevoidsetProcessor(NexusTreeProviderProcessor processor) voidsetProtectionLevel(int newLevel) Sets the permission level for this object.voidstop()Stop the current move/operation.Returns a string representation of the Scannable and its current position/value/statustoString()voidWait while the detector collects data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.device.Detector
getFileStructureMethods inherited from interface gda.device.Scannable
getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, setScanMetadataAttribute, setScanMetadataAttributes
-
Constructor Details
-
NexusDetectorProcessor
public NexusDetectorProcessor()
-
-
Method Details
-
isEnableProcessing
public boolean isEnableProcessing() -
setEnableProcessing
public void setEnableProcessing(boolean enableProcessing) -
getDetector
-
setDetector
-
isMergeWithDetectorData
public boolean isMergeWithDetectorData() -
setMergeWithDetectorData
public void setMergeWithDetectorData(boolean mergeWithDetectorData) -
getProcessor
-
setProcessor
-
rescanProcessors
public void rescanProcessors()Method to allow the correct setting of extraNames following enabling of processors Maybe the object should listen to the sub processors -
clearProcessorCache
protected void clearProcessorCache() -
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML). -
configure
Description copied from interface:ConfigurablePerform operations that must be done after Spring initialisation i.e. anything that goes beyond setting member variables.- Specified by:
configurein interfaceConfigurable- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
isConfigured
public boolean isConfigured()Description copied from interface:ConfigurableChecks to see if the object is already configured.- Specified by:
isConfiguredin interfaceConfigurable- Returns:
- return
trueif configuredfalseotherwise
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Throws:
FactoryException
-
isConfigureAtStartup
public boolean isConfigureAtStartup()Description copied from interface:ConfigurableIndicates whether this object should be configured at startup.Moved from ConditionallyConfigurable which has been deleted
- Specified by:
isConfigureAtStartupin interfaceConfigurable
-
getPosition
Description copied from interface:ScannableReturns the current position of the Scannable. Called by ConcurentScan at the end of the point.- Specified by:
getPositionin interfaceScannable- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException
-
getName
Description copied from interface:FindableGet the object name. Used by Castor to check if the object name has been set before calling theFindable.setName(String)method. -
addIObserver
public void addIObserver(gda.observable.IObserver observer) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
setAttribute
Description copied from interface:DeviceSet any attribute the implementing classes may provide- Specified by:
setAttributein interfaceDevice- Parameters:
attributeName- is the name of the attributevalue- is the value of the attribute- Throws:
DeviceException- if an attribute cannot be set
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver observer) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
toString
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
getAttribute
Description copied from interface:DeviceGet the value of the specified attribute- Specified by:
getAttributein interfaceDevice- Parameters:
attributeName- is the name of the attribute- Returns:
- the value of the attribute as an Object type
- Throws:
DeviceException- if an attribute cannot be retrieved
-
moveTo
Description copied from interface:ScannableTrigger a move/operation and block until completion.- Specified by:
moveToin interfaceScannable- Parameters:
position-- Throws:
DeviceException
-
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
-
asynchronousMoveTo
Description copied from interface:ScannableTrigger 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.- Specified by:
asynchronousMoveToin interfaceScannable- Parameters:
position- Position to move to should have an element for each input field.- Throws:
DeviceException
-
setCollectionTime
Description copied from interface:DetectorSets the collection time, in seconds, to be used during the next call of collectData.- Specified by:
setCollectionTimein interfaceDetector- Parameters:
time- the collection time in seconds- Throws:
DeviceException
-
close
Description copied from interface:DeviceClose and unconfigure the device.- Specified by:
closein interfaceDevice- Throws:
DeviceException
-
setProtectionLevel
public void setProtectionLevel(int newLevel) Description copied from interface:DeviceSets the permission level for this object. If this is not set then a default value will be applied.- Specified by:
setProtectionLevelin interfaceDevice- Parameters:
newLevel-
-
getCollectionTime
Description copied from interface:DetectorReturns the time, in seconds, the detector collects for during the next call to collectData()- Specified by:
getCollectionTimein interfaceDetector- Returns:
- double
- 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
-
checkPositionValid
Description copied from interface:ScannableTests if the given object is meaningful to this Scannable and so could be used by one of the move commands. May check limits and other things too. This is the method called by scans on all points before the scan is run.- Specified by:
checkPositionValidin interfaceScannable- Parameters:
position-- Returns:
- null if position is valid, or returns a description if not.
- Throws:
DeviceException
-
getProtectionLevel
public int getProtectionLevel()- Specified by:
getProtectionLevelin interfaceDevice- Returns:
- int - the permission level for this object.
-
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
-
stop
Description copied from interface:ScannableStop the current move/operation.- Specified by:
stopin interfaceScannable- Throws:
DeviceException
-
isBusy
Description copied from interface:ScannableCheck if the Scannable is moving/operating.- Specified by:
isBusyin interfaceScannable- Returns:
- true - if operation carried out by moveTo has not completed yet
- Throws:
DeviceException
-
getDataDimensions
Description copied from interface:DetectorReturns the dimensions of the data object returned by theDetector.readout()method.- Specified by:
getDataDimensionsin interfaceDetector- Returns:
- the dimensions of the data object returned by the
Detector.readout()method - Throws:
DeviceException
-
waitWhileBusy
Description copied from interface:DetectorWait while the detector collects data. Should return as soon as the exposure completes and it is safe to move motors. i.e. counts must be safely latched either in hardware or software before returning.- Specified by:
waitWhileBusyin interfaceDetector- Specified by:
waitWhileBusyin interfaceScannable- Throws:
DeviceExceptionInterruptedException
-
prepareForCollection
Description copied from interface:DetectorMethod called before a scan starts. May be used to setup detector for collection, for example MAR345 uses this to erase.Note: it is recommended to not implement this method, but to implement one or both of
Scannable.atScanLineStart()orScannable.atScanStart()instead. Implementing this method may cause issues when the detector class is used in multi-dimensional scans.- Specified by:
prepareForCollectionin interfaceDetector- Throws:
DeviceException
-
isAt
Description copied from interface:ScannableTests if the scannable is at (or if appropriate, close to) the value positionToTest.- Specified by:
isAtin interfaceScannable- Parameters:
positionToTest- The position to compare the scannable's position to.- Returns:
- true if scannable is at positionToTest
- Throws:
DeviceException
-
endCollection
Description copied from interface:DetectorMethod called at the end of collection to tell detector when a scan has finished. Typically integrating detectors used in powder diffraction do not output until the end of the scan and need to be told when this happens.- Specified by:
endCollectionin interfaceDetector- Throws:
DeviceException
-
setLevel
public void setLevel(int level) Description copied from interface:ScannableUsed for ordering the operations of Scannables during scans -
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
-
getLevel
public int getLevel()Description copied from interface:Scannableget the operation level of this scannable. -
getInputNames
Description copied from interface:Scannablegets a array of InputNames used by moveTo of this scannable.- Specified by:
getInputNamesin interfaceScannable- Returns:
- array of the names of the elements of the object returned by getPosition
-
setInputNames
Description copied from interface:Scannablesets the array of names returned by getInputNames method of this scannable.- Specified by:
setInputNamesin interfaceScannable- Parameters:
names-
-
getDescription
- Specified by:
getDescriptionin interfaceDetector- Returns:
- A description of the detector.
- Throws:
DeviceException
-
getExtraNames
Description copied from interface:ScannableAdditional names for extra values that returned by getPosition().- Specified by:
getExtraNamesin interfaceScannable- Returns:
- array of names of the extra elements if the array returned by getPosition is larger than the array required by moveTo
-
getDetectorID
- Specified by:
getDetectorIDin interfaceDetector- Returns:
- A identifier for this detector.
- Throws:
DeviceException
-
getDetectorType
- Specified by:
getDetectorTypein interfaceDetector- Returns:
- The type of detector.
- Throws:
DeviceException
-
setExtraNames
Description copied from interface:ScannableSets the array of names returned by getExtraNames of this scannable.- Specified by:
setExtraNamesin interfaceScannable- Parameters:
names-
-
setOutputFormat
Description copied from interface:ScannableSets the array of strings describing how best to format the positions from this scannable- Specified by:
setOutputFormatin interfaceScannable- Parameters:
names-
-
getOutputFormat
Description copied from interface:ScannableReturns an array of strings which are the format strings to use when pretty printing parts of the output- Specified by:
getOutputFormatin interfaceScannable- Returns:
- string array
-
atScanStart
Description copied from interface:ScannableCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)- Specified by:
atScanStartin interfaceScannable- Throws:
DeviceException
-
atScanEnd
Description copied from interface:ScannableCalled 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()- Specified by:
atScanEndin interfaceScannable- Throws:
DeviceException
-
atScanLineStart
Description copied from interface:ScannableCalled for every Scannable at the start of every scan- Specified by:
atScanLineStartin interfaceScannable- Throws:
DeviceException
-
atScanLineEnd
Description copied from interface:ScannableCalled for every Scannable at the end of every scan- Specified by:
atScanLineEndin interfaceScannable- Throws:
DeviceException
-
atPointStart
Description copied from interface:ScannableCalled on every Scannable at every data point, for scans which are broken down into individual points (i.e. non-continuous scans)- Specified by:
atPointStartin interfaceScannable- Throws:
DeviceException
-
atPointEnd
Description copied from interface:ScannableCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e. non-continous scans)- Specified by:
atPointEndin interfaceScannable- Throws:
DeviceException
-
atLevelMoveStart
Description copied from interface:ScannableCalled by both the pos and scan commands at the start of each subsequent level move only on Scannables that will be moved as part that level's movement.For example "pos a 1 b 2 c 3", will, if a and b have the same level and c a higher level will result in:
This hook is used by CoordinatedMotionScannables.a.atLevelMoveStart() invalid input: '<'---- b.atLevelMoveStart() invalid input: '<'---- a.asynchronousMoveTo() b.asynchronousMoveTo() a.waitWhileBusy() b.waitWhileBusy() c.atLevelMoveStart() invalid input: '<'---- c.asynchronousMoveTo() c.waitWhileBusy()
- Specified by:
atLevelMoveStartin interfaceScannable- Throws:
DeviceException
-
atLevelStart
Description copied from interface:ScannableCalled by both the pos and scan commands at the start of each subsequent level move on all Scannables that are part that level's movement.This provides a useful mechanism for e.g. creating a Scannable that opens a shutter after motors have moved but before a detector is exposed.
- Specified by:
atLevelStartin interfaceScannable- Throws:
DeviceException
-
atLevelEnd
- Specified by:
atLevelEndin interfaceScannable- Throws:
DeviceException
-
atCommandFailure
Description copied from interface:ScannableHook 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.
- Specified by:
atCommandFailurein interfaceScannable- Throws:
DeviceException
-
toFormattedString
Description copied from interface:ScannableReturns a string representation of the Scannable and its current position/value/statusTypically should return:
name : position
or for detectors, name : status
If the position/status cannot be determined, the function should return
Scannable.VALUE_UNAVAILABLEin its place.- Specified by:
toFormattedStringin interfaceScannable- Returns:
- string as defined above
-
getPositionCallable
- Specified by:
getPositionCallablein interfacePositionCallableProvider<GDANexusDetectorData>- Throws:
DeviceException
-
setHardwareTriggering
Description copied from interface:HardwareTriggerableDetectorConfigure the Detector to trigger on hardware triggers, or not.- Specified by:
setHardwareTriggeringin interfaceHardwareTriggerableDetector- Parameters:
b-- Throws:
DeviceException
-
isHardwareTriggering
public boolean isHardwareTriggering()- Specified by:
isHardwareTriggeringin interfaceHardwareTriggerableDetector- Returns:
- true if configured to triger on hardware triggers.
-
getHardwareTriggerProvider
Description copied from interface:HardwareTriggeredDetectorGet theHardwareTriggerProviderthat represents the controller this Detector is wired to.- Specified by:
getHardwareTriggerProviderin interfaceHardwareTriggeredDetector- Returns:
- the trigger provider
-
setNumberImagesToCollect
public void setNumberImagesToCollect(int numberImagesToCollect) Description copied from interface:HardwareTriggeredDetectorTell the detector how many scan points to collect. (Unfortunately named images).- Specified by:
setNumberImagesToCollectin interfaceHardwareTriggeredDetector- Parameters:
numberImagesToCollect-
-
integratesBetweenPoints
public boolean integratesBetweenPoints()Description copied from interface:HardwareTriggeredDetectorDetectors that sample some value at the time of a trigger should return False. Detectors such as counter timers should return True. If true ,TrajectoryScanLine will generate a trigger half a point before the motor reaches a demanded point such that the resulting bin of data is centred on the demand position. Area detectors that will be triggered by the first pulse should also return true.- Specified by:
integratesBetweenPointsin interfaceHardwareTriggeredDetector- Returns:
- true for detectors that integrates b
-