Changeset 2108


Ignore:
Timestamp:
Dec 24, 2015 9:10:30 PM (6 years ago)
Author:
toby
Message:

Bug fix for Andrey: 5. Allow recalibrate after load controls on new image; fix to load image controls and change to enable of Recalibrate

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r2051 r2108  
    502502   
    503503def ImageRecalibrate(G2frame,data,masks):
    504     'Needs a doc string'
     504    '''Called to repeat the calibration on an image, usually called after
     505    calibration is done initially to improve the fit.
     506    '''
    505507    import ImageCalibrants as calFile
    506508    print 'Image recalibration:'
     
    581583           
    582584def ImageCalibrate(G2frame,data):
    583     'Needs a doc string'
     585    '''Called to perform an initial image calibration after points have been
     586    selected for the inner ring.
     587    '''
    584588    import copy
    585589    import ImageCalibrants as calFile
  • trunk/GSASIIimgGUI.py

    r2107 r2108  
    120120# Menu items
    121121           
    122     def OnCalibrate(event):       
    123         G2frame.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMRECALIBRATE,enable=True)   
     122    def OnCalibrate(event):
     123        if not data.get('calibrant'):
     124            G2G.G2MessageBox(G2frame,'A calibrant must first be selected')
    124125        G2frame.dataFrame.GetStatusBar().SetStatusText('Select > 4 points on 1st used ring; LB to pick, RB on point to delete else RB to finish')
    125126        G2frame.ifGetRing = True
     
    133134        data['rings'] = []
    134135        data['ellipses'] = []
    135 #        G2frame.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMRECALIBRATE,enable=False)   
    136136        G2plt.PlotExposedImage(G2frame,event=event)
    137137           
     
    351351                    S = File.readline()
    352352                data.update(save)
    353                 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'),copy.deepcopy(data))               
     353                # next line removed. Previous updates tree contents. The next
     354                # makes a copy of data, puts it into tree and "disconnects" data
     355                # from tree contents (later changes to data are lost!)
     356                #G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'),copy.deepcopy(data))
    354357                File.close()
    355358        finally:
     
    10591062    G2frame.dataFrame.Bind(wx.EVT_MENU, OnRecalibrate, id=G2gd.wxID_IMRECALIBRATE)
    10601063    G2frame.dataFrame.Bind(wx.EVT_MENU, OnClearCalib, id=G2gd.wxID_IMCLEARCALIB)
    1061     if 'chisq' not in data:
    1062         G2frame.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMRECALIBRATE,enable=False)   
     1064    if data.get('calibrant'):
     1065        G2frame.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMRECALIBRATE,enable=True)
     1066    else:
     1067        G2frame.dataFrame.ImageEdit.Enable(id=G2gd.wxID_IMRECALIBRATE,enable=False)
    10631068    G2frame.dataFrame.Bind(wx.EVT_MENU, OnIntegrate, id=G2gd.wxID_IMINTEGRATE)
    10641069    G2frame.dataFrame.Bind(wx.EVT_MENU, OnIntegrateAll, id=G2gd.wxID_INTEGRATEALL)
  • trunk/GSASIIplot.py

    r2107 r2108  
    36093609    import numpy.ma as ma
    36103610    Dsp = lambda tth,wave: wave/(2.*npsind(tth/2.))
    3611     global Data,Masks,StrSta
     3611    #global Data,Masks,StrSta  # BHT: I don't see why these need to be globals. Where are they accessed?
    36123612    colors=['b','g','r','c','m','k']
    36133613    Data = G2frame.PatternTree.GetItemPyData(
     
    39153915            G2frame.itemPicked = None
    39163916           
    3917     # PlotImage execution starts here       
     3917    # PlotImage execution starts here
    39183918    xylim = []
    39193919    try:
     
    40724072                    xring,yring = np.array(ring).T[:2]
    40734073                    Plot.plot(xring,yring,'.',color=colors[N%6])
    4074                     N += 1           
     4074                    N += 1
    40754075            for ellipse in Data['ellipses']:      #what about hyperbola?
    40764076                cent,phi,[width,height],col = ellipse
Note: See TracChangeset for help on using the changeset viewer.