Skip to content

[ESSDIFFRACTION] BEER improvements - #704

Merged
jokasimr merged 11 commits into
mainfrom
improve-beer
Aug 21, 2026
Merged

[ESSDIFFRACTION] BEER improvements#704
jokasimr merged 11 commits into
mainfrom
improve-beer

Conversation

@jokasimr

@jokasimr jokasimr commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Main changes are:

  • Adds the modulation chopper modes to the list of chopper settings.
  • Uses chopper parameters instead of mcstas specific parameters in modulation workflow, making it more ready for real data.
  • Simplifies the McStas data loader using McstasTox - it needed some refactoring.

@github-actions github-actions Bot added the essdiffraction Issues for essdiffraction. label Aug 14, 2026
@github-actions github-actions Bot changed the title BEER improvements [ESSDIFFRACTION] BEER improvements Aug 14, 2026
@jokasimr

jokasimr commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

The changes look large and scary because of the lockfile, the non-lockfile changes are something like +850 -950.

@jokasimr
jokasimr requested a review from nvaytet August 14, 2026 12:07
@jokasimr

jokasimr commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Here is the dspacing spectrum obtained from the files in @celinedurniak linked to in #669.

Figure 1(89)

@jokasimr
jokasimr requested review from jl-wynen and removed request for nvaytet August 18, 2026 11:05
@jokasimr

jokasimr commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Comments from in-person review:

  • Definition of tof used in the automatic modulation chopper workflow needs better documentation / description.
  • Remove chopper data tests.

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.

What is the purpose of these tests? It seems to me like you are just checking that you managed to type in the same hard-coded numbers in the tests and the module. The tests do not check any behaviour. And whenever parameters change, the tests need to change as well.

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 agree they're not useful, let's remove them.

They were originally ai-written, and I thought about removing them then, but in the end I didn't do it.

}


def _beer_modulation_workflow(graph_provider, *providers) -> sl.Pipeline:

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 rename this to reflect that it is only valid for McStas data?

t0 += 0.5
sc.floor(t0, out=t0)
t0 *= mod_period
t -= 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.

Please add a comment explaining t0 (in relation to subframes and tof, ltotal)

from ..types import DetectorBank, Filename, RawDetector
from .beamline import ModulationMode, PulseShapingMode, simulation_choppers

_MCSTAS_T_OFFSET = sc.scalar(1.6, unit='ms')

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.

Please add a comment explaining what this is.

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 a specific offset applied in the beer mcstas model that changes the mcstas convention of what t=0 corresponds to. (The convention is that it corresponds to the beginning of the pulse, but in beer mcstas files it corresponds to the center of the pulse.)

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'll add a comment.

@jokasimr

Copy link
Copy Markdown
Contributor Author

@jl-wynen was there anything more to do here?

@jokasimr
jokasimr added this pull request to the merge queue Aug 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 20, 2026
@jokasimr
jokasimr added this pull request to the merge queue Aug 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 20, 2026
@jokasimr
jokasimr enabled auto-merge August 21, 2026 09:12
@jokasimr
jokasimr added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit f780b01 Aug 21, 2026
24 checks passed
@jokasimr
jokasimr deleted the improve-beer branch August 21, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

essdiffraction Issues for essdiffraction.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants