Ignore:
Timestamp:
Jul 26, 2007 2:56:06 PM (16 years ago)
Author:
srkline
Message:

invariant package now should be data folder aware, and bits inside myGlobals

File:
1 edited

Legend:

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

    r50 r134  
    77// need to: 
    88// - verify accuracy (see John) 
    9 // - help file 
    109 
    1110// this is the main entry point for the panel 
     
    1312        DoWindow/F Invariant_Panel 
    1413        if(V_flag==0) 
    15                 //create global variables in root:invariant 
     14                //create global variables in root:myGlobals:invariant 
    1615                Init_Invariant() 
    1716                Invariant_Panel() 
     
    2322//create the globals 
    2423Proc Init_Invariant() 
    25         NewDataFolder/O/S root:invariant 
     24        NewDataFolder/O/S root:myGlobals:invariant 
    2625        Variable/G gNumLow=10 
    2726        Variable/G gNumHigh=10 
     
    3433        Variable/G gIsSlitSmeared=0 
    3534        Variable/G gDqv = 0.117         //default value for USANS slit height (re-read from file) 
    36          
    37         NewDataFolder/O root:myGlobals          //just in case... 
    38          
     35                 
    3936        SetDataFolder root: 
    4037End 
     
    7471         
    7572        Variable num,invar 
    76         NVAR dQv = root:invariant:gDqv 
     73        NVAR dQv = root:myGlobals:invariant:gDqv 
    7774         
    7875        Duplicate/O qw integrand 
     
    158155         
    159156        //access the global strings representing the last data file read in 
    160         SVAR QWave = root:invariant:QWave 
    161         SVAR IWave = root:invariant:IWave 
    162         SVAR SWave = root:invariant:SWave 
     157        SVAR QWave = root:myGlobals:invariant:QWave 
     158        SVAR IWave = root:myGlobals:invariant:IWave 
     159        SVAR SWave = root:myGlobals:invariant:SWave 
    163160         
    164161        Wave qw=$QWave 
     
    211208         
    212209        //reset the invariant values to zero 
    213         NVAR meas = root:invariant:gInvMeas 
    214         NVAR lo = root:invariant:gInvLowQ 
    215         NVAR hi = root:invariant:gInvHighQ 
    216         NVAR total = root:invariant:gInvTotal 
     210        NVAR meas = root:myGlobals:invariant:gInvMeas 
     211        NVAR lo = root:myGlobals:invariant:gInvLowQ 
     212        NVAR hi = root:myGlobals:invariant:gInvHighQ 
     213        NVAR total = root:myGlobals:invariant:gInvTotal 
    217214        meas=0 
    218215        lo=0 
     
    259256        PopupMenu ywave,pos={10,60},size={154,19},title="Data File" 
    260257        PopupMenu ywave,help={"Select the experimental intensity values"} 
    261         PopupMenu ywave,mode=1,value=root:invariant:gDataPopList,proc=Inv_FilePopMenuProc 
     258        PopupMenu ywave,mode=1,value=root:myGlobals:invariant:gDataPopList,proc=Inv_FilePopMenuProc 
    262259         
    263260        Button loadButton,pos={10,90},size={130,20},proc=Inv_Load_Proc,title="Load and Plot File" 
     
    268265        Button DoneButton,help={"This button will close the panel and the associated graph"} 
    269266 
    270 //      PopupMenu wavePop_0,pos={15,9},size={139,20},title="q-values" 
    271 //      PopupMenu wavePop_0,mode=1,value= #"WaveList(\"*_q\",\";\",\"\")" 
    272 //      PopupMenu wavePop_1,pos={15,38},size={140,20},title="Intensity" 
    273 //      PopupMenu wavePop_1,mode=1,value= #"WaveList(\"*_i\",\";\",\"\")" 
    274 //      PopupMenu wavePop_2,pos={15,65},size={124,20},title="error" 
    275 //      PopupMenu wavePop_2,mode=1,value= #"WaveList(\"*_s\",\";\",\"\")" 
    276267        SetVariable setvar_0,pos={27,249},size={80,15},title="# points" 
    277         SetVariable setvar_0,limits={5,50,0},value= root:invariant:gNumLow 
     268        SetVariable setvar_0,limits={5,50,0},value= root:myGlobals:invariant:gNumLow 
    278269        SetVariable setvar_1,pos={166,249},size={80,15},title="# points" 
    279         SetVariable setvar_1,limits={5,200,0},value= root:invariant:gNumHigh 
     270        SetVariable setvar_1,limits={5,200,0},value= root:myGlobals:invariant:gNumHigh 
    280271        CheckBox check_0,pos={23,202},size={50,14},proc=LowCheckProc,title="Guinier" 
    281272        CheckBox check_0,value= 1 
     
    292283        ValDisplay valdisp0,pos={51,354},size={180,14},title="In measured Q-range " 
    293284        ValDisplay valdisp0,limits={0,0,0},barmisc={0,1000} 
    294         ValDisplay valdisp0,value= #"root:invariant:gInvMeas" 
     285        ValDisplay valdisp0,value= #"root:myGlobals:invariant:gInvMeas" 
    295286        ValDisplay valdisp0_1,pos={51,371},size={180,14},title="In low Q extrapolation " 
    296287        ValDisplay valdisp0_1,limits={0,0,0},barmisc={0,1000} 
    297         ValDisplay valdisp0_1,value= #"root:invariant:gInvLowQ" 
     288        ValDisplay valdisp0_1,value= #"root:myGlobals:invariant:gInvLowQ" 
    298289        ValDisplay valdisp0_2,pos={51,388},size={180,14},title="In high Q extrapolation " 
    299290        ValDisplay valdisp0_2,limits={0,0,0},barmisc={0,1000} 
    300         ValDisplay valdisp0_2,value= #"root:invariant:gInvHighQ" 
     291        ValDisplay valdisp0_2,value= #"root:myGlobals:invariant:gInvHighQ" 
    301292        ValDisplay valdisp0_3,pos={51,411},size={180,14},title="TOTAL " 
    302293        ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000} 
    303         ValDisplay valdisp0_3,value= #"root:invariant:gInvTotal" 
     294        ValDisplay valdisp0_3,value= #"root:myGlobals:invariant:gInvTotal" 
    304295         
    305296        CheckBox check0,pos={10,116},size={101,14},proc=SlitSmearedCheckProc,title="Slit-Smeared Data" 
    306         CheckBox check0,value= root:invariant:gIsSlitSmeared 
     297        CheckBox check0,value= root:myGlobals:invariant:gIsSlitSmeared 
    307298        SetVariable setvar0,pos={136,116},size={130,15},title="Slit Height (1/A)" 
    308         SetVariable setvar0,limits={-inf,inf,0},value= root:invariant:gDqv 
     299        SetVariable setvar0,limits={-inf,inf,0},value= root:myGlobals:invariant:gDqv 
    309300         
    310301        //set up a dependency to calculate the total invariant 
    311         root:invariant:gInvTotal := root:invariant:gInvLowQ + root:invariant:gInvMeas + root:invariant:gInvHighQ 
     302        root:myGlobals:invariant:gInvTotal := root:myGlobals:invariant:gInvLowQ + root:myGlobals:invariant:gInvMeas + root:myGlobals:invariant:gInvHighQ 
    312303EndMacro 
    313304 
     
    325316        Variable inv,num 
    326317         
    327         SVAR QWave = root:invariant:QWave 
     318        SVAR QWave = root:myGlobals:invariant:QWave 
    328319        Wave qw=$QWave 
    329         SVAR IWave = root:invariant:IWave 
     320        SVAR IWave = root:myGlobals:invariant:IWave 
    330321        Wave iw=$IWave 
    331322         
    332         NVAR isSlitSmeared=root:invariant:gIsSlitSmeared 
     323        NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 
    333324        if(isSlitSmeared) 
    334325                inv = Invariant_SlitSmeared(qw,iw) 
     
    341332         
    342333        // update the global display on the panel (there is a dependency for the total) 
    343         NVAR val = root:invariant:gInvMeas 
     334        NVAR val = root:myGlobals:invariant:gInvMeas 
    344335        val = inv 
    345336         
     
    362353//      print "yesGuinier = ",yesGuinier 
    363354        //number of points to use for fit 
    364         NVAR nbeg=root:invariant:gNumLow 
     355        NVAR nbeg=root:myGlobals:invariant:gNumLow 
    365356        //define the waves 
    366357        Wave extr_lqi=extr_lqi 
    367358        Wave extr_lqq=extr_lqq 
    368359         
    369         SVAR QWave = root:invariant:QWave 
     360        SVAR QWave = root:myGlobals:invariant:QWave 
    370361        Wave qw=$QWave 
    371         SVAR IWave = root:invariant:IWave 
     362        SVAR IWave = root:myGlobals:invariant:IWave 
    372363        Wave iw=$IWave 
    373         SVAR SWave = root:invariant:SWave 
     364        SVAR SWave = root:myGlobals:invariant:SWave 
    374365        Wave sw=$SWave 
    375366         
     
    398389         
    399390        //calculate the invariant 
    400         NVAR isSlitSmeared=root:invariant:gIsSlitSmeared 
     391        NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 
    401392        if(isSlitSmeared) 
    402393                inv = Invariant_SlitSmeared(extr_lqq,extr_lqi) 
     
    409400         
    410401        // update the global display on the panel (there is a dependency for the total) 
    411         NVAR val = root:invariant:gInvLowQ 
     402        NVAR val = root:myGlobals:invariant:gInvLowQ 
    412403        val = inv 
    413404         
     
    428419        Wave extr_hqi=extr_hqi 
    429420        Wave extr_hqq=extr_hqq 
    430         SVAR QWave = root:invariant:QWave 
     421        SVAR QWave = root:myGlobals:invariant:QWave 
    431422        Wave qw=$QWave 
    432         SVAR IWave = root:invariant:IWave 
     423        SVAR IWave = root:myGlobals:invariant:IWave 
    433424        Wave iw=$IWave 
    434         SVAR SWave = root:invariant:SWave 
     425        SVAR SWave = root:myGlobals:invariant:SWave 
    435426        Wave sw=$SWave 
    436427         
    437428        Variable/G V_FitMaxIters=300 
    438429        Variable num=numpnts(iw),nume,inv 
    439         NVAR nend=root:invariant:gNumHigh               //number of points for the fit 
     430        NVAR nend=root:myGlobals:invariant:gNumHigh             //number of points for the fit 
    440431 
    441432        Make/O/D P_coef={0,1,-4}                        //input 
     
    448439         
    449440        //calculate the invariant 
    450         NVAR isSlitSmeared=root:invariant:gIsSlitSmeared 
     441        NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 
    451442        if(isSlitSmeared) 
    452443                inv = Invariant_SlitSmeared(extr_hqq,extr_hqi) 
     
    459450         
    460451        // update the global display on the panel (there is a dependency for the total) 
    461         NVAR val = root:invariant:gInvHighQ 
     452        NVAR val = root:myGlobals:invariant:gInvHighQ 
    462453        val = inv 
    463454         
     
    472463                DoWindow/K $"Invariant_Graph" 
    473464        endif 
    474         if (DatafolderExists("root:invariant")) 
    475                 KillDatafolder root:invariant 
    476         endif 
     465        if (DatafolderExists("root:myGlobals:invariant")) 
     466                KillDatafolder root:myGlobals:invariant 
     467        endif 
     468        SetDataFolder root: 
     469        Killwaves/Z integrand,G_coef,P_coef,extr_hqq,extr_hqi,extr_lqq,extr_lqi 
    477470        Execute/P "DELETEINCLUDE \"Invariant\"" 
    478471        Execute/P "COMPILEPROCEDURES " 
     
    510503                tempStr = "Pick the data path" 
    511504        Endif 
    512         String/G root:invariant:gDataPopList =tempStr 
     505        String/G root:myGlobals:invariant:gDataPopList =tempStr 
    513506        ControlUpdate/W=Invariant_Panel ywave 
    514507         
     
    581574         
    582575        //load in the data (into the root directory) 
    583         A_LoadOneDDataWithName(tempName) 
     576        A_LoadOneDDataWithName(tempName,0) 
    584577        //Print S_fileName 
    585578        //Print tempName 
    586579         
    587         String cleanLastFileName = "root:"+CleanupName(root:myGlobals:gLastFileName,0) 
     580        String cleanLastFileName = CleanupName(root:myGlobals:gLastFileName,0) 
     581        String dataStr = "root:"+cleanLastFileName+":" 
    588582         
    589583        // keep global copies of the names rather than reading from the popup 
    590         tempName=cleanLastFileName+"_q" 
    591         String/G root:invariant:QWave=tempName 
    592         tempName=cleanLastFileName+"_i" 
    593         String/G root:invariant:IWave=tempName 
    594         tempName=cleanLastFileName+"_s" 
    595         String/G root:invariant:SWave=tempName 
     584        tempName=dataStr + cleanLastFileName+"_q" 
     585        String/G root:myGlobals:invariant:QWave=tempName 
     586        tempName=dataStr + cleanLastFileName+"_i" 
     587        String/G root:myGlobals:invariant:IWave=tempName 
     588        tempName=dataStr + cleanLastFileName+"_s" 
     589        String/G root:myGlobals:invariant:SWave=tempName 
    596590 
    597591        //Plot, and adjust the scaling to match the axis scaling set by the popups 
     
    618612        Variable checked 
    619613 
    620         NVAR isSlitSmeared=root:invariant:gIsSlitSmeared 
     614        NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 
    621615        SVAR fileStr=root:myGlobals:gLastFileName 
    622616         
     
    626620        if(checked)             //get the smearing info 
    627621                String cleanLastFileName = "root:"+CleanupName(fileStr,0) 
    628                 NVAR dQv=root:invariant:gDqv 
     622                NVAR dQv=root:myGlobals:invariant:gDqv 
    629623                String tempName = cleanLastFileName+"sq" 
    630624                Wave/Z w=$tempName 
Note: See TracChangeset for help on using the changeset viewer.