Class ScannableGroup
- All Implemented Interfaces:
Device,Scannable,IScannableGroup,Configurable,Findable,gda.observable.IObservable,gda.observable.IObserver
- Direct Known Subclasses:
CoordinatedScannableGroup,Diffractometer,MiniKappaGoniometerScannableGroup,MotomanRobotScannableGroup,ScannableGroupNamed,ScannableGroupSinglePosition,SmarGonXyzScannableGroup,TpScannableGroup,XesSpectrometerCrystal
MotomanRobotScannableGroup's validation on simultaneous KTheta, KPhi movement.
inputNames, extraNames and outputFormat are taken from the constituent Scannables, not maintained as a field of the
Group.
A ScannableGroup is a logical group of Scannables that can be created through Spring instantiation or by adding
Scannables from the Jython console.
Configuring a ScannableGroup configures all of its component Scannables and adds itself as an IObserver, and the
default behaviour of adding a Scannable to an already configured ScannableGroup is to configure the Scannable
(although it can instead un-configure the group, allowing it to be configured again).
ScannableGroups can add, remove or set Scannables by using the Scannables, and additionally can remove Scannables by
their index.
See also ScannableGroupNamed, which additionally uses the Finder to manage Scannables by name, a
former function of this class-
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, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionScannableGroup(String name) ScannableGroup(String name, Scannable[] groupMembers) Constructor.ScannableGroup(String name, List<Scannable> groupMembers) -
Method Summary
Modifier and TypeMethodDescription__getattr__(org.python.core.PyString name) See __getattr__(String name).voidaddGroupMember(Scannable groupMember) Adds a scannable to this group.voidaddGroupMember(Scannable groupMember, boolean toConfigure) Adds a scannable to this group.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.voidDefault behaviour is to do nothing.voidCalled 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 illDefinedPosObject) This default behaviour should be extended by most subclasses! This default behaviour should be extended by most subclasses! Tests if the given object is meaningful to this Scannable and so could be used by one of the move commands.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.extractPositionsFromObject(Object position) String[]Additional names for extra values that returned by getPosition().getGroupMember(String name) String[]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 outputReturns the current position of the Scannable.String[]getUnits()booleanisBusy()Check if the Scannable is moving/operating.booleanvoidremoveGroupMemberByIndex(int index) voidremoveGroupMemberByScannable(Scannable groupMember) voidsetDemandAllScannablePositions(boolean demandAllScannablePositions) voidsetExtraNames(String[] names) Sets the array of names returned by getExtraNames of this scannable.voidsetGroupMembers(List<Scannable> groupMembers) Sets the group members that make up this scannable group.final voidsetGroupMembersWithArray(Scannable[] groupMembers) Sets the members of this group.voidsetGroupMembersWithList(List<Scannable> groupMembers, boolean toConfigure) Sets the group members that make up this scannable group.voidsetInputNames(String[] names) sets the array of names returned by getInputNames method of this scannable.voidstop()Stop the current move/operation.Returns a string representation of the Scannable and its current position/value/statustoString()voidActs as a fan-out for messages from the Scannables inside this groupvoidReturns when operation carried out by moveTo has completedMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, externalToInternal, getLevel, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, throwExceptionIfInvalidTarget, 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.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
getLevel, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes
-
Constructor Details
-
ScannableGroup
public ScannableGroup() -
ScannableGroup
Constructor.- Parameters:
name-groupMembers-- Throws:
FactoryException
-
ScannableGroup
- Throws:
FactoryException
-
ScannableGroup
-
-
Method Details
-
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
-
getGroupMemberNames
- Specified by:
getGroupMemberNamesin interfaceIScannableGroup- Returns:
- the names of the members of this group
-
addGroupMember
Adds a scannable to this group. This will not add a Scannable if it is already included Will configure the Scannable if the ScannableGroup is already configured- Specified by:
addGroupMemberin interfaceIScannableGroup- Parameters:
groupMember-- Throws:
FactoryException
-
addGroupMember
Adds a scannable to this group. This will not add a Scannable if it is already included- Specified by:
addGroupMemberin interfaceIScannableGroup- Parameters:
groupMember-toConfigure- - controls behaviour if the ScannableGroup is already configured: whether to configure the scannable (true) or set the ScannableGroue to be unconfigured (false)- Throws:
FactoryException
-
removeGroupMemberByScannable
- Specified by:
removeGroupMemberByScannablein interfaceIScannableGroup
-
getGroupMembersAsArray
- Specified by:
getGroupMembersAsArrayin interfaceIScannableGroup- Returns:
- array of scannable objects in this group
-
getGroupMember
- Parameters:
name-- Returns:
- the Scannable of the given name
-
setGroupMembers
Sets the group members that make up this scannable group. If this ScannableGroup is configured, sets it to unconfigured, to allow all the scannables to be configured by call this.configure()- Specified by:
setGroupMembersin interfaceIScannableGroup- Parameters:
groupMembers- the group members- Throws:
FactoryException
-
setGroupMembersWithList
public void setGroupMembersWithList(List<Scannable> groupMembers, boolean toConfigure) throws FactoryException Sets the group members that make up this scannable group.- Specified by:
setGroupMembersWithListin interfaceIScannableGroup- Parameters:
groupMembers- the group members- Throws:
FactoryException
-
setGroupMembersWithArray
Sets the members of this group.This is final, as for historical reasons there are two setters on here, and it is natural to extend just one.
See setGroupMembersWithList for configuration behaviour
- Specified by:
setGroupMembersWithArrayin interfaceIScannableGroup- Parameters:
groupMembers-- Throws:
FactoryException
-
__getattr__
See __getattr__(String name). -
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.- Throws:
DeviceException
-
extractPositionsFromObject
- Throws:
DeviceException
-
getPosition
Description copied from class:ScannableBaseReturns 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.- Specified by:
getPositionin interfaceScannable- Overrides:
getPositionin classScannableBase- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- 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
-
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-
-
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-
-
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- Overrides:
toFormattedStringin classScannableBase- Returns:
- string as defined above
-
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:
-
update
Acts as a fan-out for messages from the Scannables inside this group- Specified by:
updatein interfacegda.observable.IObserver- See Also:
-
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
-
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
-
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
-
atPointEnd
Description copied from class:ScannableBaseCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e. non-continous scans) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atPointEndin interfaceScannable- Overrides:
atPointEndin classScannableBase- Throws:
DeviceException- See Also:
-
atPointStart
Description copied from class:ScannableBaseCalled on every Scannable at every data point, for scans which are broken down into individual points (i.e. non-continuous scans) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atPointStartin interfaceScannable- Overrides:
atPointStartin classScannableBase- Throws:
DeviceException- See Also:
-
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:
-
atLevelMoveStart
Description copied from class:ScannableBaseCalled 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. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.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- Overrides:
atLevelMoveStartin classScannableBase- Throws:
DeviceException- See Also:
-
atLevelStart
Description copied from class:ScannableBaseCalled 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. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
- Specified by:
atLevelStartin interfaceScannable- Overrides:
atLevelStartin classScannableBase- Throws:
DeviceException- See Also:
-
atLevelEnd
Description copied from class:ScannableBaseDefault behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.- Specified by:
atLevelEndin interfaceScannable- Overrides:
atLevelEndin 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:
-
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:
-
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:
-
checkPositionValid
Description copied from class:ScannableBaseThis default behaviour should be extended by most subclasses! Tests 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- Overrides:
checkPositionValidin classScannableBase- Parameters:
illDefinedPosObject-- Returns:
- null if position is valid, or returns a description if not.
- Throws:
DeviceException- See Also:
-
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 interfaceScannable- Overrides:
waitWhileBusyin classScannableBase- Throws:
DeviceExceptionInterruptedException
-
removeGroupMemberByIndex
public void removeGroupMemberByIndex(int index) - Specified by:
removeGroupMemberByIndexin interfaceIScannableGroup
-
toString
- Overrides:
toStringin classScannableBase
-
getGroupMembers
- Specified by:
getGroupMembersin interfaceIScannableGroup
-
isDemandAllScannablePositions
public boolean isDemandAllScannablePositions() -
setDemandAllScannablePositions
public void setDemandAllScannablePositions(boolean demandAllScannablePositions) -
getUnits
- Specified by:
getUnitsin interfaceIScannableGroup- Returns:
- units corresponding to each field name.
-