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

    r42 r127  
    11#pragma rtGlobals=1             // Use modern global access method. 
    2  
     2#pragma IgorVersion = 6.0 
     3 
     4// currently, there is NO XOP version of RPA, since there is an extra input parameter 
     5// wave that must be carried into the function. 
     6// this can be done with the STRUCT, if extra space is allocated for such 
     7// 
     8// in addition, the inputvalues, coefvalues_rpa names are not consistent with other models 
     9// - it would be nice for users to make all models have a consistent naming scheme 
     10// 
    311// 
    412Proc PlotRPAForm(num,qmin,qmax,nCASE) 
     
    6371End 
    6472 
    65 Proc PlotSmearedRPAForm(nCASE) 
    66         //no input parameters necessary, it MUST use the experimental q-values 
    67         // from the experimental data read in from an AVE/QSIG data file 
    68         Variable/g gCASE                //Global Variable 
     73// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     74Proc PlotSmearedRPAForm(str,nCASE)                                                               
     75        String str 
    6976        Variable nCASE 
     77        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
    7078        Prompt nCASE, "Choose one of the following cases:",popup "CASE 1: C/D BINARY MIXTURE OF HOMOPOLYMERS;" 
    7179        "CASE 2: C-D DIBLOCK COPOLYMER;" 
     
    7886        "CASE 9: A-B/C-D MIXTURE OF TWO DIBLOCK COPOLYMERS A-B AND C-D;" 
    7987        "CASE 10: A-B-C-D FOUR-BLOCK COPOLYMER" 
    80  
    81         // if no gQvals wave, data must not have been loaded => abort 
    82         if(ResolutionWavesMissing()) 
     88         
     89        SetDataFolder $("root:"+str) 
     90 
     91        Variable/g gCASE                //Global Variable 
     92 
     93        // if any of the resolution waves are missing => abort 
     94        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    8395                Abort 
    8496        endif 
    85  
     97         
    8698        gCASE = nCASE 
    8799//      print gCASE 
    88100 
     101         
    89102        IF(gCASE <=2) 
    90103                Make/O/D inputvalues={1000,0.5,100,1.e-12,1000,0.5,100,0.e-12} 
     
    116129        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    117130        // make extra copy of experimental q-values for easy plotting 
    118         Duplicate/O $gQvals smeared_rpa,smeared_qvals    
    119         SetScale d,0,0,"1/cm",smeared_rpa        
    120  
    121         smeared_rpa := SmearedRPAForm(smear_coefvalues_rpa,$gQvals) 
     131        Duplicate/O $(str+"_q") smeared_rpa,smeared_qvals        
     132        SetScale d,0,0,"1/cm",smeared_rpa                                        
     133                 
     134        Variable/G gs_rpa=0 
     135        gs_rpa := fSmearedRPAForm(smear_coef_rpa,smeared_rpa,smeared_qvals)     //this wrapper fills the STRUCT 
     136         
    122137        Display smeared_rpa vs smeared_qvals 
    123138        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    125140        Label left "Intensity (cm\\S-1\\M)" 
    126141        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
     142         
     143        SetDataFolder root: 
    127144End 
    128145 
     
    552569 
    553570// this is all there is to the smeared calculation! 
    554 Function SmearedRPAForm(w,x) :FitFunc 
    555         Wave w 
    556         Variable x 
    557          
    558         Variable ans 
    559         SVAR sq = gSig_Q 
    560         SVAR qb = gQ_bar 
    561         SVAR sh = gShadow 
    562         SVAR gQ = gQVals 
    563          
    564         //the name of your unsmeared model is the first argument 
    565         ans = Smear_Model_20(RPAForm,$sq,$qb,$sh,$gQ,w,x) 
    566  
    567         return(ans) 
     571Function SmearedRPAForm(s) :FitFunc 
     572 
     573        Struct ResSmearAAOStruct &s 
     574 
     575////the name of your unsmeared model is the first argument 
     576        s.yW = Smear_Model_20(RPAForm,s.coefW,s.xW,s.resW) 
     577 
     578        return(0) 
    568579End 
     580 
     581//wrapper to calculate the smeared model as an AAO-Struct 
     582// fills the struct and calls the ususal function with the STRUCT parameter 
     583// 
     584// used only for the dependency, not for fitting 
     585// 
     586Function fSmearedRPAForm(coefW,yW,xW) 
     587        Wave coefW,yW,xW 
     588         
     589        String str = getWavesDataFolder(yW,0) 
     590        String DF="root:"+str+":" 
     591         
     592        WAVE resW = $(DF+str+"_res") 
     593         
     594        STRUCT ResSmearAAOStruct fs 
     595        WAVE fs.coefW = coefW    
     596        WAVE fs.yW = yW 
     597        WAVE fs.xW = xW 
     598        WAVE fs.resW = resW 
     599         
     600        Variable err 
     601        err = SmearedRPAForm(fs) 
     602         
     603        return (0) 
     604End 
Note: See TracChangeset for help on using the changeset viewer.