Skip to content

Commit

Permalink
Refs #4394 Reduced random variability in initial guess
Browse files Browse the repository at this point in the history
The initial guess can be too far from the optimal parameters so that
the fitting procedure is unable to converge
  • Loading branch information
jmborr committed Dec 23, 2013
1 parent a17c250 commit 6ae6dde
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Code/Mantid/Framework/CurveFitting/test/DiffSphereTest.h
Expand Up @@ -146,9 +146,9 @@ class DiffSphereTest : public CxxTest::TestSuite
//saveWorkspace( data_workspace, "/tmp/junk_data.nxs" ); // for debugging purposes only

// override the function with new parameters, our initial guess.
double I = I_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double R = R_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double D = D_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double I = I_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
double R = R_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
double D = D_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
funtion_stream.str( std::string() );
funtion_stream.clear();
funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0,"
Expand Down Expand Up @@ -236,9 +236,9 @@ class DiffSphereTest : public CxxTest::TestSuite
//std::cout << "Intensity=" << fitalg_inelastic->getParameter( "Intensity" ) << " Radius=" << fitalg_inelastic->getParameter( "Radius" ) << " Diffusion=" << fitalg_inelastic->getParameter( "Diffusion" ) <<"\n"; // for debugging purposes only

// override the function with new parameters, our initial guess.
double I = I_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double R = R_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double D = D_0 * ( 0.5 + ( 1.0 * std::rand() ) / RAND_MAX );
double I = I_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
double R = R_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
double D = D_0 * ( 0.75 + ( 0.5 * std::rand() ) / RAND_MAX );
funtion_stream.str( std::string() );
funtion_stream.clear();
funtion_stream << "(composite=Convolution,FixResolution=true,NumDeriv=true;name=Gaussian,Height=1.0,"
Expand Down

0 comments on commit 6ae6dde

Please sign in to comment.