mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
120 stars 80 forks source link

There should be a way to know if an Instrument is open or not #107

Open developedby opened 4 years ago

developedby commented 4 years ago

I only use UC480, so I'm not sure if it applies to other instruments.
The only way I found out to know if a camera is open is to check _in_use, a protected member. Maybe it would be a good idea to rename it to in_use or to provide a function to access it.

natezb commented 4 years ago

As per #94, I've added an is_open field and a public open() method to the uc480 driver.

As every Instrument now has a close() method, it's reasonable to consider adding open() and is_open to all instruments. Some instruments (like NI DAQs) are essentially always-open, there's no underlying opening or closing going on. In cases like this, we could either make is_open perpetually True and open() and close() no-ops, or have those methods only "virtually" open and close by modifying is_open. It's not immediately obvious to me which is better.