Changeset 3805


Ignore:
Timestamp:
Jan 28, 2019 5:20:01 PM (3 years ago)
Author:
vondreele
Message:

fix normalization of mag moments --> Kvector
add save of map peaks as csv file

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3790 r3805  
    55985598           
    55995599        # Phase / Map peaks tab
    5600         G2G.Define_wxId('wxID_PEAKSMOVE', 'wxID_PEAKSCLEAR','wxID_PEAKSUNIQUE', 'wxID_PEAKSDELETE',
     5600        G2G.Define_wxId('wxID_PEAKSMOVE', 'wxID_PEAKSCLEAR','wxID_PEAKSUNIQUE', 'wxID_PEAKSDELETE','wxID_PEAKSSAVE',
    56015601            'wxID_PEAKSDA','wxID_PEAKSDISTVP', 'wxID_PEAKSVIEWPT', 'wxID_FINDEQVPEAKS', 'wxID_SHOWBONDS',)
    56025602        self.MapPeaksMenu = wx.MenuBar()
     
    56125612        self.MapPeaksEdit.Append(G2G.wxID_FINDEQVPEAKS,'Equivalent peaks','Find equivalent peaks')
    56135613        self.MapPeaksEdit.Append(G2G.wxID_PEAKSUNIQUE,'Unique peaks','Select unique set')
     5614        self.MapPeaksEdit.Append(G2G.wxID_PEAKSSAVE,'Save peaks','Save peaks to csv file')
    56145615        self.MapPeaksEdit.Append(G2G.wxID_PEAKSDELETE,'Delete peaks','Delete selected peaks')
    56155616        self.MapPeaksEdit.Append(G2G.wxID_PEAKSCLEAR,'Clear peaks','Clear the map peak list')
  • trunk/GSASIIphsGUI.py

    r3797 r3805  
    89568956        G2plt.PlotStructure(G2frame,data)
    89578957       
     8958    def OnPeaksSave(event):
     8959        if 'Map Peaks' in data:
     8960            mapPeaks = data['Map Peaks']
     8961            pfName = PhaseName+'_peaks.csv'
     8962            pfFile = ''
     8963            pth = G2G.GetExportPath(G2frame)
     8964            dlg = wx.FileDialog(G2frame, 'Choose map peaks file name', pth, pfName,
     8965                'csv (*.csv)|*.csv',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
     8966            try:
     8967                if dlg.ShowModal() == wx.ID_OK:
     8968                    pfFile = dlg.GetPath()
     8969            finally:
     8970                dlg.Destroy()
     8971               
     8972            if pfFile:
     8973                pf = open(pfFile,'w')
     8974                pf.write('"%s"\n'%(PhaseName))
     8975                pf.write(' mag, x, y, z, dzero, dcent \n')
     8976                for peak in mapPeaks:
     8977                    pf.write(' %.4f, %.4f, %.4f, %.4f, %.4f, %.4f \n'%(peak[0],peak[1],peak[2],peak[3],peak[4],peak[5]))
     8978                pf.close()
     8979       
    89588980    def OnPeaksDelete(event):
    89598981        if 'Map Peaks' in data:
     
    94849506        G2frame.Bind(wx.EVT_MENU, OnPeaksEquiv, id=G2G.wxID_FINDEQVPEAKS)
    94859507        G2frame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2G.wxID_PEAKSUNIQUE)
     9508        G2frame.Bind(wx.EVT_MENU, OnPeaksSave, id=G2G.wxID_PEAKSSAVE)
    94869509        G2frame.Bind(wx.EVT_MENU, OnPeaksDelete, id=G2G.wxID_PEAKSDELETE)
    94879510        G2frame.Bind(wx.EVT_MENU, OnPeaksClear, id=G2G.wxID_PEAKSCLEAR)
  • trunk/GSASIIstrMath.py

    r3803 r3805  
    10541054    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip * det(opM)
    10551055    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    1056     Kdata = np.inner(Gdata.T,uAmat.T).T/Mag     #Cartesian unit vectors
     1056    Kdata = np.inner(Gdata.T,uAmat).T     #Cartesian unit vectors
     1057    Kmean = np.mean(np.sqrt(np.sum(Kdata**2,axis=0)),axis=0)
     1058    Kdata /= Kmean
    10571059    Uij = np.array(G2lat.U6toUij(Uijdata))
    10581060    bij = Mast*Uij.T
     
    12111213    Gones = SGData['MagMom'][nxs,:,nxs]*Gones   #flip vectors according to spin flip
    12121214    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    1213     Kdata = np.inner(Gdata.T,uAmat.T).T/Mag     #Cartesian unit vectors
     1215    Kdata = np.inner(Gdata.T,uAmat).T     #Cartesian unit vectors
     1216    Kmean = np.mean(np.sqrt(np.sum(Kdata**2,axis=0)),axis=0)
     1217    Kdata /= Kmean
    12141218    Uij = np.array(G2lat.U6toUij(Uijdata))
    12151219    bij = Mast*Uij.T
     
    15181522        GSdata = SGData['MagMom'][nxs,:,nxs,nxs]*GSdata   #flip vectors according to spin flip * det(opM)
    15191523        SMag = np.sqrt(np.sum((np.inner(GSdata.T,Ginv)*GSdata.T),axis=-1)).T
    1520         Kdata = np.inner(Gdata.T,uAmat.T).T/SMag[nxs,:,:,:]     #Cartesian unit vectors
     1524        Kdata = np.inner(GSdata.T,uAmat).T     #Cartesian unit vectors
     1525        Kmean = np.mean(np.sqrt(np.sum(Kdata**2,axis=0)),axis=0)    #normalization --> unit vectors
     1526        Kdata /= Kmean      #mxyz,nops,ntau,natm
    15211527
    15221528    FF = np.zeros(len(Tdata))
Note: See TracChangeset for help on using the changeset viewer.