lbm_suite2p_python 3.0.2__py3-none-any.whl → 3.0.4__py3-none-any.whl

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.
@@ -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
- lbm_suite2p_python/__init__.py,sha256=bIU_X9eDd-P2uZ88v2OWEI0uOeiK6ZvWFs3HNtmhd1Q,3683
1
+ lbm_suite2p_python/__init__.py,sha256=Co20SS9KpWui19s06FUhjXFYXOYkfJ3V6nzqSVZQMGQ,3751
2
2
  lbm_suite2p_python/__main__.py,sha256=lMnZnMkCbv8OTh5i5uZlG1sF33PEs42zITw8aG8YKwI,131
3
3
  lbm_suite2p_python/_benchmarking.py,sha256=oi7q5VDShYa-YqEiZluJEmOeq-_X2jzz-bjxIalhLZ4,172
4
4
  lbm_suite2p_python/cellpose.py,sha256=RVlTfjJXqOSpJMtwXay6rTlR-55hm6Gl1niluuV8hXQ,63223
@@ -10,13 +10,13 @@ lbm_suite2p_python/grid_search.py,sha256=4Sgl2Nx95jHrpm4S9yj0z4R6tR8CrslPRAM8xiD
10
10
  lbm_suite2p_python/gui.py,sha256=jA8dg1yEM0ikMNJ0UrE_6joQkuqsmDj9I_pIb-E0YpA,10594
11
11
  lbm_suite2p_python/merging.py,sha256=qcQmAnaJPPniSMDDVeu_uZTcstXMYNfvWUBU4zVKLEI,13928
12
12
  lbm_suite2p_python/postprocessing.py,sha256=4n5c2qXZsBC65zxBWJC1UBy69N-OA9OFXdzDUUQXRQg,56821
13
- lbm_suite2p_python/run_lsp.py,sha256=3ODbBG0N6gW5CWKFx-P1kWTfDMuvRaBYzjugDXStyoU,104544
13
+ lbm_suite2p_python/run_lsp.py,sha256=nS4VhqjUKcNnhPvB7eqc_DDVchmt1AQRasIepH5jjKQ,105946
14
14
  lbm_suite2p_python/utils.py,sha256=ECqCiwaKy78YFG-qxkiUZbdSW92zHjGjqWWpnIFHy-M,3514
15
15
  lbm_suite2p_python/volume.py,sha256=Q6Jc6_qLp6rnk4aHjazuTwsR3QJNRqb-RNdqR-IFTSA,80260
16
16
  lbm_suite2p_python/zplane.py,sha256=z9l8ijMCIQsesIU1xWojf7GYp9AW9kTPEc2xlK8O_eA,181600
17
- lbm_suite2p_python-3.0.2.dist-info/licenses/LICENSE.md,sha256=iZa6bLG-5EfV2LXTfQQ7wdDwslaIc9SrOfyKRtzvCoQ,1981
18
- lbm_suite2p_python-3.0.2.dist-info/METADATA,sha256=zpbgDRibHMVf_nyassufyEBBFUmyQwXTpTNb-2yBtjA,8830
19
- lbm_suite2p_python-3.0.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
20
- lbm_suite2p_python-3.0.2.dist-info/entry_points.txt,sha256=Ow6TsVyBZI0viAeQP6Ty7GJAmoXD7RmMhIxongAWAVM,100
21
- lbm_suite2p_python-3.0.2.dist-info/top_level.txt,sha256=WhCsVG68YLKWeTNJVwueG_4H3uuiI22I_TERsF-5mGk,19
22
- lbm_suite2p_python-3.0.2.dist-info/RECORD,,
17
+ lbm_suite2p_python-3.0.4.dist-info/licenses/LICENSE.md,sha256=iZa6bLG-5EfV2LXTfQQ7wdDwslaIc9SrOfyKRtzvCoQ,1981
18
+ lbm_suite2p_python-3.0.4.dist-info/METADATA,sha256=qk1UzFJy3ygtzTOgrgGOPpJtZ7dL8llbknapoSpUG80,8830
19
+ lbm_suite2p_python-3.0.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
20
+ lbm_suite2p_python-3.0.4.dist-info/entry_points.txt,sha256=Ow6TsVyBZI0viAeQP6Ty7GJAmoXD7RmMhIxongAWAVM,100
21
+ lbm_suite2p_python-3.0.4.dist-info/top_level.txt,sha256=WhCsVG68YLKWeTNJVwueG_4H3uuiI22I_TERsF-5mGk,19
22
+ lbm_suite2p_python-3.0.4.dist-info/RECORD,,