PyOPIA 2.8.1__tar.gz → 2.9.0__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 (28) hide show
  1. pyopia-2.9.0/.gitignore +277 -0
  2. {pyopia-2.8.1 → pyopia-2.9.0}/PKG-INFO +55 -80
  3. {pyopia-2.8.1 → pyopia-2.9.0}/README.md +14 -33
  4. pyopia-2.9.0/pyopia/__init__.py +1 -0
  5. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/cli.py +34 -17
  6. pyopia-2.9.0/pyproject.toml +79 -0
  7. pyopia-2.8.1/pyopia/__init__.py +0 -1
  8. pyopia-2.8.1/pyproject.toml +0 -66
  9. {pyopia-2.8.1 → pyopia-2.9.0}/LICENSE +0 -0
  10. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/background.py +0 -0
  11. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/classify.py +0 -0
  12. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/exampledata.py +0 -0
  13. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/instrument/__init__.py +0 -0
  14. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/instrument/common.py +0 -0
  15. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/instrument/holo.py +0 -0
  16. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/instrument/silcam.py +0 -0
  17. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/instrument/uvp.py +0 -0
  18. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/io.py +0 -0
  19. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/pipeline.py +0 -0
  20. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/plotting.py +0 -0
  21. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/process.py +0 -0
  22. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/simulator/__init__.py +0 -0
  23. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/simulator/silcam.py +0 -0
  24. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/statistics.py +0 -0
  25. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/tests/__init__.py +0 -0
  26. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/tests/test_classify.py +0 -0
  27. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/tests/test_notebooks.py +0 -0
  28. {pyopia-2.8.1 → pyopia-2.9.0}/pyopia/tests/test_pipeline.py +0 -0
@@ -0,0 +1,277 @@
1
+
2
+ # Created by https://www.gitignore.io/api/vim,python,pycharm,visualstudiocode
3
+ # Edit at https://www.gitignore.io/?templates=vim,python,pycharm,visualstudiocode
4
+
5
+ ### PyCharm ###
6
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
7
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
8
+
9
+ # User-specific stuff
10
+ .idea/
11
+ .idea/**/workspace.xml
12
+ .idea/**/tasks.xml
13
+ .idea/**/usage.statistics.xml
14
+ .idea/**/dictionaries
15
+ .idea/**/shelf
16
+
17
+ # Generated files
18
+ .idea/**/contentModel.xml
19
+
20
+ # Sensitive or high-churn files
21
+ .idea/**/dataSources/
22
+ .idea/**/dataSources.ids
23
+ .idea/**/dataSources.local.xml
24
+ .idea/**/sqlDataSources.xml
25
+ .idea/**/dynamic.xml
26
+ .idea/**/uiDesigner.xml
27
+ .idea/**/dbnavigator.xml
28
+
29
+ # Gradle
30
+ .idea/**/gradle.xml
31
+ .idea/**/libraries
32
+
33
+ # Gradle and Maven with auto-import
34
+ # When using Gradle or Maven with auto-import, you should exclude module files,
35
+ # since they will be recreated, and may cause churn. Uncomment if using
36
+ # auto-import.
37
+ # .idea/modules.xml
38
+ # .idea/*.iml
39
+ # .idea/modules
40
+ # *.iml
41
+ # *.ipr
42
+
43
+ # CMake
44
+ cmake-build-*/
45
+
46
+ # Mongo Explorer plugin
47
+ .idea/**/mongoSettings.xml
48
+
49
+ # File-based project format
50
+ *.iws
51
+
52
+ # IntelliJ
53
+ out/
54
+
55
+ # mpeltonen/sbt-idea plugin
56
+ .idea_modules/
57
+
58
+ # JIRA plugin
59
+ atlassian-ide-plugin.xml
60
+
61
+ # Cursive Clojure plugin
62
+ .idea/replstate.xml
63
+
64
+ # Crashlytics plugin (for Android Studio and IntelliJ)
65
+ com_crashlytics_export_strings.xml
66
+ crashlytics.properties
67
+ crashlytics-build.properties
68
+ fabric.properties
69
+
70
+ # Editor-based Rest Client
71
+ .idea/httpRequests
72
+
73
+ # Android studio 3.1+ serialized cache file
74
+ .idea/caches/build_file_checksums.ser
75
+
76
+ ### PyCharm Patch ###
77
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
78
+
79
+ # *.iml
80
+ # modules.xml
81
+ # .idea/misc.xml
82
+ # *.ipr
83
+
84
+ # Sonarlint plugin
85
+ .idea/**/sonarlint/
86
+
87
+ # SonarQube Plugin
88
+ .idea/**/sonarIssues.xml
89
+
90
+ # Markdown Navigator plugin
91
+ .idea/**/markdown-navigator.xml
92
+ .idea/**/markdown-navigator/
93
+
94
+ ### Python ###
95
+ # Byte-compiled / optimized / DLL files
96
+ __pycache__/
97
+ *.py[cod]
98
+ *$py.class
99
+
100
+ # C extensions
101
+ *.so
102
+
103
+ # Distribution / packaging
104
+ .Python
105
+ build/
106
+ develop-eggs/
107
+ dist/
108
+ downloads/
109
+ eggs/
110
+ .eggs/
111
+ lib/
112
+ lib64/
113
+ parts/
114
+ sdist/
115
+ var/
116
+ wheels/
117
+ pip-wheel-metadata/
118
+ share/python-wheels/
119
+ *.egg-info/
120
+ .installed.cfg
121
+ *.egg
122
+ MANIFEST
123
+
124
+ # PyInstaller
125
+ # Usually these files are written by a python script from a template
126
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
127
+ *.manifest
128
+ *.spec
129
+
130
+ # Installer logs
131
+ pip-log.txt
132
+ pip-delete-this-directory.txt
133
+
134
+ # Unit test / coverage reports
135
+ htmlcov/
136
+ .tox/
137
+ .nox/
138
+ .coverage
139
+ .coverage.*
140
+ .cache
141
+ nosetests.xml
142
+ coverage.xml
143
+ *.cover
144
+ .hypothesis/
145
+ .pytest_cache/
146
+
147
+ # Translations
148
+ *.mo
149
+ *.pot
150
+
151
+ # Scrapy stuff:
152
+ .scrapy
153
+
154
+ # Sphinx documentation
155
+ docs/_build/
156
+ docs/_autosummary/
157
+ docs/source/
158
+ !docs/source/conf.py
159
+ !docs/source/index.rst
160
+
161
+ # PyBuilder
162
+ target/
163
+
164
+ # pyenv
165
+ .python-version
166
+
167
+ # pipenv
168
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
169
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
170
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
171
+ # install all needed dependencies.
172
+ #Pipfile.lock
173
+
174
+ # celery beat schedule file
175
+ celerybeat-schedule
176
+
177
+ # SageMath parsed files
178
+ *.sage.py
179
+
180
+ # Spyder project settings
181
+ .spyderproject
182
+ .spyproject
183
+
184
+ # Rope project settings
185
+ .ropeproject
186
+
187
+ # Mr Developer
188
+ .mr.developer.cfg
189
+ .project
190
+ .pydevproject
191
+
192
+ # mkdocs documentation
193
+ /site
194
+
195
+ # mypy
196
+ .mypy_cache/
197
+ .dmypy.json
198
+ dmypy.json
199
+
200
+ # Pyre type checker
201
+ .pyre/
202
+
203
+ ### Vim ###
204
+ # Swap
205
+ [._]*.s[a-v][a-z]
206
+ [._]*.sw[a-p]
207
+ [._]s[a-rt-v][a-z]
208
+ [._]ss[a-gi-z]
209
+ [._]sw[a-p]
210
+
211
+ # Session
212
+ Session.vim
213
+ Sessionx.vim
214
+
215
+ # Temporary
216
+ .netrwhist
217
+ *~
218
+
219
+ # Auto-generated tag files
220
+ tags
221
+
222
+ # Persistent undo
223
+ [._]*.un~
224
+
225
+ # Coc configuration directory
226
+ .vim
227
+
228
+ ### VisualStudioCode ###
229
+ .vscode
230
+ .vscode/*
231
+ !.vscode/settings.json
232
+ !.vscode/tasks.json
233
+ !.vscode/launch.json
234
+ !.vscode/extensions.json
235
+
236
+ ### VisualStudioCode Patch ###
237
+ # Ignore all local history of files
238
+ .history
239
+
240
+ ### ipynb checkpoints
241
+ **/*.ipynb_checkpoints/
242
+
243
+ ### data files
244
+ *.silc
245
+ *.bmp
246
+ *.png
247
+ *.h5
248
+ *.pgm
249
+ *.h5
250
+ !docs/logo.PNG
251
+
252
+ # End of https://www.gitignore.io/api/vim,python,pycharm,visualstudiocode
253
+ *.zip
254
+ notebooks/header.tfl.txt
255
+ notebooks/keras_model.h5
256
+ notebooks/github-test-holo.ipynb
257
+
258
+ test-report/*
259
+ docs/.DS_Store
260
+ .DS_Store
261
+ docs/notebooks/header.tfl.txt
262
+ docs/jupyter_execute/
263
+ *.nc
264
+
265
+ poetry.lock
266
+ /notebooks/gas_silcam_images
267
+ /notebooks/oil_silcam_images
268
+ header.tfl.txt
269
+ *.tiff
270
+ notebooks/__MACOSX/*
271
+ notebooks/silcam240822.keras
272
+ model/*
273
+ notebooks/model/*
274
+ *.keras
275
+ *.png
276
+ *-summary.txt
277
+ /dev/*
@@ -1,59 +1,62 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: PyOPIA
3
- Version: 2.8.1
3
+ Version: 2.9.0
4
4
  Summary: A Python Ocean Particle Image Analysis toolbox.
5
- Home-page: https://github.com/sintef/pyopia
6
- Keywords: Ocean,Particles,Imaging,Measurement,Size distribution
7
- Author: Emlyn Davies
8
- Author-email: emlyn.davies@sintef.no
9
- Requires-Python: >=3.12,<4.0
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.12
12
- Provides-Extra: classification
13
- Provides-Extra: classification-arm64
14
- Requires-Dist: cmocean (>=3.0.3,<4.0.0)
15
- Requires-Dist: dask (>=2024.8.1)
16
- Requires-Dist: flake8 (>=6.1.0,<7.0.0)
17
- Requires-Dist: gdown (>=4.7.1,<5.0.0)
18
- Requires-Dist: h5netcdf (>=1.3.0)
19
- Requires-Dist: h5py (>=3.9.0,<4.0.0)
20
- Requires-Dist: imageio (>=2.31.3,<3.0.0)
21
- Requires-Dist: ipykernel (>=6.19.4)
22
- Requires-Dist: jupyter-book (>=0.15.1,<0.16.0)
23
- Requires-Dist: keras (==3.5.0) ; extra == "classification-arm64" or extra == "classification"
24
- Requires-Dist: matplotlib (>=3.7)
25
- Requires-Dist: myst-nb (>=0.17.2,<0.18.0)
26
- Requires-Dist: nbclient (==0.7)
27
- Requires-Dist: nbconvert (>=7.16.4,<8.0.0)
28
- Requires-Dist: numpy (>=1.24.0,<2.0.0)
29
- Requires-Dist: pandas[computation] (>=2.1.1,<3.0.0)
30
- Requires-Dist: poetry-version-plugin (>=0.2.0,<0.3.0)
31
- Requires-Dist: pytest (>=7.2.0)
32
- Requires-Dist: pytest-error-for-skips (>=2.0.2,<3.0.0)
33
- Requires-Dist: readthedocs-sphinx-search (>=0.3.2,<0.4.0)
34
- Requires-Dist: scikit-image (>=0.24.0,<0.25.0)
35
- Requires-Dist: scipy (>=1.11.2,<2.0.0)
36
- Requires-Dist: sphinx (==5.0)
37
- Requires-Dist: sphinx-copybutton (>=0.5.2,<0.6.0)
38
- Requires-Dist: sphinx-rtd-theme (>=0.5.0)
39
- Requires-Dist: sphinx-togglebutton (>=0.3.2,<0.4.0)
40
- Requires-Dist: sphinxcontrib-napoleon (>=0.7)
41
- Requires-Dist: tensorflow-cpu (>=2.16.2,<3.0.0) ; extra == "classification"
42
- Requires-Dist: tensorflow-macos (>=2.16.2,<3.0.0) ; (sys_platform == "darwin" and platform_machine == "arm64") and (extra == "classification-arm64")
43
- Requires-Dist: toml (>=0.10.2,<0.11.0)
44
- Requires-Dist: tqdm (>=4.66.1,<5.0.0)
45
- Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
46
- Requires-Dist: urllib3 (<2.0)
47
- Requires-Dist: xarray (>=2023.12.0,<2024.0.0)
48
- Project-URL: Documentation, https://pyopia.readthedocs.io
49
5
  Project-URL: Repository, https://github.com/sintef/pyopia
6
+ Project-URL: Documentation, https://pyopia.readthedocs.io
7
+ Author-email: Emlyn Davies <emlyn.davies@sintef.no>, "Alex Nimmo Smith@plymouth.ac.uk" <alex.nimmo.smith@plymouth.ac.uk>
8
+ License-File: LICENSE
9
+ Keywords: Imaging,Measurement,Ocean,Particles,Size distribution
10
+ Requires-Python: ~=3.12
11
+ Requires-Dist: cmocean<4,>=3.0.3
12
+ Requires-Dist: dask>=2024.8.1
13
+ Requires-Dist: flake8<7,>=6.1.0
14
+ Requires-Dist: gdown<5,>=4.7.1
15
+ Requires-Dist: h5netcdf>=1.3.0
16
+ Requires-Dist: h5py<4,>=3.9.0
17
+ Requires-Dist: imageio<3,>=2.31.3
18
+ Requires-Dist: ipykernel>=6.19.4
19
+ Requires-Dist: jupyter-book<0.16,>=0.15.1
20
+ Requires-Dist: matplotlib>=3.7
21
+ Requires-Dist: myst-nb<0.18,>=0.17.2
22
+ Requires-Dist: nbclient==0.7
23
+ Requires-Dist: nbconvert<8,>=7.16.4
24
+ Requires-Dist: numpy<2,>=1.24.0
25
+ Requires-Dist: pandas[computation]<3,>=2.1.1
26
+ Requires-Dist: poetry-version-plugin<0.3,>=0.2.0
27
+ Requires-Dist: pytest-error-for-skips<3,>=2.0.2
28
+ Requires-Dist: pytest>=7.2.0
29
+ Requires-Dist: readthedocs-sphinx-search<0.4,>=0.3.2
30
+ Requires-Dist: scikit-image<0.25,>=0.24.0
31
+ Requires-Dist: scipy<2,>=1.11.2
32
+ Requires-Dist: sphinx-copybutton<0.6,>=0.5.2
33
+ Requires-Dist: sphinx-rtd-theme>=0.5.0
34
+ Requires-Dist: sphinx-togglebutton<0.4,>=0.3.2
35
+ Requires-Dist: sphinx==5.0
36
+ Requires-Dist: sphinxcontrib-napoleon>=0.7
37
+ Requires-Dist: toml<0.11,>=0.10.2
38
+ Requires-Dist: tqdm<5,>=4.66.1
39
+ Requires-Dist: typer[all]<0.10,>=0.9.0
40
+ Requires-Dist: urllib3<2.0
41
+ Requires-Dist: xarray<2024,>=2023.12.0
42
+ Provides-Extra: classification
43
+ Requires-Dist: keras==3.5.0; extra == 'classification'
44
+ Requires-Dist: tensorflow<3,>=2.16.2; extra == 'classification'
50
45
  Description-Content-Type: text/markdown
51
46
 
52
- PyOpia
47
+ PyOPIA
53
48
  ===============================
54
49
 
55
50
  A Python Ocean Particle Image Analysis toolbox
56
51
 
52
+ # Quick tryout of PyOPIA
53
+
54
+ 1) Install [uv](https://docs.astral.sh/uv/getting-started/installation)
55
+ 2) Run PyOPIA classification tests on database particles
56
+ ```bash
57
+ uv run --python 3.12 --with git+https://github.com/SINTEF/pyopia --with tensorflow==2.16.2 --with keras==3.5.0 python -m pyopia.tests.test_classify
58
+ ```
59
+
57
60
  # Documentation:
58
61
 
59
62
  [![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://pyopia.readthedocs.io) [![Documentation](https://readthedocs.org/projects/pyopia/badge/?version=latest)](https://pyopia.readthedocs.io/en/latest/?badge=latest)
@@ -104,9 +107,8 @@ Users are expected to be familiar with Python. Please refer to the recommended i
104
107
 
105
108
  ## For developers from source
106
109
 
107
- Install [Python](https://github.com/conda-forge/miniforge/#download) version 3.10.
108
110
 
109
- A prompt such as is provided by the [miniforge installation](https://github.com/conda-forge/miniforge/#download) may be used for the following:
111
+ Install (uv)[https://docs.astral.sh/uv/getting-started/installation/]
110
112
 
111
113
  1. Navigate to the folder where you want to install pyopia using the 'cd' command.
112
114
 
@@ -118,44 +120,18 @@ git clone https://github.com/SINTEF/pyopia.git
118
120
  cd pyopia
119
121
  ```
120
122
 
121
- For the next steps, you need to be located in the directory that contains the file 'environment.yml'.
122
-
123
- 1. (optional, but recommended) Create a virtual environment using the environment.yml. This will create an environment called pyopia, but with no dependencies installed. Dependencies are managed by poetry (in step 2):
124
-
125
- ```bash
126
- conda env create -f environment.yml
127
- ```
128
- and activate the environment:
129
-
130
- ```bash
131
- conda activate pyopia
132
- ```
123
+ For the next steps, you need to be located in the PyOPIA root directory that contains the file 'pyproject.toml'.
133
124
 
134
- 2. Install dependencies using poetry:
125
+ 2. Install all requirements with
135
126
 
136
127
  ```bash
137
- poetry install
128
+ uv sync --all-extras
138
129
  ```
139
130
 
140
- Optional dependecies (for classification), can be installed like this:
141
-
142
- ```bash
143
- poetry install --extras "classification"
144
- ```
145
-
146
- or for arm/silicon systems:
147
-
148
- ```bash
149
- poetry install --extras "classification-arm64"
150
- ```
151
-
152
- Note: If poetry spends ages resolving dependencies, you can install a development environment with pip, like this: `pip install -e ".[classification]"` or for arm/silicon: `pip install -e ".[classification-arm64]"`
153
-
154
-
155
131
  3. (optional) Run local tests:
156
132
 
157
133
  ```bash
158
- poetry run pytest
134
+ uv run pytest
159
135
  ```
160
136
 
161
137
  #### Version numbering
@@ -178,4 +154,3 @@ sphinx-build -b html ./docs/ ./docs/build
178
154
  # License
179
155
 
180
156
  PyOpia is licensed under the BSD3 license. See LICENSE. All contributors should be recognised & aknowledged.
181
-
@@ -1,8 +1,16 @@
1
- PyOpia
1
+ PyOPIA
2
2
  ===============================
3
3
 
4
4
  A Python Ocean Particle Image Analysis toolbox
5
5
 
6
+ # Quick tryout of PyOPIA
7
+
8
+ 1) Install [uv](https://docs.astral.sh/uv/getting-started/installation)
9
+ 2) Run PyOPIA classification tests on database particles
10
+ ```bash
11
+ uv run --python 3.12 --with git+https://github.com/SINTEF/pyopia --with tensorflow==2.16.2 --with keras==3.5.0 python -m pyopia.tests.test_classify
12
+ ```
13
+
6
14
  # Documentation:
7
15
 
8
16
  [![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://pyopia.readthedocs.io) [![Documentation](https://readthedocs.org/projects/pyopia/badge/?version=latest)](https://pyopia.readthedocs.io/en/latest/?badge=latest)
@@ -53,9 +61,8 @@ Users are expected to be familiar with Python. Please refer to the recommended i
53
61
 
54
62
  ## For developers from source
55
63
 
56
- Install [Python](https://github.com/conda-forge/miniforge/#download) version 3.10.
57
64
 
58
- A prompt such as is provided by the [miniforge installation](https://github.com/conda-forge/miniforge/#download) may be used for the following:
65
+ Install (uv)[https://docs.astral.sh/uv/getting-started/installation/]
59
66
 
60
67
  1. Navigate to the folder where you want to install pyopia using the 'cd' command.
61
68
 
@@ -67,44 +74,18 @@ git clone https://github.com/SINTEF/pyopia.git
67
74
  cd pyopia
68
75
  ```
69
76
 
70
- For the next steps, you need to be located in the directory that contains the file 'environment.yml'.
71
-
72
- 1. (optional, but recommended) Create a virtual environment using the environment.yml. This will create an environment called pyopia, but with no dependencies installed. Dependencies are managed by poetry (in step 2):
73
-
74
- ```bash
75
- conda env create -f environment.yml
76
- ```
77
- and activate the environment:
78
-
79
- ```bash
80
- conda activate pyopia
81
- ```
77
+ For the next steps, you need to be located in the PyOPIA root directory that contains the file 'pyproject.toml'.
82
78
 
83
- 2. Install dependencies using poetry:
79
+ 2. Install all requirements with
84
80
 
85
81
  ```bash
86
- poetry install
82
+ uv sync --all-extras
87
83
  ```
88
84
 
89
- Optional dependecies (for classification), can be installed like this:
90
-
91
- ```bash
92
- poetry install --extras "classification"
93
- ```
94
-
95
- or for arm/silicon systems:
96
-
97
- ```bash
98
- poetry install --extras "classification-arm64"
99
- ```
100
-
101
- Note: If poetry spends ages resolving dependencies, you can install a development environment with pip, like this: `pip install -e ".[classification]"` or for arm/silicon: `pip install -e ".[classification-arm64]"`
102
-
103
-
104
85
  3. (optional) Run local tests:
105
86
 
106
87
  ```bash
107
- poetry run pytest
88
+ uv run pytest
108
89
  ```
109
90
 
110
91
  #### Version numbering
@@ -0,0 +1 @@
1
+ __version__ = "2.9.1"
@@ -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
 
@@ -0,0 +1,79 @@
1
+ [project]
2
+ name = "PyOPIA"
3
+ version = "2.9.0"
4
+ description = "A Python Ocean Particle Image Analysis toolbox."
5
+ authors = [
6
+ { name = "Emlyn Davies", email = "emlyn.davies@sintef.no" },
7
+ { name = "Alex Nimmo Smith@plymouth.ac.uk", email = "alex.nimmo.smith@plymouth.ac.uk" },
8
+ ]
9
+ requires-python = "~=3.12"
10
+ readme = "README.md"
11
+ keywords = [
12
+ "Ocean",
13
+ "Particles",
14
+ "Imaging",
15
+ "Measurement",
16
+ "Size distribution",
17
+ ]
18
+ dependencies = [
19
+ "flake8>=6.1.0,<7",
20
+ "numpy>=1.24.0,<2",
21
+ "scipy>=1.11.2,<2",
22
+ "pytest>=7.2.0",
23
+ "imageio>=2.31.3,<3",
24
+ "matplotlib>=3.7",
25
+ "tqdm>=4.66.1,<5",
26
+ "pytest-error-for-skips>=2.0.2,<3",
27
+ "nbclient==0.7",
28
+ "sphinx==5.0",
29
+ "sphinx-rtd-theme>=0.5.0",
30
+ "sphinxcontrib-napoleon>=0.7",
31
+ "sphinx-togglebutton>=0.3.2,<0.4",
32
+ "sphinx-copybutton>=0.5.2,<0.6",
33
+ "readthedocs-sphinx-search>=0.3.2,<0.4",
34
+ "myst-nb>=0.17.2,<0.18",
35
+ "jupyter-book>=0.15.1,<0.16",
36
+ "ipykernel>=6.19.4",
37
+ "urllib3<2.0",
38
+ "gdown>=4.7.1,<5",
39
+ "cmocean>=3.0.3,<4",
40
+ "toml>=0.10.2,<0.11",
41
+ "xarray>=2023.12.0,<2024",
42
+ "typer[all]>=0.9.0,<0.10",
43
+ "pandas[computation]>=2.1.1,<3",
44
+ "h5py>=3.9.0,<4",
45
+ "poetry-version-plugin>=0.2.0,<0.3",
46
+ "dask>=2024.8.1",
47
+ "nbconvert>=7.16.4,<8",
48
+ "h5netcdf>= 1.3.0",
49
+ "scikit-image>=0.24.0,<0.25",
50
+ ]
51
+
52
+ [project.optional-dependencies]
53
+
54
+ classification = [
55
+ "tensorflow>=2.16.2,<3",
56
+ "keras==3.5.0",
57
+ ]
58
+
59
+ [project.urls]
60
+ Repository = "https://github.com/sintef/pyopia"
61
+ Documentation = "https://pyopia.readthedocs.io"
62
+
63
+ [project.scripts]
64
+ pyopia = "pyopia.cli:app"
65
+
66
+ [tool.hatch.build.targets.sdist]
67
+ include = ["pyopia"]
68
+
69
+ [tool.hatch.build.targets.wheel]
70
+ include = ["pyopia"]
71
+
72
+ [build-system]
73
+ requires = ["hatchling"]
74
+ build-backend = "hatchling.build"
75
+
76
+ [tool.poetry-version-plugin]
77
+ source = "init"
78
+
79
+ [tool.setuptools_scm]
@@ -1 +0,0 @@
1
- __version__ = '2.8.1'
@@ -1,66 +0,0 @@
1
- [tool.poetry]
2
- name = "PyOPIA"
3
- version = "0"
4
- description = "A Python Ocean Particle Image Analysis toolbox."
5
- authors = [
6
- "Emlyn Davies <emlyn.davies@sintef.no>",
7
- "Alex Nimmo Smith@plymouth.ac.uk <alex.nimmo.smith@plymouth.ac.uk>"
8
- ]
9
- readme = "README.md"
10
- repository = "https://github.com/sintef/pyopia"
11
- documentation = "https://pyopia.readthedocs.io"
12
- keywords = ["Ocean", "Particles", "Imaging", "Measurement", "Size distribution"]
13
- packages = [{include = "pyopia"}]
14
-
15
- [tool.poetry.dependencies]
16
- python = "^3.12"
17
- flake8 = "^6.1.0"
18
- numpy = "^1.24.0"
19
- scipy = "^1.11.2"
20
- pytest = ">=7.2.0"
21
- imageio = "^2.31.3"
22
- matplotlib = ">=3.7"
23
- tqdm = "^4.66.1"
24
- pytest-error-for-skips = "^2.0.2"
25
- nbclient = "0.7"
26
- sphinx = "5.0"
27
- sphinx-rtd-theme = ">=0.5.0"
28
- sphinxcontrib-napoleon = ">=0.7"
29
- sphinx-togglebutton = "^0.3.2"
30
- sphinx-copybutton = "^0.5.2"
31
- readthedocs-sphinx-search = "^0.3.2"
32
- myst-nb = "^0.17.2"
33
- jupyter-book = "^0.15.1"
34
- ipykernel = ">=6.19.4"
35
- urllib3 = "<2.0"
36
- gdown = "^4.7.1"
37
- cmocean = "^3.0.3"
38
- toml = "^0.10.2"
39
- xarray = "^2023.12.0"
40
- typer = {extras = ["all"], version = "^0.9.0"}
41
- pandas = {version = "^2.1.1", extras = ["computation"]}
42
- h5py = "^3.9.0"
43
- poetry-version-plugin = "^0.2.0"
44
- tensorflow-macos = {version = "^2.16.2", optional = true, markers = "sys_platform == 'darwin' and platform_machine == 'arm64'"}
45
- tensorflow-cpu = {version = "^2.16.2", optional = true}
46
- keras = {version = "3.5.0", optional = true}
47
- dask = ">=2024.8.1"
48
- nbconvert = "^7.16.4"
49
- h5netcdf = ">= 1.3.0"
50
- scikit-image = "^0.24.0"
51
-
52
- [tool.poetry.extras]
53
- classification-arm64 = ["tensorflow-macos", "keras"]
54
- classification = ["tensorflow-cpu", "keras"]
55
-
56
- [tool.poetry-version-plugin]
57
- source = "init"
58
-
59
- [tool.poetry.scripts]
60
- pyopia = "pyopia.cli:app"
61
-
62
- [build-system]
63
- requires = ["poetry-core"]
64
- build-backend = "poetry.core.masonry.api"
65
-
66
- [tool.setuptools_scm]
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