Changeset 127 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/StackedDiscs.ipf
- Timestamp:
- Jul 24, 2007 3:23:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/StackedDiscs.ipf
r56 r127 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma IgorVersion = 6.0 2 3 3 4 //////////////////////////////////////////////// … … 11 12 // 12 13 // 04 JUL 01 DLH 14 // 15 // SRK - 2007 16 // this model needs 76 Gauss points for a proper smearing calculation 17 // since there can be sharp interference fringes that develop from the stacking 13 18 //////////////////////////////////////////////// 14 19 … … 24 29 make/o/t parameters_scyl = {"scale","Disc Radius (A)","Core Thickness (A)","Layer Thickness (A)","Core SLD (A^-2)","Layer SLD (A^-2)","Solvent SLD(A^-2)","# of Stacking","GSD of d-Spacing","incoh. bkg (cm^-1)"} 25 30 Edit parameters_scyl,coef_scyl 26 ywave_scyl := StackedDiscs(coef_scyl,xwave_scyl) 31 Variable/G root:g_scyl 32 g_scyl := StackedDiscs(coef_scyl,ywave_scyl,xwave_scyl) 33 // ywave_scyl := StackedDiscs(coef_scyl,xwave_scyl) 27 34 Display ywave_scyl vs xwave_scyl 28 35 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 34 41 35 42 /////////////////////////////////////////////////////////// 36 Proc PlotSmearedStackedDiscs() 37 //no input parameters necessary, it MUST use the experimental q-values 38 // from the experimental data read in from an AVE/QSIG data file 39 40 // if no gQvals wave, data must not have been loaded => abort 41 if(ResolutionWavesMissing()) 43 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 44 Proc PlotSmearedStackedDiscs(str) 45 String str 46 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 47 48 // if any of the resolution waves are missing => abort 49 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 42 50 Abort 43 51 endif 52 53 SetDataFolder $("root:"+str) 44 54 45 55 // Setup parameter table for model function … … 50 60 // output smeared intensity wave, dimensions are identical to experimental QSIG values 51 61 // make extra copy of experimental q-values for easy plotting 52 Duplicate/O $gQvals smeared_scyl,smeared_qvals 53 SetScale d,0,0,"1/cm",smeared_scyl 54 55 smeared_scyl := SmearedStackedDiscs(smear_coef_scyl,$gQvals) 62 Duplicate/O $(str+"_q") smeared_scyl,smeared_qvals 63 SetScale d,0,0,"1/cm",smeared_scyl 64 65 Variable/G gs_scyl=0 66 gs_scyl := fSmearedStackedDiscs(smear_coef_scyl,smeared_scyl,smeared_qvals) //this wrapper fills the STRUCT 67 56 68 Display smeared_scyl vs smeared_qvals 57 69 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 59 71 Label left "Intensity (cm\\S-1\\M)" 60 72 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 61 End 62 /////////////////////////////////////////////////////////////// 63 73 74 SetDataFolder root: 75 End 76 77 /////////////////////////////////////////////////////////////// 78 79 //AAO version 80 Function StackedDiscs(cw,yw,xw) : FitFunc 81 Wave cw,yw,xw 82 83 #if exists("StackedDiscsX") 84 yw = StackedDiscsX(cw,xw) 85 #else 86 yw = fStackedDiscs(cw,yw) 87 #endif 88 return(0) 89 End 64 90 /////////////////////////////////////////////////////////////// 65 91 // unsmeared model calculation 66 92 /////////////////////////// 67 Function StackedDiscs(w,x) : FitFunc93 Function fStackedDiscs(w,x) : FitFunc 68 94 Wave w 69 95 Variable x … … 231 257 /////////////////////////////////////////////////////////////// 232 258 233 // this is all there is to the smeared calculation! 234 Function SmearedStackedDiscs(w,x) :FitFunc 235 Wave w 236 Variable x 237 238 Variable ans 239 SVAR sq = gSig_Q 240 SVAR qb = gQ_bar 241 SVAR sh = gShadow 242 SVAR gQ = gQVals 243 244 //the name of your unsmeared model is the first argument 245 ans = Smear_Model_76(StackedDiscs,$sq,$qb,$sh,$gQ,w,x) 246 247 return(ans) 248 End 249 259 // this model needs 76 Gauss points for a proper smearing calculation 260 // since there can be sharp interference fringes that develop from the stacking 261 Function SmearedStackedDiscs(s) :FitFunc 262 Struct ResSmearAAOStruct &s 263 264 ////the name of your unsmeared model is the first argument 265 s.yW = Smear_Model_76(StackedDiscs,s.coefW,s.xW,s.resW) 266 267 return(0) 268 End 269 270 271 //wrapper to calculate the smeared model as an AAO-Struct 272 // fills the struct and calls the ususal function with the STRUCT parameter 273 // 274 // used only for the dependency, not for fitting 275 // 276 Function fSmearedStackedDiscs(coefW,yW,xW) 277 Wave coefW,yW,xW 278 279 String str = getWavesDataFolder(yW,0) 280 String DF="root:"+str+":" 281 282 WAVE resW = $(DF+str+"_res") 283 284 STRUCT ResSmearAAOStruct fs 285 WAVE fs.coefW = coefW 286 WAVE fs.yW = yW 287 WAVE fs.xW = xW 288 WAVE fs.resW = resW 289 290 Variable err 291 err = SmearedStackedDiscs(fs) 292 293 return (0) 294 End
Note: See TracChangeset
for help on using the changeset viewer.