lbm_suite2p_python 3.0.4__tar.gz → 3.0.5__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.4/lbm_suite2p_python.egg-info → lbm_suite2p_python-3.0.5}/PKG-INFO +1 -1
  2. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/run_lsp.py +68 -13
  3. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5/lbm_suite2p_python.egg-info}/PKG-INFO +1 -1
  4. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/pyproject.toml +1 -1
  5. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/LICENSE.md +0 -0
  6. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/MANIFEST.in +0 -0
  7. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/README.md +0 -0
  8. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/__init__.py +0 -0
  9. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/__main__.py +0 -0
  10. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/_benchmarking.py +0 -0
  11. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/cellpose.py +0 -0
  12. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/cli.py +0 -0
  13. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/conversion.py +0 -0
  14. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/db_settings.py +0 -0
  15. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/default_ops.py +0 -0
  16. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/grid_search.py +0 -0
  17. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/gui.py +0 -0
  18. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/merging.py +0 -0
  19. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/postprocessing.py +0 -0
  20. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/utils.py +0 -0
  21. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/volume.py +0 -0
  22. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python/zplane.py +0 -0
  23. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python.egg-info/SOURCES.txt +0 -0
  24. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python.egg-info/dependency_links.txt +0 -0
  25. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python.egg-info/entry_points.txt +0 -0
  26. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python.egg-info/requires.txt +0 -0
  27. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/lbm_suite2p_python.egg-info/top_level.txt +0 -0
  28. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/setup.cfg +0 -0
  29. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/tests/test_frame_count_aliases.py +0 -0
  30. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/tests/test_pipeline_parameters.py +0 -0
  31. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/tests/test_refactored_pipeline.py +0 -0
  32. {lbm_suite2p_python-3.0.4 → lbm_suite2p_python-3.0.5}/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.4
3
+ Version: 3.0.5
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
@@ -237,7 +237,6 @@ def _copy_if_needed(src: Path, dst: Path, *, overwrite_empty: bool = True) -> bo
237
237
  if dst.exists():
238
238
  if not (overwrite_empty and dst.stat().st_size == 0):
239
239
  return False
240
- print(f" Copying {src.name} from {src.parent} -> {dst.parent}")
241
240
  shutil.copy2(src, dst)
242
241
  return True
243
242
 
@@ -263,6 +262,7 @@ def _stage_source_into_plane_dir(
263
262
  plane_dir = Path(plane_dir)
264
263
  plane_dir.mkdir(parents=True, exist_ok=True)
265
264
 
265
+ print(f" Staging plane outputs: {src_dir.name} -> {plane_dir.name}")
266
266
  _copy_if_needed(src_dir / "ops.npy", plane_dir / "ops.npy")
267
267
  for fname in _DETECTION_OUTPUT_FILES:
268
268
  _copy_if_needed(src_dir / fname, plane_dir / fname)
@@ -2026,6 +2026,10 @@ def run_plane(
2026
2026
  )
2027
2027
 
2028
2028
  existing_ops = np.load(src_dir / "ops.npy", allow_pickle=True).item()
2029
+ # remember the original acquisition source before the merge below
2030
+ # overwrites data_path with the staged binary path. needed by
2031
+ # force_reg path when the source has no data_raw.bin.
2032
+ original_data_path = existing_ops.get("data_path")
2029
2033
  metadata = {
2030
2034
  k: v
2031
2035
  for k, v in existing_ops.items()
@@ -2073,20 +2077,71 @@ def run_plane(
2073
2077
  "data_path": str(input_path.resolve()),
2074
2078
  }
2075
2079
 
2076
- # registration would need to write to data.bin, but data.bin
2077
- # lives at the source dir running it would clobber the user's
2078
- # source binary. force detection-only; user can re-register from
2079
- # the original tiff/zarr if they want fresh registration.
2080
- if ops_user.get("do_registration", 1):
2081
- logger.warning(
2082
- "do_registration=1 ignored when staging from an existing "
2083
- "registered binary into a different save_path — running "
2084
- "registration would clobber the source data.bin. Forcing "
2085
- "do_registration=0 (detection-only)."
2086
- )
2087
- ops["do_registration"] = 0
2080
+ if not force_reg:
2081
+ # registration would need to write to data.bin, but data.bin
2082
+ # lives at the source dir running it would clobber the user's
2083
+ # source binary. force detection-only; user can re-register
2084
+ # from the original tiff/zarr by passing force_reg=True (Force
2085
+ # in the GUI), which routes writes into the new plane_dir.
2086
+ if ops_user.get("do_registration", 1):
2087
+ logger.warning(
2088
+ "do_registration ignored when staging into a different "
2089
+ "save_path — running registration would clobber the "
2090
+ "source data.bin. Forcing do_registration=0 "
2091
+ "(detection-only). Pass force_reg=True (Force in the "
2092
+ "GUI) to re-register into the new save_path."
2093
+ )
2094
+ ops["do_registration"] = 0
2088
2095
 
2089
2096
  _stage_source_into_plane_dir(src_dir, plane_dir, ops)
2097
+
2098
+ if force_reg:
2099
+ # writes go to plane_dir/data.bin — discard the source pointer
2100
+ # that _stage_source_into_plane_dir set.
2101
+ ops.pop("reg_file", None)
2102
+ # existing_ops carries a `raw_file` path from the original
2103
+ # run; if keep_raw=False removed the file, the string is
2104
+ # still present but stale. existence-check, don't trust the
2105
+ # string alone.
2106
+ _raw = ops.get("raw_file")
2107
+ if not _raw or not Path(_raw).exists():
2108
+ import shutil
2109
+ target_raw = plane_dir / "data_raw.bin"
2110
+ # prefer the original acquisition (tiff/zarr) when it's
2111
+ # still on disk — avoids re-registering already-
2112
+ # registered data. Skip when it points at the same .bin
2113
+ # the user just loaded (no improvement, and imread of a
2114
+ # stale data_path could be wrong).
2115
+ use_original = (
2116
+ bool(original_data_path)
2117
+ and Path(original_data_path).exists()
2118
+ and Path(original_data_path).resolve() != input_path.resolve()
2119
+ )
2120
+ if use_original:
2121
+ print(
2122
+ f" Force registration: rewriting data_raw.bin from "
2123
+ f"{Path(original_data_path).name}"
2124
+ )
2125
+ file = imread(Path(original_data_path), **reader_kwargs)
2126
+ if hasattr(file, "metadata"):
2127
+ metadata = dict(file.metadata)
2128
+ else:
2129
+ metadata = get_metadata(Path(original_data_path))
2130
+ skip_imwrite = False
2131
+ else:
2132
+ # original acquisition is gone (or IS the input).
2133
+ # seed data_raw.bin from the staged data.bin so
2134
+ # registration has frames to work with. Re-registers
2135
+ # already-registered data (near-zero shifts) — fine
2136
+ # for detection / bad-frame re-runs.
2137
+ print(
2138
+ f" Force registration: original acquisition "
2139
+ f"unavailable; seeding data_raw.bin from "
2140
+ f"{input_path.name} (re-registering already-"
2141
+ f"registered data)"
2142
+ )
2143
+ shutil.copy2(input_path, target_raw)
2144
+ ops["raw_file"] = str(target_raw)
2090
2145
  else:
2091
2146
  skip_imwrite = False
2092
2147
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lbm_suite2p_python
3
- Version: 3.0.4
3
+ Version: 3.0.5
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "lbm_suite2p_python"
7
- version = "3.0.4"
7
+ version = "3.0.5"
8
8
  description = "Calcium Imaging Pipeline built with Suite2p, Cellpose and Rastermap"
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"