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/OblateForm.ipf

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    2223        make/o/t parameters_oef = {"scale","major core (A)","minor core (A)","major shell (A)","minor shell (A)","Contrast (core-shell) (A-2)","Constrast (shell-solvent) (A-2)","bkg (cm-1)"} 
    2324        Edit parameters_oef,coef_oef 
    24         ywave_oef := OblateForm(coef_oef,xwave_oef) 
     25        Variable/G root:g_oef 
     26        g_oef := OblateForm(coef_oef,ywave_oef,xwave_oef) 
     27//      ywave_oef := OblateForm(coef_oef,xwave_oef) 
    2528        Display ywave_oef vs xwave_oef 
    2629        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    2932        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    3033End 
     34 
    3135/////////////////////////////////////////////////////////// 
    32  
    33 Proc PlotSmearedOblateForm()                                                            //**** name of your function 
    34         //no input parameters necessary, it MUST use the experimental q-values 
    35         // from the experimental data read in from an AVE/QSIG data file 
    36          
    37         // if no gQvals wave, data must not have been loaded => abort 
    38         if(ResolutionWavesMissing()) 
     36// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     37Proc PlotSmearedOblateForm(str)                                                          
     38        String str 
     39        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     40         
     41        // if any of the resolution waves are missing => abort 
     42        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    3943                Abort 
    4044        endif 
     45         
     46        SetDataFolder $("root:"+str) 
    4147         
    4248        // Setup parameter table for model function 
     
    4753        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    4854        // make extra copy of experimental q-values for easy plotting 
    49         Duplicate/O $gQvals smeared_oef,smeared_qvals                            
    50         SetScale d,0,0,"1/cm",smeared_oef                                        
    51  
    52         smeared_oef := SmearedOblateForm(smear_coef_oef,$gQvals) 
     55        Duplicate/O $(str+"_q") smeared_oef,smeared_qvals                                
     56        SetScale d,0,0,"1/cm",smeared_oef                                                                                
     57                 
     58        Variable/G gs_oef=0 
     59        gs_oef := fSmearedOblateForm(smear_coef_oef,smeared_oef,smeared_qvals)  //this wrapper fills the STRUCT 
     60         
    5361        Display smeared_oef vs smeared_qvals 
    5462        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    5664        Label left "Intensity (cm\\S-1\\M)" 
    5765        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
     66         
     67        SetDataFolder root: 
     68End 
     69 
     70 
     71//AAO version 
     72Function OblateForm(cw,yw,xw) : FitFunc 
     73        Wave cw,yw,xw 
     74 
     75#if exists("OblateFormX") 
     76        yw = OblateFormX(cw,xw) 
     77#else 
     78        yw = fOblateForm(cw,xw) 
     79#endif 
     80        return(0) 
    5881End 
    5982 
     
    6184// unsmeared model calculation 
    6285/////////////////////////// 
    63 Function OblateForm(w,x) : FitFunc 
     86Function fOblateForm(w,x) : FitFunc 
    6487        Wave w 
    6588        Variable x 
     
    199222 
    200223// this is all there is to the smeared calculation! 
    201 Function SmearedOblateForm(w,x) :FitFunc 
    202         Wave w 
    203         Variable x 
    204          
    205         Variable ans 
    206         SVAR sq = gSig_Q 
    207         SVAR qb = gQ_bar 
    208         SVAR sh = gShadow 
    209         SVAR gQ = gQVals 
    210          
    211         //the name of your unsmeared model is the first argument 
    212         ans = Smear_Model_20(OblateForm,$sq,$qb,$sh,$gQ,w,x) 
    213  
    214         return(ans) 
    215 End 
     224Function SmearedOblateForm(s) :FitFunc 
     225        Struct ResSmearAAOStruct &s 
     226 
     227////the name of your unsmeared model is the first argument 
     228        s.yW = Smear_Model_20(OblateForm,s.coefW,s.xW,s.resW) 
     229 
     230        return(0) 
     231End 
     232 
     233//wrapper to calculate the smeared model as an AAO-Struct 
     234// fills the struct and calls the ususal function with the STRUCT parameter 
     235// 
     236// used only for the dependency, not for fitting 
     237// 
     238Function fSmearedOblateForm(coefW,yW,xW) 
     239        Wave coefW,yW,xW 
     240         
     241        String str = getWavesDataFolder(yW,0) 
     242        String DF="root:"+str+":" 
     243         
     244        WAVE resW = $(DF+str+"_res") 
     245         
     246        STRUCT ResSmearAAOStruct fs 
     247        WAVE fs.coefW = coefW    
     248        WAVE fs.yW = yW 
     249        WAVE fs.xW = xW 
     250        WAVE fs.resW = resW 
     251         
     252        Variable err 
     253        err = SmearedOblateForm(fs) 
     254         
     255        return (0) 
     256End 
Note: See TracChangeset for help on using the changeset viewer.