Changeset 128 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/MultiShell.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/MultiShell.ipf
r127 r128 22 22 make/O/T parameters_mss = {"scale","core radius (A)","shell thickness (A)","water thickness","core & solvent SLD (A-2)","Shell SLD (A-2)","number of water/shell pairs","bkg (cm-1)"} 23 23 Edit/K=1 parameters_mss,coef_mss 24 ywave_mss := MultiShellForm(coef_mss,xwave_mss) 24 25 Variable/G root:g_mss 26 g_mss := MultiShellForm(coef_mss,ywave_mss,xwave_mss) 25 27 Display/K=1 ywave_mss vs xwave_mss 26 28 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 30 32 End 31 33 32 Proc PlotSmearedMultiShell() 33 //no input parameters necessary, it MUST use the experimental q-values 34 // from the experimental data read in from an AVE/QSIG data file 34 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 35 Proc PlotSmearedMultiShell(str) 36 String str 37 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 35 38 36 // if no gQvals wave, data must not have been loaded => abort 37 if(Exists("gQvals") != 2) // 2 = string or numeric variable exists 38 Abort "6-column QSIG data not loaded. Use LoadQSIGData macro" 39 else 40 if(WaveExists($gQvals) ==0) //wave ref does not exist 41 Abort "6-column QSIG waves are missing. Re-load with LoadQSIGData macro" 42 endif 39 // if any of the resolution waves are missing => abort 40 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 41 Abort 43 42 endif 43 44 SetDataFolder $("root:"+str) 44 45 45 46 // Setup parameter table for model function … … 50 51 // output smeared intensity wave, dimensions are identical to experimental QSIG values 51 52 // make extra copy of experimental q-values for easy plotting 52 Duplicate/O $ gQvalssmeared_mss,smeared_qvals53 Duplicate/O $(str+"_q") smeared_mss,smeared_qvals 53 54 SetScale d,0,0,"1/cm",smeared_mss 54 55 smeared_mss := SmearedMultiShell(smear_coef_mss,$gQvals) 55 56 Variable/G gs_mss=0 57 gs_mss := fSmearedMultiShell(smear_coef_mss,smeared_mss,smeared_qvals) //this wrapper fills the STRUCT 58 56 59 Display/K=1 smeared_mss vs smeared_qvals 57 60 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 59 62 Label left "Intensity (cm\\S-1\\M)" 60 63 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 64 65 SetDataFolder root: 61 66 End 62 67 63 Function MultiShellForm(w,x) :FitFunc 68 69 70 71 //AAO version, uses XOP if available 72 // simply calls the original single point calculation with 73 // a wave assignment (this will behave nicely if given point ranges) 74 Function MultiShellForm(cw,yw,xw) : FitFunc 75 Wave cw,yw,xw 76 77 #if exists("MultiShellFormX") 78 yw = MultiShellFormX(cw,xw) 79 #else 80 yw = fMultiShellForm(cw,xw) 81 #endif 82 return(0) 83 End 84 85 Function fMultiShellForm(w,x) :FitFunc 64 86 Wave w 65 87 Variable x … … 136 158 //End 137 159 160 //wrapper to calculate the smeared model as an AAO-Struct 161 // fills the struct and calls the ususal function with the STRUCT parameter 162 // 163 // used only for the dependency, not for fitting 164 // 165 Function fSmearedMultiShell(coefW,yW,xW) 166 Wave coefW,yW,xW 167 168 String str = getWavesDataFolder(yW,0) 169 String DF="root:"+str+":" 170 171 WAVE resW = $(DF+str+"_res") 172 173 STRUCT ResSmearAAOStruct fs 174 WAVE fs.coefW = coefW 175 WAVE fs.yW = yW 176 WAVE fs.xW = xW 177 WAVE fs.resW = resW 178 179 Variable err 180 err = SmearedMultiShell(fs) 181 182 return (0) 183 End 184 138 185 // this is all there is to the smeared calculation! 139 Function SmearedMultiShell(w,x) :FitFunc 140 Wave w 141 Variable x 186 Function SmearedMultiShell(s) :FitFunc 187 Struct ResSmearAAOStruct &s 188 189 // the name of your unsmeared model (AAO) is the first argument 190 s.yW = Smear_Model_20(MultiShellForm,s.coefW,s.xW,s.resW) 191 192 return(0) 193 End 142 194 143 Variable ans144 SVAR sq = gSig_Q145 SVAR qb = gQ_bar146 SVAR sh = gShadow147 SVAR gQ = gQVals148 149 //the name of your unsmeared model is the first argument150 ans = Smear_Model_76(MultiShellForm,$sq,$qb,$sh,$gQ,w,x)151 152 return(ans)153 End
Note: See TracChangeset
for help on using the changeset viewer.