Changeset 281


Ignore:
Timestamp:
May 4, 2011 4:18:44 PM (11 years ago)
Author:
vondreele
Message:

implement reusable GSAS-II image files that can be read into a new project.
fix order of color schemes in contour plots
fix azimuth values from image integration
fix use of correct data structure for calculat all pdfs

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r273 r281  
    422422        self.CheckNotebook()
    423423        dlg = wx.FileDialog(self, 'Choose image files', '.', '',\
    424         'Any image file (*.tif;*.tiff;*.mar*;*.avg;*.sum;*.img)\
    425         |*.tif;*.tiff;*.mar*;*.avg;*.sum;*.img|\
     424        'Any image file (*.tif;*.tiff;*.mar*;*.avg;*.sum;*.img;*.G2img)\
     425        |*.tif;*.tiff;*.mar*;*.avg;*.sum;*.img;*.G2img|\
    426426        Any detector tif (*.tif;*.tiff)|*.tif;*.tiff|\
    427427        MAR file (*.mar*)|*.mar*|\
    428428        GE Image (*.avg;*.sum)|*.avg;*.sum|\
    429429        ADSC Image (*.img)|*.img|\
     430        GSAS-II Image (*.G2img)|*.G2img|\
    430431        All files (*.*)|*.*',
    431432        wx.OPEN | wx.MULTIPLE)
     
    602603                name.SetEditable(False)
    603604                scale = wx.TextCtrl(panel,id,str(item[0]),style=wx.TE_PROCESS_ENTER)
    604                 scale.Bind(wx.EVT_TEXT,self.OnScaleChange)                   
     605                scale.Bind(wx.EVT_TEXT_ENTER,self.OnScaleChange)
     606                scale.Bind(wx.EVT_KILL_FOCUS,self.OnScaleChange)
    605607                dataGridSizer.Add(scale,0,wx.LEFT,10)
    606608                dataGridSizer.Add(name,0,wx.RIGHT,10)
     
    608610                wx.LEFT|wx.TOP|wx.ALIGN_CENTER_VERTICAL,10)
    609611            self.name = wx.TextCtrl(panel,-1,self.data[-1],size=wx.Size(200,20),style=wx.TE_PROCESS_ENTER)
    610             self.name.Bind(wx.EVT_TEXT,self.OnNameChange)
     612            self.name.Bind(wx.EVT_TEXT_ENTER,self.OnNameChange)
     613            self.name.Bind(wx.EVT_KILL_FOCUS,self.OnNameChange)
    611614            dataGridSizer.Add(self.name,0,wx.RIGHT|wx.TOP,10)
    612615            mainSizer.Add(dataGridSizer,0,wx.EXPAND)
     
    825828                            self.dirname = dlg.GetDirectory()
    826829                            newimagefile = dlg.GetPath()
    827                             G2IO.PutG2Image(newimagefile,newImage)
     830                            G2IO.PutG2Image(newimagefile,Comments,Data,Npix,newImage)
    828831                            Imax = np.amax(newImage)
    829832                            Imin = np.amin(newImage)
  • trunk/GSASIIIO.py

    r273 r281  
    448448        Comments,Data,Npix,Image = GetGEsumData(imagefile)
    449449    elif ext == '.G2img':
    450         return GetG2Image(imagefile)
     450        Comments,Data,Npix,Image = GetG2Image(imagefile)
    451451    if imageOnly:
    452452        return Image
     
    454454        return Comments,Data,Npix,Image
    455455       
    456 def PutG2Image(filename,image):
     456def PutG2Image(filename,Comments,Data,Npix,image):
    457457    File = open(filename,'wb')
    458     cPickle.dump(image,File,1)
     458    cPickle.dump([Comments,Data,Npix,image],File,1)
    459459    File.close()
    460460    return
     
    462462def GetG2Image(filename):
    463463    File = open(filename,'rb')
    464     image = cPickle.load(File)
     464    Comments,Data,Npix,image = cPickle.load(File)
    465465    File.close()
    466     return image
     466    return Comments,Data,Npix,image
    467467   
    468468def GetGEsumData(filename,imageOnly=False):
     
    783783       
    784784def SaveIntegration(self,PickId,data):
    785     azms = self.Integrate[1]
     785    azms = self.Integrate[1][:-1]
    786786    X = self.Integrate[2][:-1]
    787787    Xminmax = [X[0],X[-1]]
     
    793793    names = ['Type','Lam','Zero','Polariz.','U','V','W','X','Y','SH/L','Azimuth']
    794794    codes = [0 for i in range(11)]
    795     Azms = [(azms[i+1]+azms[i])/2. for i in range(len(azms)-1)]
     795    LRazm = data['LRazimuth']
    796796    if data['fullIntegrate'] and data['outAzimuths'] == 1:
    797         Azms = [0.0,]
    798     for i,azm in enumerate(Azms):
     797        Azms = [45.0,]                              #a poor man's average?
     798    for i,azm in enumerate(azms):
    799799        item, cookie = self.PatternTree.GetFirstChild(self.root)
    800800        Id = 0
  • trunk/GSASIIplot.py

    r273 r281  
    384384            if self.Contour:
    385385                choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     386                choice.sort()
    386387                dlg = wx.SingleChoiceDialog(self,'Select','Color scheme',choice)
    387388                if dlg.ShowModal() == wx.ID_OK:
     
    717718            if self.Contour:
    718719                choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")]
     720                choice.sort()
    719721                dlg = wx.SingleChoiceDialog(self,'Select','Color scheme',choice)
    720722                if dlg.ShowModal() == wx.ID_OK:
  • trunk/GSASIIpwdGUI.py

    r273 r281  
    14171417        inst = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,powId,'Instrument Parameters'))
    14181418        inst = dict(zip(inst[3],inst[1]))
    1419         auxPlot = G2pwd.CalcPDF(data,inst,xydata)
     1419        auxPlot = G2pwd.CalcPDF(Data,inst,xydata)
    14201420        PDFId = G2gd.GetPatternTreeItemId(self,self.root,'PDF '+powName[4:])
    14211421        self.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(self,PDFId,'I(Q)'+powName[4:]),xydata['IofQ'])
     
    14281428        print 'Calculating PDF:'
    14291429        auxPlot = ComputePDF(data)
     1430        print 'Done calculating PDF:'
    14301431        Status.SetStatusText('PDF computed')
    14311432        for plot in auxPlot:
     
    14491450            Status.SetStatusText('All PDFs computed')
    14501451            G2plt.PlotISFG(self,newPlot=True,type='G(R)')
     1452            print ' Done calculating PDFs:'
    14511453       
    14521454    def OnShowTip(self,tip):
Note: See TracChangeset for help on using the changeset viewer.