diff --git a/src/geomtools/powder/image_agg.py b/src/geomtools/powder/image_agg.py
index d31e474aff42eac5c3715eefc74ffa7ba7c4a2bf..76463829ab24f62fec1a8530f1c816c56b9bf541 100644
--- a/src/geomtools/powder/image_agg.py
+++ b/src/geomtools/powder/image_agg.py
@@ -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
diff --git a/src/geomtools/powder/powdersum.py b/src/geomtools/powder/powdersum.py
index 82186aed994369cb69925b927eb4346b75c059c3..e9aca2210abae5b7b0086f3014bf0dc17d03cf87 100644
--- a/src/geomtools/powder/powdersum.py
+++ b/src/geomtools/powder/powdersum.py
@@ -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()