function d17_polcorr,win,phi=phi,F1=F1,F2=F2,p1=p1,p2=p2
LAMP function to take up to four workspaces, one for each flipper state, and to correct for the polarizing inefficiencies.
The corrections are based on the equations in Wildes, Rev. Sci. Instrum., 70 (1999) 4241
NECESSARY INPUT:
win=input workspace. This can be a 4 rows x N columns matrix, where N is the number of 2 theta values. The order of the rows *must* be (from the top) I00, I01, I10, I11. It is assumed that each column gives the values of I measured at *the same* position in theta
'mload' will automatically create an array of the right dimensions, and in the right order.
You can create such a matrix from four 1d datasets using the aw_four1d2one2d function OR, it can be a 2 rows x N columns matrix for those measurements without an analyser (i.e. for 'asymmetry'). In this case, the order of the rows *must* be (from the top) I0, I1
SEMI-NECESSARY INPUT:
All this input is in the form of a two-element array,
the first number is the value of the parameter
the second number is its error
The program aw_polcalc returns the values in the right format
Depending on the type of measurement, you must include some combination of the following:
p1=inefficiency of the polarizer (between 0 and 1)
p2=inefficiency of the analyzer (between 0 and 1)
F1=inefficiency of the first flipper (between 0 and 1)
F2=inefficiency of the second flipper (between 0 and 1)
phi=p1+p2-2*p1*p2 (between 0 and 1)
NOTE: If you enter p1 and/or p2, the program will IGNORE phi!
OUTPUT:
The workspace will be either a 4 rows x N columns matrix,
the order of the rows will be (from the top)
SIGMA(++),SIGMA(+-),SIGMA( +),SIGMA(--)
Or the workspace will be a 2 rows x N columns matrix,
the order of the rows will be (from the top) SIGMA(+),SIGMA(-)
e.g. type at LAMP interface
w6=d17_polcorr(w5,F1=[0.007,0.0008],F2=[0.005,0.0008],p1=[0.05,0.002],p2=[0.011,0.002])
(good for ferro and ferrimagnets)
w6=d17_polcorr(w5,F1=[0.007,0.0008],F2=[0.005,0.0008],phi=[0.05,0.002])
(good for antiferro and paramagnets)
w6=d17_polcorr(w5,F1=[0.007,0.0008],p1=[0.05,0.002])
(good for spin asymmetry)