PyOPIA 2.6.0__tar.gz → 2.6.1__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.6.0 → pyopia-2.6.1}/PKG-INFO +1 -1
- pyopia-2.6.1/pyopia/__init__.py +1 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/cli.py +42 -12
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/pipeline.py +4 -0
- pyopia-2.6.0/pyopia/__init__.py +0 -1
- {pyopia-2.6.0 → pyopia-2.6.1}/LICENSE +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/README.md +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/background.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/classify.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/exampledata.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/instrument/__init__.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/instrument/common.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/instrument/holo.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/instrument/silcam.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/instrument/uvp.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/io.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/plotting.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/process.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/simulator/__init__.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/simulator/silcam.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/statistics.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/tests/__init__.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/tests/test_classify.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/tests/test_notebooks.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyopia/tests/test_pipeline.py +0 -0
- {pyopia-2.6.0 → pyopia-2.6.1}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.6.1'
|
|
@@ -5,11 +5,13 @@ PyOPIA top-level code primarily for managing cmd line entry points
|
|
|
5
5
|
import typer
|
|
6
6
|
import toml
|
|
7
7
|
import os
|
|
8
|
+
import time
|
|
8
9
|
import datetime
|
|
9
10
|
import traceback
|
|
10
11
|
import logging
|
|
11
|
-
from rich.progress import
|
|
12
|
+
from rich.progress import Progress
|
|
12
13
|
from rich.logging import RichHandler
|
|
14
|
+
import rich.progress
|
|
13
15
|
import pandas as pd
|
|
14
16
|
import threading
|
|
15
17
|
|
|
@@ -129,6 +131,8 @@ def process(config_filename: str, num_chunks: int = 1):
|
|
|
129
131
|
from pyopia.io import load_toml
|
|
130
132
|
from pyopia.pipeline import Pipeline
|
|
131
133
|
|
|
134
|
+
t1 = time.time()
|
|
135
|
+
|
|
132
136
|
with Progress(transient=True) as progress:
|
|
133
137
|
progress.console.print("[blue]LOAD CONFIG")
|
|
134
138
|
pipeline_config = load_toml(config_filename)
|
|
@@ -164,25 +168,35 @@ def process(config_filename: str, num_chunks: int = 1):
|
|
|
164
168
|
|
|
165
169
|
def process_file_list(file_list, c):
|
|
166
170
|
processing_pipeline = Pipeline(pipeline_config)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
|
|
172
|
+
with get_custom_progress_bar(f'[blue]Processing progress (chunk {c})', disable=c != 0) as pbar:
|
|
173
|
+
for filename in pbar.track(file_list, description=f'[blue]Processing progress (chunk {c})'):
|
|
174
|
+
try:
|
|
175
|
+
logger.debug(f'Chunk {c} starting to process {filename}')
|
|
176
|
+
processing_pipeline.run(filename)
|
|
177
|
+
except Exception as e:
|
|
178
|
+
logger.warning('[red]An error occured in processing, ' +
|
|
179
|
+
'skipping rest of pipeline and moving to next image.' +
|
|
180
|
+
f'(chunk {c})')
|
|
181
|
+
logger.error(e)
|
|
182
|
+
logger.debug(''.join(traceback.format_tb(e.__traceback__)))
|
|
178
183
|
|
|
179
184
|
# With one chunk we keep the non-threaded functionality to ensure backwards compatibility
|
|
185
|
+
job_list = []
|
|
180
186
|
if num_chunks == 1:
|
|
181
187
|
process_file_list(raw_files, 0)
|
|
182
188
|
else:
|
|
183
189
|
for c, chunk in enumerate(raw_files.chunked_files):
|
|
184
190
|
job = threading.Thread(target=process_file_list, args=(chunk, c, ))
|
|
185
191
|
job.start()
|
|
192
|
+
job_list.append(job)
|
|
193
|
+
|
|
194
|
+
# Calculate and print total processing time
|
|
195
|
+
# If we are using threads, make sure all jobs have finished
|
|
196
|
+
[job.join() for job in job_list]
|
|
197
|
+
time_total = pd.to_timedelta(time.time() - t1, 'seconds')
|
|
198
|
+
with Progress(transient=True) as progress:
|
|
199
|
+
progress.console.print(f"[blue]PROCESSING COMPLETED IN {time_total}")
|
|
186
200
|
|
|
187
201
|
|
|
188
202
|
@app.command()
|
|
@@ -249,5 +263,21 @@ def check_chunks(chunks, pipeline_config):
|
|
|
249
263
|
raise RuntimeError('Output mode must be set to "append = false" in "output" step when using more than one chunk')
|
|
250
264
|
|
|
251
265
|
|
|
266
|
+
def get_custom_progress_bar(description, disable):
|
|
267
|
+
''' Create a custom rich.progress.Progress object for displaying progress bars'''
|
|
268
|
+
progress = Progress(
|
|
269
|
+
rich.progress.TextColumn(description),
|
|
270
|
+
rich.progress.BarColumn(),
|
|
271
|
+
rich.progress.TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
|
|
272
|
+
rich.progress.MofNCompleteColumn(),
|
|
273
|
+
rich.progress.TextColumn("•"),
|
|
274
|
+
rich.progress.TimeElapsedColumn(),
|
|
275
|
+
rich.progress.TextColumn("•"),
|
|
276
|
+
rich.progress.TimeRemainingColumn(),
|
|
277
|
+
disable=disable
|
|
278
|
+
)
|
|
279
|
+
return progress
|
|
280
|
+
|
|
281
|
+
|
|
252
282
|
if __name__ == "__main__":
|
|
253
283
|
app()
|
|
@@ -4,6 +4,7 @@ Module for managing the PyOpia processing pipeline
|
|
|
4
4
|
Refer to the :class:`Pipeline` class documentation for examples of how to process datasets and images
|
|
5
5
|
'''
|
|
6
6
|
from typing import TypedDict
|
|
7
|
+
import time
|
|
7
8
|
import datetime
|
|
8
9
|
import pandas as pd
|
|
9
10
|
from operator import methodcaller
|
|
@@ -114,7 +115,10 @@ class Pipeline():
|
|
|
114
115
|
continue
|
|
115
116
|
|
|
116
117
|
logger.info(f'Running pipeline step: {stepname}')
|
|
118
|
+
t1 = time.time()
|
|
117
119
|
self.run_step(stepname)
|
|
120
|
+
t2 = time.time()
|
|
121
|
+
logger.debug(f'Running pipeline step {stepname} took {t2-t1:.3f} seconds')
|
|
118
122
|
|
|
119
123
|
# Check for signal from this step that we should skip remaining pipeline for this image
|
|
120
124
|
if self.data['skip_next_steps']:
|
pyopia-2.6.0/pyopia/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.6.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|