Ignore:
Timestamp:
Jul 24, 2007 3:23:44 PM (16 years ago)
Author:
srkline
Message:

LOTS of changes to the analysis ipf files:

-- see sphere.ipf for the simplest example of the changes --

  • #pragma Igor 6
  • #if directive to look for XOP
  • AAO unsmeared functions
  • STRUCT functions for smearing (also AAO)
  • new wrappers for dependencies to struct functions

(2006 models have NOT been completed yet, only the old models)

  • loading data files into data folders (PlotUtils?) + some streamlining of the loaders
  • Smear_Model_N is now AAO + some streamlining of the quadrature code

-- SHS and SW structure factor XOPs are crashing (need DP wave, I may have old XOP)
-- this breaks fitting of the smeared models until wrappers can be devised
-- all packages will be broken due to the new data folder structure
-- multiple instances of functions will now cause problems (MSA)
-- RPA model is a problem with its odd functional form (extra wave)

-- lots of other carnage to follow as the bugs and typos are shaken out

24 JUL 2007 SRK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/CoreShell.ipf

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    2223        make/o/t parameters_css = {"scale","core radius (A)","shell thickness (A)","Core SLD (A-2)","Shell SLD (A-2)","Solvent SLD (A-2)","bkg (cm-1)"} 
    2324        Edit parameters_css,coef_css 
    24         ywave_css := CoreShellForm(coef_css,xwave_css) 
     25        Variable/G root:g_css 
     26        g_css := CoreShellForm(coef_css,ywave_css,xwave_css) 
     27//      ywave_css := CoreShellForm(coef_css,xwave_css) 
    2528        Display ywave_css vs xwave_css 
    2629        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    3134 
    3235/////////////////////////////////////////////////////////// 
    33  
    34 Proc PlotSmearedCoreShellSphere()                                                               //**** name of your function 
    35         //no input parameters necessary, it MUST use the experimental q-values 
    36         // from the experimental data read in from an AVE/QSIG data file 
     36// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     37Proc PlotSmearedCoreShellSphere(str)                                                             
     38        String str 
     39        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
    3740         
    38         // if no gQvals wave, data must not have been loaded => abort 
    39         if(ResolutionWavesMissing()) 
     41        // if any of the resolution waves are missing => abort 
     42        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    4043                Abort 
    4144        endif 
     45         
     46        SetDataFolder $("root:"+str) 
    4247         
    4348        // Setup parameter table for model function 
     
    4954        // make extra copy of experimental q-values for easy plotting 
    5055         
    51         Duplicate/O $gQvals smeared_css,smeared_qvals                            
     56        Duplicate/O $(str+"_q") smeared_css,smeared_qvals                                
    5257        SetScale d,0,0,"1/cm",smeared_css                                                        
    53  
    54         smeared_css := SmearedCoreShellForm(smear_coef_css,$gQvals)                                                                      
     58                                         
     59        Variable/G gs_css=0 
     60        gs_css := fSmearedCoreShellForm(smear_coef_css,smeared_css,smeared_qvals)       //this wrapper fills the STRUCT 
     61         
    5562        Display smeared_css vs smeared_qvals                                                                     
    5663        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    5865        Label left "Intensity (cm\\S-1\\M)" 
    5966        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
     67         
     68        SetDataFolder root: 
     69End 
     70 
     71 
     72//AAO version 
     73Function CoreShellForm(cw,yw,xw) : FitFunc 
     74        Wave cw,yw,xw 
     75 
     76#if exists("CoreShellFormX") 
     77        yw = CoreShellFormX(cw,xw) 
     78#else 
     79        yw = fCoreShellForm(cw,xw) 
     80#endif 
     81        return(0) 
    6082End 
    6183 
     
    6385// unsmeared model calculation 
    6486/////////////////////////// 
    65 Function CoreShellForm(w,x) : FitFunc 
     87Function fCoreShellForm(w,x) : FitFunc 
    6688        Wave w 
    6789        Variable x 
     
    117139 
    118140// this is all there is to the smeared calculation! 
    119 Function SmearedCoreShellForm(w,x) :FitFunc 
    120         Wave w 
    121         Variable x 
     141Function SmearedCoreShellForm(s) :FitFunc 
     142        Struct ResSmearAAOStruct &s 
     143 
     144////the name of your unsmeared model is the first argument 
     145        s.yW = Smear_Model_20(CoreShellForm,s.coefW,s.xW,s.resW) 
     146 
     147        return(0) 
     148End 
     149 
     150//wrapper to calculate the smeared model as an AAO-Struct 
     151// fills the struct and calls the ususal function with the STRUCT parameter 
     152// 
     153// used only for the dependency, not for fitting 
     154// 
     155Function fSmearedCoreShellForm(coefW,yW,xW) 
     156        Wave coefW,yW,xW 
    122157         
    123         Variable ans 
    124         SVAR sq = gSig_Q 
    125         SVAR qb = gQ_bar 
    126         SVAR sh = gShadow 
    127         SVAR gQ = gQVals 
     158        String str = getWavesDataFolder(yW,0) 
     159        String DF="root:"+str+":" 
    128160         
    129         //the name of your unsmeared model is the first argument 
    130         ans = Smear_Model_20(CoreShellForm,$sq,$qb,$sh,$gQ,w,x) 
    131  
    132         return(ans) 
     161        WAVE resW = $(DF+str+"_res") 
     162         
     163        STRUCT ResSmearAAOStruct fs 
     164        WAVE fs.coefW = coefW    
     165        WAVE fs.yW = yW 
     166        WAVE fs.xW = xW 
     167        WAVE fs.resW = resW 
     168         
     169        Variable err 
     170        err = SmearedCoreShellForm(fs) 
     171         
     172        return (0) 
    133173End 
Note: See TracChangeset for help on using the changeset viewer.