Commit 0e1ce57f authored by payno's avatar payno
Browse files

Merge branch 'improve_io_edfconverter' into 'master'

edf2nx: fix issues with the progress.

See merge request !80
parents 31dac622 99706746
Pipeline #60625 passed with stages
in 6 minutes and 42 seconds
......@@ -152,7 +152,11 @@ def edf_to_nx(
_edf_to_ignore.append("HST")
else:
_edf_to_ignore.remove("HST")
refs_urls = scan.get_refs_url(
try:
get_flats_url = scan.get_flats_url
except ImportError:
get_flats_url = scan.get_refs_url
refs_urls = get_flats_url(
scan_path=scan.path, prefix=refs_to_find, ignore=_edf_to_ignore
)
if len(refs_urls) > 0:
......@@ -369,7 +373,7 @@ def edf_to_nx(
if progress is not None:
progress.set_name("write dark")
progress.set_max_advancement(len(dk_urls))
progress.reset(len(dk_urls))
def ignore(file_name):
for forbid in _edf_to_ignore:
......@@ -385,7 +389,7 @@ def edf_to_nx(
norm_dark = len(dk_urls) / scan.dark_n
dk_indexes = sorted(dk_urls.keys())
if progress is not None:
progress.set_max_advancement(len(dk_urls))
progress.reset(len(dk_urls))
for dk_index in dk_indexes:
dk_url = dk_urls[dk_index]
if ignore(os.path.basename(dk_url.file_path())):
......@@ -456,9 +460,6 @@ def edf_to_nx(
ztix,
):
nfr = nF
if progress is not None:
progress.set_name("write refs")
progress.set_max_advancement(len(refIndexes))
for ref_index in refIndexes:
int_rf = int(ref_index)
test_val = 0
......@@ -491,16 +492,13 @@ def edf_to_nx(
zDataset[nfr] = float(str_mot_val[ztix])
nfr += 1
if progress is not None:
progress.increase_advancement(i=1)
return nfr
# projections
proj_indexes = sorted(proj_urls.keys())
if progress is not None:
progress.set_name("write projections")
progress.set_max_advancement(len(proj_indexes))
progress.set_name("write projections and flats")
progress.reset(len(proj_indexes))
nproj = 0
iref_pj = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment