optimouse 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {optimouse-0.1.2 → optimouse-0.1.4}/PKG-INFO +11 -3
  2. {optimouse-0.1.2 → optimouse-0.1.4}/README.md +10 -2
  3. {optimouse-0.1.2 → optimouse-0.1.4}/optimouse.egg-info/PKG-INFO +11 -3
  4. {optimouse-0.1.2 → optimouse-0.1.4}/optimouse.egg-info/SOURCES.txt +3 -0
  5. optimouse-0.1.4/pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p.json +121 -0
  6. optimouse-0.1.4/pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p_extractonly_localtest.json +121 -0
  7. optimouse-0.1.4/pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p_og.json +113 -0
  8. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/configs/config_template_suite2p.json +15 -0
  9. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/utils/pipeline_utils.py +13 -3
  10. {optimouse-0.1.2 → optimouse-0.1.4}/pyproject.toml +1 -1
  11. {optimouse-0.1.2 → optimouse-0.1.4}/LICENSE.md +0 -0
  12. {optimouse-0.1.2 → optimouse-0.1.4}/modules/__init__.py +0 -0
  13. {optimouse-0.1.2 → optimouse-0.1.4}/modules/bruker_concat_tif.py +0 -0
  14. {optimouse-0.1.2 → optimouse-0.1.4}/modules/compute_zcorr.py +0 -0
  15. {optimouse-0.1.2 → optimouse-0.1.4}/modules/extraction.py +0 -0
  16. {optimouse-0.1.2 → optimouse-0.1.4}/modules/motion_correction.py +0 -0
  17. {optimouse-0.1.2 → optimouse-0.1.4}/modules/utils/plot_zones.py +0 -0
  18. {optimouse-0.1.2 → optimouse-0.1.4}/modules/utils/save_z_motion_args.py +0 -0
  19. {optimouse-0.1.2 → optimouse-0.1.4}/optimouse.egg-info/dependency_links.txt +0 -0
  20. {optimouse-0.1.2 → optimouse-0.1.4}/optimouse.egg-info/requires.txt +0 -0
  21. {optimouse-0.1.2 → optimouse-0.1.4}/optimouse.egg-info/top_level.txt +0 -0
  22. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/__init__.py +0 -0
  23. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/configs/config_C57_O1M2_10022023_run1run2.json +0 -0
  24. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/configs/config_C57_O1M2_10022023_run1run2run3run4.json +0 -0
  25. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/configs/config_template_cnmf.json +0 -0
  26. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/configs/config_test.json +0 -0
  27. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/pipeline_cnmf.py +0 -0
  28. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/pipeline_mcorr.py +0 -0
  29. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/roi_zcorr.py +0 -0
  30. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/utils/__init__.py +0 -0
  31. {optimouse-0.1.2 → optimouse-0.1.4}/pipeline/utils/config_loader.py +0 -0
  32. {optimouse-0.1.2 → optimouse-0.1.4}/setup.cfg +0 -0
  33. {optimouse-0.1.2 → optimouse-0.1.4}/tests/test_make_composite_f_anat.py +0 -0
  34. {optimouse-0.1.2 → optimouse-0.1.4}/tests/test_module.py +0 -0
  35. {optimouse-0.1.2 → optimouse-0.1.4}/tests/test_motion_correction.py +0 -0
  36. {optimouse-0.1.2 → optimouse-0.1.4}/tests/test_patch_plots_efficient.py +0 -0
  37. {optimouse-0.1.2 → optimouse-0.1.4}/tests/test_subtract_z_motion_patches.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optimouse
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: 2-photon calcium imaging data processing pipeline with CaImAn / Suite2P
5
5
  Author-email: Vincent Prevosto <prevosto@mit.edu>, Manuel Levy <levym@mit.edu>
6
6
  License-Expression: MIT
@@ -47,9 +47,11 @@ Dynamic: license-file
47
47
 
48
48
  # 2P-proc (optimouse)
49
49
 
50
+ [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
50
51
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
51
52
  [![CaImAn Version](https://img.shields.io/badge/CaImAn-1.12.2+-green)](https://github.com/flatironinstitute/CaImAn)
52
- [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
53
+ [![Suite2p Version](https://img.shields.io/badge/Suite2p-0.14.0-orange)](https://github.com/MouseLand/suite2p/releases/tag/v0.14.0)
54
+
53
55
  [![DOI](https://zenodo.org/badge/1141473002.svg)](https://doi.org/10.5281/zenodo.18371949)
54
56
  <!-- [![Build Status](https://img.shields.io/github/actions/workflow/status/vncntprvst/2P-proc/ci.yml)](https://github.com/vncntprvst/2P-proc/actions) -->
55
57
  ![License](https://img.shields.io/badge/license-MIT-red)
@@ -57,7 +59,7 @@ Dynamic: license-file
57
59
  **2P-proc (optimouse)** is a 2-photon calcium imaging data processing pipeline built on [CaImAn](https://github.com/flatironinstitute/CaImAn/), [Mesmerize](https://github.com/nel-lab/mesmerize-core/) and [Suite2p](https://github.com/MouseLand/suite2p).
58
60
 
59
61
  This package provides:
60
- - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid/non-rigid)
62
+ - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid or non-rigid)
61
63
  - **ROI extraction**: CNMF-based or Suite2p-based cell detection and segmentation
62
64
  - **Spike deconvolution**: Temporal activity inference from calcium signals
63
65
  - **Parameter optimization**: Notebooks for systematic parameter exploration (CaImAn NoRMCorre and CNMF)
@@ -237,6 +239,12 @@ Create a configuration JSON based on `pipeline/configs/config_template_cnmf.json
237
239
  }
238
240
  ```
239
241
 
242
+ Notes:
243
+ - `params_extraction.main` accepts generic Suite2p ops overrides (passed through at ops creation).
244
+ - See notes on parameters, and setting up a local Suite2p environment for testing: `suite2p/readme.md`.
245
+ - `decay_time` is mapped to Suite2p `tau`. Use `decay_time` or `tau` interchangeably.
246
+
247
+
240
248
  ### 2. Run the pipeline
241
249
 
242
250
  **On a local machine:**
@@ -1,8 +1,10 @@
1
1
  # 2P-proc (optimouse)
2
2
 
3
+ [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
3
4
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
4
5
  [![CaImAn Version](https://img.shields.io/badge/CaImAn-1.12.2+-green)](https://github.com/flatironinstitute/CaImAn)
5
- [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
6
+ [![Suite2p Version](https://img.shields.io/badge/Suite2p-0.14.0-orange)](https://github.com/MouseLand/suite2p/releases/tag/v0.14.0)
7
+
6
8
  [![DOI](https://zenodo.org/badge/1141473002.svg)](https://doi.org/10.5281/zenodo.18371949)
7
9
  <!-- [![Build Status](https://img.shields.io/github/actions/workflow/status/vncntprvst/2P-proc/ci.yml)](https://github.com/vncntprvst/2P-proc/actions) -->
8
10
  ![License](https://img.shields.io/badge/license-MIT-red)
@@ -10,7 +12,7 @@
10
12
  **2P-proc (optimouse)** is a 2-photon calcium imaging data processing pipeline built on [CaImAn](https://github.com/flatironinstitute/CaImAn/), [Mesmerize](https://github.com/nel-lab/mesmerize-core/) and [Suite2p](https://github.com/MouseLand/suite2p).
11
13
 
12
14
  This package provides:
13
- - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid/non-rigid)
15
+ - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid or non-rigid)
14
16
  - **ROI extraction**: CNMF-based or Suite2p-based cell detection and segmentation
15
17
  - **Spike deconvolution**: Temporal activity inference from calcium signals
16
18
  - **Parameter optimization**: Notebooks for systematic parameter exploration (CaImAn NoRMCorre and CNMF)
@@ -190,6 +192,12 @@ Create a configuration JSON based on `pipeline/configs/config_template_cnmf.json
190
192
  }
191
193
  ```
192
194
 
195
+ Notes:
196
+ - `params_extraction.main` accepts generic Suite2p ops overrides (passed through at ops creation).
197
+ - See notes on parameters, and setting up a local Suite2p environment for testing: `suite2p/readme.md`.
198
+ - `decay_time` is mapped to Suite2p `tau`. Use `decay_time` or `tau` interchangeably.
199
+
200
+
193
201
  ### 2. Run the pipeline
194
202
 
195
203
  **On a local machine:**
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optimouse
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: 2-photon calcium imaging data processing pipeline with CaImAn / Suite2P
5
5
  Author-email: Vincent Prevosto <prevosto@mit.edu>, Manuel Levy <levym@mit.edu>
6
6
  License-Expression: MIT
@@ -47,9 +47,11 @@ Dynamic: license-file
47
47
 
48
48
  # 2P-proc (optimouse)
49
49
 
50
+ [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
50
51
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
51
52
  [![CaImAn Version](https://img.shields.io/badge/CaImAn-1.12.2+-green)](https://github.com/flatironinstitute/CaImAn)
52
- [![PyPI Version](https://img.shields.io/pypi/v/optimouse)](https://pypi.org/project/optimouse/)
53
+ [![Suite2p Version](https://img.shields.io/badge/Suite2p-0.14.0-orange)](https://github.com/MouseLand/suite2p/releases/tag/v0.14.0)
54
+
53
55
  [![DOI](https://zenodo.org/badge/1141473002.svg)](https://doi.org/10.5281/zenodo.18371949)
54
56
  <!-- [![Build Status](https://img.shields.io/github/actions/workflow/status/vncntprvst/2P-proc/ci.yml)](https://github.com/vncntprvst/2P-proc/actions) -->
55
57
  ![License](https://img.shields.io/badge/license-MIT-red)
@@ -57,7 +59,7 @@ Dynamic: license-file
57
59
  **2P-proc (optimouse)** is a 2-photon calcium imaging data processing pipeline built on [CaImAn](https://github.com/flatironinstitute/CaImAn/), [Mesmerize](https://github.com/nel-lab/mesmerize-core/) and [Suite2p](https://github.com/MouseLand/suite2p).
58
60
 
59
61
  This package provides:
60
- - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid/non-rigid)
62
+ - **Motion correction**: Rigid and non-rigid motion correction with optional z-drift correction (rigid or non-rigid)
61
63
  - **ROI extraction**: CNMF-based or Suite2p-based cell detection and segmentation
62
64
  - **Spike deconvolution**: Temporal activity inference from calcium signals
63
65
  - **Parameter optimization**: Notebooks for systematic parameter exploration (CaImAn NoRMCorre and CNMF)
@@ -237,6 +239,12 @@ Create a configuration JSON based on `pipeline/configs/config_template_cnmf.json
237
239
  }
238
240
  ```
239
241
 
242
+ Notes:
243
+ - `params_extraction.main` accepts generic Suite2p ops overrides (passed through at ops creation).
244
+ - See notes on parameters, and setting up a local Suite2p environment for testing: `suite2p/readme.md`.
245
+ - `decay_time` is mapped to Suite2p `tau`. Use `decay_time` or `tau` interchangeably.
246
+
247
+
240
248
  ### 2. Run the pipeline
241
249
 
242
250
  **On a local machine:**
@@ -18,6 +18,9 @@ pipeline/pipeline_cnmf.py
18
18
  pipeline/pipeline_mcorr.py
19
19
  pipeline/roi_zcorr.py
20
20
  pipeline/configs/config_C57_O1M2_10022023_run1run2.json
21
+ pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p.json
22
+ pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p_extractonly_localtest.json
23
+ pipeline/configs/config_C57_O1M2_10022023_run1run2_tiff_suite2p_og.json
21
24
  pipeline/configs/config_C57_O1M2_10022023_run1run2run3run4.json
22
25
  pipeline/configs/config_template_cnmf.json
23
26
  pipeline/configs/config_template_suite2p.json
@@ -0,0 +1,121 @@
1
+ {
2
+ "experimenter": "Manuel Levy",
3
+ "subject": {
4
+ "name": "C57_O1M2",
5
+ "genotype": "C57/Bl6",
6
+ "sex": "F",
7
+ "DOB": "14-Feb-2023",
8
+ "virus": "PHP.eB.syn.RiboL1.GCaMP8m",
9
+ "reporter": "GCaMP8m",
10
+ "injection_date": "01-Aug-2023",
11
+ "area": "BC_R"
12
+ },
13
+ "imaging": {
14
+ "date": "10022023",
15
+ "objective": 16,
16
+ "numerical_zoom": 1,
17
+ "wavelength": 920,
18
+ "power": 530,
19
+ "depth": 160,
20
+ "fr": 20,
21
+ "Npixel_x": 765,
22
+ "Npixel_y": 765,
23
+ "microns_per_pixel": 1.4542483660130718
24
+ },
25
+ "paths": {
26
+ "concatenation_groups": [
27
+ 1,
28
+ 1
29
+ ],
30
+ "data_paths": [
31
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-001",
32
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-002"
33
+ ],
34
+ "export_paths": [
35
+ "/home/wanglab/data/2P/Analysis_2P/C57_O1M2/10022023/run1run2/run1run2_tiff_suite2p"
36
+ ],
37
+ "__comment_zstack_paths": "Point to the raw z-stack directory. One per concatenation group (one per data folder works too). If not used, can be removed entirely or left empty.",
38
+ "zstack_paths": [
39
+ "/home/wanglab/data/2P/C57_O1M2/10022023/ZSeries-10022023-1300-004"
40
+ ]
41
+ },
42
+ "params_mcorr": {
43
+ "__comment": "Motion correction parameters. Only 'caiman' is supported as method. Delete 'z_motion_correction' block entirely to skip z-motion correction.",
44
+ "method": "caiman",
45
+ "main": {
46
+ "strides": [
47
+ 36,
48
+ 36
49
+ ],
50
+ "overlaps": [
51
+ 24,
52
+ 24
53
+ ],
54
+ "max_shifts": [
55
+ 12,
56
+ 12
57
+ ],
58
+ "max_deviation_rigid": 40,
59
+ "border_nan": "copy",
60
+ "pw_rigid": true,
61
+ "gSig_filt": null
62
+ },
63
+ "__comment_save_mcorr_movie": "Accepted: 'tiff' (recommended); 'h5' and 'bin' exist but may not work in all workflows.",
64
+ "save_mcorr_movie": "tiff",
65
+ "z_motion_correction": {
66
+ "zstack_shift": {
67
+ "Ch": 2,
68
+ "alpha": 22,
69
+ "beta": 8,
70
+ "step": 1,
71
+ "Nz": 41
72
+ },
73
+ "__comment": "Set 'non_rigid' to true to compute f-anat non-rigid. If false, will only compute a rigid z-position.",
74
+ "non_rigid": false
75
+ }
76
+ },
77
+ "params_extraction": {
78
+ "__comment": "ROI extraction method choices after motion correction.",
79
+ "__method_options": [
80
+ "suite2p",
81
+ "cnmf",
82
+ "aind",
83
+ "none"
84
+ ],
85
+ "method": "suite2p",
86
+ "__suite2p_parameter_options": {
87
+ "__comment": "Add any Suite2p ops key under 'main' to override Suite2p defaults at ops creation. Keep 'decay_time' (or 'tau') as the minimum required field.",
88
+ "decay_time_or_tau": "Calcium decay time in seconds (mapped to Suite2p 'tau').",
89
+ "threshold_scaling": "Detection threshold multiplier; lower finds more ROIs.",
90
+ "max_overlap": "Maximum allowed ROI overlap before rejection.",
91
+ "diameter": "Expected ROI diameter in pixels.",
92
+ "inner_neuropil_radius": "Pixels excluded around ROI for neuropil estimate.",
93
+ "snr_thresh": "Nonrigid registration SNR threshold.",
94
+ "do_registration": "1/0 or true/false to enable/disable registration in Suite2p step.",
95
+ "nonrigid": "true/false for nonrigid registration.",
96
+ "maxregshift": "Maximum rigid registration shift (fraction of frame size).",
97
+ "sparse_mode": "true/false sparse ROI detection mode.",
98
+ "pre_smooth": "Registration pre-smoothing level.",
99
+ "max_iterations": "Maximum ROI detection refinement iterations."
100
+ },
101
+ "main": {
102
+ "decay_time": 0.3,
103
+ "threshold_scaling": 0.85,
104
+ "max_overlap": 0.6,
105
+ "diameter": 14,
106
+ "inner_neuropil_radius": 3,
107
+ "snr_thresh": 1.0,
108
+ "max_iterations": 35,
109
+ "sparse_mode": true,
110
+ "pre_smooth": 1
111
+ }
112
+ },
113
+ "params_extra": {
114
+ "cleanup": true
115
+ },
116
+ "logging": {
117
+ "__comment": "Where pipeline log files are stored (defaults to export parent).",
118
+ "log_path": "/home/wanglab/data/2P/Analysis_2P/C57_O1M2",
119
+ "log_level": "INFO"
120
+ }
121
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "paths": {
3
+ "export_paths": [
4
+ "/home/wanglab/data/2P/Analysis_2P/C57_O1M2/10022023/run1run2/run1run2_tiff_suite2p"
5
+ ],
6
+ "zstack_paths": [
7
+ "/home/wanglab/data/2P/C57_O1M2/10022023/ZSeries-10022023-1300-004"
8
+ ],
9
+ "concatenation_groups": [
10
+ 1,
11
+ 1
12
+ ],
13
+ "__comment_zstack_paths": "Point to the raw z-stack directory. One per concatenation group (one per data folder works too). If not used, can be removed entirely or left empty.",
14
+ "data_paths": [
15
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-001",
16
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-002"
17
+ ]
18
+ },
19
+ "logging": {
20
+ "__comment": "Where pipeline log files are stored (defaults to export parent).",
21
+ "log_path": "/home/wanglab/data/2P/Analysis_2P/C57_O1M2",
22
+ "log_level": "INFO"
23
+ },
24
+ "params_extra": {
25
+ "cleanup": true
26
+ },
27
+ "experimenter": "Manuel Levy",
28
+ "imaging": {
29
+ "Npixel_y": 765,
30
+ "fr": 20,
31
+ "power": 530,
32
+ "microns_per_pixel": 1.4542483660130718,
33
+ "depth": 160,
34
+ "objective": 16,
35
+ "numerical_zoom": 1,
36
+ "Npixel_x": 765,
37
+ "date": "10022023",
38
+ "wavelength": 920
39
+ },
40
+ "params_extraction": {
41
+ "__comment": "ROI extraction method choices after motion correction.",
42
+ "main": {
43
+ "diameter": 14,
44
+ "inner_neuropil_radius": 3,
45
+ "max_overlap": 0.6,
46
+ "pre_smooth": 1,
47
+ "threshold_scaling": 0.85,
48
+ "sparse_mode": true,
49
+ "snr_thresh": 1.0,
50
+ "decay_time": 0.3,
51
+ "max_iterations": 35
52
+ },
53
+ "__suite2p_parameter_options": {
54
+ "__comment": "Add any Suite2p ops key under 'main' to override Suite2p defaults at ops creation. Keep 'decay_time' (or 'tau') as the minimum required field.",
55
+ "diameter": "Expected ROI diameter in pixels.",
56
+ "inner_neuropil_radius": "Pixels excluded around ROI for neuropil estimate.",
57
+ "max_overlap": "Maximum allowed ROI overlap before rejection.",
58
+ "pre_smooth": "Registration pre-smoothing level.",
59
+ "threshold_scaling": "Detection threshold multiplier; lower finds more ROIs.",
60
+ "maxregshift": "Maximum rigid registration shift (fraction of frame size).",
61
+ "do_registration": "1/0 or true/false to enable/disable registration in Suite2p step.",
62
+ "sparse_mode": "true/false sparse ROI detection mode.",
63
+ "snr_thresh": "Nonrigid registration SNR threshold.",
64
+ "decay_time_or_tau": "Calcium decay time in seconds (mapped to Suite2p 'tau').",
65
+ "nonrigid": "true/false for nonrigid registration.",
66
+ "max_iterations": "Maximum ROI detection refinement iterations."
67
+ },
68
+ "method": "suite2p",
69
+ "__method_options": [
70
+ "suite2p",
71
+ "cnmf",
72
+ "aind",
73
+ "none"
74
+ ]
75
+ },
76
+ "params_mcorr": {
77
+ "__comment": "Motion correction parameters. Only 'caiman' is supported as method. Delete 'z_motion_correction' block entirely to skip z-motion correction.",
78
+ "__comment_save_mcorr_movie": "Accepted: 'tiff' (recommended); 'h5' and 'bin' exist but may not work in all workflows.",
79
+ "save_mcorr_movie": "tiff",
80
+ "z_motion_correction": {
81
+ "__comment": "Set 'non_rigid' to true to compute f-anat non-rigid. If false, will only compute a rigid z-position.",
82
+ "non_rigid": false,
83
+ "zstack_shift": {
84
+ "alpha": 22,
85
+ "beta": 8,
86
+ "Ch": 2,
87
+ "step": 1,
88
+ "Nz": 41
89
+ }
90
+ },
91
+ "main": {
92
+ "overlaps": [
93
+ 24,
94
+ 24
95
+ ],
96
+ "border_nan": "copy",
97
+ "max_shifts": [
98
+ 12,
99
+ 12
100
+ ],
101
+ "strides": [
102
+ 36,
103
+ 36
104
+ ],
105
+ "pw_rigid": true,
106
+ "gSig_filt": null,
107
+ "max_deviation_rigid": 40
108
+ },
109
+ "method": "none"
110
+ },
111
+ "subject": {
112
+ "name": "C57_O1M2",
113
+ "reporter": "GCaMP8m",
114
+ "DOB": "14-Feb-2023",
115
+ "area": "BC_R",
116
+ "sex": "F",
117
+ "virus": "PHP.eB.syn.RiboL1.GCaMP8m",
118
+ "injection_date": "01-Aug-2023",
119
+ "genotype": "C57/Bl6"
120
+ }
121
+ }
@@ -0,0 +1,113 @@
1
+ {
2
+ "experimenter": "Manuel Levy",
3
+ "subject": {
4
+ "name": "C57_O1M2",
5
+ "genotype": "C57/Bl6",
6
+ "sex": "F",
7
+ "DOB": "14-Feb-2023",
8
+ "virus": "PHP.eB.syn.RiboL1.GCaMP8m",
9
+ "reporter": "GCaMP8m",
10
+ "injection_date": "01-Aug-2023",
11
+ "area": "BC_R"
12
+ },
13
+ "imaging": {
14
+ "date": "10022023",
15
+ "objective": 16,
16
+ "numerical_zoom": 1,
17
+ "wavelength": 920,
18
+ "power": 530,
19
+ "depth": 160,
20
+ "fr": 20,
21
+ "Npixel_x": 765,
22
+ "Npixel_y": 765,
23
+ "microns_per_pixel": 1.4542483660130718
24
+ },
25
+ "paths": {
26
+ "concatenation_groups": [
27
+ 1,
28
+ 1
29
+ ],
30
+ "data_paths": [
31
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-001",
32
+ "/home/wanglab/data/2P/C57_O1M2/10022023/TSeries-10022023-1300-002"
33
+ ],
34
+ "export_paths": [
35
+ "/home/wanglab/data/2P/Analysis_2P/C57_O1M2/10022023/run1run2/run1run2_tiff_suite2p"
36
+ ],
37
+ "__comment_zstack_paths": "Point to the raw z-stack directory. One per concatenation group (one per data folder works too). If not used, can be removed entirely or left empty.",
38
+ "zstack_paths": [
39
+ "/home/wanglab/data/2P/C57_O1M2/10022023/ZSeries-10022023-1300-004"
40
+ ]
41
+ },
42
+ "params_mcorr": {
43
+ "__comment": "Motion correction parameters. Only 'caiman' is supported as method. Delete 'z_motion_correction' block entirely to skip z-motion correction.",
44
+ "method": "caiman",
45
+ "main": {
46
+ "strides": [
47
+ 36,
48
+ 36
49
+ ],
50
+ "overlaps": [
51
+ 24,
52
+ 24
53
+ ],
54
+ "max_shifts": [
55
+ 12,
56
+ 12
57
+ ],
58
+ "max_deviation_rigid": 40,
59
+ "border_nan": "copy",
60
+ "pw_rigid": true,
61
+ "gSig_filt": null
62
+ },
63
+ "__comment_save_mcorr_movie": "Accepted: 'tiff' (recommended); 'h5' and 'bin' exist but may not work in all workflows.",
64
+ "save_mcorr_movie": "tiff",
65
+ "z_motion_correction": {
66
+ "zstack_shift": {
67
+ "Ch": 2,
68
+ "alpha": 22,
69
+ "beta": 8,
70
+ "step": 1,
71
+ "Nz": 41
72
+ },
73
+ "__comment": "Set 'non_rigid' to true to compute f-anat non-rigid. If false, will only compute a rigid z-position.",
74
+ "non_rigid": false
75
+ }
76
+ },
77
+ "params_extraction": {
78
+ "__comment": "ROI extraction method choices after motion correction.",
79
+ "__method_options": [
80
+ "suite2p",
81
+ "cnmf",
82
+ "aind",
83
+ "none"
84
+ ],
85
+ "method": "suite2p",
86
+ "__suite2p_parameter_options": {
87
+ "__comment": "Add any Suite2p ops key under 'main' to override Suite2p defaults at ops creation. Keep 'decay_time' (or 'tau') as the minimum required field.",
88
+ "decay_time_or_tau": "Calcium decay time in seconds (mapped to Suite2p 'tau').",
89
+ "threshold_scaling": "Detection threshold multiplier; lower finds more ROIs.",
90
+ "max_overlap": "Maximum allowed ROI overlap before rejection.",
91
+ "diameter": "Expected ROI diameter in pixels.",
92
+ "inner_neuropil_radius": "Pixels excluded around ROI for neuropil estimate.",
93
+ "snr_thresh": "Nonrigid registration SNR threshold.",
94
+ "do_registration": "1/0 or true/false to enable/disable registration in Suite2p step.",
95
+ "nonrigid": "true/false for nonrigid registration.",
96
+ "maxregshift": "Maximum rigid registration shift (fraction of frame size).",
97
+ "sparse_mode": "true/false sparse ROI detection mode.",
98
+ "pre_smooth": "Registration pre-smoothing level.",
99
+ "max_iterations": "Maximum ROI detection refinement iterations."
100
+ },
101
+ "main": {
102
+ "decay_time": 0.3
103
+ }
104
+ },
105
+ "params_extra": {
106
+ "cleanup": true
107
+ },
108
+ "logging": {
109
+ "__comment": "Where pipeline log files are stored (defaults to export parent).",
110
+ "log_path": "/home/wanglab/data/2P/Analysis_2P/C57_O1M2",
111
+ "log_level": "INFO"
112
+ }
113
+ }
@@ -87,6 +87,21 @@
87
87
  "none"
88
88
  ],
89
89
  "method": "suite2p",
90
+ "__suite2p_parameter_options": {
91
+ "__comment": "Add any Suite2p ops key under 'main' to override Suite2p defaults at ops creation. Keep 'decay_time' (or 'tau') as the minimum required field.",
92
+ "decay_time_or_tau": "Calcium decay time in seconds (mapped to Suite2p 'tau').",
93
+ "threshold_scaling": "Detection threshold multiplier; lower finds more ROIs.",
94
+ "max_overlap": "Maximum allowed ROI overlap before rejection.",
95
+ "diameter": "Expected ROI diameter in pixels.",
96
+ "inner_neuropil_radius": "Pixels excluded around ROI for neuropil estimate.",
97
+ "snr_thresh": "Nonrigid registration SNR threshold.",
98
+ "do_registration": "1/0 or true/false to enable/disable registration in Suite2p step.",
99
+ "nonrigid": "true/false for nonrigid registration.",
100
+ "maxregshift": "Maximum rigid registration shift (fraction of frame size).",
101
+ "sparse_mode": "true/false sparse ROI detection mode.",
102
+ "pre_smooth": "Registration pre-smoothing level.",
103
+ "max_iterations": "Maximum ROI detection refinement iterations."
104
+ },
90
105
  "main": {
91
106
  "decay_time": 0.3
92
107
  }
@@ -188,14 +188,24 @@ def cleanup_files(batch_path, export_path, preserve_batch=False):
188
188
  batch_runfile.unlink()
189
189
  batch_dir = Path(export_path) / batch_id
190
190
  if batch_dir.exists():
191
- for attempt in range(3):
191
+ max_attempts = 6
192
+ for attempt in range(max_attempts):
192
193
  time.sleep(1 + attempt)
193
194
  try:
194
195
  shutil.rmtree(batch_dir)
195
196
  break
196
197
  except Exception as e:
197
- if attempt == 2:
198
- log_and_print(f"Could not delete {batch_dir}: {e}")
198
+ if attempt == max_attempts - 1:
199
+ nfs_files = list(batch_dir.glob(".nfs*"))
200
+ if nfs_files:
201
+ log_and_print(
202
+ f"Could not delete {batch_dir}: {e}. "
203
+ f"Detected NFS temp files: {[p.name for p in nfs_files]}. "
204
+ "A process likely still holds an open handle; retry later.",
205
+ level="warning",
206
+ )
207
+ else:
208
+ log_and_print(f"Could not delete {batch_dir}: {e}")
199
209
  for pickle_file in Path(export_path).glob("batch_*.pickle"):
200
210
  pickle_file.unlink()
201
211
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "optimouse"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = "2-photon calcium imaging data processing pipeline with CaImAn / Suite2P"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes