Changeset 41e8114 in sasview for realSpaceModeling/pointsmodelpy/libpointsmodelpy
- Timestamp:
- Nov 2, 2007 11:04:05 AM (17 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:
- 5a2070e
- Parents:
- 7e845ea
- Location:
- realSpaceModeling/pointsmodelpy/libpointsmodelpy
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc
r2bb0b26 r41e8114 412 412 } 413 413 414 double PointsModel::CalculateIQ_2D_Error(const vector<Point3D>&points, double qx, double qy){ 415 416 int size = points.size(); 417 418 double delta_x, delta_y; 419 double q_t2 = qx*qx + qy*qy; 420 double cos_term = 0; 421 double sin_term = 0; 422 double cos_err = 0; 423 double sin_err = 0; 424 425 // Estimate the error on the position of each point 426 // in x or y as V^(1/3)/N 427 428 for (int i = 0; i < size; i++) { 429 430 431 //the sld for the pair of points 432 433 double phase = qx*points[i].getX() + qy*points[i].getY(); 434 double sld_fac = points[i].getSLD() * points[i].getSLD(); 435 436 cos_term += cos(phase) * points[i].getSLD(); 437 sin_term += sin(phase) * points[i].getSLD(); 438 439 sin_err += cos(phase) * cos(phase) * sld_fac; 440 cos_err += sin(phase) * sin(phase) * sld_fac; 441 442 } 443 444 // P(q) = 1/V I(q) = (V/N)^2 (1/V) (cos_term^2 + sin_term^2) 445 // We divide by N here and we will multiply by the density later. 446 447 // We will need to multiply this error by V^(1/3)/N. 448 // We don't have access to V from within this class. 449 return 2*sqrt(cos_term*cos_term*cos_err*cos_err + sin_term*sin_term*sin_err*sin_err)/size; 450 } 451 -
realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h
r2bb0b26 r41e8114 28 28 // Fast 2D simulation 29 29 double CalculateIQ_2D(const vector<Point3D>&, double qx, double qy); 30 double CalculateIQ_2D_Error(const vector<Point3D>&, double qx, double qy); 30 31 31 32 //given a set of points, calculate distance correlation
Note: See TracChangeset
for help on using the changeset viewer.