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

Acquisition Events as Generator #571

Closed
carlkesselman opened this issue Mar 27, 2023 · 10 comments
Closed

Acquisition Events as Generator #571

carlkesselman opened this issue Mar 27, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@carlkesselman
Copy link
Contributor

I am doing some long duration acquisitions with a lot of events. I am using a generator to create these event sequences. However, the validation code in the acquisition module explicitly is looking for a list, and also iterates through that list up front to check each event.

I'm curious as to if providing an alternative mode where a generator could be provided as an alternative. In this case, you would probably loose the ability to validate the entire acquisition up front, but would have the advantage of being able to provide a large number of events with a small memory footprint.

I would be happy to code this up and do a PR if this seems like a good idea.

Thanks,

Carl

@carlkesselman carlkesselman added the enhancement New feature or request label Mar 27, 2023
@henrypinkard
Copy link
Member

Could you just make multiple calls to acquire, like this:

with Acquisition(...) as acq:
   for event in your_generator():
      acq.acquire(event)

You would not be able to do hardware sequencing over multiple calls to acquire, but perhaps this doesn't matter in your application? I'm curious to know if this works for you

@carlkesselman
Copy link
Contributor Author

carlkesselman commented Mar 28, 2023 via email

@carlkesselman
Copy link
Contributor Author

carlkesselman commented Mar 28, 2023 via email

@henrypinkard
Copy link
Member

I think this is a good use case for expanding the capabilities of the acquisition engine and to have some kind of event that means "acquire continuously until a certain time has elapsed", essentially signaling the creation of a generator as you suggest. It would be a good addition. This will also become easier/more powerful with the addition of a new camera API (micro-manager/mmCoreAndDevices#243)

(Linking micro-manager/micro-manager#1524 because that's where discussion of acquisition engine improvements will occur)

However, I think you maybe can currently get by by calling acquire one event at a time. Each event will lead to a call of the post_camera_hook, and you'll have to constantly send trigger pulses for your camera. I'm guessing there would be too much overhead to do this at a high framerate, but maybe will be okay in your case? What do you think?

@carlkesselman
Copy link
Contributor Author

carlkesselman commented Mar 28, 2023 via email

@henrypinkard
Copy link
Member

Why are you calling serialize?

@carlkesselman
Copy link
Contributor Author

carlkesselman commented Mar 28, 2023 via email

@henrypinkard
Copy link
Member

I'm a bit confused now. I recommend that you make a hook function that simply prints the events and passes the event along, because this may clarify what is going on. Also, trying it out on the demo camera might be a good idea to control for the variable of different camera types

@ieivanov
Copy link
Collaborator

ieivanov commented Apr 3, 2023

@carlkesselman do you have the option to dispatch events in hardware-sequenced batches? It may be the case that your entire 2h 30 fps acquisition is not sequenced. Instead, for example, z stacks for a given channel within this acquisition are sequences. In that case you would call acquire multiple times with sets of events corresponding to the hardware-sequenced z stack portion of the acquisition.

@carlkesselman
Copy link
Contributor Author

carlkesselman commented Apr 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants