- Timestamp:
- Nov 4, 2009 4:58:52 PM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf
r589 r596 11 11 // 12 12 // 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 // 16 21 // *** look into erand48() as the (pseudo) random number generator (it's a standard c-lib function, at least on unix) 17 22 // and is apparantly thread safe. drand48() returns values [0.0,1.0) 18 23 //http://qnxcs.unomaha.edu/help/product/neutrino/lib_ref/e/erand48.html 19 24 // 20 25 21 26 … … 30 35 // X how can I get the "data" on absolute scale? This would be a great comparison vs. the ideal model calculation 31 36 // 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 angles37 // X get rid of all small angle assumptions - to make sure that the calculation is correct at all angles 33 38 34 39 // … … 72 77 // 73 78 // 79 80 81 82 74 83 75 84 // setting the flag to 1 == 2D simulation … … 1043 1052 // currently hard-wired for SAS data folder 1044 1053 // 1045 Function SaveAsVAXButtonProc(ctrlName ) : ButtonControl1054 Function SaveAsVAXButtonProc(ctrlName,[runIndex,simLabel]) 1046 1055 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 1048 1080 String fullpath="",destStr="" 1049 1081 Variable refnum … … 1785 1817 return(mScat) 1786 1818 End 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 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r583 r596 1868 1868 String type,fullpath 1869 1869 Variable dialog //=1 will present dialog for name 1870 1870 1871 1871 String filename = "" 1872 1872 filename = Write_VAXRaw_Data(type,fullpath,dialog) … … 2358 2358 // simulated VAX data file. 2359 2359 // 2360 // NCNR-Specific 2360 2361 // 2361 2362 Function SimulationVAXHeader(folder) … … 2404 2405 tw[9] = "ORNL " 2405 2406 2407 2408 //get the run index and the sample label from the optional parameters, or from a dialog 2406 2409 NVAR index = root:Packages:NIST:SAS:gSaveIndex 2407 2410 SVAR prefix = root:Packages:NIST:SAS:gSavePrefix 2408 2409 2410 2411 String labelStr=" " 2412 Variable runNum = index 2413 Prompt labelStr, "Enter sample label " // Set prompt for x param 2414 Prompt runNum,"Run Number (automatically increments)" 2415 DoPrompt "Enter sample label", labelStr,runNum 2416 if (V_Flag) 2417 //Print "no sample label entered - no file written" 2418 //index -=1 2419 return -1 // User canceled 2411 // did the user pass in values? 2412 NVAR autoSaveIndex = root:Packages:NIST:SAS:gAutoSaveIndex 2413 SVAR autoSaveLabel = root:Packages:NIST:SAS:gAutoSaveLabel 2414 2415 String labelStr="" 2416 Variable runNum 2417 if( (autoSaveIndex != 0) && (strlen(autoSaveLabel) > 0) ) 2418 // all is OK, proceed with the save 2419 labelStr = autoSaveLabel 2420 runNum = autoSaveIndex //user must take care of incrementing this! 2421 else 2422 //one or the other, or both are missing, so ask 2423 runNum = index 2424 Prompt labelStr, "Enter sample label " // Set prompt for x param 2425 Prompt runNum,"Run Number (automatically increments)" 2426 DoPrompt "Enter sample label", labelStr,runNum 2427 if (V_Flag) 2428 //Print "no sample label entered - no file written" 2429 //index -=1 2430 return -1 // User canceled 2431 endif 2432 if(runNum != index) 2433 index = runNum 2434 endif 2435 index += 1 2420 2436 endif 2421 2437 2422 if(runNum != index) 2423 index = runNum 2424 endif 2425 index += 1 2438 2426 2439 2427 2440 //make a three character string of the run number -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r583 r596 124 124 Variable/G root:Packages:NIST:SAS:gSaveIndex = 100 125 125 String/G root:Packages:NIST:SAS:gSavePrefix = "SIMUL" 126 Variable/G root:Packages:NIST:SAS:gAutoSaveIndex = 100 //a way to set the index for automated saves 127 String/G root:Packages:NIST:SAS:gAutoSaveLabel = "" //a way to set the "sample" label for automated saves 126 128 Make/O/D/N=10 root:Packages:NIST:SAS:results = 0 127 129 Make/O/T/N=10 root:Packages:NIST:SAS:results_desc = {"total X-section (1/cm)","SAS X-section (1/cm)","number that scatter","number that reach detector","avg # times scattered","fraction single coherent","fraction multiple coherent","fraction multiple scattered","fraction transmitted","detector counts w/beamstop"}
Note: See TracChangeset
for help on using the changeset viewer.