Changeset 104


Ignore:
Timestamp:
Jul 6, 2010 7:10:54 AM (13 years ago)
Author:
vondreel
Message:

new fortran binning routine added

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r101 r104  
    522522    numAzms = data['outAzimuths']
    523523    numChans = data['outChannels']
    524     NST = np.zeros(shape=(numAzms,numChans),dtype=int,order='F')
     524    t0 = time.time()
     525    NST = np.zeros(shape=(numAzms,numChans),dtype=np.int,order='F')
    525526    H0 = np.zeros(shape=(numAzms,numChans),order='F')
    526527    H1 = np.zeros(shape=(numAzms+1,))
     
    528529    NST,H0,H1,H2 = h2d.histogram2d(len(tax),tax,tay,taz,numAzms,numChans,LRazm,LUtth,NST,H0,H1,H2)
    529530    HST = [H0,H1,H2]
     531    print "Binning elapsed time:","%8.3f"%(time.time()-t0), "s"
    530532    return NST,HST
    531533
     
    550552        dlg.Update(3)
    551553        print 'Form normalized 1D pattern(s)'
    552         self.Integrate = [HST[0]/NST[0],HST[1],HST[2]]
     554        self.Integrate = [HST[0]/NST,HST[1],HST[2]]
    553555        del NST,HST
    554556        dlg.Update(4)
  • trunk/fsource/histogram2d.for

    r100 r104  
    1414Cf2py intent(in) YLIM
    1515Cf2py intent(in,out) NST
    16 Cf2py depend(NXBINS,NYBINS)
     16Cf2py depend(NXBINS,NYBINS) NST
    1717Cf2py intent(in,out) HST
    18 Cf2py depend(NXBINS,NYBINS)
     18Cf2py depend(NXBINS,NYBINS) HST
    1919Cf2py intent(in,out) HSTX
    20 Cf2py depend(NXBINS)
     20Cf2py depend(NXBINS) HSTX
    2121Cf2py intent(in,out) HSTY
    22 Cf2py depend(NYBINS)
     22Cf2py depend(NYBINS) HSTY
    2323
    2424      IMPLICIT NONE
     
    4343        HSTY(J) = YLIM(0)+FLOAT(J)*DY
    4444      END DO
    45 
    46       DO K=0,N
     45     
     46      DO K=0,N-1
    4747        IF ( ( X(K) .GE. XLIM(0) .AND. X(K) .LE. XLIM(1)) .AND.
    4848     1    (Y(K) .GE. YLIM(0) .AND. Y(K). LE. YLIM(1)) ) THEN
    49           I = INT((X(K)-XLIM(0))/DX)
    50           J = INT((Y(K)-YLIM(0))/DY)
     49          I = NINT((X(K)-XLIM(0))/DX+0.5)-1
     50          J = NINT((Y(K)-YLIM(0))/DY+0.5)-1
    5151          NST(I,J) = NST(I,J)+1
    5252          HST(I,J) = HST(I,J)+Z(K)
Note: See TracChangeset for help on using the changeset viewer.