python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
66 stars 39 forks source link

Set exposure time on TriggerTargetMixin #229

Open gjover opened 2 years ago

gjover commented 2 years ago

How would one set the exposure time on a TriggerTargetMixin device? Would it be worth to add setting exposure time on the TriggerTargetMixin abc class as it is in the Camera Class?

carandraug commented 2 years ago

I think there's some misunderstanding. The TriggerTargetMixin is mixin class which is meant to be mixed in device classes. It is mixed in the classes of devices that can receive triggers but configuring the action is specific to the device type and so is done by the device class only.

In the specific case of cameras, the Camera class already has the TriggerTargetMixin class mixed in (because all cameras can be targets of tiggers even if only software triggers). So use the Camera.set_exposure_time method, no need to also specify it on the TriggerTargetMixin class.

If that makes sense, please close this issue.

gjover commented 2 years ago

Yes, I understand that it is a mixin class. I was thinking that in, terms of cameras and lights, when one triggers a device it is always for a certain amount of time. In that sense I was proposing to generalize the implementation of set_exposure_time, moving the implementation from the camera to the TriggerTargetMixin to share the code with any other device class using it. But it is true that for some classes the triggered action may have more configuration parameters than just the exposure time.

carandraug commented 2 years ago

Having a method to configure the triggered action in the mixin class could make things cleaner, I guess it depends how that is done. It couldn't be just set_exposure_time since there are other devices types that are trigger targets where it would make no sense such as deformable mirrors. My guess would be that differences between each trigger action is so large, that they might as well be done on the individual device types. But if you can come up with something general that would be great.