Changeset 444
- Timestamp:
- Nov 12, 2008 4:45:15 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2008/Core_and_NShells_v40.ipf
r396 r444 23 23 //needed to calculate the model function. 24 24 // 25 MacroPlotOneShell(num,qmin,qmax)25 Proc PlotOneShell(num,qmin,qmax) 26 26 Variable num=200, qmin=0.001, qmax=0.7 27 27 Prompt num "Enter number of data points for model: " … … 48 48 End 49 49 50 MacroPlotTwoShell(num,qmin,qmax)50 Proc PlotTwoShell(num,qmin,qmax) 51 51 Variable num=200, qmin=0.001, qmax=0.7 52 52 Prompt num "Enter number of data points for model: " … … 73 73 End 74 74 75 MacroPlotThreeShell(num,qmin,qmax)75 Proc PlotThreeShell(num,qmin,qmax) 76 76 Variable num=200, qmin=0.001, qmax=0.7 77 77 Prompt num "Enter number of data points for model: " … … 81 81 Make/O/D/n=(num) xwave_ThreeShell, ywave_ThreeShell 82 82 xwave_ThreeShell = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) 83 Make/O/D coef_ThreeShell ={1.,60,6.4e-6,10,1e-6,10,2e-6, 6.4e-6,0.001}84 make/o/t parameters_ThreeShell = {"scale","core radius (A)","Core SLD (A-2)","Shell 1 thickness","Shell 1 SLD (A-2)","Shell 2 thickness","Shell 2 SLD (A-2)","S olvent SLD (A-2)","bkg (cm-1)"}83 Make/O/D coef_ThreeShell ={1.,60,6.4e-6,10,1e-6,10,2e-6,10,3e-6,6.4e-6,0.001} 84 make/o/t parameters_ThreeShell = {"scale","core radius (A)","Core SLD (A-2)","Shell 1 thickness","Shell 1 SLD (A-2)","Shell 2 thickness","Shell 2 SLD (A-2)","Shell 3 thickness","Shell 3 SLD (A-2)","Solvent SLD (A-2)","bkg (cm-1)"} 85 85 Edit parameters_ThreeShell, coef_ThreeShell 86 86 … … 98 98 End 99 99 100 MacroPlotFourShell(num,qmin,qmax)100 Proc PlotFourShell(num,qmin,qmax) 101 101 Variable num=200, qmin=0.001, qmax=0.7 102 102 Prompt num "Enter number of data points for model: " … … 134 134 //////////////////////////////////////////////////// 135 135 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 136 MacroPlotSmearedOneShell(str)136 Proc PlotSmearedOneShell(str) 137 137 String str 138 138 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 168 168 End 169 169 170 MacroPlotSmearedTwoShell(str)170 Proc PlotSmearedTwoShell(str) 171 171 String str 172 172 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 203 203 204 204 205 MacroPlotSmearedThreeShell(str)205 Proc PlotSmearedThreeShell(str) 206 206 String str 207 207 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 237 237 End 238 238 239 MacroPlotSmearedFourShell(str)239 Proc PlotSmearedFourShell(str) 240 240 String str 241 241 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 676 676 return (0) 677 677 End 678 679 //wrapper to calculate the smeared model as an AAO-Struct 680 // fills the struct and calls the ususal function with the STRUCT parameter 681 // 682 // used only for the dependency, not for fitting 683 // 684 Function fSmearedTwoShell(coefW,yW,xW) 685 Wave coefW,yW,xW 686 687 String str = getWavesDataFolder(yW,0) 688 String DF="root:"+str+":" 689 690 WAVE resW = $(DF+str+"_res") 691 692 STRUCT ResSmearAAOStruct fs 693 WAVE fs.coefW = coefW 694 WAVE fs.yW = yW 695 WAVE fs.xW = xW 696 WAVE fs.resW = resW 697 698 Variable err 699 err = SmearedTwoShell(fs) 700 701 return (0) 702 End 703 704 //wrapper to calculate the smeared model as an AAO-Struct 705 // fills the struct and calls the ususal function with the STRUCT parameter 706 // 707 // used only for the dependency, not for fitting 708 // 709 Function fSmearedThreeShell(coefW,yW,xW) 710 Wave coefW,yW,xW 711 712 String str = getWavesDataFolder(yW,0) 713 String DF="root:"+str+":" 714 715 WAVE resW = $(DF+str+"_res") 716 717 STRUCT ResSmearAAOStruct fs 718 WAVE fs.coefW = coefW 719 WAVE fs.yW = yW 720 WAVE fs.xW = xW 721 WAVE fs.resW = resW 722 723 Variable err 724 err = SmearedThreeShell(fs) 725 726 return (0) 727 End 728 729 //wrapper to calculate the smeared model as an AAO-Struct 730 // fills the struct and calls the ususal function with the STRUCT parameter 731 // 732 // used only for the dependency, not for fitting 733 // 734 Function fSmearedFourShell(coefW,yW,xW) 735 Wave coefW,yW,xW 736 737 String str = getWavesDataFolder(yW,0) 738 String DF="root:"+str+":" 739 740 WAVE resW = $(DF+str+"_res") 741 742 STRUCT ResSmearAAOStruct fs 743 WAVE fs.coefW = coefW 744 WAVE fs.yW = yW 745 WAVE fs.xW = xW 746 WAVE fs.resW = resW 747 748 Variable err 749 err = SmearedFourShell(fs) 750 751 return (0) 752 End -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2008/PolyCore_and_NShells_v40.ipf
r396 r444 27 27 //needed to calculate the model function. 28 28 // 29 Macro PlotPolyPolyOneShell(num,qmin,qmax)29 Proc PlotPolyOneShell(num,qmin,qmax) 30 30 Variable num=200, qmin=0.001, qmax=0.7 31 31 Prompt num "Enter number of data points for model: " … … 33 33 Prompt qmax "Enter maximum q-value (^-1) for model: " 34 34 // 35 Make/O/D/n=(num) xwave_Poly PolyOneShell, ywave_PolyPolyOneShell36 xwave_Poly PolyOneShell = alog(log(qmin) + x*((log(qmax)-log(qmin))/num))37 Make/O/D coef_Poly PolyOneShell = {1.,60,0.1,6.4e-6,10,1e-6,6.4e-6,0.001}38 make/o/t parameters_Poly PolyOneShell = {"scale","core radius (A)","Core Polydispersity(0,1)","Core SLD (A-2)","Shell thickness (A)","Shell SLD (A-2)","Solvent SLD (A-2)","bkg (cm-1)"}39 Edit parameters_Poly PolyOneShell, coef_PolyPolyOneShell40 41 Variable/G root:g_Poly PolyOneShell35 Make/O/D/n=(num) xwave_PolyOneShell, ywave_PolyOneShell 36 xwave_PolyOneShell = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) 37 Make/O/D coef_PolyOneShell = {1.,60,0.1,6.4e-6,10,1e-6,6.4e-6,0.001} 38 make/o/t parameters_PolyOneShell = {"scale","core radius (A)","Core Polydispersity(0,1)","Core SLD (A-2)","Shell thickness (A)","Shell SLD (A-2)","Solvent SLD (A-2)","bkg (cm-1)"} 39 Edit parameters_PolyOneShell, coef_PolyOneShell 40 41 Variable/G root:g_PolyOneShell 42 42 g_PolyOneShell := PolyOneShell(coef_PolyOneShell, ywave_PolyOneShell, xwave_PolyOneShell) 43 43 Display ywave_PolyOneShell vs xwave_PolyOneShell … … 52 52 End 53 53 54 Macro PlotPolyPolyTwoShell(num,qmin,qmax)54 Proc PlotPolyTwoShell(num,qmin,qmax) 55 55 Variable num=200, qmin=0.001, qmax=0.7 56 56 Prompt num "Enter number of data points for model: " … … 77 77 End 78 78 79 MacroPlotPolyThreeShell(num,qmin,qmax)79 Proc PlotPolyThreeShell(num,qmin,qmax) 80 80 Variable num=200, qmin=0.001, qmax=0.7 81 81 Prompt num "Enter number of data points for model: " … … 102 102 End 103 103 104 MacroPlotPolyFourShell(num,qmin,qmax)104 Proc PlotPolyFourShell(num,qmin,qmax) 105 105 Variable num=200, qmin=0.001, qmax=0.7 106 106 Prompt num "Enter number of data points for model: " … … 138 138 //////////////////////////////////////////////////// 139 139 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 140 MacroPlotSmearedPolyOneShell(str)140 Proc PlotSmearedPolyOneShell(str) 141 141 String str 142 142 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 172 172 End 173 173 174 MacroPlotSmearedPolyTwoShell(str)174 Proc PlotSmearedPolyTwoShell(str) 175 175 String str 176 176 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 207 207 208 208 209 MacroPlotSmearedPolyThreeShell(str)209 Proc PlotSmearedPolyThreeShell(str) 210 210 String str 211 211 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) … … 241 241 End 242 242 243 MacroPlotSmearedPolyFourShell(str)243 Proc PlotSmearedPolyFourShell(str) 244 244 String str 245 245 Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/ModelPicker/SANSModelPicker_v40.ipf
r406 r444 127 127 ////paste here... after deleting the old make statement and list 128 128 129 Make/O/T/N= 69SANS_Model_List129 Make/O/T/N=80 SANS_Model_List 130 130 131 131 SANS_Model_List[0] = "BE_Polyelectrolyte.ipf" … … 195 195 SANS_Model_List[64] = "Vesicle_UL_and_Struct.ipf" 196 196 SANS_Model_List[65] = "Vesicle_UL.ipf" 197 // BetaModels197 //2008 Models 198 198 SANS_Model_List[66] = "Core_and_NShells.ipf" 199 199 SANS_Model_List[67] = "PolyCore_and_NShells.ipf" 200 200 SANS_Model_List[68] = "Fractal_Polysphere.ipf" 201 SANS_Model_List[69] = "GaussLorentzGel.ipf" 202 SANS_Model_List[70] = "PolyGaussCoil.ipf" 203 SANS_Model_List[71] = "Two_Power_Law.ipf" 204 SANS_Model_List[72] = "BroadPeak.ipf" 205 SANS_Model_List[73] = "CorrelationLengthModel.ipf" 206 SANS_Model_List[74] = "TwoLorentzian.ipf" 207 SANS_Model_List[75] = "PolyGaussShell.ipf" 208 SANS_Model_List[76] = "LamellarParacrystal.ipf" 209 SANS_Model_List[77] = "SC_ParaCrystal.ipf" 210 SANS_Model_List[78] = "BCC_ParaCrystal.ipf" 211 SANS_Model_List[79] = "FCC_ParaCrystal.ipf" 201 212 202 213 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf
r434 r444 807 807 Variable/G V_FitError=0 //0=no err, 1=error,(2^1+2^0)=3=singular matrix 808 808 Variable/G V_FitQuitReason=0 //0=ok,1=maxiter,2=user stop,3=no chisq decrease 809 809 810 810 811 // don't use the auto-destination with no flag, it doesn't appear to work correctly 811 812 // dispatch the fit 813 814 // currently, none of the fit functions are defined as threadsafe, so I don't think that the /NTHR flag really 815 // does anything. The functions themselves can be threaded since they are AAO, and that is probably enough, 816 // since it doesn't make much sense to thread threads. In addition, there is a little-publicized warning 817 // in the WM help file that /C=texWave cannot be used to specify constraints for threadsafe functions! 818 // The textwave would have to be parsed into a constraint matrix first, then passed as /C={cMat,cVec}. 819 // -- just something to watch out for. 820 812 821 do 813 822 // Variable t0 = stopMStimer(-2) // corresponding print is at the end of the do-while loop (outside) -
sans/Dev/trunk/NCNR_User_Procedures/Common/GaussUtils_v40.ipf
r426 r444 323 323 End //Make76GaussPoints() 324 324 325 // !!!!! reduces the length of qt and zi by one !!!!! 326 // 327 Function Make_N_GaussPoints(wt,zi) 328 Wave wt,zi 329 330 Variable num 331 num = numpnts(wt) - 1 332 333 gauleg(-1,1,zi,wt,num) 334 335 DeletePoints 0,1,wt,zi 336 337 return(0) 338 End 339 340 /// gauleg subroutine from NR to calculate weights and abscissae for 341 // Gauss-Legendre quadrature 342 // 343 // 344 // arrays are indexed from 1 345 // 346 Function gauleg( x1, x2, x, w, n) 347 Variable x1, x2 348 Wave x, w 349 Variable n 350 351 variable m,j,i 352 variable z1,z,xm,xl,pp,p3,p2,p1 353 Variable eps = 3e-11 354 355 m=(n+1)/2 356 xm=0.5*(x2+x1) 357 xl=0.5*(x2-x1) 358 for (i=1;i<=m;i+=1) 359 z=cos(pi*(i-0.25)/(n+0.5)) 360 do 361 p1=1.0 362 p2=0.0 363 for (j=1;j<=n;j+=1) 364 p3=p2 365 p2=p1 366 p1=((2.0*j-1.0)*z*p2-(j-1.0)*p3)/j 367 endfor 368 pp=n*(z*p1-p2)/(z*z-1.0) 369 z1=z 370 z=z1-p1/pp 371 while (abs(z-z1) > EPS) 372 x[i]=xm-xl*z 373 x[n+1-i]=xm+xl*z 374 w[i]=2.0*xl/((1.0-z*z)*pp*pp) 375 w[n+1-i]=w[i] 376 Endfor 377 End 378 379 380 /// uses a user-supplied number of Gauss points, and generates them on-the-fly as needed 381 // using a Numerical Recipes routine 382 // 383 // - note that this has an extra input parameter, nord 384 // 385 //////////// 386 Function IntegrateFn_N(fcn,loLim,upLim,w,x,nord) 387 FUNCREF GenericQuadrature_proto fcn 388 Variable loLim,upLim //limits of integration 389 Wave w //coefficients of function fcn(w,x) 390 Variable x //x-value (q) for the calculation 391 Variable nord //number of quadrature points to used 392 393 // local variables 394 Variable ii,va,vb,summ,yyy,zi 395 Variable answer,dum 396 String weightStr,zStr 397 398 weightStr = "gauss"+num2iStr(nord)+"wt" 399 zStr = "gauss"+num2istr(nord)+"z" 400 401 if (WaveExists($weightStr) == 0) // wave reference is not valid, 402 Make/D/N=(nord+1) $weightStr,$zStr 403 Wave wt = $weightStr 404 Wave xx = $zStr // wave references to pass 405 Make_N_GaussPoints(wt,xx) //generates the gauss points and removes the extra point 406 else 407 if(exists(weightStr) > 1) 408 Abort "wave name is already in use" //executed only if name is in use elsewhere 409 endif 410 Wave wt = $weightStr 411 Wave xx = $zStr // create the wave references 412 endif 413 414 //limits of integration are input to function 415 va = loLim 416 vb = upLim 417 // Using 5 Gauss points 418 // remember to index from 0,size-1 419 420 summ = 0.0 // initialize integral 421 ii=0 // loop counter 422 do 423 // calculate Gauss points on integration interval (q-value for evaluation) 424 zi = ( xx[ii]*(vb-va) + vb + va )/2.0 425 //calculate partial sum for the passed-in model function 426 yyy = wt[ii] * fcn(w,x,zi) 427 summ += yyy //add to the running total of the quadrature 428 ii+=1 429 while (ii<nord) // end of loop over quadrature points 430 431 // calculate value of integral to return 432 answer = (vb-va)/2.0*summ 433 434 Return (answer) 435 End 436 437 438 325 439 //////////// 326 440 Function IntegrateFn5(fcn,loLim,upLim,w,x) … … 1201 1315 return(0) 1202 1316 end 1317 -
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf
r432 r444 106 106 // print "filename :"+filename 107 107 Variable numCols = V_flag 108 109 //changes JIL to allow 2-column data to be read in, "faking" a 3rd column of errors 110 if(numCols==2) //no errors 111 n1 = StringFromList(1, S_waveNames ,";" ) 112 Duplicate/O $("root:"+n1), errorTmp 113 errorTmp = 0.01*(errorTmp)+ 0.03*sqrt(errorTmp) 114 S_waveNames+="errorTmp;" 115 numCols=3 116 endif 108 117 109 118 if(numCols==3) //simple 3-column data with no resolution information
Note: See TracChangeset
for help on using the changeset viewer.