-
Notifications
You must be signed in to change notification settings - Fork 7
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 optional lazy look-up of extractor properties #247
Comments
This also can be counted as evidence than assembling multi-file formats using Not saying that this makes this a bad idea but we should consider this angle. |
How else would we go about loading a single plane or channel of a multi-channel multi-plane format that splits its frames into X number of frames per file? (where it was very slow when X=1, and perhaps not ridiculously slow when the total number of all files is less than ~100) |
The multi extractor is working as a wrapper for convenient IO. You will still have the IO without the wrapper. |
Like This class is just an IO function disguissed as a class (and IO wrapper). You probably eliminated the attribute access because it was inefficient. You could just had used the logic of That would probably be harder to mantain, a cost. But if we are propagating a lazy look up feature to ALL extractors well that is also a cost. I think you approach you guys used there is fine, keep this IO wrapper class as a private / utility object. That way you get the benefits but do not need to propagate the costs anywhere else. I am less keen on propagating this behavior to the whole library because some extractor might be used the way you used |
I think it would be better to implement a general object that behaves similar to |
I don't really get the pushback here.
If you think |
That's an interesting idea. But it doesn't work as well for formats like ScanImage that can have multi-file or single-file structure. If |
I disagree with this. The use case of lazy look up is when you use |
Do we have data for volumetric
Seems simple to me. Use the simple IO wrapper class for the multi-file case, expand the simple IO wrapper class to a full one for the single file case.
This is confined and ad-hoc for every format, you don't propagate complexity outsides of where it is needed. You can adjust what's best for performance depending on the layout of the files (if there are many the io_wrapper can be more or less light) and can chose in general what's best per format instead of thinking on a general interface for the abstract class in advance. Once you have some examples, then you can generalize and propagate to the general class. |
Yes, it's under mouseV1-to-nwb |
Current Behavior
Every ImagingExtractor (IE) looks up all its properties (num_channels, num_frames, etc.) during
__init__
and stores them as private attributes (self._num_channels
,self._num_frames
, etc.).Issue
This is efficient if you want to look up the properties many times for one file, but inefficient for
MultiImagingExtractor
that only needs to look up properties for 1 of its many IE's.Proposed Change
Add an option to the base
ImagingExtractor
class forprecomputed_properties=True
and then if you pre-compute the properties, I/O happens during__init__
and they get stored as attributes. But ifprecomputed_properties=False
then I/O happens lazily and you can skip the consistency checks for MultiImagingExtractors.See Also
See discussion here
Do you have any interest in helping implement the feature?
Yes.
Code of Conduct
The text was updated successfully, but these errors were encountered: