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