sunflare.config module¶
FrontendTypes
¶
WidgetPositionTypes
¶
Supported widget position types.
This enum is used to to define the position of a widget in the main view of the GUI.
Warning
This enumerator refers to the usage of QtWidget.DockWidget;
it may be changed in the future to support other GUI frameworks.
Attributes:
| Name | Type | Description |
|---|---|---|
LEFT |
str
|
Left widget position. |
RIGHT |
str
|
Right widget position. |
TOP |
str
|
Top widget position. |
BOTTOM |
str
|
Bottom widget position. |
Source code in src/sunflare/config.py
PModelInfo
¶
Bases: AttrsInstance, Protocol
Protocol equivalent to ModelInfo.
This protocol allows to implement the ModelInfo class
in packages that do not depend on sunflare directly.
The only required dependency is attrs.
Source code in src/sunflare/config.py
PPresenterInfo
¶
Bases: Protocol
Protocol equivalent to sunflare.config.PresenterInfo.
Note
This protocol is currently used only for type checking purposes within the Redsun application. In the future we might be able to expose this for usage in external packages.
Source code in src/sunflare/config.py
PViewInfo
¶
Bases: Protocol
Protocol equivalent to sunflare.config.ViewInfo.
Note
This protocol is currently used only for type checking purposes within the Redsun application. In the future we might be able to expose this for usage in external packages.
Source code in src/sunflare/config.py
ViewInfo
¶
Bases: PViewInfo
View information model.
All view information models inherit from this class.
Attributes:
| Name | Type | Description |
|---|---|---|
plugin_name |
str
|
Widget plugin name. Equivalent to the name of the PyPI/Conda package. |
plugin_id |
str
|
Widget plugin ID. Associated with the exposed entry point in the plugin manifest. |
position |
WidgetPositionTypes
|
Widget position in the main view of the GUI. |
Source code in src/sunflare/config.py
PresenterInfo
¶
Bases: PPresenterInfo
Presenter information model.
All controller information models inherit from this class.
Attributes:
| Name | Type | Description |
|---|---|---|
plugin_name |
str
|
Presenter plugin name. Equivalent to the name of the PyPI/Conda package. |
plugin_id |
str
|
Presenter plugin ID. Associated with the exposed entry point in the plugin manifest. |
Source code in src/sunflare/config.py
ModelInfo
¶
Bases: PModelInfo
Base model for device information.
All device information models inherit from this class.
Attributes:
| Name | Type | Description |
|---|---|---|
plugin_name |
str
|
Model plugin name. Equivalent to the name of the PyPI/Conda package. |
plugin_id |
str
|
Model plugin ID. Associated with the exposed entry point in the plugin manifest. |
vendor |
str
|
Device vendor.
Defaults to |
family |
str
|
Device family (if applicable).
Defaults to |
serial_number |
str
|
Device serial number.
Defaults to |
Source code in src/sunflare/config.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
read_configuration
¶
Read the model information as a Bluesky configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
``float``
|
Timestamp of the configuration. Use time.time() to get the current timestamp. Defaults to 0. |
0
|
Returns:
| Type | Description |
|---|---|
``dict[str, Reading[Any]]``
|
A dictionary containing the model information, compatible with Bluesky configuration representation. |
Notes
See the Configurable_ protocol.
.. _Configurable: https://blueskyproject.io/bluesky/main/hardware.html#bluesky.protocols.Configurable
Source code in src/sunflare/config.py
describe_configuration
¶
Describe the model information as a Bluesky configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
``str``
|
Source of the configuration.
Defaults to |
'model_info'
|
Returns:
| Type | Description |
|---|---|
``dict[str, Descriptor]``
|
A dictionary containing the model information description, compatible with Bluesky configuration representation. |
Notes
See the Configurable_ protocol.
.. _Configurable: https://blueskyproject.io/bluesky/main/hardware.html#bluesky.protocols.Configurable
Source code in src/sunflare/config.py
RedSunSessionInfo
¶
Redsun session configuration class.
This class is used to store the configuration of a running Redsun application; it provides information about the hardware layout and the selected acquisition engine.
A minimal configuration must include:
- the selected frontend;
- the selected acquisition engine;
Attributes:
| Name | Type | Description |
|---|---|---|
session |
str
|
The name of the current session. Defaults to |
frontend |
FrontendTypes
|
Frontend selected for the current session.
Defaults to |
controllers |
dict[str, PPresenterInfo]
|
Presenter informations dictionary. Defaults to an empty dictionary. |
models |
dict[str, PModelInfo]
|
Model informations dictionary. Defaults to an empty dictionary. |
views |
dict[str, PViewInfo]
|
View informations dictionary. Defaults to an empty dictionary. |
Source code in src/sunflare/config.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
load_yaml
staticmethod
¶
Load a YAML configuration file.
This method is invoked before the actual construction of the model. It will do preliminary checks on the YAML file and store the configuration in a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
``str``
|
Path to the YAML file. |
required |
Returns:
| Type | Description |
|---|---|
``dict[str, Any]``
|
A dictionary containing the configuration data. |
Raises:
| Type | Description |
|---|---|
``FileExistsError``
|
If the file does not exist. |
``FileNotFoundError``
|
If the path is not a file. |
``ValueError``
|
If the file is not a YAML file. |
``yaml.YAMLError``
|
If an error occurs while loading the file. |
Source code in src/sunflare/config.py
store_yaml
¶
Store the configuration in a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
``str``
|
Path to the desired YAML file. |
required |