You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will be either a Sequence[T] where T is float, int, or str, or a numpy array with a dtype. This will not be an arg to the dataclass (not optional).
There will be a length on the datatype set to some sane default, since this is required by the EPICS and tango backends.
Enum
Will take a python enum.Enum type. When putting to the attribute you put the enum member not a string/int value itself. We will check on initialisation that all the values are either string or int.
We should keep allowed values for checking on Attribute.set, but I don't think that the current system of making and mbb record if it's a string with allowed values is as nice as having a dedicated Enum datatype that can be altered to whatever control system's enum definition.
Changes which will be required across datatypes.
DataType will now be given two additional attributes:
cast(T): For casting to a datatype which can be sent over the control system. It will also do some validation (i.e checking that an Int value doesn't exceed the maximum defined in the DataType).
WaveForm(Sequence[str]).cast(["a"]) ==np.array(["a"], dtype="S40")
Enum(SomeEnum).cast(SomeEnum.member) ->"TheStringValueOfTheMember"# Fails so that we don't have an internal value of the `Attribute` out of sync with the softioc.Int(max=5).cast(6)
@property\intitial_value(): We can't rely on Attr._datatype.dtype() for an initial value anymore since the structured numpy array's has to be initialised with shape (length in our case) and dtype=. For enums this is true too. Therefore, we will use DataType.initial_value for the default initial value on attributes. This can be defaulted to self.dtype() in the Attribute base class.
The text was updated successfully, but these errors were encountered:
We should keep allowed values for checking on Attribute.set
Can we just do self.dtype.validate(value) instead of keeping allowed_values on Attribute? Actually, I don't think it even validates against allowed_values currently.
I think cast should be validate using the mechanism suggested here.
Okay, I'll move it to that PR.
Can we just do self.dtype.validate(value) instead of keeping allowed_values on Attribute? Actually, I don't think it even validates against allowed_values currently.
I'll make it so that an enum type which exceeds the epics limit for options comes out as a builder.string in the backend.
WaveForm
Will be either a
Sequence[T]
whereT
isfloat
,int
, orstr
, or a numpy array with adtype
. This will not be an arg to the dataclass (not optional).There will be a
length
on the datatype set to some sane default, since this is required by the EPICS and tango backends.Enum
Will take a python
enum.Enum
type. When putting to the attribute you put the enum member not a string/int value itself. We will check on initialisation that all the values are either string or int.We should keep allowed values for checking on
Attribute.set
, but I don't think that the current system of making andmbb
record if it's a string with allowed values is as nice as having a dedicatedEnum
datatype that can be altered to whatever control system's enum definition.Changes which will be required across datatypes.
DataType
will now be given two additional attributes:cast(T)
: For casting to a datatype which can be sent over the control system. It will also do some validation (i.e checking that anInt
value doesn't exceed the maximum defined in theDataType
).@property\intitial_value()
: We can't rely onAttr._datatype.dtype()
for an initial value anymore since the structured numpy array's has to be initialised with shape (length in our case) anddtype=
. For enums this is true too. Therefore, we will useDataType.initial_value
for the default initial value on attributes. This can be defaulted toself.dtype()
in theAttribute
base class.The text was updated successfully, but these errors were encountered: