Class DummyNXDetector
- All Implemented Interfaces:
Detector,NexusDetector,Device,Scannable,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 anIObserver) 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.voidclose()Close and unconfigure the device.voidTells the detector to begin to collect a set of data, then returns immediately.booleanReturns a value which indicates whether the detector creates its own files.voiddeleteIObserver(gda.observable.IObserver anIObserver) 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().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.booleanTests if the scannable is at (or if appropriate, close to) the value positionToTest.booleanisBusy()Check if the Scannable is moving/operating.voidTrigger 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.voidsetAttribute(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.voidsetExtraNames(String[] names) Sets the array of names returned by getExtraNames of this scannable.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 scansvoidSet or change the name of the object (as defined in XML).voidsetOutputFormat(String[] names) Sets the array of strings describing how best to format the positions from this scannablevoidsetProtectionLevel(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 gda.factory.ConfigurableBase
configure, isConfigureAtStartup, isConfigured, 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, isConfiguredMethods inherited from interface gda.device.Detector
getFileStructureMethods inherited from interface gda.device.Scannable
getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, setScanMetadataAttribute, setScanMetadataAttributes
-
Constructor Details
-
DummyNXDetector
- Parameters:
name- - prefix for each elementnumElements- - number of elements - if 1 then the name is simply the value of name
-
-
Method Details
-
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
-
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
-
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
-
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
-
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
-
getDescription
- Specified by:
getDescriptionin interfaceDetector- Returns:
- A description of the detector.
- Throws:
DeviceException
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
atScanLineEnd
Description copied from interface:ScannableCalled for every Scannable at the end of every scan- Specified by:
atScanLineEndin interfaceScannable- Throws:
DeviceException
-
atScanLineStart
Description copied from interface:ScannableCalled for every Scannable at the start of every scan- Specified by:
atScanLineStartin interfaceScannable- Throws:
DeviceException
-
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
-
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
-
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
-
getLevel
public int getLevel()Description copied from interface:Scannableget the operation level of this scannable. -
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
-
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
-
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
-
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
-
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.
-
moveTo
Description copied from interface:ScannableTrigger a move/operation and block until completion.- Specified by:
moveToin interfaceScannable- Parameters:
position-- Throws:
DeviceException
-
setExtraNames
Description copied from interface:ScannableSets the array of names returned by getExtraNames of this scannable.- Specified by:
setExtraNamesin interfaceScannable- Parameters:
names-
-
setInputNames
Description copied from interface:Scannablesets the array of names returned by getInputNames method of this scannable.- Specified by:
setInputNamesin interfaceScannable- Parameters:
names-
-
setLevel
public void setLevel(int level) Description copied from interface:ScannableUsed for ordering the operations of Scannables during scans -
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-
-
stop
Description copied from interface:ScannableStop the current move/operation.- Specified by:
stopin interfaceScannable- 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
-
close
Description copied from interface:DeviceClose and unconfigure the device.- Specified by:
closein interfaceDevice- Throws:
DeviceException
-
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
-
getProtectionLevel
public int getProtectionLevel()- Specified by:
getProtectionLevelin interfaceDevice- Returns:
- int - the permission level for this object.
-
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
-
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-
-
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. -
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML). -
addIObserver
public void addIObserver(gda.observable.IObserver anIObserver) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver anIObserver) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Overrides:
reconfigurein classConfigurableBase- Throws:
FactoryException
-
toString
-
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
-