Changeset 2043


Ignore:
Timestamp:
Nov 11, 2015 10:19:17 AM (8 years ago)
Author:
vondreele
Message:

some SS deriv work
trap G2frame.PatternId? = None (or 0) in PLotPatterns
put missing import numpy in G2img_1TIF.py

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2034 r2043  
    10771077            DataType = Iparm['INS   HTYPE '].strip()[:3]  # take 1st 3 chars
    10781078            # override inst values with values read from data file
     1079            Bank = rd.powderentry[2]    #should be used in multibank iparm files
    10791080            if rd.instdict.get('type'):
    10801081                DataType = rd.instdict.get('type')
  • trunk/GSASIImath.py

    r2041 r2043  
    10411041    Xmod = np.swapaxes(Xmod,1,2)
    10421042    D = twopi*H[:,3][:,nxs]*glTau[nxs,:]              #m*e*tau; ops X 32
    1043     HdotX = twopi*np.inner(HP,Xmod)+D[:,nxs,:]        #ops x atoms X 32
     1043    HdotX = twopi*np.inner(HP,Xmod)        #ops x atoms X 32
    10441044    HdotXD = HdotX+D[:,nxs,:]
    1045     HdotXA = HP[:,nxs,nxs,nxs,:]*np.swapaxes(XmodA,-1,-2)[nxs,:,:,:,:]+D[:,nxs,nxs,:,nxs]  #ops x atoms x waves x 32 x xyz
    1046     HdotXB = HP[:,nxs,nxs,nxs,:]*np.swapaxes(XmodB,-1,-2)[nxs,:,:,:,:]+D[:,nxs,nxs,:,nxs]
     1045    HdotXA = twopi*HP[:,nxs,nxs,nxs,:]*np.swapaxes(XmodA,-1,-2)[nxs,:,:,:,:]+D[:,nxs,nxs,:,nxs]  #ops x atoms x waves x 32 x xyz
     1046    HdotXB = twopi*HP[:,nxs,nxs,nxs,:]*np.swapaxes(XmodB,-1,-2)[nxs,:,:,:,:]+D[:,nxs,nxs,:,nxs]
    10471047    if Af.shape[1]:
    10481048        tauF = np.arange(1.,Af.shape[1]+1-nf)[:,nxs]*glTau  #Fwaves x 32
     
    10791079    dHdXA = HP[:,nxs,nxs,nxs,:]*np.swapaxes(StauX,-1,-2)[nxs,:,:,:,:]    #ops x atoms x waves x 32 x xyz
    10801080    dHdXB = HP[:,nxs,nxs,nxs,:]*np.swapaxes(CtauX,-1,-2)[nxs,:,:,:,:]              #ditto
    1081     dGdMxCa = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(-twopi*dHdXA*np.sin(twopi*HdotXA))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)
    1082     dGdMxCb = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(-twopi*dHdXB*np.sin(twopi*HdotXB))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)
     1081    dGdMxCa = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(-dHdXA*np.sin(HdotXA))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)
     1082    dGdMxCb = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(-dHdXB*np.sin(HdotXB))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)
    10831083    dGdMxC = np.concatenate((dGdMxCa,dGdMxCb),axis=-1)
    10841084# ops x atoms x waves x xyz - real part
    1085     dGdMxSa = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(twopi*dHdXA*np.cos(twopi*HdotXA))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)   
    1086     dGdMxSb = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(twopi*dHdXB*np.cos(twopi*HdotXB))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)   
     1085    dGdMxSa = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(dHdXA*np.cos(HdotXA))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)   
     1086    dGdMxSb = np.sum((Fmod*HbH)[:,:,nxs,:,nxs]*(dHdXB*np.cos(HdotXB))*glWt[nxs,nxs,nxs,:,nxs],axis=-2)   
    10871087    dGdMxS = np.concatenate((dGdMxSa,dGdMxSb),axis=-1)
    10881088# ops x atoms x waves x xyz - imaginary part
  • trunk/GSASIIplot.py

    r2040 r2043  
    10421042    global Ymax
    10431043    plottype = plotType
     1044    if not G2frame.PatternId:
     1045        return
    10441046#patch
    10451047    data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)
     
    31163118    Title += ' map for atom '+atom[0]+    \
    31173119        ' at %.4f %.4f %.4f'%(atxyz[0],atxyz[1],atxyz[2])
    3118     ix = -np.array(np.rint(rhoSize[:3]*atxyz),dtype='i')
     3120    ix = -np.array(np.rint(rhoSize[:3]*atxyz)+1,dtype='i')
    31193121    ix += (rhoSize[:3]/2)
    31203122    ix = ix%rhoSize[:3]
     
    31223124    ix = rhoSize[:3]/2
    31233125    ib = 4
     3126    hdx = [0,0,0]       #this needs to be something for an offset correction on atom positions
    31243127    if Ax == 'x':
     3128        Doff = (hdx[0]+Off)*.005
    31253129        slab = np.sum(np.sum(rho[:,ix[1]-ib:ix[1]+ib,ix[2]-ib:ix[2]+ib,:],axis=2),axis=1)
    31263130        Plot.plot(tau,wave[0])
    31273131    elif Ax == 'y':
     3132        Doff = (hdx[1]+Off)*.005
    31283133        slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,:,ix[2]-ib:ix[2]+ib,:],axis=2),axis=0)
    31293134        Plot.plot(tau,wave[1])
    31303135    elif Ax == 'z':
     3136        Doff = (hdx[2]+Off)*.005
    31313137        slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,ix[1]-ib:ix[1]+ib,:,:],axis=1),axis=0)
    31323138        Plot.plot(tau,wave[2])
     
    31373143    acolor = mpl.cm.get_cmap('RdYlGn')
    31383144    if 'delt' in MapType:
    3139         Plot.contour(Slab[:,:21],20,extent=(0.,2.,-.5+Off*.005,.5+Off*.005),cmap=acolor)
     3145        Plot.contour(Slab[:,:21],20,extent=(0.,2.,-.5+Doff,.5+Doff),cmap=acolor)
    31403146    else:
    3141         Plot.contour(Slab[:,:21],20,extent=(0.,2.,-.5+Off*.005,.5+Off*.005))
     3147        Plot.contour(Slab[:,:21],20,extent=(0.,2.,-.5+Doff,.5+Doff))
    31423148    Page.canvas.draw()
    31433149   
  • trunk/imports/G2img_1TIF.py

    r2042 r2043  
    2121import GSASIIIO as G2IO
    2222import GSASIIpath
     23import numpy as np
    2324GSASIIpath.SetVersionNumber("$Revision: $")
    2425class TIF_ReaderClass(G2IO.ImportImage):
     
    197198                    print 'Read CHESS-detector tiff file: ',filename
    198199                image = np.array(ar.array('L',File.read(4*Npix)),dtype=np.int32)
    199            
     200    elif 270 in IFD:
     201        File.seek(IFD[270][2][0])
     202        S = File.read(IFD[273][2][0]-IFD[270][2][0])
     203        if 'ImageJ' in S:
     204            tifType = 'ImageJ'
     205            dataType = 0
     206            pixy = [200,200]*IFD[277][2][0]
     207            File.seek(IFD[273][2][0])
     208            if not imageOnly:
     209                print 'Read ImageJ tiff file: ',filename
     210            image = ar.array('H',File.read(2*Npix))
     211            if '>' in byteOrd:
     212                image.byteswap()
     213            image = np.array(np.asarray(image,dtype='H'),dtype=np.int32)           
    200214    elif 262 in IFD and IFD[262][2][0] > 4:
    201215        tifType = 'DND'
     
    250264                print 'Read 11-ID-C tiff file: ',filename
    251265            image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32)
    252         elif IFD[273][2][0] == 168:
    253             tifType = 'ImageJ'
    254             dataType = 0
    255             pixy = [200,200]
    256             File.seek(IFD[273][2][0])
    257             if not imageOnly:
    258                 print 'Read ImageJ tiff file: ',filename
    259             image = ar.array('H',File.read(2*Npix))
    260             if '>' in byteOrd:
    261                 image.byteswap()
    262             image = np.array(np.asarray(image,dtype='H'),dtype=np.int32)           
    263266                   
    264267    elif sizexy == [4096,4096]:
Note: See TracChangeset for help on using the changeset viewer.