Ignore:
Timestamp:
Mar 28, 2019 11:12:06 AM (4 years ago)
Author:
srkline
Message:

1) speed improvement (2x + faster) in recalculation of VCALC configuration by using multithreading where possible.

2) Important bug fix for USANS to account for data collected in q-values, where each point is collected for a different lenght of time. This change had unintended consequences for normalization and dead time corrections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf

    r1134 r1137  
    153153//////////////////// 
    154154         
    155         prob_i = trans*thick*pixSizeX*pixSizeY/(sdd)^2*tmpInten                 //probability of a neutron in q-bin(i)  
     155        MultiThread prob_i = trans*thick*pixSizeX*pixSizeY/(sdd)^2*tmpInten                     //probability of a neutron in q-bin(i)  
    156156                 
    157157        tmpInten = (imon)*prob_i                //tmpInten is not the model calculation anymore!! 
     
    159159 
    160160/// **** can I safely assume a Gaussian error in the count rate?? 
    161         tmpSig = sqrt(tmpInten)         // corrected based on John's memo, from 8/9/99 
    162  
    163         tmpInten += gnoise(tmpSig) 
    164         tmpInten = (tmpInten[p][q] < 0) ? 0 : tmpInten[p][q]                    // MAR 2013 -- is this the right thing to do 
     161        MultiThread tmpSig = sqrt(tmpInten)             // corrected based on John's memo, from 8/9/99 
     162 
     163        MultiThread tmpInten += gnoise(tmpSig) 
     164        MultiThread tmpInten = (tmpInten[p][q] < 0) ? 0 : tmpInten[p][q]                        // MAR 2013 -- is this the right thing to do 
    165165        tmpInten = trunc(tmpInten) 
    166166                 
     
    205205        // loop over the array and calculate the values - this is done as a wave assignment 
    206206// TODO -- be sure that it's p,q -- or maybe p+1,q+1 as used in WriteQIS.ipf     
    207         qTot = VC_CalcQval(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    208         qx = VC_CalcQX(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    209         qy = VC_CalcQY(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    210         qz = VC_CalcQZ(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     207        MultiThread qTot = VC_CalcQval(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     208        MultiThread     qx = VC_CalcQX(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     209        MultiThread     qy = VC_CalcQY(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     210        MultiThread     qz = VC_CalcQZ(p,q,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    211211         
    212212        return(0) 
     
    411411// 
    412412// 
    413 Function VC_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     413Threadsafe Function VC_CalcQval(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    414414        Variable xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY 
    415415         
     
    438438// now properly accounts for qz 
    439439// 
    440 Function VC_CalcQX(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     440Threadsafe Function VC_CalcQX(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    441441        Variable xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY 
    442442 
     
    468468// now properly accounts for qz 
    469469// 
    470 Function VC_CalcQY(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     470Threadsafe Function VC_CalcQY(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    471471        Variable xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY 
    472472         
     
    497497// not actually used, but here for completeness if anyone asks 
    498498// 
    499 Function VC_CalcQZ(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
     499Threadsafe Function VC_CalcQZ(xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY) 
    500500        Variable xaxval,yaxval,xctr,yctr,sdd,lam,pixSizeX,pixSizeY 
    501501         
Note: See TracChangeset for help on using the changeset viewer.