Package gda.device.detector
Class NXDetector
- All Implemented Interfaces:
Detector,NexusDetector,NXPluginDetector,Device,Scannable,PositionCallableProvider<NexusTreeProvider>,Configurable,Findable,gda.observable.IObservable,Serializable,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
AbstractWriteRegionsImmediatelyNXDetector,HardwareTriggeredNXDetector,MbsAnalyser,PixiumNXDetector,SpecsPhoibosAnalyser,SpecsPhoibosAnalyserSeparateIterations
public class NXDetector
extends DetectorBase
implements org.springframework.beans.factory.InitializingBean, NXPluginDetector
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NexusTreeProviderprotected static final Stringprotected static final StringFields 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
ConstructorsConstructorDescriptionCreates an ADDetector with name, collectionStrategy and probably additionalPluginList yet to configure.NXDetector(String name, NXCollectionStrategyPlugin collectionStrategy, List<NXPluginBase> additionalPluginList) -
Method Summary
Modifier and TypeMethodDescription__getattr__(String name) Returns the NXPlugin with the given name (configuration methods will have prevented duplicate plugin names).__str__()When printed from Jython show the standard detector state followed by a representation of all the plugins.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 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)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.final voidDefault which should be overridden by subclasses.String[]Additional names for extra values that returned by getPosition().Returns the initial file structure for this detector including all of its plugins.String[]gets a array of InputNames used by moveTo of this scannable.String[]Returns an array of strings which are the format strings to use when pretty printing parts of the outputReturn a plugin by its name (configuration methods will have prevented duplicate plugin names).Return all plugins: collection-strategy and then additional pluginsReturn map of all plugins: collection-strategy and then additional pluginsReturns the current position of the Scannable.intReturns the current collecting state of the device.booleanbooleanisBusy()Check if the Scannable is moving/operating.protected voidprepareCollectionStrategyAtScanStart(int numberImagesPerCollection, ScanInformation scanInfo) voidDefault which should be overridden by subclasses.readout()Returns the latest data collected as well as general detector informationvoidsetAddCollectTimeMs(boolean addCollectTimeMs) voidsetAdditionalPluginList(List<NXPluginBase> additionalPluginList) Set plugins in addition to the collection-strategy plugin.voidsetCollectionStrategy(NXCollectionStrategyPlugin collectionStrategy) 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.voidsetOutputFormat(String[] names) Sets the array of strings describing how best to format the positions from this scannablevoidstop()Stop the current move/operation.voidReturns when operation carried out by moveTo has completedMethods inherited from class gda.device.detector.DetectorBase
checkPositionValid, getCollectionTime, getDataDimensions, getDescription, getDetectorID, getDetectorType, setCollectionTime, toFormattedStringMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, externalToInternal, getLevel, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setLevel, 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
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.Detector
getCollectionTime, getDataDimensions, getDescription, getDetectorID, getDetectorType, 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, checkPositionValid, getLevel, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setLevel, setScanMetadataAttribute, setScanMetadataAttributes, toFormattedString
-
Field Details
-
UNSUPPORTED_PART_OF_SCANNABLE_INTERFACE
- See Also:
-
UNSUPPORTED_SET_FUNCTION
- See Also:
-
lastReadoutValue
-
-
Constructor Details
-
NXDetector
public NXDetector(String name, NXCollectionStrategyPlugin collectionStrategy, List<NXPluginBase> additionalPluginList) -
NXDetector
public NXDetector()Creates an ADDetector with name, collectionStrategy and probably additionalPluginList yet to configure. A metadataProvider could also be provided.
-
-
Method Details
-
isAddCollectTimeMs
public boolean isAddCollectTimeMs() -
setAddCollectTimeMs
public void setAddCollectTimeMs(boolean addCollectTimeMs) -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
setCollectionStrategy
- Specified by:
setCollectionStrategyin interfaceNXPluginDetector
-
setAdditionalPluginList
Set plugins in addition to the collection-strategy plugin.- Specified by:
setAdditionalPluginListin interfaceNXPluginDetector- Parameters:
additionalPluginList-
-
getCollectionStrategy
- Specified by:
getCollectionStrategyin interfaceNXPluginDetector
-
getAdditionalPluginList
- Specified by:
getAdditionalPluginListin interfaceNXPluginDetector
-
getPluginList
Return all plugins: collection-strategy and then additional plugins- Specified by:
getPluginListin interfaceNXPluginDetector
-
getPluginMap
Return map of all plugins: collection-strategy and then additional plugins- Specified by:
getPluginMapin interfaceNXPluginDetector
-
getPlugin
Return a plugin by its name (configuration methods will have prevented duplicate plugin names).- Parameters:
name-- Returns:
- plugin
-
__str__
When printed from Jython show the standard detector state followed by a representation of all the plugins.- Overrides:
__str__in classScannableBase- Returns:
- the result of the toString method
-
__getattr__
Returns the NXPlugin with the given name (configuration methods will have prevented duplicate plugin names).- Parameters:
name-
-
setInputNames
Description copied from interface:Scannablesets the array of names returned by getInputNames method of this scannable.- Specified by:
setInputNamesin interfaceScannable- Overrides:
setInputNamesin classScannableBase- Parameters:
names-
-
setExtraNames
Description copied from interface:ScannableSets the array of names returned by getExtraNames of this scannable.- Specified by:
setExtraNamesin interfaceScannable- Overrides:
setExtraNamesin classScannableBase- 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- Overrides:
setOutputFormatin classScannableBase- Parameters:
names-
-
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
public boolean 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
- 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:
-
endCollection
Description copied from class:DetectorBaseDefault which should be overridden by subclasses.- Specified by:
endCollectionin interfaceDetector- Overrides:
endCollectionin classDetectorBase- Throws:
DeviceException- See Also:
-
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
-
getInputNames
Description copied from interface:Scannablegets a array of InputNames used by moveTo of this scannable.- Specified by:
getInputNamesin interfaceScannable- Overrides:
getInputNamesin classScannableBase- Returns:
- array of the names of the elements of the object returned by getPosition
-
getExtraNames
Description copied from interface:ScannableAdditional names for extra values that returned by getPosition().- Specified by:
getExtraNamesin interfaceScannable- Overrides:
getExtraNamesin classScannableBase- Returns:
- array of names of the extra elements if the array returned by getPosition is larger than the array required by moveTo
-
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- Overrides:
getOutputFormatin classScannableBase- Returns:
- string array
-
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:
-
prepareCollectionStrategyAtScanStart
protected void prepareCollectionStrategyAtScanStart(int numberImagesPerCollection, ScanInformation scanInfo) throws Exception, DeviceException - Throws:
ExceptionDeviceException
-
atScanLineStart
Description copied from class:ScannableBaseCalled for every Scannable at the start of every scan Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanLineStartin interfaceScannable- Overrides:
atScanLineStartin 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
-
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
-
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
-
getFileStructure
Returns the initial file structure for this detector including all of its plugins. This is used if propertyNexusScanDataWriter#PROPERTY_NAME_CREATE_FILE_AT_SCAN_STARTis true to allow this detector to still be compatible with data writing.- Specified by:
getFileStructurein interfaceDetector- Returns:
- the nexus file structure
- Throws:
DeviceException
-
getPositionCallable
- Specified by:
getPositionCallablein interfacePositionCallableProvider<NexusTreeProvider>- Throws:
DeviceException
-
atScanLineEnd
Description copied from class:ScannableBaseCalled for every Scannable at the end of every scan Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atScanLineEndin interfaceScannable- Overrides:
atScanLineEndin classScannableBase- 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:
-