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

added user given output directory #1

Merged
merged 6 commits into from
Jan 26, 2022

Conversation

tdincer
Copy link

@tdincer tdincer commented Jan 18, 2022

Added:

  1. user given output directory option to cnmf.fit_file method
  2. option for cnmf.fit_file to return movie correction object

@tdincer
Copy link
Author

tdincer commented Jan 19, 2022

This modified pipeline was successfully run on a sample dataset. Let's try to push this to the flatironinstitute/caiman fork before Friday. Any feedback is appreciated, especially on backward compatibility.

Copy link

@jverswijver jverswijver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @tdincer! just one minor change with some whitespace at the end of a line. 👍

Co-authored-by: jverswijver <49455164+jverswijver@users.noreply.github.com>
@@ -337,7 +342,7 @@ def fit_file(self, motion_correct=False, indices=None, include_eval=False):
logging.warning("Error: File not found, with file list:\n" + fnames[0])
raise Exception('File not found!')

base_name = pathlib.Path(fnames[0]).stem + "_memmap_"
base_name = (pathlib.Path(output_dir) / (pathlib.Path(fnames[0]).stem + "_memmap_")).as_posix()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd double check here on how base_name is used. I think base_name should not contain any path, but only a filename (or prefix to a filename), so we should not join output_dir here.

Copy link
Author

@tdincer tdincer Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttngu207 base_name is passed only to mmapping.save_memmap together with the full path file names in line 369 or 372, depending on a condition. Addition of another path related keyword looks excessive to me. There is only one caveat. The docstring in mmapping.save_memmap clearly states that the base_name must not contain underscore character. As long as this caveat is considered we should be good.

Copy link

@ttngu207 ttngu207 Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot guarantee base_name will not contain underscore especially when base_name is now a full path.
On second look, I do think you don't need to include the output_dir as part of the base_name here. And you don't need to pass output_dir into mmapping.save_memmap.
In the mmapping.save_memmap, the path is actually retrieved from fname, which, in this case, is passed in as fname_mc (line 369 below).
fname_mc is generated from the output of mc.motion_correct, which should already account for the correct output_dir.

Copy link

@ttngu207 ttngu207 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, I have a few comments/suggestions

tdincer and others added 3 commits January 19, 2022 10:59
Co-authored-by: Thinh Nguyen <thinhnguyen0405@gmail.com>
changed `if return_mc:` to ` if return_mc & motion_correct:` to make sure that motion correction is applied if we want to return the `motion correction object`
`base_name` line is changed to its original form.
@tdincer
Copy link
Author

tdincer commented Jan 26, 2022

@ttngu207 This one is finally ready to merge (see adjusted .npz file output directory).

@ttngu207 ttngu207 merged commit 26b8271 into datajoint:master Jan 26, 2022
dimitri-yatsenko pushed a commit that referenced this pull request Jan 30, 2023
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

Successfully merging this pull request may close these issues.

4 participants