PyOPIA 2.8.0__tar.gz → 2.8.2__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 (26) hide show
  1. {pyopia-2.8.0 → pyopia-2.8.2}/PKG-INFO +2 -1
  2. pyopia-2.8.2/pyopia/__init__.py +1 -0
  3. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/cli.py +34 -17
  4. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/instrument/silcam.py +1 -1
  5. pyopia-2.8.0/pyopia/__init__.py +0 -1
  6. {pyopia-2.8.0 → pyopia-2.8.2}/LICENSE +0 -0
  7. {pyopia-2.8.0 → pyopia-2.8.2}/README.md +0 -0
  8. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/background.py +0 -0
  9. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/classify.py +0 -0
  10. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/exampledata.py +0 -0
  11. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/instrument/__init__.py +0 -0
  12. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/instrument/common.py +0 -0
  13. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/instrument/holo.py +0 -0
  14. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/instrument/uvp.py +0 -0
  15. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/io.py +0 -0
  16. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/pipeline.py +0 -0
  17. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/plotting.py +0 -0
  18. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/process.py +0 -0
  19. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/simulator/__init__.py +0 -0
  20. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/simulator/silcam.py +0 -0
  21. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/statistics.py +0 -0
  22. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/tests/__init__.py +0 -0
  23. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/tests/test_classify.py +0 -0
  24. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/tests/test_notebooks.py +0 -0
  25. {pyopia-2.8.0 → pyopia-2.8.2}/pyopia/tests/test_pipeline.py +0 -0
  26. {pyopia-2.8.0 → pyopia-2.8.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyOPIA
3
- Version: 2.8.0
3
+ Version: 2.8.2
4
4
  Summary: A Python Ocean Particle Image Analysis toolbox.
5
5
  Home-page: https://github.com/sintef/pyopia
6
6
  Keywords: Ocean,Particles,Imaging,Measurement,Size distribution
@@ -9,6 +9,7 @@ Author-email: emlyn.davies@sintef.no
9
9
  Requires-Python: >=3.12,<4.0
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Provides-Extra: classification
13
14
  Provides-Extra: classification-arm64
14
15
  Requires-Dist: cmocean (>=3.0.3,<4.0.0)
@@ -0,0 +1 @@
1
+ __version__ = '2.8.2'
@@ -172,28 +172,13 @@ def process(config_filename: str, num_chunks: int = 1, strategy: str = 'block'):
172
172
 
173
173
  progress.console.print("[blue]INITIALISE PIPELINE")
174
174
 
175
- def process_file_list(file_list, c):
176
- processing_pipeline = pyopia.pipeline.Pipeline(pipeline_config)
177
-
178
- with get_custom_progress_bar(f'[blue]Processing progress (chunk {c})', disable=c != 0) as pbar:
179
- for filename in pbar.track(file_list, description=f'[blue]Processing progress (chunk {c})'):
180
- try:
181
- logger.debug(f'Chunk {c} starting to process {filename}')
182
- processing_pipeline.run(filename)
183
- except Exception as e:
184
- logger.warning('[red]An error occured in processing, ' +
185
- 'skipping rest of pipeline and moving to next image.' +
186
- f'(chunk {c})')
187
- logger.error(e)
188
- logger.debug(''.join(traceback.format_tb(e.__traceback__)))
189
-
190
175
  # With one chunk we keep the non-multiprocess functionality to ensure backwards compatibility
191
176
  job_list = []
192
177
  if num_chunks == 1:
193
- process_file_list(raw_files, 0)
178
+ process_file_list(raw_files, pipeline_config, 0)
194
179
  else:
195
180
  for c, chunk in enumerate(raw_files.chunked_files):
196
- job = multiprocessing.Process(target=process_file_list, args=(chunk, c))
181
+ job = multiprocessing.Process(target=process_file_list, args=(chunk, pipeline_config, c))
197
182
  job_list.append(job)
198
183
 
199
184
  # Start all the jobs
@@ -239,6 +224,38 @@ def merge_mfdata(path_to_data: str, prefix='*', overwrite_existing_partials: boo
239
224
  chunk_size=chunk_size)
240
225
 
241
226
 
227
+ def process_file_list(file_list, pipeline_config, c):
228
+ '''Run a PyOPIA processing pipeline for a chuncked list of files based on a given config.toml
229
+
230
+ Parameters
231
+ ----------
232
+ file_list : str
233
+ List of file paths to process, where each file will be passed individually through the processing pipeline
234
+
235
+ pipeline_config : str
236
+ Loaded config.toml file to initialize the processing pipeline and setup logging
237
+
238
+ c : int
239
+ Chunk index for tracking progress and logging. If set to 0, enables the
240
+ progress bar; for other values, the progress bar is disabled.
241
+ '''
242
+ processing_pipeline = pyopia.pipeline.Pipeline(pipeline_config)
243
+ setup_logging(pipeline_config)
244
+ logger = logging.getLogger('rich')
245
+
246
+ with get_custom_progress_bar(f'[blue]Processing progress (chunk {c})', disable=c != 0) as pbar:
247
+ for filename in pbar.track(file_list, description=f'[blue]Processing progress (chunk {c})'):
248
+ try:
249
+ logger.debug(f'Chunk {c} starting to process {filename}')
250
+ processing_pipeline.run(filename)
251
+ except Exception as e:
252
+ logger.warning('[red]An error occured in processing, ' +
253
+ 'skipping rest of pipeline and moving to next image.' +
254
+ f'(chunk {c})')
255
+ logger.error(e)
256
+ logger.debug(''.join(traceback.format_tb(e.__traceback__)))
257
+
258
+
242
259
  def setup_logging(pipeline_config):
243
260
  '''Configure logging
244
261
 
@@ -245,7 +245,7 @@ class SilCamLoad():
245
245
  self.extension_load = {'.silc': load_rgb8,
246
246
  '.msilc': load_mono8,
247
247
  '.bsilc': load_bayer_rgb8,
248
- '.bmp': skimage.io.imread}
248
+ '.bmp': lambda filename: skimage.io.imread(filename).astype(np.float64) / 255}
249
249
  self.format_load = {'RGB8': load_rgb8,
250
250
  'MONO8': load_mono8, 'BAYER_RG8': load_bayer_rgb8}
251
251
 
@@ -1 +0,0 @@
1
- __version__ = '2.8.0'
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