Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read and write Spectrum/Image attribute problem #157

Open
liujin001 opened this issue Aug 25, 2022 · 1 comment · May be fixed by #159
Open

read and write Spectrum/Image attribute problem #157

liujin001 opened this issue Aug 25, 2022 · 1 comment · May be fixed by #159

Comments

@liujin001
Copy link

Now tango-simlib can support SPECTRUM and IMAGE attribute addition correctly. but read and write attribute value have some problems.

  1. In Spectrum_SimDD.json file, if we change doubleSpectrum attribute's "quantity_simulation_type" from "ConstantQuantity" to "GaussianSlewLimited" (with mean, std_dev, max_slew_rate, min_bound, max_bound set), then we can not read doubleSpectrum attribute of simulator device, the exception description is: Wrong Python type for attribute doubleSpectrum of type DevDouble. Expected a sequence;
  2. If we set value for the attribute of SPECTRUM and IMAGE data format through sim control device's attribute (by attribute_name and last_val), then the simulator device's attribute of SPECTRUM and IMAGE data format can not read, the exception description is: Wrong Python type for attribute XXX of type DevDouble. Expected a sequence. This may be caused by that last_val is SCALAR format forever, we can only write a scalar value to it. May solution is that if the data format of attribute set by attribute_name is SPECTRUM or IMAGE, we should disable write last_val attribute of sim control device?
@kmadisa
Copy link
Contributor

kmadisa commented Aug 28, 2022

Thanks @liujin001 for raising these issues.

Now tango-simlib can support SPECTRUM and IMAGE attribute addition correctly. but read and write attribute value have some problems.

  1. In Spectrum_SimDD.json file, if we change doubleSpectrum attribute's "quantity_simulation_type" from "ConstantQuantity" to "GaussianSlewLimited" (with mean, std_dev, max_slew_rate, min_bound, max_bound set), then we can not read doubleSpectrum attribute of simulator device, the exception description is: Wrong Python type for attribute doubleSpectrum of type DevDouble. Expected a sequence;

I tried to think of a use case for using the GaussianSlewLimited simulation type for the SPECTRUM attributes but didn't think it would be needed. But it should be possible to generate the values in a list for that.
Would you want each value generated as part of the list be unique?

  1. If we set value for the attribute of SPECTRUM and IMAGE data format through sim control device's attribute (by attribute_name and last_val), then the simulator device's attribute of SPECTRUM and IMAGE data format can not read, the exception description is: Wrong Python type for attribute XXX of type DevDouble. Expected a sequence. This may be caused by that last_val is SCALAR format forever, we can only write a scalar value to it. May solution is that if the data format of attribute set by attribute_name is SPECTRUM or IMAGE, we should disable write last_val attribute of sim control device?

Yes, I think it would be best not to allow writing to the last_val attribute for now.

kmadisa added a commit that referenced this issue Sep 14, 2022
…es that are python primitive types (float in this case) which are appropriate for attributes with a SCALAR data format.

This is a problem for the attrbiutes with more complex data formats, SPECTRUM/IMAGE. When reading an attribute, the quantity returns a primitive type which PyTango is not expecting, therefore
resulting in the error, 'Wrong Python type for attribute... Expected a sequence'.
This change here allows us to cater for the complex data formats. The method next_val now generates the simulation data according to the data format, given by the meta dictionary.

Resolves #157

Signed-off-by: Katleho Madisa <[email protected]>
@kmadisa kmadisa linked a pull request Sep 14, 2022 that will close this issue
5 tasks
kmadisa added a commit that referenced this issue Sep 14, 2022
…LAR. It is implied to be 1. I have set default values

for the max_dim_x and max_dim_y properties, respectively, when the are not provided.

Resolves #157

Signed-off-by: Katleho Madisa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants