Changeset 128 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Parallelepiped.ipf
- Timestamp:
- Jul 25, 2007 3:07:20 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/NewModels_2006/Parallelepiped.ipf
r127 r128 38 38 make/o/t parameters_Parallelepiped = {"Scale Factor","Shortest Edge A ()","B ()","Longest Edge C ()","Contrast (^-2)","Incoherent Bgd (cm-1)"} //CH#3 39 39 Edit parameters_Parallelepiped, coef_Parallelepiped 40 ywave_Parallelepiped := Parallelepiped(coef_Parallelepiped, xwave_Parallelepiped) 40 41 Variable/G root:g_Parallelepiped 42 g_Parallelepiped := Parallelepiped(coef_Parallelepiped,ywave_Parallelepiped, xwave_Parallelepiped) 41 43 Display ywave_Parallelepiped vs xwave_Parallelepiped 42 44 ModifyGraph marker=29, msize=2, mode=4 … … 48 50 End 49 51 50 // 51 //this macro sets up all the necessary parameters and waves that are 52 //needed to calculate the smeared model function. 53 // 54 //no input parameters are necessary, it MUST use the experimental q-values 55 // from the experimental data read in from an AVE/QSIG data file 56 //////////////////////////////////////////////////// 57 Proc PlotSmeared_Parallelepiped() //Parallelepiped 58 // if no gQvals wave, data must not have been loaded => abort 59 if(ResolutionWavesMissing()) 52 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 53 Proc PlotSmeared_Parallelepiped(str) 54 String str 55 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 56 57 // if any of the resolution waves are missing => abort 58 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 60 59 Abort 61 60 endif 62 61 62 SetDataFolder $("root:"+str) 63 63 64 64 // Setup parameter table for model function … … 69 69 // output smeared intensity wave, dimensions are identical to experimental QSIG values 70 70 // make extra copy of experimental q-values for easy plotting 71 Duplicate/O $ gQvalssmeared_Parallelepiped,smeared_qvals //71 Duplicate/O $(str+"_q") smeared_Parallelepiped,smeared_qvals // 72 72 SetScale d,0,0,"1/cm",smeared_Parallelepiped // 73 74 smeared_Parallelepiped := Parallelepiped_Smeared(smear_coef_Parallelepiped,$gQvals) // SMEARED function name 73 74 Variable/G gs_Parallelepiped=0 75 gs_Parallelepiped := fParallelepiped_Smeared(smear_coef_Parallelepiped,smeared_Parallelepiped,smeared_qvals) //this wrapper fills the STRUCT 76 75 77 Display smeared_Parallelepiped vs smeared_qvals // 76 78 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 78 80 Label left "I(q) (cm\\S-1\\M)" 79 81 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 80 End // end macro 82 83 SetDataFolder root: 84 End 85 86 87 88 //AAO version, uses XOP if available 89 // simply calls the original single point calculation with 90 // a wave assignment (this will behave nicely if given point ranges) 91 Function Parallelepiped(cw,yw,xw) : FitFunc 92 Wave cw,yw,xw 93 94 #if exists("ParallelepipedX") 95 yw = ParallelepipedX(cw,xw) 96 #else 97 yw = fParallelepiped(cw,xw) 98 #endif 99 return(0) 100 End 81 101 82 102 // calculates the form factor of a rectangular solid 83 103 // - a double integral - choose points wisely 84 104 // 85 Function Parallelepiped(w,x) : FitFunc105 Function fParallelepiped(w,x) : FitFunc 86 106 Wave w 87 107 Variable x … … 178 198 End 179 199 200 //wrapper to calculate the smeared model as an AAO-Struct 201 // fills the struct and calls the ususal function with the STRUCT parameter 202 // 203 // used only for the dependency, not for fitting 204 // 205 Function fParallelepiped_Smeared(coefW,yW,xW) 206 Wave coefW,yW,xW 207 208 String str = getWavesDataFolder(yW,0) 209 String DF="root:"+str+":" 210 211 WAVE resW = $(DF+str+"_res") 212 213 STRUCT ResSmearAAOStruct fs 214 WAVE fs.coefW = coefW 215 WAVE fs.yW = yW 216 WAVE fs.xW = xW 217 WAVE fs.resW = resW 218 219 Variable err 220 err = Parallelepiped_Smeared(fs) 221 222 return (0) 223 End 180 224 181 225 // this is all there is to the smeared calculation! 182 Function Parallelepiped_Smeared(w,x) :FitFunc 183 Wave w 184 Variable x 185 186 Variable ans 187 SVAR sq = gSig_Q 188 SVAR qb = gQ_bar 189 SVAR sh = gShadow 190 SVAR gQ = gQVals 191 192 //the name of your unsmeared model is the first argument 193 ans = Smear_Model_20(Parallelepiped,$sq,$qb,$sh,$gQ,w,x) 194 195 return(ans) 196 End 226 Function Parallelepiped_Smeared(s) :FitFunc 227 Struct ResSmearAAOStruct &s 228 229 // the name of your unsmeared model (AAO) is the first argument 230 s.yW = Smear_Model_20(Parallelepiped,s.coefW,s.xW,s.resW) 231 232 return(0) 233 End
Note: See TracChangeset
for help on using the changeset viewer.