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

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    2324        make/o/t parameters_rect = {"scale","Radius (A)","polydispersity","contrast (A^-2)","background (cm^-1)"} 
    2425        Edit parameters_rect,coef_rect 
    25         ywave_rect := PolyRectSpheres(coef_rect,xwave_rect) 
     26        Variable/G root:g_rect 
     27        g_rect := PolyRectSpheres(coef_rect,ywave_rect,xwave_rect) 
     28//      ywave_rect := PolyRectSpheres(coef_rect,xwave_rect) 
    2629        Display ywave_rect vs xwave_rect 
    2730        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    3437 
    3538/////////////////////////////////////////////////////////// 
    36  
    37 Proc PlotSmearedPolyRectSpheres()                
    38         //no input parameters necessary, it MUST use the experimental q-values 
    39         // from the experimental data read in from an AVE/QSIG data file 
    40          
    41         // if no gQvals wave, data must not have been loaded => abort 
    42         if(ResolutionWavesMissing()) 
     39// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     40Proc PlotSmearedPolyRectSpheres(str)                                                             
     41        String str 
     42        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     43         
     44        // if any of the resolution waves are missing => abort 
     45        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    4346                Abort 
    4447        endif 
     48         
     49        SetDataFolder $("root:"+str) 
    4550         
    4651        // Setup parameter table for model function 
     
    5156        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    5257        // make extra copy of experimental q-values for easy plotting 
    53         Duplicate/O $gQvals smeared_rect,smeared_qvals 
    54         SetScale d,0,0,"1/cm",smeared_rect 
    55  
    56         smeared_rect := SmearedPolyRectSpheres(smear_coef_rect,$gQvals) 
     58        Duplicate/O $(str+"_q") smeared_rect,smeared_qvals 
     59        SetScale d,0,0,"1/cm",smeared_rect                       
     60                 
     61        Variable/G gs_rect=0 
     62        gs_rect := fSmearedPolyRectSpheres(smear_coef_rect,smeared_rect,smeared_qvals)  //this wrapper fills the STRUCT 
     63 
    5764        Display smeared_rect vs smeared_qvals 
    5865        ModifyGraph log=1,marker=29,msize=2,mode=4 
    5966        Label bottom "q (\\S-1\\M)" 
    6067        Label left "Intensity (cm\\S-1\\M)" 
    61         AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    62 End 
    63  
    64  
     68        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)   
     69         
     70        SetDataFolder root: 
     71End 
     72 
     73 
     74//AAO version 
     75Function PolyRectSpheres(cw,yw,xw) : FitFunc 
     76                Wave cw,yw,xw 
     77 
     78#if exists("PolyRectSpheresX") 
     79        yw = PolyRectSpheresX(cw,xw) 
     80#else 
     81        yw = fPolyRectSpheres(cw,xw) 
     82#endif 
     83        return(0) 
     84End 
    6585/////////////////////////////////////////////////////////////// 
    6686// unsmeared model calculation 
    6787/////////////////////////// 
    68 Function PolyRectSpheres(w,x) : FitFunc 
     88Function fPolyRectSpheres(w,x) : FitFunc 
    6989        Wave w                  // the coefficient wave 
    7090        Variable x              // the x values, as a variable 
     
    147167 
    148168// this is all there is to the smeared calculation! 
    149 Function SmearedPolyRectSpheres(w,x) :FitFunc 
    150         Wave w 
    151         Variable x 
    152          
    153         Variable ans 
    154         SVAR sq = gSig_Q 
    155         SVAR qb = gQ_bar 
    156         SVAR sh = gShadow 
    157         SVAR gQ = gQVals 
    158          
    159         //the name of your unsmeared model is the first argument 
    160         ans = Smear_Model_20(PolyRectSpheres,$sq,$qb,$sh,$gQ,w,x) 
    161  
    162         return(ans) 
    163 End 
     169Function SmearedPolyRectSpheres(s) :FitFunc 
     170        Struct ResSmearAAOStruct &s 
     171 
     172////the name of your unsmeared model is the first argument 
     173        s.yW = Smear_Model_20(PolyRectSpheres,s.coefW,s.xW,s.resW) 
     174 
     175        return(0) 
     176End 
     177 
     178//wrapper to calculate the smeared model as an AAO-Struct 
     179// fills the struct and calls the ususal function with the STRUCT parameter 
     180// 
     181// used only for the dependency, not for fitting 
     182// 
     183Function fSmearedPolyRectSpheres(coefW,yW,xW) 
     184        Wave coefW,yW,xW 
     185         
     186        String str = getWavesDataFolder(yW,0) 
     187        String DF="root:"+str+":" 
     188         
     189        WAVE resW = $(DF+str+"_res") 
     190         
     191        STRUCT ResSmearAAOStruct fs 
     192        WAVE fs.coefW = coefW    
     193        WAVE fs.yW = yW 
     194        WAVE fs.xW = xW 
     195        WAVE fs.resW = resW 
     196         
     197        Variable err 
     198        err = SmearedPolyRectSpheres(fs) 
     199         
     200        return (0) 
     201End 
Note: See TracChangeset for help on using the changeset viewer.