# source:sans/Dev/trunk/NCNR_User_Procedures/Analysis/VSANS/V_WB_Beaucage.ipf@1099

Last change on this file since 1099 was 1099, checked in by srkline, 5 years ago

added Beaucage model to White Beam so that I could model the CFG sample.

cleaned up a few routines to get rid of NaN values in the output I(q) data sets if they were not masked out completely

File size: 20.4 KB
Line
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5/////////////////////////////////////////////////////
6//
7// Plot's Greg Beaucage's Rg-power Law "model" of scattering
8// somewhat useful for identifying length scales, but short on
9// physical inerpretation of the real structure of the sample.
10//
11// up to 4 "levels" can be calculated
12// best to start with single level, and fit a small range of
13// the data, and add more levels as needed
14//
15// see the help file for the original references
16//
17Proc PlotOnelevelWB(num,qmin,qmax)
18        Variable num=256,qmin=0.001,qmax=0.7
19        Prompt num "Enter number of data points for model: "
20        Prompt qmin "Enter minimum q-value (A^-1) for model: "
21        Prompt qmax "Enter maximum q-value (A^-1) for model: "
22
23        make/o/d/n=(num) xwave_b1WB,ywave_b1WB
24        xwave_b1WB = alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
25        make/o/d coef_b1WB = {1,3,21,6e-4,2,0}
26        make/o/t parameters_b1WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","bkg (cm-1 sr-1)"}
27        Edit parameters_b1WB,coef_b1WB
28
29        Variable/G root:g_b1WB
30        g_b1WB := OneLevelWB(coef_b1WB,ywave_b1WB,xwave_b1WB)
31        Display ywave_b1WB vs xwave_b1WB
32        ModifyGraph log=1,marker=29,msize=2,mode=4
33        Label bottom "q (A\\S-1\\M)"
34        Label left "Intensity (cm\\S-1\\M)"
35        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
36
38End
39
40Proc PlotTwoLevelWB(num,qmin,qmax)
41        Variable num=256,qmin=0.001,qmax=0.7
42        Prompt num "Enter number of data points for model: "
43        Prompt qmin "Enter minimum q-value (A^-1) for model: "
44        Prompt qmax "Enter maximum q-value (A^-1) for model: "
45
46        make/o/d/n=(num) xwave_b2WB,ywave_b2WB
47        xwave_b2WB = alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
48        make/o/d coef_b2WB = {1,400,200,5e-6,4,3,21,6e-4,2,0}
49        make/o/t parameters_b2WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","bkg (cm-1 sr-1)"}
50        Edit parameters_b2WB,coef_b2WB
51
52        Variable/G root:g_b2WB
53        g_b2WB := TwoLevelWB(coef_b2WB,ywave_b2WB,xwave_b2WB)
54        Display ywave_b2WB vs xwave_b2WB
55        ModifyGraph log=1,marker=29,msize=2,mode=4
56        Label bottom "q (A\\S-1\\M)"
57        Label left "Intensity (cm\\S-1\\M)"
58        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
59
61End
62
63Proc PlotThreeLevelWB(num,qmin,qmax)
64        Variable num=256,qmin=0.001,qmax=0.7
65        Prompt num "Enter number of data points for model: "
66        Prompt qmin "Enter minimum q-value (A^-1) for model: "
67        Prompt qmax "Enter maximum q-value (A^-1) for model: "
68
69        make/o/d/n=(num) xwave_b3WB,ywave_b3WB
70        xwave_b3WB = alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
71        make/o/d coef_b3WB = {1,4000,600,2e-7,4,400,200,5e-6,4,3,21,6e-4,2,0}
72        make/o/t parameters_b3WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","G3 (cm-1 sr-1)","Rg3  (A)","B3 (cm-1 sr-1 A^-Pow)","Pow3","bkg (cm-1)"}
73        Edit parameters_b3WB,coef_b3WB
74
75        Variable/G root:g_b3WB
76        g_b3WB := ThreeLevelWB(coef_b3WB,ywave_b3WB,xwave_b3WB)
77        Display ywave_b3WB vs xwave_b3WB
78        ModifyGraph log=1,marker=29,msize=2,mode=4
79        Label bottom "q (A\\S-1\\M)"
80        Label left "Intensity (cm\\S-1\\M)"
81        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
82
84End
85
86Proc PlotFourLevelWB(num,qmin,qmax)
87        Variable num=256,qmin=0.001,qmax=0.7
88        Prompt num "Enter number of data points for model: "
89        Prompt qmin "Enter minimum q-value (A^-1) for model: "
90        Prompt qmax "Enter maximum q-value (A^-1) for model: "
91
92        make/o/d/n=(num) xwave_b4WB,ywave_b4WB
93        xwave_b4WB = alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
94        make/o/d coef_b4WB = {1,40000,2000,1e-8,4,4000,600,2e-7,4,400,200,5e-6,4,3,21,6e-4,2,0}
95        make/o/t parameters_b4WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","G3 (cm-1 sr-1)","Rg3  (A)","B3 (cm-1 sr-1 A^-Pow)","Pow3","G4 (cm-1 sr-1)","Rg4  (A)","B4 (cm-1 sr-1 A^-Pow)","Pow4","bkg (cm-1)"}
96        Edit parameters_b4WB,coef_b4WB
97
98        Variable/G root:g_b4WB
99        g_b4WB := FourLevelWB(coef_b4WB,ywave_b4WB,xwave_b4WB)
100        Display ywave_b4WB vs xwave_b4WB
101        ModifyGraph log=1,marker=29,msize=2,mode=4
102        Label bottom "q (A\\S-1\\M)"
103        Label left "Intensity (cm\\S-1\\M)"
104        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
105
107End
108
109/////////// macros for smeared model calculations
110
111// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
112Proc PlotSmearedOneLevelWB(str)
113        String str
114        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
115
116        // if any of the resolution waves are missing => abort
117        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
118                Abort
119        endif
120
121        SetDataFolder \$("root:"+str)
122
123        // Setup parameter table for model function
124        Make/O/D smear_coef_b1WB ={1,3,21,6e-4,2,0}
125        make/o/t smear_parameters_b1WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","bkg (cm-1 sr-1)"}
126        Edit smear_parameters_b1WB,smear_coef_b1WB
127
128        // output smeared intensity wave, dimensions are identical to experimental QSIG values
129        // make extra copy of experimental q-values for easy plotting
130        Duplicate/O \$(str+"_q") smeared_b1WB,smeared_qvals
131        SetScale d,0,0,"1/cm",smeared_b1WB
132
133        Variable/G gs_b1WB=0
134        gs_b1WB := fSmearedOneLevelWB(smear_coef_b1WB,smeared_b1WB,smeared_qvals)       //this wrapper fills the STRUCT
135
136        Display smeared_b1WB vs smeared_qvals
137        ModifyGraph log=1,marker=29,msize=2,mode=4
138        Label bottom "q (A\\S-1\\M)"
139        Label left "Intensity (cm\\S-1\\M)"
140        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
141
142        SetDataFolder root:
144End
145
146// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
147Proc PlotSmearedTwoLevelWB(str)
148        String str
149        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
150
151        // if any of the resolution waves are missing => abort
152        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
153                Abort
154        endif
155
156        SetDataFolder \$("root:"+str)
157
158        // Setup parameter table for model function
159        Make/O/D smear_coef_b2WB = {1,400,200,5e-6,4,3,21,6e-4,2,0}
160        make/o/t smear_parameters_b2WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","bkg (cm-1 sr-1)"}
161        Edit smear_parameters_b2WB,smear_coef_b2WB
162
163        // output smeared intensity wave, dimensions are identical to experimental QSIG values
164        // make extra copy of experimental q-values for easy plotting
165        Duplicate/O \$(str+"_q") smeared_b2WB,smeared_qvals
166        SetScale d,0,0,"1/cm",smeared_b2WB
167
168        Variable/G gs_b2WB=0
169        gs_b2WB := fSmearedTwoLevelWB(smear_coef_b2WB,smeared_b2WB,smeared_qvals)       //this wrapper fills the STRUCT
170
171        Display smeared_b2WB vs smeared_qvals
172        ModifyGraph log=1,marker=29,msize=2,mode=4
173        Label bottom "q (A\\S-1\\M)"
174        Label left "Intensity (cm\\S-1\\M)"
175        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
176
177        SetDataFolder root:
179End
180
181// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
182Proc PlotSmearedThreeLevelWB(str)
183        String str
184        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
185
186        // if any of the resolution waves are missing => abort
187        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
188                Abort
189        endif
190
191        SetDataFolder \$("root:"+str)
192
193        // Setup parameter table for model function
194        Make/O/D smear_coef_b3WB = {1,4000,600,2e-7,4,400,200,5e-6,4,3,21,6e-4,2,0}
195        make/o/t smear_parameters_b3WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","G3 (cm-1 sr-1)","Rg3  (A)","B3 (cm-1 sr-1 A^-Pow)","Pow3","bkg (cm-1)"}
196        Edit smear_parameters_b3WB,smear_coef_b3WB
197
198        // output smeared intensity wave, dimensions are identical to experimental QSIG values
199        // make extra copy of experimental q-values for easy plotting
200        Duplicate/O \$(str+"_q") smeared_b3WB,smeared_qvals
201        SetScale d,0,0,"1/cm",smeared_b3WB
202
203        Variable/G gs_b3WB=0
204        gs_b3WB := fSmearedThreeLevelWB(smear_coef_b3WB,smeared_b3WB,smeared_qvals)     //this wrapper fills the STRUCT
205
206        Display smeared_b3WB vs smeared_qvals
207        ModifyGraph log=1,marker=29,msize=2,mode=4
208        Label bottom "q (A\\S-1\\M)"
209        Label left "Intensity (cm\\S-1\\M)"
210        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
211
212        SetDataFolder root:
214End
215
216// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
217Proc PlotSmearedFourLevelWB(str)
218        String str
219        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
220
221        // if any of the resolution waves are missing => abort
222        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
223                Abort
224        endif
225
226        SetDataFolder \$("root:"+str)
227
228        // Setup parameter table for model function
229        Make/O/D smear_coef_b4WB = {1,40000,2000,1e-8,4,4000,600,2e-7,4,400,200,5e-6,4,3,21,6e-4,2,0}
230        Make/o/t smear_parameters_b4WB = {"scale","G1 (cm-1 sr-1)","Rg1  (A)","B1 (cm-1 sr-1 A^-Pow)","Pow1","G2 (cm-1 sr-1)","Rg2  (A)","B2 (cm-1 sr-1 A^-Pow)","Pow2","G3 (cm-1 sr-1)","Rg3  (A)","B3 (cm-1 sr-1 A^-Pow)","Pow3","G4 (cm-1 sr-1)","Rg4  (A)","B4 (cm-1 sr-1 A^-Pow)","Pow4","bkg (cm-1)"}
231        Edit smear_parameters_b4WB,smear_coef_b4WB
232
233        // output smeared intensity wave, dimensions are identical to experimental QSIG values
234        // make extra copy of experimental q-values for easy plotting
235        Duplicate/O \$(str+"_q") smeared_b4WB,smeared_qvals
236        SetScale d,0,0,"1/cm",smeared_b4WB
237
238        Variable/G gs_b4WB=0
239        gs_b4WB := fSmearedFourLevelWB(smear_coef_b4WB,smeared_b4WB,smeared_qvals)      //this wrapper fills the STRUCT
240
241        Display smeared_b4WB vs smeared_qvals
242        ModifyGraph log=1,marker=29,msize=2,mode=4
243        Label bottom "q (A\\S-1\\M)"
244        Label left "Intensity (cm\\S-1\\M)"
245        AutoPositionWindow/M=1/R=\$(WinName(0,1)) \$WinName(0,2)
246
247        SetDataFolder root:
249End
250
251
252
253
254//AAO version, uses XOP if available
255// simply calls the original single point calculation with
256// a wave assignment (this will behave nicely if given point ranges)
257Function OneLevelWB(cw,yw,xw) : FitFunc
258        Wave cw,yw,xw
259
260#if exists("OneLevelX")
261//      yw = OneLevelX(cw,xw)
262        yw = V_fOneLevelWB(cw,xw)
263#else
264//      yw = fOneLevel(cw,xw)
265        yw = 1
266#endif
267        return(0)
268End
269
270//////////Function definitions
271
272Function V_fOneLevelWB(w,x) :FitFunc
273        Wave w
274        Variable x
275
276        Variable inten,lolim,uplim
277
278        // define limits based on lo/mean, hi/mean of the wavelength distribution
279        // using the empirical definition, "middle" of the peaks
280        loLim = 3.37/5.3
281        upLim = 8.37/5.3
282
283        inten = V_IntegrOneLevelWB_mid(w,loLim,upLim,x)
284
285// why do I need this? Is this because this is defined as the mean of the distribution
286//  and is needed to normalize the integral? verify this on paper.
287        inten *= 5.3
288
289// normalize the integral
290        inten /= 19933          // "middle"  of peaks
291
293        inten /= 1.05           //
294        Return (inten)
295
296End
297
298// the trick here is that declaring the last qVal wave as a variable
299// since this is implicitly called N times in the wave assignment of the answer wave
300Function V_IntegrOneLevelWB_mid(cw,loLim,upLim,qVal)
301        Wave cw
302        Variable loLim,upLim
303        Variable qVal
304
305        Variable/G root:qq = qval
306        Variable ans
307
309        ans = Integrate1D(V_integrand_OneLevelWB,lolim,uplim,1,0,cw)            // Romberg integration
310
311        return ans
312end
313
314Function V_integrand_OneLevelWB(cw,dum)
315        Wave cw
316        Variable dum            // the dummy of the integration
317
318        Variable val
319        NVAR qq = root:qq               //the q-value of the integration, not part of cw, so pass global
320//      SVAR funcStr = root:gFunctionString
321//      FUNCREF SANSModel_proto func = \$funcStr
322
323        val = V_WhiteBeamDist_mid(dum*5.3)*OneLevelX(cw,qq/dum)
324
325        return (val)
326End
327
328//AAO version, uses XOP if available
329// simply calls the original single point calculation with
330// a wave assignment (this will behave nicely if given point ranges)
331Function TwoLevelWB(cw,yw,xw) : FitFunc
332        Wave cw,yw,xw
333
334#if exists("TwoLevelX")
335//      yw = TwoLevelX(cw,xw)
336        yw = V_fTwoLevelWB(cw,xw)
337#else
338//      yw = fTwoLevel(cw,xw)
339        yw = 1
340#endif
341        return(0)
342End
343
344Function V_fTwoLevelWB(w,x) :FitFunc
345        Wave w
346        Variable x
347
348        Variable inten,lolim,uplim
349
350        // define limits based on lo/mean, hi/mean of the wavelength distribution
351        // using the empirical definition, "middle" of the peaks
352        loLim = 3.37/5.3
353        upLim = 8.37/5.3
354
355        inten = V_IntegrTwoLevelWB_mid(w,loLim,upLim,x)
356
357// why do I need this? Is this because this is defined as the mean of the distribution
358//  and is needed to normalize the integral? verify this on paper.
359        inten *= 5.3
360
361// normalize the integral
362        inten /= 19933          // "middle"  of peaks
363
365        inten /= 1.05           //
366        Return (inten)
367
368End
369
370// the trick here is that declaring the last qVal wave as a variable
371// since this is implicitly called N times in the wave assignment of the answer wave
372Function V_IntegrTwoLevelWB_mid(cw,loLim,upLim,qVal)
373        Wave cw
374        Variable loLim,upLim
375        Variable qVal
376
377        Variable/G root:qq = qval
378        Variable ans
379
381        ans = Integrate1D(V_integrand_TwoLevelWB,lolim,uplim,1,0,cw)            // Romberg integration
382
383        return ans
384end
385
386Function V_integrand_TwoLevelWB(cw,dum)
387        Wave cw
388        Variable dum            // the dummy of the integration
389
390        Variable val
391        NVAR qq = root:qq               //the q-value of the integration, not part of cw, so pass global
392//      SVAR funcStr = root:gFunctionString
393//      FUNCREF SANSModel_proto func = \$funcStr
394
395        val = V_WhiteBeamDist_mid(dum*5.3)*TwoLevelX(cw,qq/dum)
396
397        return (val)
398End
399
400//AAO version, uses XOP if available
401// simply calls the original single point calculation with
402// a wave assignment (this will behave nicely if given point ranges)
403Function ThreeLevelWB(cw,yw,xw) : FitFunc
404        Wave cw,yw,xw
405
406#if exists("ThreeLevelX")
407//      yw = ThreeLevelX(cw,xw)
408        yw = V_fThreeLevelWB(cw,xw)
409#else
410//      yw = fThreeLevel(cw,xw)
411        yw = 1
412#endif
413        return(0)
414End
415
416Function V_fThreeLevelWB(w,x) :FitFunc
417        Wave w
418        Variable x
419
420        Variable inten,lolim,uplim
421
422        // define limits based on lo/mean, hi/mean of the wavelength distribution
423        // using the empirical definition, "middle" of the peaks
424        loLim = 3.37/5.3
425        upLim = 8.37/5.3
426
427        inten = V_IntegrThreeLevelWB_mid(w,loLim,upLim,x)
428
429// why do I need this? Is this because this is defined as the mean of the distribution
430//  and is needed to normalize the integral? verify this on paper.
431        inten *= 5.3
432
433// normalize the integral
434        inten /= 19933          // "middle"  of peaks
435
437        inten /= 1.05           //
438        Return (inten)
439
440End
441
442// the trick here is that declaring the last qVal wave as a variable
443// since this is implicitly called N times in the wave assignment of the answer wave
444Function V_IntegrThreeLevelWB_mid(cw,loLim,upLim,qVal)
445        Wave cw
446        Variable loLim,upLim
447        Variable qVal
448
449        Variable/G root:qq = qval
450        Variable ans
451
453        ans = Integrate1D(V_integrand_ThreeLevelWB,lolim,uplim,1,0,cw)          // Romberg integration
454
455        return ans
456end
457
458Function V_integrand_ThreeLevelWB(cw,dum)
459        Wave cw
460        Variable dum            // the dummy of the integration
461
462        Variable val
463        NVAR qq = root:qq               //the q-value of the integration, not part of cw, so pass global
464//      SVAR funcStr = root:gFunctionString
465//      FUNCREF SANSModel_proto func = \$funcStr
466
467        val = V_WhiteBeamDist_mid(dum*5.3)*ThreeLevelX(cw,qq/dum)
468
469        return (val)
470End
471
472
473//AAO version, uses XOP if available
474// simply calls the original single point calculation with
475// a wave assignment (this will behave nicely if given point ranges)
476Function FourLevelWB(cw,yw,xw) : FitFunc
477        Wave cw,yw,xw
478
479#if exists("FourLevelX")
480//      yw = FourLevelX(cw,xw)
481        yw = V_fFourLevelWB(cw,xw)
482#else
483//      yw = fFourLevel(cw,xw)
484        yw = 1
485#endif
486        return(0)
487End
488
489
490Function V_fFourLevelWB(w,x) :FitFunc
491        Wave w
492        Variable x
493
494        Variable inten,lolim,uplim
495
496        // define limits based on lo/mean, hi/mean of the wavelength distribution
497        // using the empirical definition, "middle" of the peaks
498        loLim = 3.37/5.3
499        upLim = 8.37/5.3
500
501        inten = V_IntegrFourLevelWB_mid(w,loLim,upLim,x)
502
503// why do I need this? Is this because this is defined as the mean of the distribution
504//  and is needed to normalize the integral? verify this on paper.
505        inten *= 5.3
506
507// normalize the integral
508        inten /= 19933          // "middle"  of peaks
509
511        inten /= 1.05           //
512        Return (inten)
513
514End
515
516// the trick here is that declaring the last qVal wave as a variable
517// since this is implicitly called N times in the wave assignment of the answer wave
518Function V_IntegrFourLevelWB_mid(cw,loLim,upLim,qVal)
519        Wave cw
520        Variable loLim,upLim
521        Variable qVal
522
523        Variable/G root:qq = qval
524        Variable ans
525
527        ans = Integrate1D(V_integrand_FourLevelWB,lolim,uplim,1,0,cw)           // Romberg integration
528
529        return ans
530end
531
532Function V_integrand_FourLevelWB(cw,dum)
533        Wave cw
534        Variable dum            // the dummy of the integration
535
536        Variable val
537        NVAR qq = root:qq               //the q-value of the integration, not part of cw, so pass global
538//      SVAR funcStr = root:gFunctionString
539//      FUNCREF SANSModel_proto func = \$funcStr
540
541        val = V_WhiteBeamDist_mid(dum*5.3)*FourLevelX(cw,qq/dum)
542
543        return (val)
544End
545
546
547
548Function SmearedOneLevelWB(s) :FitFunc
549        Struct ResSmearAAOStruct &s
550
551//      the name of your unsmeared model (AAO) is the first argument
552        Smear_Model_20(OneLevelWB,s.coefW,s.xW,s.yW,s.resW)
553
554        return(0)
555End
556
557
558Function SmearedTwoLevelWB(s) :FitFunc
559        Struct ResSmearAAOStruct &s
560
561//      the name of your unsmeared model (AAO) is the first argument
562        Smear_Model_20(TwoLevelWB,s.coefW,s.xW,s.yW,s.resW)
563
564        return(0)
565End
566
567
568Function SmearedThreeLevelWB(s) :FitFunc
569        Struct ResSmearAAOStruct &s
570
571//      the name of your unsmeared model (AAO) is the first argument
572        Smear_Model_20(ThreeLevelWB,s.coefW,s.xW,s.yW,s.resW)
573
574        return(0)
575End
576
577Function SmearedFourLevelWB(s) :FitFunc
578        Struct ResSmearAAOStruct &s
579
580//      the name of your unsmeared model (AAO) is the first argument
581        Smear_Model_20(FourLevelWB,s.coefW,s.xW,s.yW,s.resW)
582
583        return(0)
584End
585
586//wrapper to calculate the smeared model as an AAO-Struct
587// fills the struct and calls the ususal function with the STRUCT parameter
588//
589// used only for the dependency, not for fitting
590//
591Function fSmearedOneLevelWB(coefW,yW,xW)
592        Wave coefW,yW,xW
593
594        String str = getWavesDataFolder(yW,0)
595        String DF="root:"+str+":"
596
597        WAVE resW = \$(DF+str+"_res")
598
599        STRUCT ResSmearAAOStruct fs
600        WAVE fs.coefW = coefW
601        WAVE fs.yW = yW
602        WAVE fs.xW = xW
603        WAVE fs.resW = resW
604
605        Variable err
606        err = SmearedOneLevelWB(fs)
607
608        return (0)
609End
610
611//wrapper to calculate the smeared model as an AAO-Struct
612// fills the struct and calls the ususal function with the STRUCT parameter
613//
614// used only for the dependency, not for fitting
615//
616Function fSmearedTwoLevelWB(coefW,yW,xW)
617        Wave coefW,yW,xW
618
619        String str = getWavesDataFolder(yW,0)
620        String DF="root:"+str+":"
621
622        WAVE resW = \$(DF+str+"_res")
623
624        STRUCT ResSmearAAOStruct fs
625        WAVE fs.coefW = coefW
626        WAVE fs.yW = yW
627        WAVE fs.xW = xW
628        WAVE fs.resW = resW
629
630        Variable err
631        err = SmearedTwoLevelWB(fs)
632
633        return (0)
634End
635
636//wrapper to calculate the smeared model as an AAO-Struct
637// fills the struct and calls the ususal function with the STRUCT parameter
638//
639// used only for the dependency, not for fitting
640//
641Function fSmearedThreeLevelWB(coefW,yW,xW)
642        Wave coefW,yW,xW
643
644        String str = getWavesDataFolder(yW,0)
645        String DF="root:"+str+":"
646
647        WAVE resW = \$(DF+str+"_res")
648
649        STRUCT ResSmearAAOStruct fs
650        WAVE fs.coefW = coefW
651        WAVE fs.yW = yW
652        WAVE fs.xW = xW
653        WAVE fs.resW = resW
654
655        Variable err
656        err = SmearedThreeLevelWB(fs)
657
658        return (0)
659End
660
661//wrapper to calculate the smeared model as an AAO-Struct
662// fills the struct and calls the ususal function with the STRUCT parameter
663//
664// used only for the dependency, not for fitting
665//
666Function fSmearedFourLevelWB(coefW,yW,xW)
667        Wave coefW,yW,xW
668
669        String str = getWavesDataFolder(yW,0)
670        String DF="root:"+str+":"
671
672        WAVE resW = \$(DF+str+"_res")
673
674        STRUCT ResSmearAAOStruct fs
675        WAVE fs.coefW = coefW
676        WAVE fs.yW = yW
677        WAVE fs.xW = xW
678        WAVE fs.resW = resW
679
680        Variable err
681        err = SmearedFourLevelWB(fs)
682
683        return (0)
684End
685
Note: See TracBrowser for help on using the repository browser.