Changeset 127 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/RectPolySpheres.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/RectPolySpheres.ipf
r42 r127 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma IgorVersion = 6.0 2 3 3 4 //////////////////////////////////////////////// … … 23 24 make/o/t parameters_rect = {"scale","Radius (A)","polydispersity","contrast (A^-2)","background (cm^-1)"} 24 25 Edit parameters_rect,coef_rect 25 ywave_rect := PolyRectSpheres(coef_rect,xwave_rect) 26 Variable/G root:g_rect 27 g_rect := PolyRectSpheres(coef_rect,ywave_rect,xwave_rect) 28 // ywave_rect := PolyRectSpheres(coef_rect,xwave_rect) 26 29 Display ywave_rect vs xwave_rect 27 30 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 34 37 35 38 /////////////////////////////////////////////////////////// 36 37 Proc PlotSmearedPolyRectSpheres( )38 //no input parameters necessary, it MUST use the experimental q-values39 // from the experimental data read in from an AVE/QSIG data file40 41 // if no gQvals wave, data must not have been loaded=> abort42 if(ResolutionWavesMissing ())39 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 40 Proc PlotSmearedPolyRectSpheres(str) 41 String str 42 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 43 44 // if any of the resolution waves are missing => abort 45 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 43 46 Abort 44 47 endif 48 49 SetDataFolder $("root:"+str) 45 50 46 51 // Setup parameter table for model function … … 51 56 // output smeared intensity wave, dimensions are identical to experimental QSIG values 52 57 // make extra copy of experimental q-values for easy plotting 53 Duplicate/O $gQvals smeared_rect,smeared_qvals 54 SetScale d,0,0,"1/cm",smeared_rect 55 56 smeared_rect := SmearedPolyRectSpheres(smear_coef_rect,$gQvals) 58 Duplicate/O $(str+"_q") smeared_rect,smeared_qvals 59 SetScale d,0,0,"1/cm",smeared_rect 60 61 Variable/G gs_rect=0 62 gs_rect := fSmearedPolyRectSpheres(smear_coef_rect,smeared_rect,smeared_qvals) //this wrapper fills the STRUCT 63 57 64 Display smeared_rect vs smeared_qvals 58 65 ModifyGraph log=1,marker=29,msize=2,mode=4 59 66 Label bottom "q (\\S-1\\M)" 60 67 Label left "Intensity (cm\\S-1\\M)" 61 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 62 End 63 64 68 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 69 70 SetDataFolder root: 71 End 72 73 74 //AAO version 75 Function PolyRectSpheres(cw,yw,xw) : FitFunc 76 Wave cw,yw,xw 77 78 #if exists("PolyRectSpheresX") 79 yw = PolyRectSpheresX(cw,xw) 80 #else 81 yw = fPolyRectSpheres(cw,xw) 82 #endif 83 return(0) 84 End 65 85 /////////////////////////////////////////////////////////////// 66 86 // unsmeared model calculation 67 87 /////////////////////////// 68 Function PolyRectSpheres(w,x) : FitFunc88 Function fPolyRectSpheres(w,x) : FitFunc 69 89 Wave w // the coefficient wave 70 90 Variable x // the x values, as a variable … … 147 167 148 168 // this is all there is to the smeared calculation! 149 Function SmearedPolyRectSpheres(w,x) :FitFunc 150 Wave w 151 Variable x 152 153 Variable ans 154 SVAR sq = gSig_Q 155 SVAR qb = gQ_bar 156 SVAR sh = gShadow 157 SVAR gQ = gQVals 158 159 //the name of your unsmeared model is the first argument 160 ans = Smear_Model_20(PolyRectSpheres,$sq,$qb,$sh,$gQ,w,x) 161 162 return(ans) 163 End 169 Function SmearedPolyRectSpheres(s) :FitFunc 170 Struct ResSmearAAOStruct &s 171 172 ////the name of your unsmeared model is the first argument 173 s.yW = Smear_Model_20(PolyRectSpheres,s.coefW,s.xW,s.resW) 174 175 return(0) 176 End 177 178 //wrapper to calculate the smeared model as an AAO-Struct 179 // fills the struct and calls the ususal function with the STRUCT parameter 180 // 181 // used only for the dependency, not for fitting 182 // 183 Function fSmearedPolyRectSpheres(coefW,yW,xW) 184 Wave coefW,yW,xW 185 186 String str = getWavesDataFolder(yW,0) 187 String DF="root:"+str+":" 188 189 WAVE resW = $(DF+str+"_res") 190 191 STRUCT ResSmearAAOStruct fs 192 WAVE fs.coefW = coefW 193 WAVE fs.yW = yW 194 WAVE fs.xW = xW 195 WAVE fs.resW = resW 196 197 Variable err 198 err = SmearedPolyRectSpheres(fs) 199 200 return (0) 201 End
Note: See TracChangeset
for help on using the changeset viewer.