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

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    2425        make/o/t parameters_cscyl = {"scale","core radius (A)","shell THICKNESS (A)","CORE length (A)","SLD core (A^-2)","SLD shell (A^-2)","SLD solvent (A^-2)","incoh. bkg (cm^-1)"} 
    2526        Edit parameters_cscyl,coef_cscyl 
    26         ywave_cscyl := CoreShellCylinderForm(coef_cscyl,xwave_cscyl) 
     27        Variable/G root:g_cscyl 
     28        g_cscyl := CoreShellCylinder(coef_cscyl,ywave_cscyl,xwave_cscyl) 
     29//      ywave_cscyl := CoreShellCylinder(coef_cscyl,xwave_cscyl) 
    2730        Display ywave_cscyl vs xwave_cscyl 
    2831        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    3134        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    3235End 
     36 
    3337/////////////////////////////////////////////////////////// 
    34  
    35 Proc PlotSmearedCSCylinderForm()         
    36         //no input parameters necessary, it MUST use the experimental q-values 
    37         // from the experimental data read in from an AVE/QSIG data file 
    38          
    39         // if no gQvals wave, data must not have been loaded => abort 
    40         if(ResolutionWavesMissing()) 
     38// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     39Proc PlotSmearedCSCylinderForm(str)                                                              
     40        String str 
     41        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     42         
     43        // if any of the resolution waves are missing => abort 
     44        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    4145                Abort 
    4246        endif 
     47         
     48        SetDataFolder $("root:"+str) 
    4349         
    4450        // Setup parameter table for model function 
     
    4955        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    5056        // make extra copy of experimental q-values for easy plotting 
    51         Duplicate/O $gQvals smeared_cscyl,smeared_qvals 
     57        Duplicate/O $(str+"_q") smeared_cscyl,smeared_qvals 
    5258        SetScale d,0,0,"1/cm",smeared_cscyl      
    53  
    54         smeared_cscyl := SmearedCoreShellCylinderForm(smear_coef_cscyl,$gQvals) 
     59                                         
     60        Variable/G gs_cscyl=0 
     61        gs_cscyl := fSmearedCoreShellCylinderForm(smear_coef_cscyl,smeared_cscyl,smeared_qvals) //this wrapper fills the STRUCT 
     62         
    5563        Display smeared_cscyl vs smeared_qvals 
    5664        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    5866        Label left "Intensity (cm\\S-1\\M)" 
    5967        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
     68         
     69        SetDataFolder root: 
     70End 
     71         
     72 
     73//AAO version 
     74Function CoreShellCylinder(cw,yw,xw) : FitFunc 
     75        Wave cw,yw,xw 
     76 
     77#if exists("CoreShellCylinderX") 
     78        yw = CoreShellCylinderX(cw,xw) 
     79#else 
     80        yw = fCoreShellCylinder(cw,xw) 
     81#endif 
     82        return(0) 
    6083End 
    6184 
     
    6386// unsmeared model calculation 
    6487/////////////////////////// 
    65 Function CoreShellCylinderForm(w,x) : FitFunc 
     88Function fCoreShellCylinder(w,x) : FitFunc 
    6689        Wave w 
    6790        Variable x 
     
    200223 
    201224// this is all there is to the smeared calculation! 
    202 Function SmearedCoreShellCylinderForm(w,x) :FitFunc 
    203         Wave w 
    204         Variable x 
    205          
    206         Variable ans 
    207         SVAR sq = gSig_Q 
    208         SVAR qb = gQ_bar 
    209         SVAR sh = gShadow 
    210         SVAR gQ = gQVals 
    211          
    212         //the name of your unsmeared model is the first argument 
    213         ans = Smear_Model_20(CoreShellCylinderForm,$sq,$qb,$sh,$gQ,w,x) 
    214  
    215         return(ans) 
    216 End 
    217  
     225Function SmearedCoreShellCylinderForm(s) :FitFunc 
     226        Struct ResSmearAAOStruct &s 
     227 
     228////the name of your unsmeared model is the first argument 
     229        s.yW = Smear_Model_20(CoreShellCylinder,s.coefW,s.xW,s.resW) 
     230 
     231        return(0) 
     232End 
     233 
     234 
     235//wrapper to calculate the smeared model as an AAO-Struct 
     236// fills the struct and calls the ususal function with the STRUCT parameter 
     237// 
     238// used only for the dependency, not for fitting 
     239// 
     240Function fSmearedCoreShellCylinderForm(coefW,yW,xW) 
     241        Wave coefW,yW,xW 
     242         
     243        String str = getWavesDataFolder(yW,0) 
     244        String DF="root:"+str+":" 
     245         
     246        WAVE resW = $(DF+str+"_res") 
     247         
     248        STRUCT ResSmearAAOStruct fs 
     249        WAVE fs.coefW = coefW    
     250        WAVE fs.yW = yW 
     251        WAVE fs.xW = xW 
     252        WAVE fs.resW = resW 
     253         
     254        Variable err 
     255        err = SmearedCoreShellCylinderForm(fs) 
     256         
     257        return (0) 
     258End 
Note: See TracChangeset for help on using the changeset viewer.