PyOPIA 2.16.7__tar.gz → 2.16.9__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. {pyopia-2.16.7 → pyopia-2.16.9}/PKG-INFO +3 -3
  2. pyopia-2.16.9/pyopia/__init__.py +1 -0
  3. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/instrument/holo.py +30 -16
  4. {pyopia-2.16.7 → pyopia-2.16.9}/pyproject.toml +2 -2
  5. pyopia-2.16.7/pyopia/__init__.py +0 -1
  6. {pyopia-2.16.7 → pyopia-2.16.9}/.gitignore +0 -0
  7. {pyopia-2.16.7 → pyopia-2.16.9}/LICENSE +0 -0
  8. {pyopia-2.16.7 → pyopia-2.16.9}/README.md +0 -0
  9. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/auxillarydata.py +0 -0
  10. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/background.py +0 -0
  11. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/cf_metadata.json +0 -0
  12. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/classify.py +0 -0
  13. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/classify_torch.py +0 -0
  14. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/cli.py +0 -0
  15. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/dataexport/__init__.py +0 -0
  16. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/dataexport/ecotaxa.py +0 -0
  17. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/exampledata.py +0 -0
  18. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/instrument/__init__.py +0 -0
  19. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/instrument/common.py +0 -0
  20. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/instrument/silcam.py +0 -0
  21. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/instrument/uvp.py +0 -0
  22. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/io.py +0 -0
  23. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/metadata.py +0 -0
  24. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/pipeline.py +0 -0
  25. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/plotting.py +0 -0
  26. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/process.py +0 -0
  27. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/realtime.py +0 -0
  28. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/simulator/__init__.py +0 -0
  29. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/simulator/silcam.py +0 -0
  30. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/statistics.py +0 -0
  31. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/__init__.py +0 -0
  32. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_auxillarydata.py +0 -0
  33. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_classify.py +0 -0
  34. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_io.py +0 -0
  35. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_notebooks.py +0 -0
  36. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_pipeline.py +0 -0
  37. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_process.py +0 -0
  38. {pyopia-2.16.7 → pyopia-2.16.9}/pyopia/tests/test_realtime.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOPIA
3
- Version: 2.16.7
3
+ Version: 2.16.9
4
4
  Summary: A Python Ocean Particle Image Analysis toolbox.
5
5
  Project-URL: Repository, https://github.com/sintef/pyopia
6
6
  Project-URL: Documentation, https://pyopia.readthedocs.io
@@ -12,7 +12,7 @@ Requires-Dist: click<8.2.0
12
12
  Requires-Dist: cmocean<4,>=3.0.3
13
13
  Requires-Dist: dask>=2024.8.1
14
14
  Requires-Dist: flake8<7,>=6.1.0
15
- Requires-Dist: gdown<5,>=4.7.1
15
+ Requires-Dist: gdown<7,>=5.2.2
16
16
  Requires-Dist: h5netcdf>=1.3.0
17
17
  Requires-Dist: h5py<4,>=3.9.0
18
18
  Requires-Dist: imageio<3,>=2.31.3
@@ -40,7 +40,7 @@ Requires-Dist: sphinxcontrib-napoleon>=0.7
40
40
  Requires-Dist: toml<0.11,>=0.10.2
41
41
  Requires-Dist: tqdm<5,>=4.66.1
42
42
  Requires-Dist: typer[all]<0.10,>=0.9.0
43
- Requires-Dist: urllib3<2.0
43
+ Requires-Dist: urllib3<3,>=2.5.0
44
44
  Requires-Dist: watchdog>=6.0.0
45
45
  Requires-Dist: xarray<2024,>=2023.12.0
46
46
  Provides-Extra: classification
@@ -0,0 +1 @@
1
+ __version__ = "2.16.9"
@@ -22,7 +22,6 @@ from skimage.morphology import disk, erosion, dilation
22
22
  import pyopia.process
23
23
  import struct
24
24
  from datetime import timedelta
25
- from glob import glob
26
25
 
27
26
  import logging
28
27
  logger = logging.getLogger()
@@ -31,6 +30,11 @@ logger = logging.getLogger()
31
30
  class Initial():
32
31
  '''PyOpia pipline-compatible class for one-time setup of holograhic reconstruction
33
32
 
33
+ Stores the reconstruction parameters needed to build the reconstruction kernel.
34
+ The kernel itself is built lazily on the first call to :class:`Reconstruct`, using the
35
+ dimensions of the first hologram actually loaded by the pipeline. This avoids needing to
36
+ glob or otherwise list the raw files here just to peek at one for its dimensions.
37
+
34
38
  Parameters
35
39
  ----------
36
40
  wavelength : float
@@ -48,11 +52,10 @@ class Initial():
48
52
 
49
53
  Returns
50
54
  -------
51
- kern : np.arry
52
- reconstruction kernel
53
- im_stack : np.array
54
- pre-allocated array to receive reconstruction
55
+ data : :class:`pyopia.pipeline.Data`
56
+ containing the following new keys:
55
57
 
58
+ :attr:`pyopia.pipeline.Data.holo_recon_params`
56
59
  '''
57
60
 
58
61
  def __init__(self, wavelength, n, offset, minZ, maxZ, stepZ):
@@ -64,17 +67,15 @@ class Initial():
64
67
  self.stepZ = stepZ
65
68
 
66
69
  def __call__(self, data):
67
- logger.info('Using first raw file from list in general settings to determine image dimensions')
68
- raw_files = glob(data['settings']['general']['raw_files'])
69
- self.filename = raw_files[0]
70
- imtmp = load_image(self.filename)
71
- self.pixel_size = data['settings']['general']['pixel_size']
72
- logger.info(f'Build kernel with pixel_size = {self.pixel_size} um')
73
- kern = create_kernel(imtmp, self.pixel_size, self.wavelength, self.n, self.offset, self.minZ, self.maxZ, self.stepZ)
74
- im_stack = np.zeros(np.shape(kern)).astype(np.float64)
75
- logger.info('HoloInitial done')
76
- data['kern'] = kern
77
- data['im_stack'] = im_stack
70
+ data['holo_recon_params'] = {
71
+ 'wavelength': self.wavelength,
72
+ 'n': self.n,
73
+ 'offset': self.offset,
74
+ 'minZ': self.minZ,
75
+ 'maxZ': self.maxZ,
76
+ 'stepZ': self.stepZ,
77
+ }
78
+ logger.info('HoloInitial done. Kernel will be built on first call to Reconstruct.')
78
79
  return data
79
80
 
80
81
 
@@ -135,6 +136,11 @@ class Reconstruct():
135
136
 
136
137
  Required keys in :class:`pyopia.pipeline.Data`:
137
138
  - :attr:`pyopia.pipeline.Data.im_corrected`
139
+ - :attr:`pyopia.pipeline.Data.holo_recon_params` (set by :class:`Initial`)
140
+
141
+ On the first call, builds the reconstruction kernel and image stack from the dimensions
142
+ of `im_corrected` and stores them on `data['kern']` / `data['im_stack']` for reuse on
143
+ subsequent calls.
138
144
 
139
145
  Parameters
140
146
  ----------
@@ -160,6 +166,14 @@ class Reconstruct():
160
166
 
161
167
  def __call__(self, data):
162
168
  imc = data['im_corrected']
169
+
170
+ if 'kern' not in data:
171
+ pixel_size = data['settings']['general']['pixel_size']
172
+ logger.info(f'Build kernel with pixel_size = {pixel_size} um')
173
+ kern = create_kernel(imc, pixel_size, **data['holo_recon_params'])
174
+ data['kern'] = kern
175
+ data['im_stack'] = np.zeros(np.shape(kern)).astype(np.float64)
176
+
163
177
  kern = data['kern']
164
178
  im_stack = data['im_stack']
165
179
 
@@ -34,8 +34,8 @@ dependencies = [
34
34
  "myst-nb>=0.17.2,<0.18",
35
35
  "jupyter-book>=0.15.1,<0.16",
36
36
  "ipykernel>=6.19.4",
37
- "urllib3<2.0",
38
- "gdown>=4.7.1,<5",
37
+ "urllib3>=2.5.0,<3",
38
+ "gdown>=5.2.2,<7",
39
39
  "cmocean>=3.0.3,<4",
40
40
  "toml>=0.10.2,<0.11",
41
41
  "xarray>=2023.12.0,<2024",
@@ -1 +0,0 @@
1
- __version__ = "2.16.7"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes