nanoobjectdetection 2.0.0__tar.gz → 2.1.1__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 (38) hide show
  1. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/PKG-INFO +1 -1
  2. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/localization.py +40 -11
  3. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/pipeline.py +5 -1
  4. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection.egg-info/PKG-INFO +1 -1
  5. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection.egg-info/SOURCES.txt +1 -2
  6. nanoobjectdetection-2.1.1/nanoobjectdetection.egg-info/top_level.txt +1 -0
  7. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/pyproject.toml +1 -1
  8. nanoobjectdetection-2.0.0/nanoobjectdetection.egg-info/top_level.txt +0 -2
  9. nanoobjectdetection-2.0.0/nanoobjectdetection_2_0/__init__.py +0 -30
  10. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/MANIFEST.in +0 -0
  11. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/README.md +0 -0
  12. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/__init__.py +0 -0
  13. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/__main__.py +0 -0
  14. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/application.py +0 -0
  15. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/auto_parameters.py +0 -0
  16. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/calibration.py +0 -0
  17. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/config.py +0 -0
  18. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/drift.py +0 -0
  19. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/gpu.py +0 -0
  20. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/hindrance.py +0 -0
  21. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/legacy_config.py +0 -0
  22. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/legacy_outputs.py +0 -0
  23. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/msd.py +0 -0
  24. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/plotting.py +0 -0
  25. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/preprocessing.py +0 -0
  26. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/progress.py +0 -0
  27. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/quality.py +0 -0
  28. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/statistics.py +0 -0
  29. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/stitching.py +0 -0
  30. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/storage.py +0 -0
  31. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/synthetic.py +0 -0
  32. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/tracking.py +0 -0
  33. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/trajectory_processing.py +0 -0
  34. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection/ultra_uniform.py +0 -0
  35. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection.egg-info/dependency_links.txt +0 -0
  36. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection.egg-info/entry_points.txt +0 -0
  37. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/nanoobjectdetection.egg-info/requires.txt +0 -0
  38. {nanoobjectdetection-2.0.0 → nanoobjectdetection-2.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nanoobjectdetection
3
- Version: 2.0.0
3
+ Version: 2.1.1
4
4
  Summary: Particle localization and diffusion analysis for TIFF image stacks
5
5
  Author: Tim Stechel, Ronny Förster
6
6
  License: MIT
@@ -6,21 +6,41 @@ import pandas as pd
6
6
  import numpy as np
7
7
  import os
8
8
  import sys
9
+ import warnings
9
10
  from concurrent.futures import ProcessPoolExecutor
10
11
 
11
- def _locate_frame(args):
12
+
13
+ def _locate_frame(args) -> tuple[pd.DataFrame, bool]:
12
14
  import trackpy as tp
13
15
 
14
16
  frame, diameter, minmass, separation, percentile, preprocess = args
15
- return tp.locate(
16
- frame,
17
- diameter,
18
- minmass=minmass,
19
- separation=separation,
20
- percentile=percentile,
21
- preprocess=preprocess,
22
- engine="python",
23
- )
17
+ with warnings.catch_warnings(record=True) as caught:
18
+ warnings.simplefilter("always")
19
+ found = tp.locate(
20
+ frame,
21
+ diameter,
22
+ minmass=minmass,
23
+ separation=separation,
24
+ percentile=percentile,
25
+ preprocess=preprocess,
26
+ engine="python",
27
+ )
28
+
29
+ black_image_warning = False
30
+ for warning in caught:
31
+ if (
32
+ warning.category is UserWarning
33
+ and str(warning.message) == "Image is completely black."
34
+ ):
35
+ black_image_warning = True
36
+ else:
37
+ warnings.warn_explicit(
38
+ warning.message,
39
+ warning.category,
40
+ warning.filename,
41
+ warning.lineno,
42
+ )
43
+ return found, black_image_warning
24
44
 
25
45
 
26
46
  def locate(
@@ -62,8 +82,17 @@ def locate(
62
82
  results = list(pool.map(_locate_frame, jobs, chunksize=batch))
63
83
  else:
64
84
  results = [_locate_frame(job) for job in jobs]
85
+ black_frames = sum(is_black for _, is_black in results)
86
+ if black_frames:
87
+ warnings.warn(
88
+ f"Trackpy found {black_frames} completely black image frame(s). "
89
+ "If using 8-bit processing, try switching to 16-bit processing. "
90
+ "The exposure may also have been too low.",
91
+ UserWarning,
92
+ stacklevel=2,
93
+ )
65
94
  detections = []
66
- for frame_number, found in enumerate(results):
95
+ for frame_number, (found, _) in enumerate(results):
67
96
  if not found.empty:
68
97
  found = found.copy()
69
98
  found["frame"] = frame_number
@@ -546,7 +546,11 @@ class AnalysisPipeline:
546
546
  )
547
547
  maximum = max(maximum, float(np.max(np.maximum(processed, 0.0))))
548
548
  if maximum <= 0:
549
- raise RuntimeError("Processed image stack contains no positive intensity")
549
+ raise RuntimeError(
550
+ "Processed image stack contains no positive intensity; the images "
551
+ "appear completely black. If using 8-bit processing, try switching "
552
+ "to 16-bit processing. The exposure may also have been too low."
553
+ )
550
554
  return maximum
551
555
 
552
556
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nanoobjectdetection
3
- Version: 2.0.0
3
+ Version: 2.1.1
4
4
  Summary: Particle localization and diffusion analysis for TIFF image stacks
5
5
  Author: Tim Stechel, Ronny Förster
6
6
  License: MIT
@@ -31,5 +31,4 @@ nanoobjectdetection.egg-info/SOURCES.txt
31
31
  nanoobjectdetection.egg-info/dependency_links.txt
32
32
  nanoobjectdetection.egg-info/entry_points.txt
33
33
  nanoobjectdetection.egg-info/requires.txt
34
- nanoobjectdetection.egg-info/top_level.txt
35
- nanoobjectdetection_2_0/__init__.py
34
+ nanoobjectdetection.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ nanoobjectdetection
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nanoobjectdetection"
7
- version = "2.0.0"
7
+ version = "2.1.1"
8
8
  description = "Particle localization and diffusion analysis for TIFF image stacks"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,2 +0,0 @@
1
- nanoobjectdetection
2
- nanoobjectdetection_2_0
@@ -1,30 +0,0 @@
1
- """Backward-compatibility module forwarding to nanoobjectdetection."""
2
-
3
- import sys
4
- import nanoobjectdetection
5
-
6
- # Forward package attributes
7
- __all__ = nanoobjectdetection.__all__
8
- __version__ = nanoobjectdetection.__version__
9
-
10
- for name in __all__:
11
- globals()[name] = getattr(nanoobjectdetection, name)
12
-
13
- # Ensure submodules imported via `from nanoobjectdetection_2_0.submodule import ...` work
14
- import importlib
15
-
16
- class _CompatibilityFinder:
17
- """Redirects imports from nanoobjectdetection_2_0 to nanoobjectdetection."""
18
- @classmethod
19
- def find_spec(cls, fullname, path=None, target=None):
20
- if fullname.startswith("nanoobjectdetection_2_0."):
21
- submodule = fullname[len("nanoobjectdetection_2_0."):]
22
- try:
23
- real_module = importlib.import_module(f"nanoobjectdetection.{submodule}")
24
- sys.modules[fullname] = real_module
25
- return real_module.__spec__
26
- except ImportError:
27
- return None
28
- return None
29
-
30
- sys.meta_path.insert(0, _CompatibilityFinder)