sunflare.model module¶
Model
¶
A boilerplate base class for quick model development.
Users may subclass from this model and provide their custom
sunflare.config.ModelInfo implementation.
Example usage:
from sunflare.model import Model
from sunflare.config import ModelInfo
from attrs import define
@define
class MyModelInfo(ModelInfo):
str_param: str
bool_param: bool
# any other parameters...
class MyModel(Model[MyModelInfo]):
def __init__(self, name: str, model_info: MyModelInfo) -> None:
super().__init__(name, model_info)
# any other initialization code...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
``str``
|
Name of the model. Serves as a unique identifier for the object created from it. |
required |
model_info
|
``MI``
|
Instance of |
required |
Source code in src/sunflare/model/_base.py
describe_configuration
¶
Provide a description of the model configuration.
Inspects the local model_info object and
returns a descriptor dictionary compatible
with the Bluesky event model.
Returns:
| Type | Description |
|---|---|
dict[``str``, `event_model.DataKey`]
|
A dictionary with the description of each field of the model configuration. |
Source code in src/sunflare/model/_base.py
read_configuration
¶
Provide a description of the model configuration.
Inspects the local model_info object and
returns a reading dictionary compatible
with the Bluesky event model.
Returns:
| Type | Description |
|---|---|
dict[``str``, `bluesky.protocols.Descriptor`]
|
A dictionary with the description of each field of the model configuration. |
Source code in src/sunflare/model/_base.py
PModel
¶
Bases: HasName, HasParent, Configurable[Any], Protocol
Minimal required protocol for a recognizable device in Redsun.
Exposes the following Bluesky protocols:
Source code in src/sunflare/model/_protocols.py
model_info
abstractmethod
property
¶
The associated model information.
It can return a subclass of sunflare.config.ModelInfo.