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

Simplify key_source #86

Open
dimitri-yatsenko opened this issue Sep 1, 2022 · 1 comment
Open

Simplify key_source #86

dimitri-yatsenko opened this issue Sep 1, 2022 · 1 comment

Comments

@dimitri-yatsenko
Copy link
Member

Some complex key_source properties have been introduced. They need to be simplified to improve performance. Let's review together.

@dimitri-yatsenko
Copy link
Member Author

The key_source can be simplified from

 @property
    def key_source(self):
        suite2p_key_source = (
            Fluorescence
            * ActivityExtractionMethod
            * ProcessingParamSet.proj("processing_method")
            & 'processing_method = "suite2p"'
            & 'extraction_method LIKE "suite2p%"'
        )
        caiman_key_source = (
            Fluorescence
            * ActivityExtractionMethod
            * ProcessingParamSet.proj("processing_method")
            & 'processing_method = "caiman"'
            & 'extraction_method LIKE "caiman%"'
        )
        return suite2p_key_source.proj() + caiman_key_source.proj()

to equivalent

    @property
    def key_source(self):
        return (
            Fluorescence
            * ActivityExtractionMethod
            * ProcessingParamSet.proj("processing_method")
            & [
             'processing_method = "suite2p" and extraction_method LIKE "suite2p%"', 
             'processing_method = "caiman" and extraction_method LIKE "caiman%"'])

Better yet, the custom key source should be removed altogether since the make already handles the case for unknown methods and raises a NotImplementedError

kabilar pushed a commit to kabilar/element-calcium-imaging that referenced this issue May 22, 2023
Permit multiple root data directories
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

1 participant