Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow overriding the wavelength used to calculate Material.sld #167

Open
bmaranville opened this issue Jan 8, 2024 · 0 comments
Open

allow overriding the wavelength used to calculate Material.sld #167

bmaranville opened this issue Jan 8, 2024 · 0 comments

Comments

@bmaranville
Copy link
Member

Currently, we don't have support for wavelength-dependent Material layers (for multiple wavelengths in the same Probe object)

  • Slab.render(probe, slabs) calls
    • Material.sld(probe) which then calls
      • probe.scattering_factors(self.formula, density) which then calls
        • periodictable.nsf.neutron_sld(formula, wavelength=self.unique_L[0], density)

The choice of self.unique_L[0] was made just to be the simplest possible arbitrary choice of a wavelength to pick, as we do not currently properly support calculating for all the wavelengths (would require calculating a separate profile for each unique_L)

workarounds used:

To calculate models with wavelength-dependent SLD, users are creating Probe objects with coarse-grained wavelength grouping, and setting the SLD for the layers to something close to the expected value for that average wavelength. For example, a single angle of an ISIS dataset is broken up into multiple Probe objects by wavelength, and then the Parameters of the probes are tied together manually.

change suggested:

We could allow one of the objects in the call tree to specify an override_wavelength to manually set the wavelength used specifically for SLD calculation, while still leaving the L and dL columns intact for calculating resolution. My first thought is to add it to the Material class, so that you can create e.g. Eu = Material("Eu", override_wavelength=5.0), and that this wavelength is then passed to probe.scattering_factors as an optional argument, which is then used instead of Probe.unique_L[0] This would enable the current workaround to be implemented in a much saner fashion, and would preserve existing behavior for users that don't add the new override_wavelength keyword argument.

On the other hand, if override_wavelength is attached to the Probe object instead, then you could easily reuse the same Layers with different Probes that then set the SLD according a the specified wavelength. Would it be too confusing to have two different wavelengths specified on a Probe object?

alternative:

We could just fix it so that calculating for all wavelengths works properly (again - I think it did once). The issue then was that if you used Material with any element that was even slightly wavelength-dependent, the time to calculate increased dramatically so that it became unusable (need to calculate a profile and a separate reflectivity for each Q value, without reusing anything). Paul has suggested calculating a mesh of reflectivities vs. wavelength and interpolating.

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

No branches or pull requests

1 participant