Changeset 139 for sans/SASCalc


Ignore:
Timestamp:
Aug 3, 2007 5:16:46 PM (16 years ago)
Author:
srkline
Message:

Added the option for an arbitrary diameter of sample aperture

-the aperture must still be circular, as the resolution calculations require circular apertures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/SASCalc/trunk/SASCALC.ipf

    r84 r139  
    2828// - "simulation" of data and error bars given a model and a total number of detector counts 
    2929// - streamline code (globals needed in panel vs. wave needed for calculation) 
     30// 
     31// - there is a lot of re-calculation of things (a consequence of the fake-OO) that could be streamlined 
    3032// 
    3133// Done: 
     
    8587        String/G root:SAS:gSourceApString = "1.43 cm;2.54 cm;3.81 cm;" 
    8688        String/G root:SAS:gDeltaLambdaStr = "0.11;0.15;0.34;" 
    87         String/G root:SAS:gApPopStr = "1/16\";1/8\";3/16\";1/4\";5/16\";3/8\";7/16\";1/2\";9/16\";5/8\";11/16\";3/4\";" 
     89        String/G root:SAS:gApPopStr = "1/16\";1/8\";3/16\";1/4\";5/16\";3/8\";7/16\";1/2\";9/16\";5/8\";11/16\";3/4\";other;" 
     90        Variable/G root:SAS:gSamApOther = 10            //non-standard aperture diameter, in mm 
    8891         
    8992        //tick labels for SDD slider 
     
    302305        SetDataFolder fldrSav0 
    303306         
     307        SetVariable setvar0_3,pos={140,94},size={110,15},title="Diam (mm)",disable=1 
     308        SetVariable setvar0_3,limits={0,100,0.1},value= root:SAS:gSamApOther,proc=SourceApOtherSetVarProc 
    304309        // set up a fake dependency to trigger recalculation 
    305310        //root:SAS:gCalculate := ReCalculateInten(root:SAS:gTouched) 
     
    530535        return(0) 
    531536End 
     537 
    532538 
    533539// change the wavelength spread 
     
    12841290end 
    12851291 
     1292// change the sample aperture to a non-standard value 
     1293Function SourceApOtherSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl 
     1294        String ctrlName 
     1295        Variable varNum 
     1296        String varStr 
     1297        String varName 
     1298                 
     1299        WAVE rw=root:SAS:realsRead 
     1300        rw[24] = varNum                 //sample aperture diameter in mm 
     1301        ReCalculateInten(1) 
     1302        return(0) 
     1303End 
     1304 
    12861305//parses the control for A2 diam 
    12871306// updates the wave and global 
     
    12901309        ControlInfo popup0_1 
    12911310         
     1311//      Print "In sampleApertureDiam()" 
    12921312        //set the global 
    12931313        NVAR a2=root:SAS:gSamAp 
    1294         //1st item is 1/16", popup steps by 1/16" 
    1295         a2 = 2.54/16.0 * (V_Value) 
    1296          
     1314         
     1315        if(cmpstr(S_Value,"other") == 0)                // "other" selected 
     1316                //enable the setvar, diameter in mm! 
     1317                SetVariable setvar0_3 disable=0 
     1318                // read its value (a global) 
     1319                NVAR a2other = root:SAS:gSamApOther 
     1320                a2=a2other/10                           //a2 in cm 
     1321        else 
     1322                SetVariable setvar0_3 disable=1 
     1323                //1st item is 1/16", popup steps by 1/16" 
     1324                a2 = 2.54/16.0 * (V_Value)                      //convert to cm          
     1325        endif 
    12971326        WAVE rw=root:SAS:realsRead 
    12981327        rw[24] = a2*10                  //sample aperture diameter in mm 
Note: See TracChangeset for help on using the changeset viewer.