Skip to content

Commit 5622473

Browse files
committed
Use DataGroup.apply
1 parent 75a76dd commit 5622473

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/ess/reduce/nexus/workflow.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,10 @@ def parse_disk_choppers(
519519
) -> Choppers[RunType]:
520520
"""Convert the NeXus representation of a chopper to ours."""
521521
return Choppers[RunType](
522-
sc.DataGroup(
523-
{
524-
name: extract_chopper_from_nexus(
525-
nexus.compute_component_position(chopper)
526-
)
527-
for name, chopper in choppers.items()
528-
}
522+
choppers.apply(
523+
lambda chopper: extract_chopper_from_nexus(
524+
nexus.compute_component_position(chopper)
525+
)
529526
)
530527
)
531528

@@ -534,14 +531,7 @@ def parse_analyzers(
534531
analyzers: AllNeXusComponents[snx.NXcrystal, RunType],
535532
) -> Analyzers[RunType]:
536533
"""Convert the NeXus representation of an analyzer to ours."""
537-
return Analyzers[RunType](
538-
sc.DataGroup(
539-
{
540-
name: nexus.compute_component_position(analyzer)
541-
for name, analyzer in analyzers.items()
542-
}
543-
)
544-
)
534+
return Analyzers[RunType](analyzers.apply(nexus.compute_component_position))
545535

546536

547537
def _drop(

0 commit comments

Comments
 (0)