reflectometry / refl1d

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

Add standard handling for half-polarized beam #148

Open bmaranville opened 2 years ago

bmaranville commented 2 years ago

On CANDOR we will be measuring without an analyzer for a while. Many files will have polarization = + or - instead of ++ and --

load4 does not work for these files (throws an exception) because it is expecting only pairs from the full 4 cross-sections.

We should work out what the standard handling for half-polarized files will be (up-convert to ++ and --?), instead of forcing users to manually edit .refl files to change the polarization in the header.

bmaranville commented 2 years ago

Apparently the folks at ISIS are also frequently loading + as ++ and - as --

bmaranville commented 2 years ago

Kirby pointed out that sometimes you'll want to do something more subtle, like an incoherent sum of SF and NSF, assuming that the SF channel is being measured correctly for that geometry (that Zeeman splitting < resolution).
In that case maybe users just wouldn't use load4 for that model? Then load4 could still do something 90+% of users want, which seems to be converting + to ++.

pkienzle commented 2 years ago

There are two SF channels. Which one is added will depend on whether the spin selector is before or after the sample. Maybe a mnemonic such as ?+ or +? to distinguish.

bmaranville commented 2 years ago

But what would we do in load4 and PolarizedNeutronProbe with the ?+ and +? after that? There is only a defined workflow for ++ and --

pkienzle commented 2 years ago

Sure, we can do the same until we refactor the handling of polarized beam, which we need to do at some point.

I'm suggesting that reduction should record whether the half-polarized beam is front or back polarized for those samples which exhibit splitting in the spin flip channel and those programs that can handle it.

bmaranville commented 2 years ago

Leaving aside for the moment whether we should include more information from the reduction (I agree, this is a good idea), what should refl1d do with half-polarized data? That is the essence of the ticket. I think most people will want to treat it as ++ and --

pkienzle commented 2 years ago

This is the easier approach. I suspect most people want to treat it as ++ and -- because they believe they have no spin flip. I would prefer correct behavior by default, which would be to add in the appropriate spin flip channel. If the model has no SF then this harmless since it gives the same result, but it seamlessly handles Kirby's case as well. This is more work.

I suggest treating it as ++ and -- for now but do the full calculation when we refactor the polarized neutron data structure.

Note that sasview lets you fit the measurement without polarization correction by having mixing terms as part of the model. I don't think we want to go there.

bmaranville commented 2 years ago

There is an issue with adding in the SF channels - they don't line up on the NSF channels when the field is non-zero (Zeeman splitting). In this sense SANS has an easier time of it because they can mix spin channels all over the detector (nothing gets lost when it shifts in angle)

pkienzle commented 2 years ago

I don't understand. If the Zeeman effect is captured in the model then it can be mixed before comparing with the data. If it is not captured in the model then it needs to be a correction in the reduction and I don't see it there.

bmaranville commented 2 years ago

The Zeeman effect makes SF scatter at a different angle, so it might not make it into the detector if the shift is big enough compared to the acceptance.

bmaranville commented 8 months ago

If we make the assumption that all the scattering is captured in half-polarized mode, it should be possible to polarization-correct the measured I+ and I-, extracting the sums $S^+ \equiv \Sigma^{++} + \Sigma^{+-}$, $S^- \equiv \Sigma^{-+} + \Sigma^{--}$ (using the notation of Wildes, where we typically use $R^{++} ...$ instead of $\Sigma^{++}...$ to describe the reflectivity cross-sections)

Here is the result: $$J^+ \equiv I^{++} + I^{+-}$$ $$J^- \equiv I^{-+} + I^{--}$$ $$J^+ = p S^+ + (1 - p) S^-$$ $$J^- = (f_p - p) S^+ + (f_p + p - 1) S^-$$ Putting that into matrix form and inverting, I get that the corrected $S^, S^-$ (which we can model exactly as an incoherent sum!) are $$S^+ = \frac{1}{f_p (2p - 1)} \left[(f_p + p - 1)J^+ + (p - 1) J^-\right]$$ $$S^- = \frac{1}{f_p (2p - 1)} \left[(p - f_p) J^+ + p J^-\right]$$

this was calculated by taking inverses of the matrices defined in Eq. 4a from Wildes, setting $f_a = a = 1$ and calculating $$I = [F_p^{-1}] [P^{-1}] [F_a^{-1}] [A^{-1}] \Sigma$$ noting that $F_a^{-1} = A^{-1} = Identity$ for $f_a = a = 1$