Skip to content

[ESSREDUCE] feat: Add option to not drop event_time_offset from WavelengthData - #700

Merged
jokasimr merged 6 commits into
mainfrom
fix-593
Aug 17, 2026
Merged

[ESSREDUCE] feat: Add option to not drop event_time_offset from WavelengthData#700
jokasimr merged 6 commits into
mainfrom
fix-593

Conversation

@jokasimr

@jokasimr jokasimr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #593

I know there were some disagreement on exactly what we should do here.
But it is at least easier to have a PR with a suggested implementation to base the discussion on.

@jokasimr
jokasimr requested a review from jl-wynen August 11, 2026 13:53
@github-actions github-actions Bot added the essreduce Issues for essreduce. label Aug 11, 2026
@github-actions github-actions Bot changed the title fix: don't drop event_time_offset from WavelengthData [ESSREDUCE] fix: don't drop event_time_offset from WavelengthData Aug 11, 2026
parts["data"] = wavs
result = da.bins.assign_coords(wavelength=sc.bins(**parts, validate_indices=False))
out = result.bins.drop_coords("event_time_offset")
out = da.bins.assign_coords(wavelength=sc.bins(**parts, validate_indices=False))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping an extra coord cost both memory and compute for all instruments and follow up operations. I don't think we can do this (not drop the coord) as a generally enabled thing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what you're saying, but consider that the coord could be dropped in the instrument package code and then it would not cost extra compute or memory.

It would use extra memory in-between this drop and the drop in the package code, but that will likely be a short period between those run, and max memory usage is unlikely to increase.

But if we don't make this change, what alternative do you prefer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it already costing in the very same function a couple lines further down?

How about adding a workflow param that can optionally enable keeping this coord?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it already costing in the very same function a couple lines further down?

I don't think so. What code section do you mean?

How about adding a workflow param that can optionally enable keeping this coord?

I'm fine with that too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the if "event_time_zero" in out.dims: block.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha I see. 👍 I thought that less important because it only runs for event monitors and not for regular detectors. But I guess it could be relevant for larger event monitors.

@SimonHeybrock SimonHeybrock changed the title [ESSREDUCE] fix: don't drop event_time_offset from WavelengthData [ESSREDUCE] feat: Add option to not drop event_time_offset from WavelengthData Aug 17, 2026
run_types: Iterable[sciline.typing.Key],
monitor_types: Iterable[sciline.typing.Key],
wavelength_from: WavelengthLutMode = "file",
keep_event_time_offset: bool = False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose to make this a workflow-factory param? It does not affect workflow structure (likely the other args above), so we can keep it a plain Pipeline param, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's much better 👍 Fixed that and some other structure issues.

@jokasimr
jokasimr requested a review from SimonHeybrock August 17, 2026 09:53
@jokasimr
jokasimr added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit 1be149d Aug 17, 2026
24 checks passed
@jokasimr
jokasimr deleted the fix-593 branch August 17, 2026 11:59
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.

[ESSREDUCE] event_time_offset should be kept on WavelengthDetector

2 participants