Status¶
Bases: object
Status class represents a state of the system.
A Status object encapsulates the state of the microscope and other devices at a particular moment. It manages a list of status parameters, which are key-value pairs associating a sub-device with a value. It also maintains a list of tags used for sequence generation with recipes.
__init__(*args)
¶
Overload 1:
Default constructor.
Initializes a new instance of the Status class.
|
Overload 2:
Constructor with parameters and tags.
Initializes a new instance of the Status class with a list of parameters and tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statusParams
|
list[StatusParam]
|
The list of status parameter objects |
required |
tags
|
list[string]
|
The list of tags | Overload 3: Copy constructor. Creates a new instance of the Status class from an existing one, optionally performing a deep copy. |
required |
status
|
Status
|
The source Status object |
required |
copy
|
boolean
|
If true, performs a deep copy, otherwise status parameters are shared with the source (default: false) |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs during copy | Overload 4: Copy constructor. Creates a new instance of the Status class from an existing one, optionally performing a deep copy. |
InscoperException
|
If an error occurs during copy |
fromXML(xml)
¶
Load from XML.
Populates the status information from an XML node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml
|
XMLNode
|
The XML node containing status information |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs |
toXML(xmlParent)
¶
Save to XML.
Exports the status information to an XML node attached to the parent node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xmlParent
|
XMLNode
|
The parent XML node |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs |
setStatus(status, copy=False)
¶
Update status content.
Updates this status with the content of another status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
Status
|
The source status |
required |
copy
|
boolean
|
If true, performs a deep copy, otherwise status parameters are shared with the source (default: false) |
False
|
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs |
getParamList()
¶
Get the status parameter list.
Retrieves the list of all status parameters in this status.
Returns:
| Type | Description |
|---|---|
list[StatusParam]
|
The list of status parameters |
getParam(subDeviceId)
¶
Get the status parameter by sub-device ID.
Retrieves a specific status parameters associated with the given sub-device ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the desired parameter |
required |
Returns:
| Type | Description |
|---|---|
StatusParam
|
The status parameter, or null if not found |
hasParamValue(subDeviceId)
¶
Check if the status parameter has a value.
Checks if the status parameter associated with the given sub-device ID exists and has at least a value assigned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID to check |
required |
Returns:
| Type | Description |
|---|---|
boolean
|
True if the parameter has a value, false otherwise |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs |
getParamStringValue(subDeviceId)
¶
Get string value.
Retrieves the value of the status parameter associated with the sub-device ID as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
str
|
The string value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamUnsignedCharValue(subDeviceId)
¶
Get int value.
Retrieves the value of the status parameter associated with the sub-device ID as an int.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The int value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamCharValue(subDeviceId)
¶
Get char value.
Retrieves the value of the status parameter associated with the sub-device ID as a char.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The char value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamUnsignedShortValue(subDeviceId)
¶
Get unsigned short value.
Retrieves the value of the status parameter associated with the sub-device ID as an unsigned short.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The unsigned short value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamShortValue(subDeviceId)
¶
Get short value.
Retrieves the value of the status parameter associated with the sub-device ID as a short.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The short value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamUnsignedIntValue(subDeviceId)
¶
Get unsigned int value.
Retrieves the value of the status parameter associated with the sub-device ID as an unsigned int.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The unsigned int value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamIntValue(subDeviceId)
¶
Get int value.
Retrieves the value of the status parameter associated with the sub-device ID as an int.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The int value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamUnsignedLongValue(subDeviceId)
¶
Get unsigned long long value.
Retrieves the value of the status parameter associated with the sub-device ID as an unsigned long long.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The unsigned long long value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamLongValue(subDeviceId)
¶
Get long long value.
Retrieves the value of the status parameter associated with the sub-device ID as a long long.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The long long value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamFloatValue(subDeviceId)
¶
Get float value.
Retrieves the value of the status parameter associated with the sub-device ID as a float.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
float
|
The float value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getParamDoubleValue(subDeviceId)
¶
Get double value.
Retrieves the value of the status parameter associated with the sub-device ID as a double.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
float
|
The double value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or conversion fails |
getValueType(subDeviceId)
¶
Get value type.
Retrieves the type of the value for the status parameter associated with the sub-device ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter |
required |
Returns:
| Type | Description |
|---|---|
int
|
The parameter type of the value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If parameter is missing or type cannot be determined |
getTags()
¶
Get tag list.
Retrieves the list of tags associated with this status.
Returns:
| Type | Description |
|---|---|
list[string]
|
The list of tags |
addTag(tag)
¶
Add a tag.
Adds a single tag to the status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
string
|
The tag to add |
required |
addTags(tagList)
¶
Add multiple tags.
Adds a list of tags to the status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tagList
|
list[string]
|
The list of tag |
required |
addParam(*args)
¶
Overload 1:
Add status parameter without value.
Adds a status parameter for the given sub-device ID without assigning a value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID for the new parameter |
required |
value
|
string
|
The string value |
required |
newParam
|
StatusParam
|
The status parameter to add |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs | Overload 2: Add string status parameter. Adds a status parameter with a string value. |
InscoperException
|
If an error occurs | Overload 3: Add char status parameter. Adds a status parameter with a char value. |
InscoperException
|
If an error occurs | Overload 4: Add short status parameter. Adds a status parameter with a short value. |
InscoperException
|
If an error occurs | Overload 5: Add int status parameter. Adds a status parameter with an int value. |
InscoperException
|
If an error occurs | Overload 6: Add unsigned long long status parameter. Adds a status parameter with an unsigned long long value. |
InscoperException
|
If an error occurs | Overload 7: Add long long status parameter. Adds a status parameter with a long long value. |
InscoperException
|
If an error occurs | Overload 8: Add float status parameter. Adds a status parameter with a float value. |
InscoperException
|
If an error occurs | Overload 9: Add double status parameter. Adds a status parameter with a double value. |
InscoperException
|
If an error occurs | Overload 10: Add boolean status parameter. Adds a status parameter with a boolean value. |
InscoperException
|
If an error occurs | Overload 11: Add existing status parameter. Adds an existing status parameter to the status. |
InscoperException
|
If an error occurs |
addMultiParam(*args)
¶
Overload 1:
Add tagged string status parameter.
Adds a tagged status parameter with a string value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID for the parameter |
required |
tag
|
int
|
The tag |
required |
value
|
string
|
The string value |
required |
index
|
int
|
The value index |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs | Overload 2: Add tagged char status parameter. |
InscoperException
|
If an error occurs | Overload 3: Add tagged short status parameter. |
InscoperException
|
If an error occurs | Overload 4: Add tagged int status parameter. |
InscoperException
|
If an error occurs | Overload 5: Add tagged unsigned long long status parameter. |
InscoperException
|
If an error occurs | Overload 6: Add tagged long long status parameter. |
InscoperException
|
If an error occurs | Overload 7: Add tagged float status parameter. |
InscoperException
|
If an error occurs | Overload 8: Add tagged double status parameter. |
InscoperException
|
If an error occurs | Overload 9: Add tagged boolean status parameter. |
InscoperException
|
If an error occurs | Overload 10: Add indexed tagged string status parameter. Adds a parameter with index, tag, and string value. |
InscoperException
|
If an error occurs | Overload 11: Add indexed tagged char status parameter. |
InscoperException
|
If an error occurs | Overload 12: Add indexed tagged short status parameter. |
InscoperException
|
If an error occurs | Overload 13: Add indexed tagged int status parameter. |
InscoperException
|
If an error occurs | Overload 14: Add indexed tagged unsigned long long status parameter. |
InscoperException
|
If an error occurs | Overload 15: Add indexed tagged long long status parameter. |
InscoperException
|
If an error occurs | Overload 16: Add indexed tagged float status parameter. |
InscoperException
|
If an error occurs | Overload 17: Add indexed tagged double status parameter. |
InscoperException
|
If an error occurs | Overload 18: Add indexed tagged boolean status parameter. |
InscoperException
|
If an error occurs |
containsParam(subDeviceId)
¶
Check if status parameter exists.
Verifies if a status parameter with the given sub-device ID exists in the status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID to check |
required |
Returns:
| Type | Description |
|---|---|
boolean
|
True if the parameter exists, false otherwise |
removeParam(subDeviceId)
¶
Remove status parameter.
Removes the status parameter identified by the sub-device ID from the status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subDeviceId
|
SubDeviceId
|
The sub-device ID of the parameter to remove |
required |
equals(other)
¶
Check equality.
Compares this status with another for equality. Tests if all status parameters are equal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Status
|
The status object to compare with |
required |
Returns:
| Type | Description |
|---|---|
boolean
|
True if equal, false otherwise |
getHash()
¶
Get hash.
Calculates a hash code for this status.
Returns:
| Type | Description |
|---|---|
int
|
The hash code |