Skip to content
Snippets Groups Projects
Commit ff7cd862 authored by Egor Sobolev's avatar Egor Sobolev
Browse files

Fix the use of detector source

parent 98965fa2
Branches master
Tags 0.0.4
1 merge request!3Center refinement using powder diffraction data
......@@ -79,8 +79,7 @@ class ImageAgg:
tm0 = time.perf_counter()
print(f"[{self._rank:2d}] {modno:3d}: ", end="")
source_id = source_pattern.format(
detector_id=self.detector_id, modno=modno)
source_id = source_pattern.format(modno)
dc = dc_img.select(
[(source_id, "image.data"), (source_id, "image.mask")],
require_all=True
......
......@@ -181,11 +181,7 @@ def main(argv=None):
modules = args.modules
if modules is None:
re_pattern = re.compile(
"^" +
source_pattern.format(
detector_id=detector_id, modno=r"(?P<modno>\d+)") +
"$"
)
"^" + det_source_pattern.replace("*", r"(?P<modno>\d+)") + "$")
matches = (re_pattern.match(s) for s in dc_img.all_sources)
modules = sorted(int(m["modno"]) for m in matches if m is not None)
num_modules = len(modules)
......@@ -217,11 +213,11 @@ def main(argv=None):
mpi_print()
mpi_print("Rounding threshold:", rounding_threshold)
det_source_pattern = det_source_pattern.replace("*", "{}")
if args.layout is None:
px_area = None
for modno in modules:
source_id = source_pattern.format(
detector_id=detector_id, modno=modno)
source_id = det_source_pattern.format(modno)
if source_id in dc_img.all_sources:
break
shape = dc_img[source_id, "image.data"].shape[1:]
......@@ -245,7 +241,7 @@ def main(argv=None):
rounding_threshold, px_area=px_area)
agg.prepare(output_fn, mask=mask0, comm=comm, conditions=conditions)
agg.compute(dc_img, source_pattern)
agg.compute(dc_img, det_source_pattern)
agg.flush()
tm1 = time.perf_counter()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment