reflectometry / refl1d

1-D reflectometry fitting
https://refl1d.readthedocs.io/
Other
17 stars 24 forks source link

Update model_view to handle an array of SLD (from wavelength-dependence) #119

Open bmaranville opened 3 years ago

bmaranville commented 3 years ago

A recent update to periodictable enables SLD calculation for an array of wavelengths for a Material, but when that is done there is no way to display this in the profile plot.

pkienzle commented 3 years ago

profile.Microslabs does not yet support wavelength dependent SLD so the wavelength-dependent profiles are not being generated.

The reflectivity calculator allows each q point to have a different SLD profile so once we have the table we can calculate it. For now, though, probe.NeutronProbe.scattering_factors returns the SLD for only the first wavelength.

We need a polychromatic probe object manages the grid of wavelength × angle so we can calculate resolution correctly.

acaruana2009 commented 3 years ago

With regards to data input from the instrument how should we handle this? I was contemplating if I should just reduce my data in native time bins converted to lambda and feed in theta, lambda, R, dR, and we rebin in refl1d?

Or should I rebin in lambda before passing the data to refl1d? The issue here is how to handle many wavelengths in one bin - to be honest I had not contemplated this before as I had not thought about having to do a wavelength dependent absorption fit.

bmaranville commented 3 years ago

While probe.NeutronProbe.scattering_factors returns only the SLD for the first wavelength, material.Material.sld returns an array and this is breaking the GUI for refl1d if you have more than one wavelength and you use a Material instead of SLD. For the moment I'm suggesting users pin the periodictable version to 1.5.3 to prevent this.

pkienzle commented 3 years ago

For now you can split the data into separate wavelength regions and do a simultaneous fit. You may end up with sparse data in each curve so you will need to oversample to compute resolution. I added #120 as a reminder that this condition needs to be detected automatically.

acaruana2009 commented 3 years ago

OK, my plan was to export the data as individual angles anyway (i.e. dont stitch) and use probe_set. So I will rebin in wavelength and export the data as something like: Q, R, dR, dQ (derived from dQ/Q step as determined by dlam/lam and dtheta/theta steps) lam, dlam (derived from dlam/lam - but ultimately since dtheta/theta is our dominant term in dQ/Q i should rebin lambda accordingly), theta (which will be a column of the same value for a given angle), dtheta (derived from dtheta/theta - determined from our slit settings).

Since our resolution term (for the most part) is determined by our slits, I would set the rebin step to that determined by our dtheta/theta term. @bmaranville showed me how you guys output to your data format, so my plan was to use that and adjust it for our instrument.

pkienzle commented 3 years ago

On a related note you should be able to do θ-offset on stitched data with some small tweaks to (Q, ΔQ). You will need to include some information about the spectrum in the reduction, namely the mean and standard deviation of 1/λ. It would be better to store this separately for each bin especially if the stitching overlap is small. See #47 for details.