Changeset 598


Ignore:
Timestamp:
Nov 6, 2009 5:50:45 PM (13 years ago)
Author:
srkline
Message:

Procedures for mostly my use that enable me to (crudely) script the MC simulations so that they can be done in a big batch overnight.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
2 edited

Legend:

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

    r597 r598  
    10981098        Endif 
    10991099         
     1100        NVAR actSimTime = root:Packages:NIST:SAS:g_actSimTime 
     1101        String str = "" 
     1102        sprintf str,"%30s\t\t%g seconds\r","MonteCarlo Simulation time = ",actSimTime 
     1103                 
    11001104        Open refNum as fullpath+".txt" 
    11011105                wfprintf refNum, "%30s\t\t%g\r",results_desc,results 
     1106                FBinWrite refNum,str 
    11021107                FStatus refNum 
    11031108                FSetPos refNum,V_logEOF 
     
    12391244        t0 *= imon/1000/ThreadProcessorCount                    //projected time, in seconds (using threads for the calculation) 
    12401245 
     1246        Print "Estimated Simulation time (s) = ",t0 
     1247         
    12411248// to correct for detector efficiency, send only the fraction of neutrons that are actually counted      
    12421249        NVAR detectorEff = root:Packages:NIST:SAS:g_detectorEff 
     1250        NVAR actSimTime = root:Packages:NIST:SAS:g_actSimTime 
     1251        NVAR SimTimeWarn = root:Packages:NIST:SAS:g_SimTimeWarn 
    12431252 
    12441253        inputWave[0] = imon     * detectorEff                   //reset number of input neutrons before full simulation 
    12451254         
    1246         if(t0>10) 
     1255        if(t0>SimTimeWarn) 
    12471256                sprintf str,"The simulation will take approximately %d seconds.\r- Proceed?",t0 
    12481257                DoAlert 1,str 
     
    12681277        t0 = (stopMSTimer(-2) - t0)*1e-6 
    12691278        Printf  "MC sim time = %g seconds\r",t0 
     1279        actSimTime = t0 
    12701280         
    12711281        trans = results[8]                      //(n1-n2)/n1 
     
    13071317        if(!rawCts)                     //go ahead and do the linear scaling 
    13081318                linear_data = linear_data / kappa 
     1319                linear_data /= detectorEff 
    13091320        endif            
    13101321        data = linear_data 
     
    17811792        sigave[10,50;10] = 10*sigave[p] 
    17821793 
    1783         // convert to absolute scale 
     1794        // convert to absolute scale, remembering to un-correct for the detector efficiency 
    17841795        if(doABS) 
    17851796                Variable kappa = thick*(pixSize/sdd)^2*trans*iMon 
    17861797                aveint /= kappa 
    17871798                sigave /= kappa 
     1799                aveint /= detectorEff 
     1800                sigave /= detectorEff 
    17881801        endif 
    17891802                                 
     
    18371850//Function Script_2DMC() 
    18381851// 
     1852// 
     1853//      NVAR SimTimeWarn = root:Packages:NIST:SAS:g_SimTimeWarn 
     1854//      SimTimeWarn = 36000                     //sets the threshold for the warning dialog to 10 hours 
    18391855//      STRUCT WMButtonAction ba 
    18401856//      ba.eventCode = 2                        //fake mouse click on button 
    18411857//       
    18421858//      NVAR detDist = root:Packages:NIST:SAS:gDetDist 
    1843 //       
     1859// 
    18441860//      detDist = 200           //set directly in cm 
    18451861//      MC_DoItButtonProc(ba) 
     
    18541870//      SaveAsVAXButtonProc("",runIndex=107,simLabel="this is run 107, SDD = 400") 
    18551871//       
     1872// 
     1873// SimTimeWarn = 10             //back to 10 seconds for manual operation 
    18561874//      return(0) 
    18571875//end 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r597 r598  
    136136        Variable/G root:Packages:NIST:SAS:g_1D_AddNoise = 1 
    137137        Variable/G root:Packages:NIST:SAS:g_MultScattFraction=0 
    138         Variable/G root:Packages:NIST:SAS:g_detectorEff=0.75                    //averag value for most wavelengths 
     138        Variable/G root:Packages:NIST:SAS:g_detectorEff=0.75                    //average value for most wavelengths 
     139        Variable/G root:Packages:NIST:SAS:g_actSimTime = 0                              //for the save 
     140        Variable/G root:Packages:NIST:SAS:g_SimTimeWarn = 10                    //manually set to a very large value for scripted operation 
     141         
    139142         
    140143        //tick labels for SDD slider 
Note: See TracChangeset for help on using the changeset viewer.