Envelope task #1438: === Physics ===
GISASSimulatin setAnalyzerProperties total_transmission default parameter generates Exception
|Status:||Rejected||Start date:||08 Nov 2016|
When simulating polarizatio analysis experiments the setAnalyzerProperties method with parameters (kvector_t, 1.0, total_transmission=1.0) throws the exception:
IDetector2D::setAnalyzerProperties: the given properties are not physical
terminate called after throwing an instance of 'Exceptions::ClassInitializationException'
what(): IDetector2D::setAnalyzerProperties: the given properties are not physical
The default parameter of total_transmission should therefore be changed to 0.5 or replaced by desired spin transmission of 1.0.
#1 Updated by herck over 3 years ago
- Status changed from New to Backlog
- Assignee set to herck
Its not entirely clear to me what should be the desired behavior here. Analyzer efficiency and total transmission are defined in the standard way. The default values for the analyzer are:
-Efficiency P = 0
-Total transmission T = 1
which means no polarization analysis.
The default value of total_transmission=1.0 might be confusing in case users set full polarization (P=1) and leave the default value for transmission. Should I just remove the default value? That would at least force users to put in a reasonable physical value.
#2 Updated by a.glavic over 3 years ago
I think if you keep a default value, that should never through an exception. My feeling is, that in typical experiments the users will need relatively good polarization and the transmissions will be between 0.25 and 0.5.
My suggestion would be:
- Default if no analyzer is used P=0, T=1
- Default if an analyzer is used P=1, T=0.5
- Only polarization efficiency is given as parameter: P=parameter, T=0.5
That should work in most instances, where the user does not actually care about the transmission efficiency and avoid any exceptions.
#3 Updated by herck over 3 years ago
I agree that default values should not throw exceptions. The problem here is that efficiency and total transmission are coupled. Using default parameters cannot overcome this problem. A user might want to switch between no analysis and perfect polarization analysis. In the first case, default value 0.5 doesn't make sense, in the second case 1.0 throws an exception. More specifically, if the user sets efficiency explicitly to zero, nothing should change. Using default transmission of 0.5 would make the intensity suddenly drop by 50%.
I think the safe approach is to always force users to set physically reasonable values by not providing any default parameters in the method. The default values for uninitialized analysis will still remain 0.0 and 1.0 (no analysis).
#4 Updated by a.glavic over 3 years ago
Why not use the physically more suitable definition of a transmission of the analyzed neutrons? Meaning that 100% in polarization and transmission would be 50% of total intensity. This also makes more sense when using an analyzer but only looking at ++ and --, which would result in the same result as when using no analyzer and there is no spin-flip scattering.
Your current defined parameters would then be:
The default transmission definition does not make much sense for an analyzer, anyway, as you almost never hit it with unpolarized neutrons. For the calculation it is only important how much + and - neutrons are transmitted, not how much unpolarized are.
The different definition also makes it much easier to used measured values, as you just look at the transmitted intensity with and without analyzer.
#5 Updated by herck over 3 years ago
The type of analyzed neutrons (+ or - with respect to the given vector) changes according to the sign of P.
The defined parameters would become:
Pnew = P
Tnew = T*(1+P) if P>0 and T*(1-P) if P<0 (I think you had a typo with the division)
This makes this not such a nice parameter for object initialization. The current implementation would also not give a change between ++ and no analysis in case of no spin-flip scattering.
The only viable alternative would be to pass directly the two transmissions (for + and
: T+ and T). The objection here is that polarization analyzers are almost always characterized by their efficiency.
I will remove the default value of 1.0 for the current release and postpone this issue to after our workshop. We can then discuss this more fully in person.