PyOPIA 2.16.12__tar.gz → 2.16.13__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.12 → pyopia-2.16.13}/PKG-INFO +1 -1
  2. pyopia-2.16.13/pyopia/__init__.py +1 -0
  3. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/pipeline.py +6 -0
  4. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_pipeline.py +18 -1
  5. pyopia-2.16.12/pyopia/__init__.py +0 -1
  6. {pyopia-2.16.12 → pyopia-2.16.13}/.gitignore +0 -0
  7. {pyopia-2.16.12 → pyopia-2.16.13}/LICENSE +0 -0
  8. {pyopia-2.16.12 → pyopia-2.16.13}/README.md +0 -0
  9. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/auxillarydata.py +0 -0
  10. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/background.py +0 -0
  11. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/cf_metadata.json +0 -0
  12. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/classify.py +0 -0
  13. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/classify_torch.py +0 -0
  14. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/cli.py +0 -0
  15. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/dataexport/__init__.py +0 -0
  16. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/dataexport/ecotaxa.py +0 -0
  17. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/exampledata.py +0 -0
  18. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/instrument/__init__.py +0 -0
  19. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/instrument/common.py +0 -0
  20. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/instrument/holo.py +0 -0
  21. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/instrument/silcam.py +0 -0
  22. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/instrument/uvp.py +0 -0
  23. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/io.py +0 -0
  24. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/metadata.py +0 -0
  25. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/plotting.py +0 -0
  26. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/process.py +0 -0
  27. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/realtime.py +0 -0
  28. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/simulator/__init__.py +0 -0
  29. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/simulator/silcam.py +0 -0
  30. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/statistics.py +0 -0
  31. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/__init__.py +0 -0
  32. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_auxillarydata.py +0 -0
  33. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_classify.py +0 -0
  34. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_io.py +0 -0
  35. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_notebooks.py +0 -0
  36. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_process.py +0 -0
  37. {pyopia-2.16.12 → pyopia-2.16.13}/pyopia/tests/test_realtime.py +0 -0
  38. {pyopia-2.16.12 → pyopia-2.16.13}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOPIA
3
- Version: 2.16.12
3
+ Version: 2.16.13
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
@@ -0,0 +1 @@
1
+ __version__ = "2.16.13"
@@ -351,6 +351,7 @@ class FilesToProcess:
351
351
  '''
352
352
  def __init__(self, glob_pattern=None):
353
353
  self.files = None
354
+ self.glob_pattern = glob_pattern
354
355
  self.background_files = []
355
356
  self.chunked_files = []
356
357
  if glob_pattern is not None:
@@ -399,6 +400,11 @@ class FilesToProcess:
399
400
  strategy : str, optional
400
401
  Strategy to use for chunking dataset, either `block` or `interleave`. Defult: `block`
401
402
  '''
403
+ if len(self.files) == 0:
404
+ raise RuntimeError(
405
+ f'No raw files found for "{self.glob_pattern}". '
406
+ 'Check the general.raw_files setting in your config file.'
407
+ )
402
408
  if num_chunks > len(self.files) // 2:
403
409
  raise RuntimeError('Number of chunks exceeds more than half the number of files to process. Use less chunks.')
404
410
  self.chunk_files(num_chunks, strategy)
@@ -7,12 +7,13 @@ from glob import glob
7
7
  import tempfile
8
8
  import os
9
9
  import numpy as np
10
+ import pytest
10
11
  import skimage.io
11
12
 
12
13
  import pyopia.exampledata as testdata
13
14
  import pyopia.io
14
15
  import pyopia.classify
15
- from pyopia.pipeline import Pipeline
16
+ from pyopia.pipeline import FilesToProcess, Pipeline
16
17
  import pyopia.process
17
18
  import pyopia.statistics
18
19
  import pyopia.background # noqa: F401
@@ -307,7 +308,23 @@ def test_per_class_concentration():
307
308
  np.testing.assert_allclose(result.loc[ts_2, 'sample_volume_L'], sample_volume)
308
309
 
309
310
 
311
+ def test_files_to_process_raises_clear_error_for_no_matching_files(tmp_path):
312
+ '''Regression test for #279: an empty/non-matching raw_files pattern used to surface
313
+ as a misleading "Number of chunks exceeds..." RuntimeError instead of a clear
314
+ "no files found" error.
315
+ '''
316
+ empty_dir = tmp_path / 'empty'
317
+ empty_dir.mkdir()
318
+ glob_pattern = str(empty_dir / '*.silc')
319
+
320
+ raw_files = FilesToProcess(glob_pattern)
321
+
322
+ with pytest.raises(RuntimeError, match='No raw files found'):
323
+ raw_files.prepare_chunking(num_chunks=1, average_window=0, bgshift_function='pass')
324
+
325
+
310
326
  if __name__ == "__main__":
311
327
  test_holo_pipeline()
312
328
  test_silcam_pipeline()
313
329
  test_per_class_concentration()
330
+ test_files_to_process_raises_clear_error_for_no_matching_files()
@@ -1 +0,0 @@
1
- __version__ = "2.16.12"
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