Changeset 273 for trunk/GSASIIIO.py


Ignore:
Timestamp:
May 2, 2011 5:16:06 PM (11 years ago)
Author:
vondreele
Message:

output of S(Q) and G(R) as files for other use
some effort to fix graphics tab behavior

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r267 r273  
    895895            wx.EndBusyCursor()
    896896        print 'powder pattern file written'
     897       
     898def PDFSave(self,exports):   
     899    for export in exports:
     900        PickId = G2gd.GetPatternTreeItemId(self, self.root, export)
     901        SQname = 'S(Q)'+export[4:]
     902        GRname = 'G(R)'+export[4:]
     903        sqfilename = ospath.join(self.dirname,export.replace(' ','_')[5:]+'.sq')
     904        grfilename = ospath.join(self.dirname,export.replace(' ','_')[5:]+'.gr')
     905        sqId = G2gd.GetPatternTreeItemId(self, PickId, SQname)
     906        grId = G2gd.GetPatternTreeItemId(self, PickId, GRname)
     907        sqdata = np.array(self.PatternTree.GetItemPyData(sqId)[1][:2]).T
     908        grdata = np.array(self.PatternTree.GetItemPyData(grId)[1][:2]).T
     909        sqfile = open(sqfilename,'w')
     910        grfile = open(grfilename,'w')
     911        sqfile.write('#T S(Q) %s\n'%(export))
     912        grfile.write('#T G(R) %s\n'%(export))
     913        sqfile.write('#L Q     S(Q)\n')
     914        grfile.write('#L R     G(R)\n')
     915        for q,sq in sqdata:
     916            sqfile.write("%15.6g %15.6g\n" % (q,sq))
     917        sqfile.close()
     918        for r,gr in grdata:
     919            grfile.write("%15.6g %15.6g\n" % (r,gr))
     920        grfile.close()
    897921   
    898922def PeakListSave(self,file,peaks):
Note: See TracChangeset for help on using the changeset viewer.