Changeset c451be9 in sasview for sansmodels/src/sans/models/c_models/cylinder.cpp
- Timestamp:
- Jan 7, 2010 5:04:25 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- dfa8832
- Parents:
- 4cbaf35
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/cylinder.cpp
rf9bf661 rc451be9 73 73 double sum = 0.0; 74 74 double norm = 0.0; 75 double vol = 0.0; 75 76 76 77 // Loop over radius weight points … … 81 82 for(int j=0; j<weights_len.size(); j++) { 82 83 dp[2] = weights_len[j].value; 83 84 //Un-normalize by volume 84 85 sum += weights_rad[i].weight 85 * weights_len[j].weight * CylinderForm(dp, q); 86 * weights_len[j].weight * CylinderForm(dp, q) 87 *pow(weights_rad[i].value,2)*weights_len[j].value; 88 89 //Find average volume 90 vol += weights_rad[i].weight 91 * weights_len[j].weight *pow(weights_rad[i].value,2)*weights_len[j].value; 86 92 norm += weights_rad[i].weight 87 93 * weights_len[j].weight; 88 94 } 89 95 } 96 if (vol != 0.0 && norm != 0.0) { 97 //Re-normalize by avg volume 98 sum = sum/(vol/norm);} 99 90 100 return sum/norm + background(); 91 101 } … … 127 137 double sum = 0.0; 128 138 double norm = 0.0; 139 double norm_vol = 0.0; 140 double vol = 0.0; 129 141 130 142 // Loop over radius weight points … … 144 156 for(int l=0; l<weights_phi.size(); l++) { 145 157 dp.cyl_phi = weights_phi[l].value; 146 158 //Un-normalize by volume 147 159 double _ptvalue = weights_rad[i].weight 148 160 * weights_len[j].weight 149 161 * weights_theta[k].weight 150 162 * weights_phi[l].weight 151 * cylinder_analytical_2DXY(&dp, qx, qy); 163 * cylinder_analytical_2DXY(&dp, qx, qy) 164 *pow(weights_rad[i].value,2)*weights_len[j].value; 152 165 if (weights_theta.size()>1) { 153 166 _ptvalue *= sin(weights_theta[k].value); 154 167 } 155 168 sum += _ptvalue; 169 //Find average volume 170 vol += weights_rad[i].weight 171 * weights_len[j].weight 172 * pow(weights_rad[i].value,2)*weights_len[j].value; 173 //Find norm for volume 174 norm_vol += weights_rad[i].weight 175 * weights_len[j].weight; 156 176 157 177 norm += weights_rad[i].weight … … 168 188 // integration (see documentation). 169 189 if (weights_theta.size()>1) norm = norm / asin(1.0); 190 if (vol != 0.0 && norm_vol != 0.0) { 191 //Re-normalize by avg volume 192 sum = sum/(vol/norm_vol);} 193 170 194 return sum/norm + background(); 171 195 }
Note: See TracChangeset
for help on using the changeset viewer.