Changeset 2334


Ignore:
Timestamp:
Jun 20, 2016 1:23:28 PM (5 years ago)
Author:
vondreele
Message:

fix mask array issue with si.interp1d in scipy 17.0+; use ma.getdata to use nonmasked data
fix problem with update of anomalous scattering density on copy substances for small angle stuff
fix this in AddSubstance? also.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r2239 r2334  
    2222import scipy as sp
    2323import numpy.linalg as nl
     24import numpy.ma as ma
    2425import random as rand
    2526from numpy.fft import ifft, fft, fftshift
     
    616617                bakVals[i] = parmDict[pfx+'Back;'+str(i)]
    617618            bakInt = si.interp1d(bakPos,bakVals,'linear')
    618             yb = bakInt(xdata)
     619            yb = bakInt(ma.getdata(xdata))
    619620        sumBk[0] = np.sum(yb)
    620621#Debye function       
  • trunk/GSASIIpwdGUI.py

    r2310 r2334  
    831831        xFin = np.searchsorted(pwddata[0],limits[1])
    832832        xdata = pwddata[0][xBeg:xFin]
    833         ydata = si.interp1d(X,Y)(xdata)
     833        ydata = si.interp1d(X,Y)(ma.getdata(xdata))
    834834        #GSASIIpath.IPyBreak()
    835835        W = [1]*len(xdata)
     
    35043504        for item in copyList:
    35053505            Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item)
    3506             G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Substances'),
    3507                 copy.copy(data))
     3506            Inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Instrument Parameters'))[0]
     3507            wave = G2mth.getWave(Inst)
     3508            ndata = copy.deepcopy(data)
     3509            for name in ndata['Substances'].keys():
     3510                contrst,absorb = G2mth.XScattDen(ndata['Substances'][name]['Elements'],ndata['Substances'][name]['Volume'],wave)         
     3511                ndata['Substances'][name]['XAnom density'] = contrst
     3512                ndata['Substances'][name]['XAbsorption'] = absorb
     3513            G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Substances'),ndata)
    35083514   
    35093515    def OnAddSubstance(event):
     
    35633569                Info.update({'Num':1})
    35643570                data['Substances'][name]['Elements'][El] = Info
    3565                 data['Substances'][name]['Volume'] = G2mth.El2EstVol(data['Substances'][name]['Elements'])
    3566                 data['Substances'][name]['Density'] = \
    3567                     G2mth.Vol2Den(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'])
    3568                 data['Substances'][name]['Scatt density'] = \
    3569                     G2mth.XScattDen(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'])[0]
    3570                 contrst,absorb = G2mth.XScattDen(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'],wave)         
    3571                 data['Substances'][name]['XAnom density'] = contrst
    3572                 data['Substances'][name]['XAbsorption'] = absorb
     3571            data['Substances'][name]['Volume'] = G2mth.El2EstVol(data['Substances'][name]['Elements'])
     3572            data['Substances'][name]['Density'] = \
     3573                G2mth.Vol2Den(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'])
     3574            data['Substances'][name]['Scatt density'] = \
     3575                G2mth.XScattDen(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'])[0]
     3576            contrst,absorb = G2mth.XScattDen(data['Substances'][name]['Elements'],data['Substances'][name]['Volume'],wave)         
     3577            data['Substances'][name]['XAnom density'] = contrst
     3578            data['Substances'][name]['XAbsorption'] = absorb
    35733579        dlg.Destroy()
    35743580       
Note: See TracChangeset for help on using the changeset viewer.