Changeset 0be5c81 in sasview for realSpaceModeling/pointsmodelpy


Ignore:
Timestamp:
Jun 9, 2008 10:46:23 AM (17 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
c61228f
Parents:
43bf807
Message:

Normalize output P(r)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc

    rbbfad0a r0be5c81  
    210210    exit(1); 
    211211  } 
     212   
     213  double sum = 0.0; 
     214  double r_stepsize = 1.0; 
     215  if (pr_.dim1()>2) r_stepsize = pr_[1][0] - pr_[0][0]; 
     216   
    212217  for (int i = 0;  i < pr_.dim1(); ++i){ 
    213     outfile << pr_[i][0] << "       " << pr_[i][1] << endl; 
     218          sum += pr_[i][1]*r_stepsize; 
     219  } 
     220   
     221  for (int i = 0;  i < pr_.dim1(); ++i){ 
     222          if (pr_[i][1]==0) continue; 
     223          outfile << pr_[i][0] << "       " << (pr_[i][1]/sum) << endl; 
    214224  } 
    215225} 
Note: See TracChangeset for help on using the changeset viewer.