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

Add calibration factor from device names #13

Open
hayg25 opened this issue Sep 25, 2020 · 1 comment
Open

Add calibration factor from device names #13

hayg25 opened this issue Sep 25, 2020 · 1 comment

Comments

@hayg25
Copy link

hayg25 commented Sep 25, 2020

Hello,
I am trying to put calibration factors depending on the DS.

from facadedevice import Facade, proxy_attribute, logical_attribute, state_attribute, local_attribute
from tango.server import run
from tango import DevState, AttrWriteType

class FAC_ATT_DEPH(Facade):
    
    def safe_init_device(self):
        super(FAC_ATT_DEPH, self).safe_init_device()
        self.set_state(DevState.ON)

    pos = proxy_attribute(
        dtype=float,
        property_name='Motor_Attribute')

    @logical_attribute(
        bind=['pos'])
    def calib(self, pos):
# --- define calib_factor here from device name 
        return  pos * calib_factor(depends_on_ds_name)
        
if __name__ == '__main__':
    FAC_ATT_DEPH.run_server()
 

So I need to get the DS name in order to choose the calibration factor.
How could I get it ?

Thx

@hayg25
Copy link
Author

hayg25 commented Sep 25, 2020

Hi again,
I just would like to clarify my need :
I would like to make like calibrated variables from raw (ds from equipment). So for that, I would need external files (xls files for interpolation for example) and put the files may be as parameter into the DS properties.

  1. so for that I need to access those variables in the code.
  2. I also need to make conditions on ds_names (calibration depends on the material)
    • I solved it by getting the instance name from :
str(self).split('(')[0] 

Could you please comment on the method to include the calibrations (create calibrated variables) and more on that, how could I deal with including external files, may be as new property variables.

Thanks

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

No branches or pull requests

1 participant