PyOPIA 2.5.0__tar.gz → 2.5.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.
- {pyopia-2.5.0 → pyopia-2.5.2}/PKG-INFO +1 -1
- pyopia-2.5.2/pyopia/__init__.py +1 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/instrument/holo.py +20 -19
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/instrument/silcam.py +9 -3
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/instrument/uvp.py +1 -1
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/io.py +55 -5
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/tests/test_pipeline.py +2 -2
- pyopia-2.5.0/pyopia/__init__.py +0 -1
- {pyopia-2.5.0 → pyopia-2.5.2}/LICENSE +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/README.md +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/background.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/classify.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/cli.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/exampledata.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/instrument/__init__.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/instrument/common.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/pipeline.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/plotting.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/process.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/simulator/__init__.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/simulator/silcam.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/statistics.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/tests/__init__.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/tests/test_classify.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyopia/tests/test_notebooks.py +0 -0
- {pyopia-2.5.0 → pyopia-2.5.2}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.5.2'
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
'''
|
|
2
|
-
|
|
2
|
+
This is a module containing basic processing for reconstruction of in-line holographic images with :mod:`pyopia.pipeline`.
|
|
3
|
+
|
|
4
|
+
See (and references therein):
|
|
5
|
+
Davies EJ, Buscombe D, Graham GW & Nimmo-Smith WAM (2015)
|
|
6
|
+
'Evaluating Unsupervised Methods to Size and Classify Suspended Particles
|
|
7
|
+
Using Digital In-Line Holography'
|
|
8
|
+
Journal of Atmospheric and Oceanic Technology 32, (6) 1241-1256,
|
|
9
|
+
https://doi.org/10.1175/JTECH-D-14-00157.1
|
|
10
|
+
https://journals.ametsoc.org/view/journals/atot/32/6/jtech-d-14-00157_1.xml
|
|
11
|
+
|
|
12
|
+
2022-11-01 Alex Nimmo-Smith alex.nimmo.smith@plymouth.ac.uk
|
|
3
13
|
'''
|
|
4
14
|
|
|
5
15
|
import os
|
|
@@ -17,20 +27,6 @@ from glob import glob
|
|
|
17
27
|
import logging
|
|
18
28
|
logger = logging.getLogger()
|
|
19
29
|
|
|
20
|
-
'''
|
|
21
|
-
This is a module containing basic processing for reconstruction of in-line holographic images.
|
|
22
|
-
|
|
23
|
-
See (and references therein):
|
|
24
|
-
Davies EJ, Buscombe D, Graham GW & Nimmo-Smith WAM (2015)
|
|
25
|
-
'Evaluating Unsupervised Methods to Size and Classify Suspended Particles
|
|
26
|
-
Using Digital In-Line Holography'
|
|
27
|
-
Journal of Atmospheric and Oceanic Technology 32, (6) 1241-1256,
|
|
28
|
-
https://doi.org/10.1175/JTECH-D-14-00157.1
|
|
29
|
-
https://journals.ametsoc.org/view/journals/atot/32/6/jtech-d-14-00157_1.xml
|
|
30
|
-
|
|
31
|
-
2022-11-01 Alex Nimmo-Smith alex.nimmo.smith@plymouth.ac.uk
|
|
32
|
-
'''
|
|
33
|
-
|
|
34
30
|
|
|
35
31
|
class Initial():
|
|
36
32
|
'''PyOpia pipline-compatible class for one-time setup of holograhic reconstruction
|
|
@@ -472,7 +468,7 @@ class Focus():
|
|
|
472
468
|
|
|
473
469
|
Returns
|
|
474
470
|
-------
|
|
475
|
-
:class:`pyopia.pipeline.Data`
|
|
471
|
+
data : :class:`pyopia.pipeline.Data`
|
|
476
472
|
|
|
477
473
|
containing the following keys:
|
|
478
474
|
|
|
@@ -547,11 +543,12 @@ class MergeStats():
|
|
|
547
543
|
|
|
548
544
|
Parameters
|
|
549
545
|
----------
|
|
546
|
+
None
|
|
550
547
|
|
|
551
548
|
Returns
|
|
552
549
|
-------
|
|
553
|
-
|
|
554
|
-
|
|
550
|
+
data : :class:`pyopia.pipeline.Data`
|
|
551
|
+
Updated pipeline data, where data['stats'] includes the new columns: 'holo_filename', 'z', and 'ifocus'
|
|
555
552
|
'''
|
|
556
553
|
|
|
557
554
|
def __init__(self):
|
|
@@ -573,6 +570,10 @@ class MergeStats():
|
|
|
573
570
|
ifocus.append(stack_ifocus[np.argmin(total_diff)])
|
|
574
571
|
|
|
575
572
|
stats['ifocus'] = np.array(ifocus, dtype=np.int64)
|
|
573
|
+
z = (np.arange(data['settings']['steps']['initial']['minZ'],
|
|
574
|
+
(data['settings']['steps']['initial']['maxZ'] + data['settings']['steps']['initial']['stepZ']),
|
|
575
|
+
data['settings']['steps']['initial']['stepZ']))
|
|
576
|
+
stats['z'] = z[stats['ifocus']-1]
|
|
576
577
|
stats['holo_filename'] = data['filename']
|
|
577
578
|
data['stats'] = stats
|
|
578
579
|
return data
|
|
@@ -680,7 +681,7 @@ def generate_config(raw_files: str, model_path: str, outfolder: str, output_pref
|
|
|
680
681
|
'pipeline_class': 'pyopia.instrument.holo.MergeStats',
|
|
681
682
|
},
|
|
682
683
|
'output': {
|
|
683
|
-
'pipeline_class': 'pyopia.io.
|
|
684
|
+
'pipeline_class': 'pyopia.io.StatsToDisc',
|
|
684
685
|
'output_datafile': os.path.join(outfolder, output_prefix)
|
|
685
686
|
}
|
|
686
687
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'''
|
|
2
2
|
Module containing SilCam specific tools to enable compatability with the :mod:`pyopia.pipeline`
|
|
3
|
+
|
|
4
|
+
See:
|
|
5
|
+
Davies, E. J., Brandvik, P. J., Leirvik, F., & Nepstad, R. (2017). The use of wide-band transmittance imaging to size and
|
|
6
|
+
classify suspended particulate matter in seawater. Marine Pollution Bulletin,
|
|
7
|
+
115(1–2). https://doi.org/10.1016/j.marpolbul.2016.11.063
|
|
3
8
|
'''
|
|
4
9
|
|
|
5
10
|
import os
|
|
@@ -14,11 +19,12 @@ def timestamp_from_filename(filename):
|
|
|
14
19
|
|
|
15
20
|
Parameters
|
|
16
21
|
----------
|
|
17
|
-
|
|
22
|
+
filename (string): silcam filename (.silc)
|
|
18
23
|
|
|
19
24
|
Returns
|
|
20
25
|
-------
|
|
21
|
-
|
|
26
|
+
timestamp: timestamp
|
|
27
|
+
timestamp from pandas.to_datetime()
|
|
22
28
|
'''
|
|
23
29
|
|
|
24
30
|
# get the timestamp of the image (in this case from the filename)
|
|
@@ -332,7 +338,7 @@ def generate_config(raw_files: str, model_path: str, outfolder: str, output_pref
|
|
|
332
338
|
'roi_source': 'imref'
|
|
333
339
|
},
|
|
334
340
|
'output': {
|
|
335
|
-
'pipeline_class': 'pyopia.io.
|
|
341
|
+
'pipeline_class': 'pyopia.io.StatsToDisc',
|
|
336
342
|
'output_datafile': os.path.join(outfolder, output_prefix)
|
|
337
343
|
}
|
|
338
344
|
}
|
|
@@ -117,7 +117,7 @@ def generate_config(raw_files: str, model_path: str, outfolder: str, output_pref
|
|
|
117
117
|
'roi_source': 'imraw'
|
|
118
118
|
},
|
|
119
119
|
'output': {
|
|
120
|
-
'pipeline_class': 'pyopia.io.
|
|
120
|
+
'pipeline_class': 'pyopia.io.StatsToDisc',
|
|
121
121
|
'output_datafile': os.path.join(outfolder, output_prefix)
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -229,7 +229,7 @@ def combine_stats_netcdf_files(path_to_data, prefix='*'):
|
|
|
229
229
|
|
|
230
230
|
def merge_and_save_mfdataset(path_to_data, prefix='*'):
|
|
231
231
|
'''Combine a multi-file directory of STATS.nc files into a single '-STATS.nc' file
|
|
232
|
-
that can then be loaded with
|
|
232
|
+
that can then be loaded with :func:`pyopia.io.load_stats`
|
|
233
233
|
|
|
234
234
|
Parameters
|
|
235
235
|
----------
|
|
@@ -321,8 +321,6 @@ def show_h5_meta(h5file):
|
|
|
321
321
|
class StatsToDisc():
|
|
322
322
|
'''PyOpia pipline-compatible class for calling write_stats() that created NetCDF files.
|
|
323
323
|
|
|
324
|
-
Replaces the old StatsH5 class
|
|
325
|
-
|
|
326
324
|
Parameters
|
|
327
325
|
----------
|
|
328
326
|
output_datafile : str
|
|
@@ -377,10 +375,62 @@ class StatsToDisc():
|
|
|
377
375
|
return data
|
|
378
376
|
|
|
379
377
|
|
|
380
|
-
|
|
378
|
+
def load_toml(toml_file):
|
|
379
|
+
'''Load a TOML settings file from file
|
|
381
380
|
|
|
381
|
+
Parameters
|
|
382
|
+
----------
|
|
383
|
+
toml_file : str
|
|
384
|
+
TOML filename
|
|
382
385
|
|
|
383
|
-
|
|
386
|
+
Returns
|
|
387
|
+
-------
|
|
388
|
+
settings : dict
|
|
389
|
+
TOML settings
|
|
390
|
+
'''
|
|
384
391
|
with open(toml_file, 'r') as f:
|
|
385
392
|
settings = toml.load(f)
|
|
386
393
|
return settings
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def StatsH5():
|
|
397
|
+
'''.. deprecated:: 2.4.8
|
|
398
|
+
:class:`pyopia.io.StatsH5` will be removed in version 3.0.0, it is replaced by
|
|
399
|
+
:class:`pyopia.io.StatsToDisc`.
|
|
400
|
+
|
|
401
|
+
PyOpia pipline-compatible class for calling write_stats() that creates h5 files.
|
|
402
|
+
|
|
403
|
+
Parameters
|
|
404
|
+
----------
|
|
405
|
+
output_datafile : str
|
|
406
|
+
prefix path for output nc file
|
|
407
|
+
dataformat : str
|
|
408
|
+
either 'nc' or 'h5
|
|
409
|
+
export_name_len : int
|
|
410
|
+
max number of chars allowed for col 'export name'. Defaults to 40
|
|
411
|
+
append : bool
|
|
412
|
+
Append all processed data into one nc file.
|
|
413
|
+
Defaults to True.
|
|
414
|
+
If False, then one nc file will be generated per raw image,
|
|
415
|
+
which can be loaded using :func:`pyopia.io.combine_stats_netcdf_files`
|
|
416
|
+
This is useful for larger datasets, where appending causes substantial slowdown
|
|
417
|
+
as the dataset gets larger.
|
|
418
|
+
|
|
419
|
+
Returns
|
|
420
|
+
-------
|
|
421
|
+
data : :class:`pyopia.pipeline.Data`
|
|
422
|
+
data from the pipeline
|
|
423
|
+
|
|
424
|
+
Example
|
|
425
|
+
-------
|
|
426
|
+
Example config for pipeline useage:
|
|
427
|
+
|
|
428
|
+
.. code-block:: toml
|
|
429
|
+
|
|
430
|
+
[steps.output]
|
|
431
|
+
pipeline_class = 'pyopia.io.StatsH5'
|
|
432
|
+
output_datafile = './test' # prefix path for output nc file
|
|
433
|
+
append = true
|
|
434
|
+
'''
|
|
435
|
+
logger.warning('StatsH5 will be removed in version 3.0.0, it is replaced by pyopia.io.StatsToDisc')
|
|
436
|
+
return StatsToDisc()
|
|
@@ -93,7 +93,7 @@ def test_holo_pipeline():
|
|
|
93
93
|
'pipeline_class': 'pyopia.instrument.holo.MergeStats',
|
|
94
94
|
},
|
|
95
95
|
'output': {
|
|
96
|
-
'pipeline_class': 'pyopia.io.
|
|
96
|
+
'pipeline_class': 'pyopia.io.StatsToDisc',
|
|
97
97
|
'output_datafile': datafile_prefix
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -164,7 +164,7 @@ def test_silcam_pipeline():
|
|
|
164
164
|
'roi_source': 'im_minimum'
|
|
165
165
|
},
|
|
166
166
|
'output': {
|
|
167
|
-
'pipeline_class': 'pyopia.io.
|
|
167
|
+
'pipeline_class': 'pyopia.io.StatsToDisc',
|
|
168
168
|
'output_datafile': datafile_prefix
|
|
169
169
|
}
|
|
170
170
|
}
|
pyopia-2.5.0/pyopia/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.5.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|