Changeset 273


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

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

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r271 r273  
    12361236    def OnExportPDF(self,event):
    12371237        #need S(Q) and G(R) to be saved here - probably best from selection?
    1238         event.Skip()
     1238        names = ['All']
     1239        exports = []
     1240        item, cookie = self.PatternTree.GetFirstChild(self.root)
     1241        while item:
     1242            name = self.PatternTree.GetItemText(item)
     1243            if 'PDF' in name:
     1244                names.append(name)
     1245            item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     1246        if names:
     1247            dlg = wx.MultiChoiceDialog(self,'Select','PDF patterns to export',names)
     1248            if dlg.ShowModal() == wx.ID_OK:
     1249                sel = dlg.GetSelections()
     1250                if sel[0] == 0:
     1251                    exports = names[1:]
     1252                else:
     1253                    for x in sel:
     1254                        exports.append(names[x])
     1255            dlg.Destroy()
     1256        if exports:
     1257            G2IO.PDFSave(self,exports)
    12391258       
    12401259    def OnExportPhase(self,event):
  • 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):
  • trunk/GSASIIgrid.py

    r272 r273  
    205205        parent.Append(help='Copy PDF controls', id=wxID_PDFCOPYCONTROLS, kind=wx.ITEM_NORMAL,
    206206            text='Copy controls')
    207         parent.Append(help='Load PDF controls from file',id=wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL,
    208             text='Load Controls')
    209         parent.Append(help='Save PDF controls to file', id=wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL,
    210             text='Save controls')
     207#        parent.Append(help='Load PDF controls from file',id=wxID_PDFLOADCONTROLS, kind=wx.ITEM_NORMAL,
     208#            text='Load Controls')
     209#        parent.Append(help='Save PDF controls to file', id=wxID_PDFSAVECONTROLS, kind=wx.ITEM_NORMAL,
     210#            text='Save controls')
    211211        self.PDFCompute = parent.Append(help='Compute PDF', id=wxID_PDFCOMPUTE, kind=wx.ITEM_NORMAL,
    212212            text='Compute PDF')
  • trunk/GSASIIplot.py

    r272 r273  
    17951795    def OnMouseMove(event):
    17961796        newxy = event.GetPosition()
     1797        page = getSelection()
    17971798        if event.ControlDown() and drawingData['showABC']:
    17981799            if event.LeftIsDown():
    1799                 ctrlDown = True
    18001800                SetTestRot(newxy)
    18011801            elif event.RightIsDown():
     
    18031803            elif event.MiddleIsDown():
    18041804                SetTestRotZ(newxy)
     1805            x,y,z = drawingData['testPos'][0]
     1806            self.G2plotNB.status.SetStatusText('moving test point %.4f,%.4f,%.4f'%(x,y,z),1)
    18051807               
    18061808               
     
    18081810            if event.LeftIsDown():
    18091811                SetRotation(newxy)
     1812                angX,angY,angZ = drawingData['Rotation'][:3]
     1813                self.G2plotNB.status.SetStatusText('New rotation: %.2f, %.2f ,%.2f'%(angX,angY,angZ),1)
    18101814            elif event.RightIsDown():
    18111815                SetTranslation(newxy)
     1816                Tx,Ty,Tz = drawingData['viewPoint'][0]
     1817                self.G2plotNB.status.SetStatusText('New view point: %.4f, %.4f, %.4f'%(Tx,Ty,Tz),1)
    18121818            elif event.MiddleIsDown():
    18131819                SetRotationZ(newxy)
     1820                angX,angY,angZ = drawingData['Rotation'][:3]
     1821                self.G2plotNB.status.SetStatusText('New rotation: %.2f, %.2f, %.2f'%(angX,angY,angZ),1)
    18141822        Draw()
    18151823       
     
    18171825        drawingData['cameraPos'] += event.GetWheelRotation()/24
    18181826        drawingData['cameraPos'] = max(10,min(500,drawingData['cameraPos']))
    1819         page = self.dataDisplay.GetSelection()
     1827        self.G2plotNB.status.SetStatusText('New camera distance: %.2f'%(drawingData['cameraPos']),1)
     1828        page = getSelection()
    18201829        if page:
    18211830            if self.dataDisplay.GetPageText(page) == 'Draw Options':
     
    18271836       
    18281837    def getSelection():
    1829         if self.dataDisplay:
     1838        try:
    18301839            return self.dataDisplay.GetSelection()
    1831         else:
     1840        except AttributeError:
     1841            print self.dataDisplay.GetLabel()
     1842            self.G2plotNB.status.SetStatusText('Select this from Phase data window!')
    18321843            return 0
    18331844           
     
    21722183            RenderBox()
    21732184        if drawingData['showABC']:
    2174 #            try:            #temporary fix - not needed further?
    2175 #                x,y,z = drawingData['testPos'][0]
    2176 #            except TypeError:
    2177 #                x,y,z = drawingData['testPos']
    21782185            x,y,z = drawingData['testPos'][0]
    2179             if altDown:
    2180                 self.G2plotNB.status.SetStatusText('moving test point %.4f,%.4f,%.4f'%(x,y,z),1)
    2181             else:
    2182                 self.G2plotNB.status.SetStatusText('test point %.4f,%.4f,%.4f'%(x,y,z),1)           
     2186#            if altDown:
     2187#                self.G2plotNB.status.SetStatusText('moving test point %.4f,%.4f,%.4f'%(x,y,z),1)
     2188#            else:
     2189#                self.G2plotNB.status.SetStatusText('test point %.4f,%.4f,%.4f'%(x,y,z),1)           
    21832190            RenderUnitVectors(x,y,z)
    21842191        Backbone = []
  • trunk/GSASIIpwdGUI.py

    r272 r273  
    10911091    wave = 12.397639/keV
    10921092    qLimits = [tth2q(fullLimits[0],wave),tth2q(fullLimits[1],wave)]
    1093     data['QScaleLim'][0] = max(qLimits[0],data['QScaleLim'][0])
    10941093    data['QScaleLim'][1] = min(qLimits[1],data['QScaleLim'][1])
     1094    if data['QScaleLim'][0]:
     1095        data['QScaleLim'][0] = max(qLimits[0],data['QScaleLim'][0])
     1096    else:                                #initial setting at 90% of max Q
     1097        data['QScaleLim'][0] = 0.90*data['QScaleLim'][1]
    10951098    polariz = inst['Polariz.']
    10961099    azimuth = inst['Azimuth']
Note: See TracChangeset for help on using the changeset viewer.