Skip to content

[essreduce]: Allow single transformation timepoint#555

Merged
nvaytet merged 2 commits intomainfrom
allow-single-transformation-timepoint
May 4, 2026
Merged

[essreduce]: Allow single transformation timepoint#555
nvaytet merged 2 commits intomainfrom
allow-single-transformation-timepoint

Conversation

@nvaytet
Copy link
Copy Markdown
Member

@nvaytet nvaytet commented May 4, 2026

When we provide a transformation filter that slices a single value

wf = loki.LokiWorkflow()
wf[Filename[SampleRun]] = 'loki_051657_00000135.hdf'
wf[TransformationTimeFilter[sx.NXdetector, RunType]] = lambda da: da['time', 0].data

we ran into the error:

        if isinstance(total_transform, sc.DataArray):
            time_dependent = [t for t in chain if isinstance(t, sc.DataArray)]
>           times = [da.coords['time'][0] for da in time_dependent]
E           scipp._scipp.core.DimensionError: Slicing a scalar object is not possible.

We fix this by returning the .data if the result of the apply_transformation is a DataArray containing just a scalar value.

@nvaytet nvaytet requested a review from jl-wynen May 4, 2026 13:18
@nvaytet nvaytet added the essreduce Issues for essreduce. label May 4, 2026
@jl-wynen
Copy link
Copy Markdown
Member

jl-wynen commented May 4, 2026

To clarify, we got the error only when

wf[TransformationTimeFilter[sx.NXdetector, RunType]] = lambda da: da['time', 0]

i.e., without .data.

@nvaytet nvaytet added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit 5b8fe40 May 4, 2026
15 checks passed
@nvaytet nvaytet deleted the allow-single-transformation-timepoint branch May 4, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

essreduce Issues for essreduce.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants