lbm_suite2p_python 3.0.2__tar.gz → 3.0.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 (32) hide show
  1. {lbm_suite2p_python-3.0.2/lbm_suite2p_python.egg-info → lbm_suite2p_python-3.0.4}/PKG-INFO +2 -2
  2. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/__init__.py +2 -0
  3. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/run_lsp.py +39 -15
  4. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4/lbm_suite2p_python.egg-info}/PKG-INFO +2 -2
  5. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python.egg-info/requires.txt +1 -1
  6. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/pyproject.toml +106 -106
  7. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/LICENSE.md +0 -0
  8. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/MANIFEST.in +0 -0
  9. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/README.md +0 -0
  10. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/__main__.py +0 -0
  11. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/_benchmarking.py +0 -0
  12. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/cellpose.py +0 -0
  13. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/cli.py +0 -0
  14. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/conversion.py +0 -0
  15. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/db_settings.py +0 -0
  16. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/default_ops.py +0 -0
  17. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/grid_search.py +0 -0
  18. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/gui.py +0 -0
  19. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/merging.py +0 -0
  20. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/postprocessing.py +0 -0
  21. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/utils.py +0 -0
  22. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/volume.py +0 -0
  23. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python/zplane.py +0 -0
  24. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python.egg-info/SOURCES.txt +0 -0
  25. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python.egg-info/dependency_links.txt +0 -0
  26. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python.egg-info/entry_points.txt +0 -0
  27. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/lbm_suite2p_python.egg-info/top_level.txt +0 -0
  28. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/setup.cfg +0 -0
  29. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/tests/test_frame_count_aliases.py +0 -0
  30. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/tests/test_pipeline_parameters.py +0 -0
  31. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/tests/test_refactored_pipeline.py +0 -0
  32. {lbm_suite2p_python-3.0.2 → lbm_suite2p_python-3.0.4}/tests/test_run_volume.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lbm_suite2p_python
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: Calcium Imaging Pipeline built with Suite2p, Cellpose and Rastermap
5
5
  License-Expression: BSD-3-Clause
6
6
  Project-URL: homepage, https://github.com/MillerBrainObservatory/LBM-Suite2p-Python
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: <3.14,>=3.12.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE.md
14
- Requires-Dist: mbo_utilities>=3.0.1
14
+ Requires-Dist: mbo_utilities>=3.0.3
15
15
  Requires-Dist: suite2p>=1.0.0.1
16
16
  Requires-Dist: setuptools<81
17
17
  Provides-Extra: rastermap
@@ -7,6 +7,7 @@ from lbm_suite2p_python.run_lsp import (
7
7
  run_plane,
8
8
  add_processing_step,
9
9
  generate_plane_dirname,
10
+ compute_enhanced_mean_image
10
11
  )
11
12
 
12
13
  from lbm_suite2p_python.cellpose import (
@@ -95,6 +96,7 @@ __all__ = [
95
96
  "default_ops",
96
97
  "add_processing_step",
97
98
  "generate_plane_dirname",
99
+ "compute_enhanced_mean_image"
98
100
 
99
101
  # Cellpose / HITL Workflow
100
102
  "train_cellpose",
@@ -101,7 +101,7 @@ def _call_upstream_pipeline(ops, f_reg, f_raw, f_reg_chan2, f_raw_chan2,
101
101
  return ops
102
102
 
103
103
 
104
- def _compute_enhanced_mean_image(img, ops):
104
+ def compute_enhanced_mean_image(img, ops):
105
105
  """Compat shim for upstream's removal of `compute_enhanced_mean_image`.
106
106
 
107
107
  Upstream suite2p replaced `compute_enhanced_mean_image(img, ops)` with
@@ -1729,7 +1729,7 @@ def run_plane_bin(ops) -> bool:
1729
1729
  print(" Computed meanImg from binary")
1730
1730
 
1731
1731
  if "meanImgE" not in ops and "meanImg" in ops:
1732
- ops["meanImgE"] = _compute_enhanced_mean_image(
1732
+ ops["meanImgE"] = compute_enhanced_mean_image(
1733
1733
  ops["meanImg"].astype(np.float32), ops
1734
1734
  )
1735
1735
  print(" Computed meanImgE from meanImg")
@@ -1791,7 +1791,7 @@ def run_plane_bin(ops) -> bool:
1791
1791
 
1792
1792
  # ensure meanImgE is always present in final ops (safety net)
1793
1793
  if "meanImgE" not in ops and "meanImg" in ops:
1794
- ops["meanImgE"] = _compute_enhanced_mean_image(
1794
+ ops["meanImgE"] = compute_enhanced_mean_image(
1795
1795
  ops["meanImg"].astype(np.float32), ops
1796
1796
  )
1797
1797
 
@@ -2052,7 +2052,12 @@ def run_plane(
2052
2052
  nframes_hint = existing_ops.get("nframes_chan1") or existing_ops.get(
2053
2053
  "nframes"
2054
2054
  )
2055
- subdir_name = generate_plane_dirname(plane=naming_plane, nframes=nframes_hint)
2055
+ subdir_name = generate_plane_dirname(
2056
+ plane=naming_plane,
2057
+ nframes=nframes_hint,
2058
+ frame_start=(int(min(frame_indices)) + 1) if frame_indices else 1,
2059
+ frame_stop=(int(max(frame_indices)) + 1) if frame_indices else None,
2060
+ )
2056
2061
 
2057
2062
  plane_dir = save_path / subdir_name
2058
2063
  plane_dir.mkdir(exist_ok=True)
@@ -2122,6 +2127,8 @@ def run_plane(
2122
2127
  subdir_name = generate_plane_dirname(
2123
2128
  plane=naming_plane,
2124
2129
  nframes=nframes_hint,
2130
+ frame_start=(int(min(frame_indices)) + 1) if frame_indices else 1,
2131
+ frame_stop=(int(max(frame_indices)) + 1) if frame_indices else None,
2125
2132
  )
2126
2133
 
2127
2134
  plane_dir = save_path / subdir_name
@@ -2562,17 +2569,6 @@ def run_plane(
2562
2569
  )
2563
2570
  np.save(plane_dir / "dff.npy", dff)
2564
2571
 
2565
- # Record the dF/F params that actually drew the dff.npy +
2566
- # figures. These live as top-level ops keys (NOT in the suite2p
2567
- # settings schema), so save_ops_db_settings writes them to
2568
- # ops.npy but leaves settings.npy / db.npy untouched. That keeps
2569
- # settings.npy as a record of suite2p stages and lets ops.npy
2570
- # carry the post-processing knobs separately.
2571
- current_ops["dff_window_size"] = dff_window_size
2572
- current_ops["dff_percentile"] = dff_percentile
2573
- current_ops["dff_smooth_window"] = dff_smooth_window
2574
- current_ops["correct_neuropil"] = bool(correct_neuropil)
2575
-
2576
2572
  _add_processing_step(
2577
2573
  current_ops,
2578
2574
  "dff_calculation",
@@ -2581,6 +2577,34 @@ def run_plane(
2581
2577
  )
2582
2578
  save_ops_db_settings(ops_file, current_ops)
2583
2579
 
2580
+ # 3b. Persist post-processing kwargs to ops.npy unconditionally.
2581
+ # These live as top-level ops keys (NOT in the suite2p settings
2582
+ # schema), so settings.npy / db.npy stay a record of the suite2p
2583
+ # stages only — ops.npy carries the lsp / GUI-tunable knobs. Done
2584
+ # outside the F.npy/Fneu.npy gate above so detection-skipped runs
2585
+ # still leave a record of which knobs the caller passed in. Callers
2586
+ # like mbo_utilities / mbo studio diff these against their dataclass
2587
+ # defaults to flag "modified" parameters in the GUI.
2588
+ if ops_file.exists():
2589
+ try:
2590
+ _post_ops = load_ops(ops_file)
2591
+ _post_ops["dff_window_size"] = dff_window_size
2592
+ _post_ops["dff_percentile"] = dff_percentile
2593
+ _post_ops["dff_smooth_window"] = dff_smooth_window
2594
+ _post_ops["correct_neuropil"] = bool(correct_neuropil)
2595
+ _post_ops["accept_all_cells"] = bool(accept_all_cells)
2596
+ _post_ops["save_json"] = bool(save_json)
2597
+ # cell_filters: list[dict] (or None). Stored as-is so a reload
2598
+ # can reconstruct each criterion's enabled/value pair.
2599
+ _post_ops["cell_filters"] = cell_filters
2600
+ # rastermap_kwargs: nested dict {"planar": {...}, "volumetric":
2601
+ # {...}} or None. Presence of a key is the per-mode enable
2602
+ # signal; sub-dict contents override Rastermap() defaults.
2603
+ _post_ops["rastermap_kwargs"] = rastermap_kwargs
2604
+ save_ops_db_settings(ops_file, _post_ops)
2605
+ except Exception as _e:
2606
+ print(f" Warning: persisting post-processing kwargs failed: {_e}")
2607
+
2584
2608
  # 3b. ROI statistics
2585
2609
  try:
2586
2610
  from lbm_suite2p_python.postprocessing import compute_roi_stats
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lbm_suite2p_python
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: Calcium Imaging Pipeline built with Suite2p, Cellpose and Rastermap
5
5
  License-Expression: BSD-3-Clause
6
6
  Project-URL: homepage, https://github.com/MillerBrainObservatory/LBM-Suite2p-Python
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: <3.14,>=3.12.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE.md
14
- Requires-Dist: mbo_utilities>=3.0.1
14
+ Requires-Dist: mbo_utilities>=3.0.3
15
15
  Requires-Dist: suite2p>=1.0.0.1
16
16
  Requires-Dist: setuptools<81
17
17
  Provides-Extra: rastermap
@@ -1,4 +1,4 @@
1
- mbo_utilities>=3.0.1
1
+ mbo_utilities>=3.0.3
2
2
  suite2p>=1.0.0.1
3
3
  setuptools<81
4
4
 
@@ -1,106 +1,106 @@
1
- [build-system]
2
- requires = ["setuptools>=61", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "lbm_suite2p_python"
7
- version = "3.0.2"
8
- description = "Calcium Imaging Pipeline built with Suite2p, Cellpose and Rastermap"
9
- readme = "README.md"
10
- license = "BSD-3-Clause"
11
- requires-python = ">=3.12.7,<3.14"
12
- keywords = ["Pipeline", "Numpy", "Microscopy", "ScanImage", "Suite2p", "tiff"]
13
- urls = {homepage = "https://github.com/MillerBrainObservatory/LBM-Suite2p-Python"}
14
- classifiers=[
15
- "Development Status :: 3 - Alpha",
16
- "Intended Audience :: Science/Research",
17
- "Programming Language :: Python :: 3 :: Only",
18
- ]
19
-
20
- dependencies = [
21
- "mbo_utilities>=3.0.1",
22
- "suite2p>=1.0.0.1",
23
- "setuptools<81",
24
- ]
25
-
26
- [project.scripts]
27
- lsp = "lbm_suite2p_python.__main__:main"
28
- cellpose-gui = "lbm_suite2p_python.gui:main"
29
-
30
- [project.optional-dependencies]
31
- rastermap = [
32
- "rastermap",
33
- ]
34
- # Cellpose for anatomical cell detection (requires PyTorch)
35
- cellpose = [
36
- "cellpose>=4.0.6",
37
- ]
38
- # All optional dependencies
39
- all = [
40
- "lbm_suite2p_python[rastermap,cellpose]",
41
- ]
42
-
43
- [dependency-groups]
44
- dev = [
45
- "pytest>=8.0.0",
46
- ]
47
- docs = [
48
- "docutils>=0.21.2",
49
- "myst-nb>=1.2.0",
50
- "sphinx>=8.1.3",
51
- "roman-numerals-py>=2.0.0,<3.0.0", # 3.x is broken
52
- "sphinx-autodoc2>=0.5.0",
53
- "sphinx-copybutton>=0.5.2",
54
- "sphinx_togglebutton",
55
- "sphinx-design>=0.6.1",
56
- "sphinxcontrib-bibtex",
57
- "sphinx-tippy",
58
- "sphinx_book_theme",
59
- "numpydoc",
60
- "ipykernel",
61
- "sphinxcontrib-images",
62
- "sphinxcontrib-video",
63
- "jupytext",
64
- "scikit-image",
65
- "scipy",
66
- "pandas",
67
- "suite2p",
68
- ]
69
-
70
- # https://github.com/charliermarsh/ruff
71
- [tool.ruff]
72
- line-length = 88
73
- src = ["lbm_suite2p_python"]
74
- exclude = ["docs", "exclude", "demos", "scripts", "dev"]
75
-
76
- [tool.ruff.lint]
77
- pydocstyle = { convention = "numpy" }
78
- select = ["ALL"]
79
- ignore = [
80
- "D401", # First line should be in imperative mood (remove to opt in)
81
- "COM812", # Missing trailing comma (conflicts with ruff format)
82
- "ISC001", # Import sorting (conflicts with ruff format)
83
- "FIX002", # Fixable issue
84
- "DOC201", # TODO enable in follow-up PR; no doc for return type.
85
- "FBT", # TODO: enable in follow-up PR; require bool options to be keyword-only.
86
- ]
87
-
88
- [tool.ruff.lint.per-file-ignores]
89
- "docs/*.py" = ["D"]
90
-
91
- [tool.setuptools.exclude-package-data]
92
- "*" = ["data/*"]
93
-
94
- [tool.setuptools.packages.find]
95
- where = ["."]
96
- include = ["lbm_suite2p_python*"]
97
-
98
- [tool.coverage.report]
99
- exclude_lines = [
100
- "pragma: no cover",
101
- "if TYPE_CHECKING:",
102
- "@overload",
103
- "except ImportError",
104
- "\\.\\.\\.",
105
- "raise NotImplementedError()"
106
- ]
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "lbm_suite2p_python"
7
+ version = "3.0.4"
8
+ description = "Calcium Imaging Pipeline built with Suite2p, Cellpose and Rastermap"
9
+ readme = "README.md"
10
+ license = "BSD-3-Clause"
11
+ requires-python = ">=3.12.7,<3.14"
12
+ keywords = ["Pipeline", "Numpy", "Microscopy", "ScanImage", "Suite2p", "tiff"]
13
+ urls = {homepage = "https://github.com/MillerBrainObservatory/LBM-Suite2p-Python"}
14
+ classifiers=[
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ ]
19
+
20
+ dependencies = [
21
+ "mbo_utilities>=3.0.3",
22
+ "suite2p>=1.0.0.1",
23
+ "setuptools<81",
24
+ ]
25
+
26
+ [project.scripts]
27
+ lsp = "lbm_suite2p_python.__main__:main"
28
+ cellpose-gui = "lbm_suite2p_python.gui:main"
29
+
30
+ [project.optional-dependencies]
31
+ rastermap = [
32
+ "rastermap",
33
+ ]
34
+ # Cellpose for anatomical cell detection (requires PyTorch)
35
+ cellpose = [
36
+ "cellpose>=4.0.6",
37
+ ]
38
+ # All optional dependencies
39
+ all = [
40
+ "lbm_suite2p_python[rastermap,cellpose]",
41
+ ]
42
+
43
+ [dependency-groups]
44
+ dev = [
45
+ "pytest>=8.0.0",
46
+ ]
47
+ docs = [
48
+ "docutils>=0.21.2",
49
+ "myst-nb>=1.2.0",
50
+ "sphinx>=8.1.3",
51
+ "roman-numerals-py>=2.0.0,<3.0.0", # 3.x is broken
52
+ "sphinx-autodoc2>=0.5.0",
53
+ "sphinx-copybutton>=0.5.2",
54
+ "sphinx_togglebutton",
55
+ "sphinx-design>=0.6.1",
56
+ "sphinxcontrib-bibtex",
57
+ "sphinx-tippy",
58
+ "sphinx_book_theme",
59
+ "numpydoc",
60
+ "ipykernel",
61
+ "sphinxcontrib-images",
62
+ "sphinxcontrib-video",
63
+ "jupytext",
64
+ "scikit-image",
65
+ "scipy",
66
+ "pandas",
67
+ "suite2p",
68
+ ]
69
+
70
+ # https://github.com/charliermarsh/ruff
71
+ [tool.ruff]
72
+ line-length = 88
73
+ src = ["lbm_suite2p_python"]
74
+ exclude = ["docs", "exclude", "demos", "scripts", "dev"]
75
+
76
+ [tool.ruff.lint]
77
+ pydocstyle = { convention = "numpy" }
78
+ select = ["ALL"]
79
+ ignore = [
80
+ "D401", # First line should be in imperative mood (remove to opt in)
81
+ "COM812", # Missing trailing comma (conflicts with ruff format)
82
+ "ISC001", # Import sorting (conflicts with ruff format)
83
+ "FIX002", # Fixable issue
84
+ "DOC201", # TODO enable in follow-up PR; no doc for return type.
85
+ "FBT", # TODO: enable in follow-up PR; require bool options to be keyword-only.
86
+ ]
87
+
88
+ [tool.ruff.lint.per-file-ignores]
89
+ "docs/*.py" = ["D"]
90
+
91
+ [tool.setuptools.exclude-package-data]
92
+ "*" = ["data/*"]
93
+
94
+ [tool.setuptools.packages.find]
95
+ where = ["."]
96
+ include = ["lbm_suite2p_python*"]
97
+
98
+ [tool.coverage.report]
99
+ exclude_lines = [
100
+ "pragma: no cover",
101
+ "if TYPE_CHECKING:",
102
+ "@overload",
103
+ "except ImportError",
104
+ "\\.\\.\\.",
105
+ "raise NotImplementedError()"
106
+ ]