Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Open spectrometers by serial-number #14

Open
ap-- opened this issue Oct 28, 2014 · 2 comments
Open

Open spectrometers by serial-number #14

ap-- opened this issue Oct 28, 2014 · 2 comments

Comments

@ap--
Copy link
Owner

ap-- commented Oct 28, 2014

This should be implemented for everyone who wants to use several spectrometers at once

@nonbiostudent
Copy link

I'd be interested in working on this issue if no one else has started on it yet. From the brief look I've had at the exisiting code, I would propose a new get_spectrometers() function which returns a dict of spectrometer objects with their serial numbers as keys.

Does anyone have any ideas/comments on the problem of creating multiple instances of a spectrometer object - currently you get a USBError raised if you try to do that (e.g. if you call get_a_random_spectrometer() more than once). Would it be better to cache a list of spectrometer objects somewhere and have subsequent calls to the functions return the same instance each time?

@ap--
Copy link
Owner Author

ap-- commented Jan 27, 2015

You could do the following:
implement a list_unopened_spectrometers() function in utils.py, which (as you suggested) creates a dict of all available spectrometers, but catches and ignores the USBError if a spectrometer is already opened.
A serial() function would need to be implemented in OceanOpticsUSBComm (and sadly, we need to figure out something for the STS class).

Then you could use the list in OceanOpticsBase to pick the spectrometer depended on the serial provided to the init() method.

This would not require a global variable storing a list of all spectrometers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants