Add inelastic sample component that changes neutron wavelengths#124
Open
Add inelastic sample component that changes neutron wavelengths#124
Conversation
Member
Author
|
@bingli621 please take a look (and also try it out!) |
nvaytet
commented
Feb 25, 2026
| self.add_detector(None) | ||
| det = self.detectors_container.children[-1] | ||
| det.distance_widget.value = comp.distance.to(unit='m').value | ||
| det.name_widget.value = comp.name |
Member
Author
There was a problem hiding this comment.
This is where we need to also update the dashboard to support samples. This will be done in a follow up PR.
Member
Author
|
Comments from in-person discussion:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new type of component:
InelasticSample.It modifies the neutron energies according to a probability function for energy shift.
It is used as follows:
Internal changes
Quite a bit of the internals had to be refactored, because of the way the chopper and detector logic was hard-coded inside the
Model(especially therunfunction).Instead of taking in
choppersanddetectors, the Model now accepts a flat list of components.The effects of each component are applied onto the neutrons in succession, and the logic for those effects has been moved inside the components themselves.
I think it makes for a much cleaner structure in the model. Logic for plotting was also moved into the respective components.
Fixes #117