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

Feature: add "requested destination" or other save specs? #131

Open
tlambert03 opened this issue Aug 17, 2023 · 6 comments
Open

Feature: add "requested destination" or other save specs? #131

tlambert03 opened this issue Aug 17, 2023 · 6 comments

Comments

@tlambert03
Copy link
Member

Should we add something like requested_destination to MDASequence?

I don't (immediately) want to add a whole lot of specific saving stuff, but a single field requesting a destination path might be very useful for possible downstream writers: It would provide a directory, base name, and extension. Writers could then increment that base name as desired (until any further spec added instructions on that sort of thing)

@ianhi ?

@ianhi
Copy link
Contributor

ianhi commented Aug 17, 2023

Sounds good to me! Maybe also an extra metadata dictionary to allow for downstream uses we can't conceive of now?

Are you imagining these all as required arguments, or optional?

@tlambert03
Copy link
Member Author

everything optional. you should probably always be able to call MDAEvent() or MDASequence() without args.

@ianhi
Copy link
Contributor

ianhi commented Aug 17, 2023

ooh right because requested_destination is the name. Rather than something like "save_params" which would be it's own object

@tlambert03
Copy link
Member Author

tlambert03 commented Aug 17, 2023

yeah, for now, the writer (over in pymmcore-plus) would have all the parameters. This is just a bare-minimum sort of start.
I can imagine something like this:

seq = MDASequence(requested_destination='...')

class MDARunner():
    def run(self, events: MDASequence):
        if seq.requested_destination:
            for writer in self.writers:  # these are the objects with as-of-yet undetermined parameters
                writer.set_destination(seq.requested_destination)

but... I dunno

@ianhi
Copy link
Contributor

ianhi commented Aug 17, 2023

for writer in self.writers:

a little bit of an aside here: in a couple places you've given examples of how to work with many writers. Is that just a generality thing, or are their use cases im not thinking of for multiple writers? unless we think of something like the napari display as also being a writer

@tlambert03
Copy link
Member Author

yeah, good question. I can't see an immediate use case for multiple writers... but I do think that so far, the writer "spec" fits a general category of something that I can see multiple of: namely, anything that wants to be notified at the start, end, and each frame of an acquisition, let's call it a handler:

class Handler:
    def sequenceStarted(): ...
    def frameReady(): ...
    def sequenceFinished(): ...

so, I'm kinda mentally leaving that possibility open :)

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

No branches or pull requests

2 participants