Skip to content

Conversation

@jokasimr
Copy link
Contributor

@jokasimr jokasimr commented Nov 11, 2025

Fixes #263

If the frequency is negative we change the direction of the coordinate system to make it positive.
In that case, phase should also be transformed the same way, but phase should not be transformed just because it is negative.

@jokasimr jokasimr requested a review from nvaytet November 11, 2025 09:09
open=ch.slit_begin,
close=ch.slit_end,
phase=abs(ch.phase),
phase=ch.phase if ch.frequency.value > 0.0 else -ch.phase,
Copy link
Member

@nvaytet nvaytet Nov 11, 2025

Choose a reason for hiding this comment

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

If you change the order of operations in tof, does this go away?
(first add phase, and then mirror)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I could not make it go away by changing anything in tof.
I lean towards the implementation in tof being correct.

phase=abs(ch.phase),
phase=ch.phase if ch.frequency.value > 0.0 else -ch.phase,
distance=sc.norm(ch.axle_position - source_position),
name=name,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add properly maintained methods in tof to construct chopper from DiskChopper and NeXus.
I suspect this code exists in multiple places (packages, notebooks etc...)

See scipp/tof#6.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that sounds like a good idea. Do you want to see that in this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Do you want to see that in this PR?

No, I will do that separately.

@jokasimr jokasimr merged commit 3f9d087 into main Nov 11, 2025
4 checks passed
@jokasimr jokasimr deleted the fix-fake-beamline branch November 11, 2025 13:14
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.

ToF lookup table is wrong for negative chopper phase

3 participants