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

Install parameters on instance instead of class #510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcusZuber
Copy link
Member

This should attach the parameters to the single instances and not to the class.

First tests are working:

from concert.devices.motors.dummy import LinearMotor
from concert.base import Quantity

l = await LinearMotor()
l2 = await LinearMotor()
l2.install_parameters({"pos2": Quantity(q.deg)})

l
<concert.devices.motors.dummy.LinearMotor object at 0x7f10a94d39a0>
 Parameter        Value                        
 motion_velocity  200000.0 millimeter / second 
 position         5 millimeter                 
 state            standby  

l2
<concert.devices.motors.dummy.LinearMotor object at 0x7f10a89d6fb0>
 Parameter        Value                        
 motion_velocity  200000.0 millimeter / second 
 pos2             N/A                          
 position         0 millimeter                 
 state            standby  

The actual use-case of this is, when employing different uca-cameras.
With the class-wide implementation, each of the concert.devices.camera.uca.Camera adds all plugin-parameters to the uca.Camera class.

@MarcusZuber
Copy link
Member Author

@tfarago : Do you see any general problems here? I will also add a few tests for this later.

@tfarago
Copy link
Contributor

tfarago commented Feb 1, 2023

What is the difference between setattr(self, 'foo', foo) and self.__dict__['foo'] = foo? You changed it to this kind and I am curious what the benefits are.

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 this pull request may close these issues.

None yet

2 participants