Ignore:
Timestamp:
Nov 3, 2008 12:48:40 PM (14 years ago)
Author:
srkline
Message:

More tweaking of the MonteCarlo?, trying in vain to thread the XOP. As is, works fine with the XOP and single threading.

File:
1 edited

Legend:

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

    r431 r434  
    106106        Variable/G root:Packages:NIST:SAS:gThick = 0.1 
    107107        Variable/G root:Packages:NIST:SAS:gSig_incoh = 0.1 
    108         String/G root:Packages:NIST:SAS:gFuncStr = "SphereForm" 
     108        String/G root:Packages:NIST:SAS:gFuncStr = "" 
    109109        Variable/G root:Packages:NIST:SAS:gR2 = 2.54/2   
    110110        Variable/G root:Packages:NIST:SAS:gDoMonteCarlo = 0      
    111111        Make/O/D/N=10 root:Packages:NIST:SAS:results = 0 
    112         Make/O/T/N=10 root:Packages:NIST:SAS:results_desc = {"total X-section (1/cm)","SAS X-section (1/cm)","# reaching detector","fraction reaching detector","# that interact","fraction singly scattered","fraction transmitted","","",""} 
     112        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 double coherent","fraction multiple scattered","fraction transmitted","-"} 
    113113         
    114114        //tick labels for SDD slider 
     
    711711                inputWave[10] = sig_sas 
    712712 
    713                 //initialize ran1 in the XOP by passing a negative integer 
    714                 // does nothing in the Igor code 
    715                 results[0] = -1*trunc(datetime)/10 
    716  
    717 //              Variable t0 = stopMStimer(-2) 
    718          
    719 #if exists("Monte_SANSX") 
    720         Monte_SANSX(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    721 #else 
    722         Monte_SANS(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    723 #endif 
    724 //              t0 = (stopMSTimer(-2) - t0)*1e-6 
    725 //              Printf  "Mc sim time = %g seconds\r\r",t0        
     713                Variable t0 = stopMStimer(-2) 
     714         
     715// threading crashes - there must be some operation in the XOP that is not threadSafe. What, I don't know... 
     716//              xMonte_SANS_Threaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
     717                Monte_SANS_NotThreaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
     718 
     719                t0 = (stopMSTimer(-2) - t0)*1e-6 
     720                Printf  "MC sim time = %g seconds\r\r",t0 
    726721                 
     722                Variable trans 
     723                trans = results[8]                      //(n1-n2)/n1 
     724 
    727725                // convert to absolute scale 
    728726                Variable kappa,beaminten = beamIntensity() 
    729                 // results[6] is the fraction transmitted 
    730 //              kappa = beamInten*pi*r1*r1*thick*(pixSize/sdd)^2*results[6]*(iMon/beaminten) 
    731                 kappa = thick*(pixSize/sdd)^2*results[6]*iMon 
     727//              kappa = beamInten*pi*r1*r1*thick*(pixSize/sdd)^2*trans*(iMon/beaminten) 
     728                kappa = thick*(pixSize/sdd)^2*trans*iMon 
    732729 
    733730                linear_data = linear_data / kappa 
    734731                linear_data[xCtr][yCtr] = 0                     //snip out the transmitted spike 
    735732                data = linear_data 
    736          
     733                 
     734//              print sum(linear_data), kappa 
     735 
    737736        endif 
    738737         
     
    15671566        NVAR val = root:Packages:NIST:SAS:gOffset 
    15681567        rw[19] = val            // already in cm 
    1569         //move the beamcenter 
    1570         rw[16] = 64 + 2*rw[19]          //approximate beam X is 64 w/no offset, 114 w/25 cm offset 
     1568        //move the beamcenter, make it an integer value for the MC simulation 
     1569        rw[16] = 64 + round(2*rw[19])           //approximate beam X is 64 w/no offset, 114 w/25 cm offset  
    15711570        rw[17] = 64             //typical value 
    15721571         
Note: See TracChangeset for help on using the changeset viewer.