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

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
     3 
    24//////////////////////////////////////////////////// 
    35//      C. Glinka, 11-22-98 
    46//////////////// 
     7 
     8 
     9                                                                //Debye-Anderson-Brumberger 
     10 
    511 
    612Proc PlotDAB(num,qmin,qmax) 
     
    1521        make/o/t parameters_DAB = {"Scale Factor, A ", "Correlation Length ()", "Incoherent Bgd (cm-1)"} 
    1622        Edit parameters_DAB, coef_DAB 
    17         ywave_DAB  := DAB_Model(coef_DAB, xwave_DAB) 
     23        Variable/G root:g_DAB 
     24        g_DAB  := DAB_Model(coef_DAB, ywave_DAB, xwave_DAB) 
     25//      ywave_DAB  := DAB_Model(coef_DAB, xwave_DAB) 
    1826        Display ywave_DAB vs xwave_DAB 
    1927        ModifyGraph marker=29, msize=2, mode=4 
     
    2331        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    2432End 
     33 
    2534//////////////////////////////////////////////////// 
    26 Proc PlotSmearedDAB()                                                           //Debye-Anderson-Brumberger 
    27         //no input parameters necessary, it MUST use the experimental q-values 
    28         // from the experimental data read in from an AVE/QSIG data file 
     35// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     36Proc PlotSmearedDAB(str)                                                                 
     37        String str 
     38        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
    2939         
    30         // if no gQvals wave, data must not have been loaded => abort 
    31         if(ResolutionWavesMissing()) 
     40        // if any of the resolution waves are missing => abort 
     41        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    3242                Abort 
    3343        endif 
     44         
     45        SetDataFolder $("root:"+str) 
    3446         
    3547        // Setup parameter table for model function 
     
    4052        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    4153        // make extra copy of experimental q-values for easy plotting 
    42         Duplicate/O $gQvals smeared_DAB,smeared_qvals                           // 
     54        Duplicate/O $(str+"_q") smeared_DAB,smeared_qvals                               // 
    4355        SetScale d,0,0,"1/cm",smeared_DAB                                                       // 
    44  
    45         smeared_DAB := SmearedDAB_Model(smear_coef_DAB,$gQvals)         // SMEARED function name 
     56                                         
     57        Variable/G gs_DAB=0 
     58        gs_DAB := fSmearedDAB_Model(smear_coef_DAB,smeared_DAB,smeared_qvals)   //this wrapper fills the STRUCT 
     59         
    4660        Display smeared_DAB vs smeared_qvals                                                                    // 
    4761        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    4963        Label left "Debye-Anderson-Brumberger Model (cm\\S-1\\M)" 
    5064        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    51 End     // end macro PlotSmearedDAB 
     65         
     66        SetDataFolder root: 
     67End 
    5268 
    53 Function DAB_model(w,x) : FitFunc 
     69//AAO version 
     70Function DAB_model(cw,yw,xw) : FitFunc 
     71        Wave cw,yw,xw 
     72 
     73#if exists("DAB_modelX") 
     74        yw = DAB_modelX(cw,xw) 
     75#else 
     76        yw = fDAB_model(cw,xw) 
     77#endif 
     78        return(0) 
     79End 
     80 
     81Function fDAB_model(w,x) : FitFunc 
    5482        Wave w 
    5583        Variable x 
     
    75103 
    76104// this is all there is to the smeared calculation! 
    77 Function SmearedDAB_Model(w,x) :FitFunc 
    78         Wave w 
    79         Variable x 
     105Function SmearedDAB_Model(s) :FitFunc 
     106        Struct ResSmearAAOStruct &s 
     107 
     108////the name of your unsmeared model is the first argument 
     109        s.yW = Smear_Model_20(DAB_Model,s.coefW,s.xW,s.resW) 
     110 
     111        return(0) 
     112End 
     113 
     114//wrapper to calculate the smeared model as an AAO-Struct 
     115// fills the struct and calls the ususal function with the STRUCT parameter 
     116// 
     117// used only for the dependency, not for fitting 
     118// 
     119Function fSmearedDAB_Model(coefW,yW,xW) 
     120        Wave coefW,yW,xW 
    80121         
    81         Variable ans 
    82         SVAR sq = gSig_Q 
    83         SVAR qb = gQ_bar 
    84         SVAR sh = gShadow 
    85         SVAR gQ = gQVals 
     122        String str = getWavesDataFolder(yW,0) 
     123        String DF="root:"+str+":" 
    86124         
    87         //the name of your unsmeared model is the first argument 
    88         ans = Smear_Model_20(DAB_Model,$sq,$qb,$sh,$gQ,w,x) 
    89  
    90         return(ans) 
     125        WAVE resW = $(DF+str+"_res") 
     126         
     127        STRUCT ResSmearAAOStruct fs 
     128        WAVE fs.coefW = coefW    
     129        WAVE fs.yW = yW 
     130        WAVE fs.xW = xW 
     131        WAVE fs.resW = resW 
     132         
     133        Variable err 
     134        err = SmearedDAB_Model(fs) 
     135         
     136        return (0) 
    91137End 
Note: See TracChangeset for help on using the changeset viewer.