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

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
     2#pragma IgorVersion = 6.0 
    23 
    34//////////////////////////////////////////////// 
     
    2324        make/o/t parameters_phs = {"Radius (A)","polydispersity","volume fraction","contrast (A^-2)","background (cm^-1)"} 
    2425        Edit parameters_phs,coef_phs 
    25         ywave_phs := PolyHSIntensity(coef_phs,xwave_phs) 
     26        Variable/G root:g_phs 
     27        g_phs := PolyHardSphereIntensity(coef_phs,ywave_phs,xwave_phs) 
     28//      ywave_phs := PolyHardSphereIntensity(coef_phs,xwave_phs) 
    2629        Display ywave_phs vs xwave_phs 
    2730        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    3235 
    3336/////////////////////////////////////////////////////////// 
    34  
    35 Proc PlotSmearedPolyHardSpheres()                
    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()) 
     37// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     38Proc PlotSmearedPolyHardSpheres(str)                                                             
     39        String str 
     40        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     41         
     42        // if any of the resolution waves are missing => abort 
     43        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    4144                Abort 
    4245        endif 
     46         
     47        SetDataFolder $("root:"+str) 
    4348         
    4449        // Setup parameter table for model function 
     
    4954        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    5055        // make extra copy of experimental q-values for easy plotting 
    51         Duplicate/O $gQvals smeared_phs,smeared_qvals 
    52         SetScale d,0,0,"1/cm",smeared_phs 
    53  
    54         smeared_phs := SmearedPolyHardSpheres(smear_coef_phs,$gQvals) 
     56        Duplicate/O $(str+"_q") smeared_phs,smeared_qvals 
     57        SetScale d,0,0,"1/cm",smeared_phs                                        
     58                 
     59        Variable/G gs_phs=0 
     60        gs_phs := fSmearedPolyHardSpheres(smear_coef_phs,smeared_phs,smeared_qvals)     //this wrapper fills the STRUCT 
     61 
    5562        Display smeared_phs vs smeared_qvals 
    5663        ModifyGraph log=1,marker=29,msize=2,mode=4 
    5764        Label bottom "q (\\S-1\\M)" 
    5865        Label left "Intensity (cm\\S-1\\M)" 
    59         AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    60 End 
    61  
     66        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)   
     67         
     68        SetDataFolder root: 
     69End 
     70 
     71//AAO version 
     72Function PolyHardSphereIntensity(cw,yw,xw) : FitFunc 
     73        Wave cw,yw,xw 
     74 
     75#if exists("PolyHardSphereIntensityX") 
     76        yw = PolyHardSphereIntensityX(cw,xw) 
     77#else 
     78        yw = fPolyHardSphereIntensity(cw,xw) 
     79#endif 
     80        return(0) 
     81End 
    6282 
    6383/////////////////////////////////////////////////////////////// 
     
    7494// 
    7595/////////////////////////// 
    76 Function PolyHSIntensity(w,k) : FitFunc 
     96Function fPolyHardSphereIntensity(w,k) : FitFunc 
    7797        Wave w                  // the coefficient wave 
    7898        Variable k              // the x values, as a variable (single k is OK) 
     
    186206 
    187207// this is all there is to the smeared calculation! 
    188 Function SmearedPolyHardSpheres(w,x) :FitFunc 
    189         Wave w 
    190         Variable x 
    191          
    192         Variable ans 
    193         SVAR sq = gSig_Q 
    194         SVAR qb = gQ_bar 
    195         SVAR sh = gShadow 
    196         SVAR gQ = gQVals 
    197          
    198         //the name of your unsmeared model is the first argument 
    199         ans = Smear_Model_20(PolyHSIntensity,$sq,$qb,$sh,$gQ,w,x) 
    200  
    201         return(ans) 
    202 End 
     208Function SmearedPolyHardSpheres(s) :FitFunc 
     209        Struct ResSmearAAOStruct &s 
     210 
     211////the name of your unsmeared model is the first argument 
     212        s.yW = Smear_Model_20(PolyHardSphereIntensity,s.coefW,s.xW,s.resW) 
     213 
     214        return(0) 
     215End 
     216 
     217//wrapper to calculate the smeared model as an AAO-Struct 
     218// fills the struct and calls the ususal function with the STRUCT parameter 
     219// 
     220// used only for the dependency, not for fitting 
     221// 
     222Function fSmearedPolyHardSpheres(coefW,yW,xW) 
     223        Wave coefW,yW,xW 
     224         
     225        String str = getWavesDataFolder(yW,0) 
     226        String DF="root:"+str+":" 
     227         
     228        WAVE resW = $(DF+str+"_res") 
     229         
     230        STRUCT ResSmearAAOStruct fs 
     231        WAVE fs.coefW = coefW    
     232        WAVE fs.yW = yW 
     233        WAVE fs.xW = xW 
     234        WAVE fs.resW = resW 
     235         
     236        Variable err 
     237        err = SmearedPolyHardSpheres(fs) 
     238         
     239        return (0) 
     240End 
Note: See TracChangeset for help on using the changeset viewer.