Giter VIP home page Giter VIP logo

Comments (6)

ap-- avatar ap-- commented on July 3, 2024

All spectrometer methods should be blocking.

What's your specific use case for an isready method?

from python-seabreeze.

yakir12 avatar yakir12 commented on July 3, 2024

I want to fetch intensities when the spec is ready and not before by using
asynchronous coroutines. All of this is done in Julia (not Python) with
channels, tasks, and @async.
What do you mean with "All spectrometer methods should be blocking"? Maybe
I can work around it?

On 18:57, Mon, 12/10/2015 Andreas Poehlmann [email protected]
wrote:

All spectrometer methods should be blocking.

What's your specific use case for an isready method?


Reply to this email directly or view it on GitHub
https://github.com/ap--/python-seabreeze/issues/18#issuecomment-147334894
.

from python-seabreeze.

ap-- avatar ap-- commented on July 3, 2024

If you call spec.intensities() pyseabreeze sends a request command to the spectrometer and starts reading the spectrum information from the spectrometer.

By default most oceanoptics spectrometers are in a free running trigger mode. This means, that once you set the integration time, the spectrometer is constantly acquiring spectra. When a spectrum is requested via usb the spectrometer is sending the next valid acquired spectrum. This means in free running trigger mode, dependent on when the spectrum is requested, it can take from [insert really short time] up to [insert the integration time you set] until the spec.intensities() call returns.

if you call spec.intensities() in a loop, the loop delay will be the integration time you set (plus some overhead).

from python-seabreeze.

yakir12 avatar yakir12 commented on July 3, 2024

I'm trying to avoid changing the integration time and fetching the
intensities at the same time. I think it should be possible to do that in
my specific setup but thought it would be great if there was a isready()
function that could tell me when the spec is ready for any kind of
communication.
On 12/10/2015 8:30 PM, "Andreas Poehlmann" [email protected] wrote:

If you call spec.intensities() pyseabreeze sends a request command to the
spectrometer and starts reading the spectrum information from the
spectrometer.

By default most oceanoptics spectrometers are in a free running trigger
mode. This means, that once you set the integration time, the spectrometer
is constantly acquiring spectra. When a spectrum is requested via usb the
spectrometer is sending the next valid acquired spectrum. This means in
free running trigger mode, dependent on when the spectrum is requested, it
can take from [insert really short time] up to [insert the integration
time you set]
until the spec.intensities() call returns.

if you call spec.intensities() in a loop, the loop delay will be the
integration time you set (plus some overhead).


Reply to this email directly or view it on GitHub
https://github.com/ap--/python-seabreeze/issues/18#issuecomment-147360309
.

from python-seabreeze.

ap-- avatar ap-- commented on July 3, 2024

I should check if pyseabreeze is threadsafe. In the meantime, if you want to change the integration time and read spectra from two different threads, you may need to implement the thread locking yourself.

I would recommend to use a single thread to communicate with the spectrometer and implement all asynchronous calls on this thread. In the main loop of this thread you can check if other threads want to change the integration time and do the change on demand.

from python-seabreeze.

yakir12 avatar yakir12 commented on July 3, 2024

Awesome advice. I'll keep tinkering. Thanks for all the work and sorry for
opening all these "issues".
On 12/10/2015 9:41 PM, "Andreas Poehlmann" [email protected] wrote:

I should check if pyseabreeze is threadsafe. In the meantime, if you want
to change the integration time and read spectra from two different threads,
you may need to implement the thread locking yourself.

I would recommend to use a single thread to communicate with the
spectrometer and implement all asynchronous calls on this thread. In the
main loop of this thread you can check if other threads want to change the
integration time and do the change on demand.


Reply to this email directly or view it on GitHub
https://github.com/ap--/python-seabreeze/issues/18#issuecomment-147371751
.

from python-seabreeze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.