Changeset 127 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/DAB_model.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/DAB_model.ipf
r42 r127 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma IgorVersion = 6.0 3 2 4 //////////////////////////////////////////////////// 3 5 // C. Glinka, 11-22-98 4 6 //////////////// 7 8 9 //Debye-Anderson-Brumberger 10 5 11 6 12 Proc PlotDAB(num,qmin,qmax) … … 15 21 make/o/t parameters_DAB = {"Scale Factor, A ", "Correlation Length ()", "Incoherent Bgd (cm-1)"} 16 22 Edit parameters_DAB, coef_DAB 17 ywave_DAB := DAB_Model(coef_DAB, xwave_DAB) 23 Variable/G root:g_DAB 24 g_DAB := DAB_Model(coef_DAB, ywave_DAB, xwave_DAB) 25 // ywave_DAB := DAB_Model(coef_DAB, xwave_DAB) 18 26 Display ywave_DAB vs xwave_DAB 19 27 ModifyGraph marker=29, msize=2, mode=4 … … 23 31 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 24 32 End 33 25 34 //////////////////////////////////////////////////// 26 Proc PlotSmearedDAB() //Debye-Anderson-Brumberger 27 //no input parameters necessary, it MUST use the experimental q-values 28 // from the experimental data read in from an AVE/QSIG data file 35 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 36 Proc PlotSmearedDAB(str) 37 String str 38 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 29 39 30 // if no gQvals wave, data must not have been loaded=> abort31 if(ResolutionWavesMissing ())40 // if any of the resolution waves are missing => abort 41 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 32 42 Abort 33 43 endif 44 45 SetDataFolder $("root:"+str) 34 46 35 47 // Setup parameter table for model function … … 40 52 // output smeared intensity wave, dimensions are identical to experimental QSIG values 41 53 // make extra copy of experimental q-values for easy plotting 42 Duplicate/O $ gQvalssmeared_DAB,smeared_qvals //54 Duplicate/O $(str+"_q") smeared_DAB,smeared_qvals // 43 55 SetScale d,0,0,"1/cm",smeared_DAB // 44 45 smeared_DAB := SmearedDAB_Model(smear_coef_DAB,$gQvals) // SMEARED function name 56 57 Variable/G gs_DAB=0 58 gs_DAB := fSmearedDAB_Model(smear_coef_DAB,smeared_DAB,smeared_qvals) //this wrapper fills the STRUCT 59 46 60 Display smeared_DAB vs smeared_qvals // 47 61 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 49 63 Label left "Debye-Anderson-Brumberger Model (cm\\S-1\\M)" 50 64 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 51 End // end macro PlotSmearedDAB 65 66 SetDataFolder root: 67 End 52 68 53 Function DAB_model(w,x) : FitFunc 69 //AAO version 70 Function DAB_model(cw,yw,xw) : FitFunc 71 Wave cw,yw,xw 72 73 #if exists("DAB_modelX") 74 yw = DAB_modelX(cw,xw) 75 #else 76 yw = fDAB_model(cw,xw) 77 #endif 78 return(0) 79 End 80 81 Function fDAB_model(w,x) : FitFunc 54 82 Wave w 55 83 Variable x … … 75 103 76 104 // this is all there is to the smeared calculation! 77 Function SmearedDAB_Model(w,x) :FitFunc 78 Wave w 79 Variable x 105 Function SmearedDAB_Model(s) :FitFunc 106 Struct ResSmearAAOStruct &s 107 108 ////the name of your unsmeared model is the first argument 109 s.yW = Smear_Model_20(DAB_Model,s.coefW,s.xW,s.resW) 110 111 return(0) 112 End 113 114 //wrapper to calculate the smeared model as an AAO-Struct 115 // fills the struct and calls the ususal function with the STRUCT parameter 116 // 117 // used only for the dependency, not for fitting 118 // 119 Function fSmearedDAB_Model(coefW,yW,xW) 120 Wave coefW,yW,xW 80 121 81 Variable ans 82 SVAR sq = gSig_Q 83 SVAR qb = gQ_bar 84 SVAR sh = gShadow 85 SVAR gQ = gQVals 122 String str = getWavesDataFolder(yW,0) 123 String DF="root:"+str+":" 86 124 87 //the name of your unsmeared model is the first argument 88 ans = Smear_Model_20(DAB_Model,$sq,$qb,$sh,$gQ,w,x) 89 90 return(ans) 125 WAVE resW = $(DF+str+"_res") 126 127 STRUCT ResSmearAAOStruct fs 128 WAVE fs.coefW = coefW 129 WAVE fs.yW = yW 130 WAVE fs.xW = xW 131 WAVE fs.resW = resW 132 133 Variable err 134 err = SmearedDAB_Model(fs) 135 136 return (0) 91 137 End
Note: See TracChangeset
for help on using the changeset viewer.