Ignore:
Timestamp:
Nov 4, 2009 4:58:52 PM (13 years ago)
Author:
srkline
Message:

changes to how a fake VAX raw data file is written out. now call accepts optional parameters so that the index and label can be supplied, and the MC simulation can be very crudely scripted for unattended operation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r589 r596  
    1111// 
    1212// 
    13  
    14  
    15  
     13// at the end of the procedure fils is a *very* simple example of scripting for unattended simulations 
     14// - not for the casual user at all. 
     15 
     16 
     17 
     18// the RNG issue is really not worth the effort. multiple copies with different RNG is as good as I need. Plus, 
     19// whatever XOP crashing was happining during threading is really unlikely to be from the RNG 
     20// 
    1621// *** look into erand48() as the (pseudo) random number generator (it's a standard c-lib function, at least on unix) 
    1722//     and is apparantly thread safe. drand48() returns values [0.0,1.0) 
    1823//http://qnxcs.unomaha.edu/help/product/neutrino/lib_ref/e/erand48.html 
    19  
     24// 
    2025 
    2126 
     
    3035// X how can I get the "data" on absolute scale? This would be a great comparison vs. the ideal model calculation 
    3136// X why does my integrated tau not match up with John's analytical calculations? where are the assumptions? 
    32 // - get rid of all small angle assumptions - to make sure that the calculation is correct at all angles 
     37// X get rid of all small angle assumptions - to make sure that the calculation is correct at all angles 
    3338 
    3439// 
     
    7277// 
    7378// 
     79 
     80 
     81 
     82 
    7483 
    7584// setting the flag to 1 == 2D simulation 
     
    10431052// currently hard-wired for SAS data folder 
    10441053// 
    1045 Function SaveAsVAXButtonProc(ctrlName) : ButtonControl 
     1054Function SaveAsVAXButtonProc(ctrlName,[runIndex,simLabel]) 
    10461055        String ctrlName 
    1047  
     1056        Variable runIndex 
     1057        String simLabel 
     1058 
     1059         
     1060        // if default parameters were passed in, use them 
     1061        // if not, set them to "bad" values so that the user will be prompted later      
     1062        NVAR autoSaveIndex = root:Packages:NIST:SAS:gAutoSaveIndex 
     1063        SVAR autoSaveLabel = root:Packages:NIST:SAS:gAutoSaveLabel 
     1064         
     1065        // Determine if the optional parameters were supplied 
     1066        if( ParamIsDefault(runIndex))           //==1 if parameter was NOT specified 
     1067                print "runIndex not specified" 
     1068                autoSaveIndex=0                                 // 0 == bad value, test for this later 
     1069        else 
     1070                autoSaveIndex=runIndex 
     1071        endif 
     1072         
     1073        if( ParamIsDefault(simLabel))           //==1 if parameter was NOT specified 
     1074                print "simLabel not specified" 
     1075                autoSaveLabel=""                                        // "" == bad value, test for this later 
     1076        else 
     1077                autoSaveLabel=simLabel 
     1078        endif 
     1079         
    10481080        String fullpath="",destStr="" 
    10491081        Variable refnum 
     
    17851817        return(mScat) 
    17861818End 
     1819 
     1820 
     1821//// this is a very simple example of how to script the MC simulation to run unattended 
     1822// 
     1823//  you need to supply for each "run":  the run index (you increment manually) 
     1824//                                                                                              the sample label (as a string) 
     1825// 
     1826// changing the various configuration paramters will have to be done on a case-by-case basis 
     1827// looking into SASCALC to see what is really changed, 
     1828// or the configuration parameters of the MC_SASCALC panel  
     1829// 
     1830// 
     1831//Function Script_2DMC() 
     1832// 
     1833//      STRUCT WMButtonAction ba 
     1834//      ba.eventCode = 2                        //fake mouse click on button 
     1835//       
     1836//      NVAR detDist = root:Packages:NIST:SAS:gDetDist 
     1837//       
     1838//      detDist = 200           //set directly in cm 
     1839//      MC_DoItButtonProc(ba) 
     1840//      SaveAsVAXButtonProc("",runIndex=105,simLabel="this is run 105, SDD = 200") 
     1841//       
     1842//      detDist = 300           //set directly in cm 
     1843//      MC_DoItButtonProc(ba) 
     1844//      SaveAsVAXButtonProc("",runIndex=106,simLabel="this is run 106, SDD = 300") 
     1845// 
     1846//      detDist = 400           //set directly in cm 
     1847//      MC_DoItButtonProc(ba) 
     1848//      SaveAsVAXButtonProc("",runIndex=107,simLabel="this is run 107, SDD = 400") 
     1849//       
     1850//      return(0) 
     1851//end 
Note: See TracChangeset for help on using the changeset viewer.