Changeset 127 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/PolyHardSphereInten.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/PolyHardSphereInten.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_phs = {"Radius (A)","polydispersity","volume fraction","contrast (A^-2)","background (cm^-1)"} 24 25 Edit parameters_phs,coef_phs 25 ywave_phs := PolyHSIntensity(coef_phs,xwave_phs) 26 Variable/G root:g_phs 27 g_phs := PolyHardSphereIntensity(coef_phs,ywave_phs,xwave_phs) 28 // ywave_phs := PolyHardSphereIntensity(coef_phs,xwave_phs) 26 29 Display ywave_phs vs xwave_phs 27 30 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 32 35 33 36 /////////////////////////////////////////////////////////// 34 35 Proc PlotSmearedPolyHardSpheres( )36 //no input parameters necessary, it MUST use the experimental q-values37 // from the experimental data read in from an AVE/QSIG data file38 39 // if no gQvals wave, data must not have been loaded=> abort40 if(ResolutionWavesMissing ())37 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 38 Proc PlotSmearedPolyHardSpheres(str) 39 String str 40 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 41 42 // if any of the resolution waves are missing => abort 43 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 41 44 Abort 42 45 endif 46 47 SetDataFolder $("root:"+str) 43 48 44 49 // Setup parameter table for model function … … 49 54 // output smeared intensity wave, dimensions are identical to experimental QSIG values 50 55 // make extra copy of experimental q-values for easy plotting 51 Duplicate/O $gQvals smeared_phs,smeared_qvals 52 SetScale d,0,0,"1/cm",smeared_phs 53 54 smeared_phs := SmearedPolyHardSpheres(smear_coef_phs,$gQvals) 56 Duplicate/O $(str+"_q") smeared_phs,smeared_qvals 57 SetScale d,0,0,"1/cm",smeared_phs 58 59 Variable/G gs_phs=0 60 gs_phs := fSmearedPolyHardSpheres(smear_coef_phs,smeared_phs,smeared_qvals) //this wrapper fills the STRUCT 61 55 62 Display smeared_phs vs smeared_qvals 56 63 ModifyGraph log=1,marker=29,msize=2,mode=4 57 64 Label bottom "q (\\S-1\\M)" 58 65 Label left "Intensity (cm\\S-1\\M)" 59 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 60 End 61 66 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 67 68 SetDataFolder root: 69 End 70 71 //AAO version 72 Function PolyHardSphereIntensity(cw,yw,xw) : FitFunc 73 Wave cw,yw,xw 74 75 #if exists("PolyHardSphereIntensityX") 76 yw = PolyHardSphereIntensityX(cw,xw) 77 #else 78 yw = fPolyHardSphereIntensity(cw,xw) 79 #endif 80 return(0) 81 End 62 82 63 83 /////////////////////////////////////////////////////////////// … … 74 94 // 75 95 /////////////////////////// 76 Function PolyHSIntensity(w,k) : FitFunc96 Function fPolyHardSphereIntensity(w,k) : FitFunc 77 97 Wave w // the coefficient wave 78 98 Variable k // the x values, as a variable (single k is OK) … … 186 206 187 207 // this is all there is to the smeared calculation! 188 Function SmearedPolyHardSpheres(w,x) :FitFunc 189 Wave w 190 Variable x 191 192 Variable ans 193 SVAR sq = gSig_Q 194 SVAR qb = gQ_bar 195 SVAR sh = gShadow 196 SVAR gQ = gQVals 197 198 //the name of your unsmeared model is the first argument 199 ans = Smear_Model_20(PolyHSIntensity,$sq,$qb,$sh,$gQ,w,x) 200 201 return(ans) 202 End 208 Function SmearedPolyHardSpheres(s) :FitFunc 209 Struct ResSmearAAOStruct &s 210 211 ////the name of your unsmeared model is the first argument 212 s.yW = Smear_Model_20(PolyHardSphereIntensity,s.coefW,s.xW,s.resW) 213 214 return(0) 215 End 216 217 //wrapper to calculate the smeared model as an AAO-Struct 218 // fills the struct and calls the ususal function with the STRUCT parameter 219 // 220 // used only for the dependency, not for fitting 221 // 222 Function fSmearedPolyHardSpheres(coefW,yW,xW) 223 Wave coefW,yW,xW 224 225 String str = getWavesDataFolder(yW,0) 226 String DF="root:"+str+":" 227 228 WAVE resW = $(DF+str+"_res") 229 230 STRUCT ResSmearAAOStruct fs 231 WAVE fs.coefW = coefW 232 WAVE fs.yW = yW 233 WAVE fs.xW = xW 234 WAVE fs.resW = resW 235 236 Variable err 237 err = SmearedPolyHardSpheres(fs) 238 239 return (0) 240 End
Note: See TracChangeset
for help on using the changeset viewer.