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

    r56 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    1112// 
    1213// 04 JUL 01   DLH 
     14// 
     15// SRK - 2007 
     16// this model needs 76 Gauss points for a proper smearing calculation 
     17// since there can be sharp interference fringes that develop from the stacking 
    1318//////////////////////////////////////////////// 
    1419 
     
    2429        make/o/t parameters_scyl = {"scale","Disc Radius (A)","Core Thickness (A)","Layer Thickness (A)","Core SLD (A^-2)","Layer SLD (A^-2)","Solvent  SLD(A^-2)","# of Stacking","GSD of d-Spacing","incoh. bkg (cm^-1)"} 
    2530        Edit parameters_scyl,coef_scyl 
    26         ywave_scyl := StackedDiscs(coef_scyl,xwave_scyl) 
     31        Variable/G root:g_scyl 
     32        g_scyl := StackedDiscs(coef_scyl,ywave_scyl,xwave_scyl) 
     33//      ywave_scyl := StackedDiscs(coef_scyl,xwave_scyl) 
    2734        Display ywave_scyl vs xwave_scyl 
    2835        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    3441 
    3542/////////////////////////////////////////////////////////// 
    36 Proc PlotSmearedStackedDiscs()   
    37         //no input parameters necessary, it MUST use the experimental q-values 
    38         // from the experimental data read in from an AVE/QSIG data file 
    39          
    40         // if no gQvals wave, data must not have been loaded => abort 
    41         if(ResolutionWavesMissing()) 
     43// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     44Proc PlotSmearedStackedDiscs(str)                                                                
     45        String str 
     46        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     47         
     48        // if any of the resolution waves are missing => abort 
     49        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    4250                Abort 
    4351        endif 
     52         
     53        SetDataFolder $("root:"+str) 
    4454         
    4555        // Setup parameter table for model function 
     
    5060        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    5161        // make extra copy of experimental q-values for easy plotting 
    52         Duplicate/O $gQvals smeared_scyl,smeared_qvals 
    53         SetScale d,0,0,"1/cm",smeared_scyl       
    54  
    55         smeared_scyl := SmearedStackedDiscs(smear_coef_scyl,$gQvals) 
     62        Duplicate/O $(str+"_q") smeared_scyl,smeared_qvals 
     63        SetScale d,0,0,"1/cm",smeared_scyl                               
     64                 
     65        Variable/G gs_scyl=0 
     66        gs_scyl := fSmearedStackedDiscs(smear_coef_scyl,smeared_scyl,smeared_qvals)     //this wrapper fills the STRUCT 
     67         
    5668        Display smeared_scyl vs smeared_qvals 
    5769        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    5971        Label left "Intensity (cm\\S-1\\M)" 
    6072        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    61 End 
    62 /////////////////////////////////////////////////////////////// 
    63  
     73         
     74        SetDataFolder root: 
     75End 
     76 
     77/////////////////////////////////////////////////////////////// 
     78 
     79//AAO version 
     80Function StackedDiscs(cw,yw,xw) : FitFunc 
     81        Wave cw,yw,xw 
     82         
     83#if exists("StackedDiscsX") 
     84        yw = StackedDiscsX(cw,xw) 
     85#else 
     86        yw = fStackedDiscs(cw,yw) 
     87#endif 
     88        return(0) 
     89End 
    6490/////////////////////////////////////////////////////////////// 
    6591// unsmeared model calculation 
    6692/////////////////////////// 
    67 Function StackedDiscs(w,x) : FitFunc 
     93Function fStackedDiscs(w,x) : FitFunc 
    6894        Wave w 
    6995        Variable x 
     
    231257/////////////////////////////////////////////////////////////// 
    232258 
    233 // this is all there is to the smeared calculation! 
    234 Function SmearedStackedDiscs(w,x) :FitFunc 
    235         Wave w 
    236         Variable x 
    237          
    238         Variable ans 
    239         SVAR sq = gSig_Q 
    240         SVAR qb = gQ_bar 
    241         SVAR sh = gShadow 
    242         SVAR gQ = gQVals 
    243          
    244         //the name of your unsmeared model is the first argument 
    245         ans = Smear_Model_76(StackedDiscs,$sq,$qb,$sh,$gQ,w,x) 
    246  
    247         return(ans) 
    248 End 
    249  
     259// this model needs 76 Gauss points for a proper smearing calculation 
     260// since there can be sharp interference fringes that develop from the stacking 
     261Function SmearedStackedDiscs(s) :FitFunc 
     262        Struct ResSmearAAOStruct &s 
     263 
     264////the name of your unsmeared model is the first argument 
     265        s.yW = Smear_Model_76(StackedDiscs,s.coefW,s.xW,s.resW) 
     266 
     267        return(0) 
     268End 
     269 
     270 
     271//wrapper to calculate the smeared model as an AAO-Struct 
     272// fills the struct and calls the ususal function with the STRUCT parameter 
     273// 
     274// used only for the dependency, not for fitting 
     275// 
     276Function fSmearedStackedDiscs(coefW,yW,xW) 
     277        Wave coefW,yW,xW 
     278         
     279        String str = getWavesDataFolder(yW,0) 
     280        String DF="root:"+str+":" 
     281         
     282        WAVE resW = $(DF+str+"_res") 
     283         
     284        STRUCT ResSmearAAOStruct fs 
     285        WAVE fs.coefW = coefW    
     286        WAVE fs.yW = yW 
     287        WAVE fs.xW = xW 
     288        WAVE fs.resW = resW 
     289         
     290        Variable err 
     291        err = SmearedStackedDiscs(fs) 
     292         
     293        return (0) 
     294End 
Note: See TracChangeset for help on using the changeset viewer.