Ignore:
Timestamp:
Mar 29, 2019 10:41:40 AM (6 years ago)
Author:
dirk
Branches:
magnetic_scatt
Children:
73cd800
Parents:
b36e7c7
Message:

Make polarisation efficiency weights consistently the same as in SASmodels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/c_extensions/libfunc.c

    rb36e7c7 r1342f6a  
    132132//      double re_du = 0.0; 
    133133//      double im_du = 0.0; 
    134 // 
     134//  const double norm=outspin; 
     135 
     136 
     137// The norm is needed to make sure that the scattering cross sections are 
     138//correctly weighted, such that the sum of spin-resolved measurements adds up to 
     139// the unpolarised or half-polarised scattering cross section. No intensity weighting 
     140// needed on the incoming polariser side (assuming that a user), has normalised 
     141// to the incoming flux with polariser in for SANSPOl and unpolarised beam, respectively. 
     142 
     143//if (out_spin < 0.5){norm=1-out_spin;} 
     144//else{norm=out_spin;} 
     145 
    135146//      //No mag means no further calculation 
    136147//      if (isangle>0) { 
    137148//              if (m_max < 1.0e-32){ 
    138 //                      uu = sqrt((1+in_spin)/2 * (1+out_spin)/2) * uu; 
    139 //                      dd = sqrt((1.0 - in_spin)/2 * (1.0 - out_spin)/2) * dd; 
     149//                      uu = sqrt(in_spin * out_spin/ norm) * uu ; 
     150//                      dd = sqrt((1.0 - in_spin) * (1.0 - out_spin)/ norm) * dd ; 
    140151//              } 
    141152//      } 
    142153//      else if (fabs(m_max)< 1.0e-32 && fabs(m_phi)< 1.0e-32 && fabs(m_theta)< 1.0e-32){ 
    143 //                      uu = sqrt((1+in_spin)/2 * (1+out_spin)/2) * uu; 
    144 //                      dd = sqrt((1.0 - in_spin)/2 * (1.0 - out_spin)/2) * dd; 
     154//                      uu = sqrt(in_spin * out_spin/ norm) * uu; 
     155//                      dd = sqrt((1.0 - in_spin) * (1.0 - out_spin)/ norm) * dd; 
    145156//      } else { 
    146157// 
     
    192203// 
    193204//              //Find b 
    194 //              uu -= m_sigma_x; 
    195 //              dd += m_sigma_x; 
     205//              uu += m_sigma_x; 
     206//              dd -= m_sigma_x; 
    196207//              re_ud = m_sigma_y; 
    197208//              re_du = m_sigma_y; 
     
    199210//              im_du = -m_sigma_z; 
    200211// 
    201 //              uu = sqrt((1+in_spin) * (1 + out_spin)) * uu; 
    202 //              dd = sqrt((1.0 - in_spin) * (1.0 - out_spin)) * dd; 
    203 // 
    204 //              re_ud = sqrt(in_spin * (1.0 - out_spin)) * re_ud; 
    205 //              im_ud = sqrt(in_spin * (1.0 - out_spin)) * im_ud; 
    206 //              re_du = sqrt((1.0 - in_spin) * out_spin) * re_du; 
    207 //              im_du = sqrt((1.0 - in_spin) * out_spin) * im_du; 
     212//              uu = sqrt((in_spin) * (out_spin)/ norm) * uu; 
     213//              dd = sqrt((1.0 - in_spin) * (1.0 - out_spin)/ norm) * dd; 
     214// 
     215//              re_ud = sqrt(in_spin * (1.0 - out_spin)/ norm) * re_ud; 
     216//              im_ud = sqrt(in_spin * (1.0 - out_spin)/ norm) * im_ud; 
     217//              re_du = sqrt((1.0 - in_spin) * out_spin/ norm) * re_du; 
     218//              im_du = sqrt((1.0 - in_spin) * out_spin/ norm) * im_du; 
    208219//      } 
    209220//      p_sld->uu = uu; 
Note: See TracChangeset for help on using the changeset viewer.