Changeset 1646


Ignore:
Timestamp:
Feb 11, 2015 1:33:27 PM (7 years ago)
Author:
vondreele
Message:

allow search for negative density peaks in charge flip and Fourier maps
plot negative density in neutron maps & negative peaks in red

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r1645 r1646  
    20802080    return mapData,map4DData
    20812081   
    2082 def SearchMap(generalData,drawingData):
     2082def SearchMap(generalData,drawingData,Neg=False):
    20832083    '''Does a search of a density map for peaks meeting the criterion of peak
    20842084    height is greater than mapData['cutOff']/100 of mapData['rhoMax'] where
    20852085    mapData is data['General']['mapData']; the map is also in mapData.
    20862086
    2087     :param data: the phase data structure
     2087    :param generalData: the phase data structure; includes the map
     2088    :param drawingData: the drawing data structure
     2089    :param Neg:  if True then search for negative peaks (i.e. H-atoms & neutron data)
    20882090
    20892091    :returns: (peaks,mags,dzeros) where
     
    21582160        mapData = generalData['Map']
    21592161        contLevel = mapData['cutOff']*mapData['rhoMax']/100.
    2160         rho = copy.copy(mapData['rho'])     #don't mess up original
     2162        if Neg:
     2163            rho = -copy.copy(mapData['rho'])     #flip +/-
     2164        else:
     2165            rho = copy.copy(mapData['rho'])     #don't mess up original
    21612166        mapHalf = np.array(rho.shape)/2
    21622167        res = mapData['Resolution']
     
    21932198        rho = rollMap(rho,-ind)       
    21942199    dzeros = np.sqrt(np.sum(np.inner(Amat,peaks)**2,axis=0))
    2195     return np.array(peaks),np.array([mags,]).T,np.array([dzeros,]).T
     2200    if Neg:     #want negative magnitudes for negative peaks
     2201        return np.array(peaks),-np.array([mags,]).T,np.array([dzeros,]).T
     2202    else:
     2203        return np.array(peaks),np.array([mags,]).T,np.array([dzeros,]).T
    21962204   
    21972205def sortArray(data,pos,reverse=False):
  • trunk/GSASIIphsGUI.py

    r1639 r1646  
    56475647            try:
    56485648                peaks,mags,dzeros = G2mth.SearchMap(generalData,drawingData)
     5649                if 'N' in mapData['Type']:      #look for negatives in neutron maps
     5650                    npeaks,nmags,ndzeros = G2mth.SearchMap(generalData,drawingData,Neg=True)
     5651                    peaks = np.concatenate((peaks,npeaks))
     5652                    mags = np.concatenate((mags,nmags))
     5653                    dzeros = np.concatenate((dzeros,ndzeros))
    56495654            finally:
    56505655                wx.EndBusyCursor()
  • trunk/GSASIIplot.py

    r1645 r1646  
    41214121   
    41224122    def OnKeyBox(event):
    4123 #        Draw()                          #make sure plot is fresh!!
    41244123        mode = cb.GetValue()
    41254124        if mode in ['jpeg','bmp','tiff',]:
     
    41524151
    41534152    def OnKey(event):           #on key UP!!
    4154 #        Draw()                          #make sure plot is fresh!!
    41554153        try:
    41564154            keyCode = event.GetKeyCode()
     
    49554953                    RenderMapPeak(x,y,z,Gr,1.0)
    49564954                else:
    4957                     RenderMapPeak(x,y,z,Wt,mag/peakMax)
     4955                    if mag > 0.:
     4956                        RenderMapPeak(x,y,z,Wt,mag/peakMax)
     4957                    else:
     4958                        RenderMapPeak(x,y,z,Rd,-mag/peakMax)
    49584959                if showBonds:
    49594960                    RenderLines(x,y,z,mapBonds[ind],Wt)
Note: See TracChangeset for help on using the changeset viewer.