Skip to content

Beer powdiff workflow#262

Open
jokasimr wants to merge 16 commits intomainfrom
beer-powdiff
Open

Beer powdiff workflow#262
jokasimr wants to merge 16 commits intomainfrom
beer-powdiff

Conversation

@jokasimr
Copy link
Copy Markdown
Contributor

Fixes #235

@jokasimr jokasimr marked this pull request as draft March 25, 2026 09:56
@jokasimr jokasimr marked this pull request as ready for review April 8, 2026 08:43
@jokasimr jokasimr requested a review from jl-wynen April 8, 2026 08:44
return {
**gg,
't0': t0_estimate,
'tof': lambda time_of_arrival, t0: time_of_arrival - t0,
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.

Eventually we will replace this mechanism for computing wavelengths in beer pulse shaping modes with the lookup table approach to make it consistent with the other techniques.

if north_or_south is not None and number is not None
else next(_find_all_h5(data_dir, f'.*{north_or_south}'))
if north_or_south is not None
else next(_find_all_h5(data_dir, f'/entry1.*bank.*{number}'))
Copy link
Copy Markdown
Contributor Author

@jokasimr jokasimr Apr 10, 2026

Choose a reason for hiding this comment

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

The McStas file loading is complex because there have been several rounds of changes to the McStas output files, and we want to be "backwards compatible" with the old McStas output structure because otherwise we have to replace the files in the tests/docs.

I've raised this with Celine and I don't expect there will be more significant changes going forward.

Copy link
Copy Markdown
Member

@SimonHeybrock SimonHeybrock left a comment

Choose a reason for hiding this comment

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

Small questions:

Comment on lines +192 to +197
def t0_estimate(
wavelength_estimate: sc.Variable,
L0: sc.Variable,
Ltotal: sc.Variable,
) -> sc.Variable:
"""Estimates the time-at-chopper by assuming the wavelength."""
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.

  • Not clear to me what L0 is without context. Can you explain in the docstrings? Either here or module-level?
  • Could a helper from scippneutron be used for this conversion?

return {
**gg,
't0': t0_estimate,
'tof': lambda time_of_arrival, t0: time_of_arrival - t0,
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.

Can you clarify why we still have tof here despite the switch to use the new wavelength-LUT in other code above?

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.

Beer currently does not use the LUT approach to compute wavelengths. Eventually we will move to that approach for the pulse shaping modes (the modulation modes are incompatible with the LUT approach).

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.

But I saw a lot of changes that replaced Tof with Wavelength?

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, the workflow is still using the generic unwrap workflow which does not have any public Tof... types.

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.

So where does TOF come into play? Is it TOA->TOF->Wavelength, or TOA->Wavelength->TOF as for DREAM final result, or something else?

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.

It's toa->tof->wavelength.

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.

So what is GenericUnwrapWorkflow being used for? As far as I understand it does not support TOF anymore.

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.

It's used so that the interface of the workflow matches what it will look like once we have lookup tables for the pulse skipping modes. That the wavelengths are currently not computed using lookup tables is an implementation detail, it does not need to be reflected in the public interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Requirement] BEER: Powder diffraction reduction workflow

2 participants