Skip to content

StatisticalChopper: sign of delay for isfirst=1, and autocorrelation check stops after A_0 #3005

Open

Description

@willend

Open points from the review in #2993. They are not changed there, because the intended behaviour needs a maintainer decision. Line numbers refer to mcstas-comps/contrib/StatisticalChopper.comp on the #2993 branch.

1. Sign of delay in the isfirst=1 branch

  • isfirst=1 (line 217) emits at t = atan2(x, yprime)/omega + SequenceIndex[k]/nslit/nu - delay + ....
  • The isfirst=0 acceptance test (line 223) uses angle = 2*PI*nu*(t - atan2(x, yprime)/omega + ...) - phase. Here phase = delay*omega (line 119), so a slit is open at t ≈ ... + delay.
  • DiskChopper is consistent: isfirst=1 emits at + delay (optics/DiskChopper.comp:167), and isfirst=0 accepts at - delay (line 171).

With delay != 0, a first chopper and an identical downstream chopper at the same position therefore disagree by 2*delay. Should isfirst=1 use + delay?

2. Autocorrelation check only tests A_0

In INITIALIZE (lines 164–184), both branches of the if (j == 0 || j == nslit || j == 2*nslit) test end in break. So the loop stops after j = 0, and the pseudorandom criterion A_j = m(m-1)/(N-1) for j != 0 mod N is never checked. Was the break meant to apply only after a warning has been printed, or should it be removed altogether?

Numerical behaviour: (1) changes timing for isfirst=1 with delay/phase != 0. (2) changes only warnings, not results.

🤖 Generated with Claude Code

Activity

  1. willend commented on Nov 22, 2026

    @willend
    ContributorAuthor

    Fix for point 2 incoming in #3173. Point 1 (sign of delay) is left for the DiskChopper discussion in #2347.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions