Changeset 5e1875c in sasmodels
- Timestamp:
- Mar 29, 2019 4:31:37 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 6b86bee, 663d2a8, 8973e0d, 8b7ce55
- Parents:
- 62dc889
- git-author:
- Dirk Honecker <honecker@…> (03/29/19 04:27:47)
- git-committer:
- Dirk Honecker <honecker@…> (03/29/19 04:31:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
r12f4c19 r5e1875c 85 85 static void set_spin_weights(double in_spin, double out_spin, double weight[6]) 86 86 { 87 88 const double norm; 87 89 in_spin = clip(in_spin, 0.0, 1.0); 88 90 out_spin = clip(out_spin, 0.0, 1.0); … … 94 96 // However, since the weights are applied to the final intensity and 95 97 // are not interned inside the I(q) function, we want the full 96 // weight and not the square root. Any function using 97 // set_spin_weights as part of calculating an amplitude will need to 98 // manually take that square root, but there is currently no such 99 // function. 100 weight[0] = (1.0-in_spin) * (1.0-out_spin); // dd 101 weight[1] = (1.0-in_spin) * out_spin; // du 102 weight[2] = in_spin * (1.0-out_spin); // ud 103 weight[3] = in_spin * out_spin; // uu 98 // weight and not the square root. Anyway no function will ever use 99 // set_spin_weights as part of calculating an amplitude, as the weights are 100 // related to polarisation efficiency of the instrument. The weights serve to 101 // construct various magnet scattering cross sections, which are linear combinations 102 // of the spin-resolved cross sections. The polarisation efficiency e_in and e_out 103 // are parameters ranging from 0.5 (unpolarised) beam to 1 (perfect optics). 104 // For in_spin or out_spin <0.5 one assumes a CS, where the spin is reversed/flipped 105 // with respect to the initial supermirror polariser. The actual polarisation efficiency 106 // in this case is however e_in/out = 1-in/out_spin. 107 108 if (out_spin < 0.5){norm=1-out_spin;} 109 else{norm=out_spin;} 110 111 112 // The norm is needed to make sure that the scattering cross sections are 113 //correctly weighted, such that the sum of spin-resolved measurements adds up to 114 // the unpolarised or half-polarised scattering cross section. No intensity weighting 115 // needed on the incoming polariser side (assuming that a user), has normalised 116 // to the incoming flux with polariser in for SANSPOl and unpolarised beam, respectively. 117 118 119 weight[0] = (1.0-in_spin) * (1.0-out_spin) / norm; // dd 120 weight[1] = (1.0-in_spin) * out_spin / norm; // du 121 weight[2] = in_spin * (1.0-out_spin) / norm; // ud 122 weight[3] = in_spin * out_spin / norm; // uu 104 123 weight[4] = weight[1]; // du.imag 105 124 weight[5] = weight[2]; // ud.imag … … 119 138 switch (xs) { 120 139 default: // keep compiler happy; condition ensures xs in [0,1,2,3] 121 case 0: // uu=> sld - D M_perpx140 case 0: // dd => sld - D M_perpx 122 141 return sld - px*perp; 123 case 1: // ud.real => -D M_perpy142 case 1: // du.real => -D M_perpy 124 143 return py*perp; 125 case 2: // du.real => -D M_perpy144 case 2: // ud.real => -D M_perpy 126 145 return py*perp; 127 case 3: // dd=> sld + D M_perpx146 case 3: // uu => sld + D M_perpx 128 147 return sld + px*perp; 129 148 }
Note: See TracChangeset
for help on using the changeset viewer.