Ignore:
Timestamp:
Jul 25, 2007 3:07:20 PM (16 years ago)
Author:
srkline
Message:

Second round of changes to ipf files to (hopefully) complete the changes to bring all of the model functions to be:

  • this set of changes is for the "2006" set of models
  • AAO
  • new dependencies
  • smearing using structures
  • #if conditional compile for XOPS

-this needs to be FULLY tested for correctness and bugs
-packages are certainly still broken (data folders)

SRK 25 JUL 07

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/BinaryHardSpheres.ipf

    r127 r128  
    5858        ModifyTable width(coef_BinaryHS)=90 
    5959         
    60         ywave_BinaryHS  := BinaryHS(coef_BinaryHS, xwave_BinaryHS) 
     60        Variable/G root:g_BinaryHS 
     61        g_BinaryHS := BinaryHS(coef_BinaryHS, ywave_BinaryHS,xwave_BinaryHS) 
    6162        Display ywave_BinaryHS vs xwave_BinaryHS 
    6263        ModifyGraph marker=29, msize=2, mode=4 
     
    6768End 
    6869 
    69 // 
    70 //this macro sets up all the necessary parameters and waves that are 
    71 //needed to calculate the  smeared model function. 
    72 // 
    73 //no input parameters are necessary, it MUST use the experimental q-values 
    74 // from the experimental data read in from an AVE/QSIG data file 
    75 //////////////////////////////////////////////////// 
    76 Proc PlotSmeared_BinaryHS()                                                             //BinaryHS 
    77          
    78         // if no gQvals wave, data must not have been loaded => abort 
    79         if(ResolutionWavesMissing()) 
     70// - sets up a dependency to a wrapper, not the actual SmearedModelFunction 
     71Proc PlotSmeared_BinaryHS(str)                                                           
     72        String str 
     73        Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 
     74         
     75        // if any of the resolution waves are missing => abort 
     76        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils) 
    8077                Abort 
    8178        endif 
     79         
     80        SetDataFolder $("root:"+str) 
    8281         
    8382        // Setup parameter table for model function 
     
    8988        // output smeared intensity wave, dimensions are identical to experimental QSIG values 
    9089        // make extra copy of experimental q-values for easy plotting 
    91         Duplicate/O $gQvals smeared_BinaryHS,smeared_qvals                              // 
     90        Duplicate/O $(str+"_q") smeared_BinaryHS,smeared_qvals                          // 
    9291        SetScale d,0,0,"1/cm",smeared_BinaryHS                                                  // 
    93  
    94         smeared_BinaryHS := BinaryHS_Smeared(smear_coef_BinaryHS,$gQvals)               // SMEARED function name 
     92                                         
     93        Variable/G gs_BinaryHS=0 
     94        gs_BinaryHS := fBinaryHS_Smeared(smear_coef_BinaryHS,smeared_BinaryHS,smeared_qvals)    //this wrapper fills the STRUCT 
     95         
    9596        Display smeared_BinaryHS vs smeared_qvals                                                                       // 
    9697        ModifyGraph log=1,marker=29,msize=2,mode=4 
     
    9899        Label left "I(q) (cm\\S-1\\M)" 
    99100        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 
    100 End     // end macro  
     101         
     102        SetDataFolder root: 
     103End 
     104 
     105 
     106 
     107//AAO version, uses XOP if available 
     108// simply calls the original single point calculation with 
     109// a wave assignment (this will behave nicely if given point ranges) 
     110Function BinaryHS(cw,yw,xw) : FitFunc 
     111        Wave cw,yw,xw 
     112         
     113#if exists("BinaryHSX") 
     114        yw = BinaryHSX(cw,xw) 
     115#else 
     116        yw = fBinaryHS(cw,xw) 
     117#endif 
     118        return(0) 
     119End 
     120 
    101121 
    102122//CH#1 
     
    105125// based on the wave (array) of parameters that you send it (w) 
    106126// 
    107 Function BinaryHS(w,x) : FitFunc 
     127Function fBinaryHS(w,x) : FitFunc 
    108128        Wave w 
    109129        Variable x 
     
    168188End 
    169189 
    170 Function BinaryHS_PSF11(w,x) : FitFunc 
     190//AAO version, uses XOP if available 
     191// simply calls the original single point calculation with 
     192// a wave assignment (this will behave nicely if given point ranges) 
     193Function BinaryHS_PSF11(cw,yw,xw) : FitFunc 
     194        Wave cw,yw,xw 
     195         
     196#if exists("BinaryHS_PSF11X") 
     197        yw = BinaryHS_PSF11X(cw,xw) 
     198#else 
     199        yw = fBinaryHS_PSF11(cw,xw) 
     200#endif 
     201        return(0) 
     202End 
     203 
     204Function fBinaryHS_PSF11(w,x) : FitFunc 
    171205        Wave w 
    172206        Variable x 
     
    210244End 
    211245 
    212 Function BinaryHS_PSF12(w,x) : FitFunc 
     246//AAO version, uses XOP if available 
     247// simply calls the original single point calculation with 
     248// a wave assignment (this will behave nicely if given point ranges) 
     249Function BinaryHS_PSF12(cw,yw,xw) : FitFunc 
     250        Wave cw,yw,xw 
     251         
     252#if exists("BinaryHS_PSF12X") 
     253        yw = BinaryHS_PSF12X(cw,xw) 
     254#else 
     255        yw = fBinaryHS_PSF12(cw,xw) 
     256#endif 
     257        return(0) 
     258End 
     259 
     260Function fBinaryHS_PSF12(w,x) : FitFunc 
    213261        Wave w 
    214262        Variable x 
     
    252300End 
    253301 
    254 Function BinaryHS_PSF22(w,x) : FitFunc 
     302//AAO version, uses XOP if available 
     303// simply calls the original single point calculation with 
     304// a wave assignment (this will behave nicely if given point ranges) 
     305Function BinaryHS_PSF22(cw,yw,xw) : FitFunc 
     306        Wave cw,yw,xw 
     307         
     308#if exists("BinaryHS_PSF22X") 
     309        yw = BinaryHS_PSF22X(cw,xw) 
     310#else 
     311        yw = fBinaryHS_PSF22(cw,xw) 
     312#endif 
     313        return(0) 
     314End 
     315 
     316Function fBinaryHS_PSF22(w,x) : FitFunc 
    255317        Wave w 
    256318        Variable x 
     
    387449End 
    388450         
    389          
     451 
     452//wrapper to calculate the smeared model as an AAO-Struct 
     453// fills the struct and calls the ususal function with the STRUCT parameter 
     454// 
     455// used only for the dependency, not for fitting 
     456// 
     457Function fBinaryHS_Smeared(coefW,yW,xW) 
     458        Wave coefW,yW,xW 
     459         
     460        String str = getWavesDataFolder(yW,0) 
     461        String DF="root:"+str+":" 
     462         
     463        WAVE resW = $(DF+str+"_res") 
     464         
     465        STRUCT ResSmearAAOStruct fs 
     466        WAVE fs.coefW = coefW    
     467        WAVE fs.yW = yW 
     468        WAVE fs.xW = xW 
     469        WAVE fs.resW = resW 
     470         
     471        Variable err 
     472        err = BinaryHS_Smeared(fs) 
     473         
     474        return (0) 
     475End 
     476 
    390477// this is all there is to the smeared calculation! 
    391 Function BinaryHS_Smeared(w,x) :FitFunc 
    392         Wave w 
    393         Variable x 
    394          
    395         Variable ans 
    396         SVAR sq = gSig_Q 
    397         SVAR qb = gQ_bar 
    398         SVAR sh = gShadow 
    399         SVAR gQ = gQVals 
    400          
    401         //the name of your unsmeared model is the first argument 
    402         ans = Smear_Model_20(BinaryHS,$sq,$qb,$sh,$gQ,w,x)      //CH#4 
    403  
    404         return(ans) 
    405 End 
     478Function BinaryHS_Smeared(s) :FitFunc 
     479        Struct ResSmearAAOStruct &s 
     480 
     481//      the name of your unsmeared model (AAO) is the first argument 
     482        s.yW = Smear_Model_20(BinaryHS,s.coefW,s.xW,s.resW) 
     483 
     484        return(0) 
     485End 
     486 
    406487 
    407488 
Note: See TracChangeset for help on using the changeset viewer.