Changeset 3147


Ignore:
Timestamp:
Nov 2, 2017 9:13:23 AM (4 years ago)
Author:
vondreele
Message:

for image integration use linear interpolation to fill in bins with no pixels based on nearest filled bins.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r3136 r3147  
    2525import scipy.signal as scsg
    2626import scipy.cluster.vq as scvq
     27import scipy.interpolate as scint
    2728import copy
    2829import GSASIIpath
     
    944945            del tax; del tay; del taz; del tad; del tabs
    945946    t0 = time.time()
     947    H2 = np.array([tth for tth in np.linspace(lutth[0],lutth[1],numChans+1)])
    946948    NST = np.array(NST,dtype=np.float)
    947     H0 = np.divide(H0,NST)
     949    #prepare masked arrays of bins with pixels for interpolation setup
     950    H2msk = [ma.array(H2[:-1],mask=np.logical_not(nst)) for nst in NST]
     951    H0msk = [ma.array(np.divide(h0,nst),mask=np.logical_not(nst)) for nst,h0 in zip(NST,H0)]
     952    #make linear interpolators; outside limits give NaN
     953    H0int = [scint.interp1d(h2msk.compressed(),h0msk.compressed(),bounds_error=False) for h0msk,h2msk in zip(H0msk,H2msk)]
     954    #do interpolation on all points - fills in the empty bins; leaves others the same
     955    H0 = np.array([h0int(H2[:-1]) for h0int in H0int])
    948956    H0 = np.nan_to_num(H0)
    949     H2 = np.array([tth for tth in np.linspace(lutth[0],lutth[1],numChans+1)])
    950957    if 'log(q)' in data.get('binType',''):
    951958        H2 = 2.*npasind(np.exp(H2)*data['wavelength']/(4.*np.pi))
Note: See TracChangeset for help on using the changeset viewer.