Changeset 1188


Ignore:
Timestamp:
Jan 9, 2014 4:05:59 PM (9 years ago)
Author:
vondreele
Message:

use a key to trigger add of new strain ring
sort by d-zero
deal with bad rings (no points found)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1181 r1188  
    17701770        self.ifGetRing = False
    17711771        self.MaskKey = ''           #trigger for making image masks
     1772        self.StrainKey = ''         #ditto for new strain d-zeros
    17721773        arg = sys.argv
    17731774        if len(arg) > 1:
  • trunk/GSASIIimage.py

    r1187 r1188  
    868868        return Ring,ring
    869869    else:
     870        ring['ImxyObs'] = [[],[]]
     871        ring['ImtaObs'] = [[],[]]
     872        ring['ImtaCalc'] = [[],[]]
    870873        return [],[]    #bad ring; no points found
    871874   
  • trunk/GSASIIimgGUI.py

    r1186 r1188  
    2424GSASIIpath.SetVersionNumber("$Revision$")
    2525import GSASIIimage as G2img
     26import GSASIImath as G2mth
    2627import GSASIIplot as G2plt
    2728import GSASIIIO as G2IO
     
    14541455            Obj.SetValue("%.5f"%(value))
    14551456            data['d-zero'][Indx[Obj.GetId()]]['Dset'] = value
     1457            data['d-zero'] = G2mth.sortArray(data['d-zero'],'Dset',reverse=True)
    14561458            Ring,R = G2img.MakeStrStaRing(data['d-zero'][Indx[Obj.GetId()]],G2frame.ImageZ,Controls)
    14571459            if len(Ring):
     
    14591461            else:
    14601462                G2frame.ErrorDialog('Strain peak selection','WARNING - No points found for this ring selection')
     1463               
    14611464        #sort them on d-spacing?
    14621465            UpdateStressStrain(G2frame,data)
     
    15481551    if not G2frame.dataFrame.GetStatusBar():
    15491552        Status = G2frame.dataFrame.CreateStatusBar()
    1550         Status.SetStatusText(" test  ")
     1553    if G2frame.StrainKey == 'a':    #probably doesn't happen
     1554        G2frame.dataFrame.GetStatusBar().SetStatusText('Add strain ring active - LB pick d-zero value')
     1555    else:
     1556        G2frame.dataFrame.GetStatusBar().SetStatusText("To add strain data: On On 2D Powder Image, key a:add ring")
     1557       
    15511558    G2frame.dataDisplay = wx.Panel(G2frame.dataFrame)
    15521559    mainSizer = wx.BoxSizer(wx.VERTICAL)
  • trunk/GSASIIplot.py

    r1185 r1188  
    21682168    G2imG.UpdateMasks(G2frame,Masks)
    21692169    PlotImage(G2frame,newImage=True)
     2170   
     2171def OnStartNewDzero(G2frame):
     2172    '''Initiate the start of adding a new d-zero to a strain data set
     2173
     2174    :param wx.Frame G2frame: The main GSAS-II tree "window"
     2175    :param str eventkey: a single letter ('a') that
     2176      triggers the addition of a d-zero.   
     2177    '''
     2178    StrSta = G2frame.PatternTree.GetItemPyData(
     2179        G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Stress/Strain'))
    21702180
    21712181def PlotImage(G2frame,newPlot=False,event=None,newImage=True):
     
    22242234                tth,azm,D,dsp = G2img.GetTthAzmDsp(xpos,ypos,Data)
    22252235                Q = 2.*math.pi/dsp
     2236                fields = ['','Detector 2-th =%9.3fdeg, dsp =%9.3fA, Q = %6.5fA-1, azm = %7.2fdeg, I = %6d'%(tth,dsp,Q,azm,Int)]
    22262237                if G2frame.MaskKey in ['p','f']:
    2227                     G2frame.G2plotNB.status.SetFields(['','Polygon/frame mask pick - LB next point, RB close polygon'])
    2228                 else:
    2229                     G2frame.G2plotNB.status.SetFields(\
    2230                         ['','Detector 2-th =%9.3fdeg, dsp =%9.3fA, Q = %6.5fA-1, azm = %7.2fdeg, I = %6d'%(tth,dsp,Q,azm,Int)])
     2238                    fields[1] = 'Polygon/frame mask pick - LB next point, RB close polygon'
     2239                elif G2frame.StrainKey:
     2240                    fields[0] = 'd-zero pick active'
     2241                G2frame.G2plotNB.status.SetFields(fields)
    22312242
    22322243    def OnImPlotKeyPress(event):
     
    22392250                G2frame.MaskKey = event.key
    22402251                OnStartMask(G2frame)
     2252               
     2253        elif PickName == 'Stress/Strain':
     2254            if event.key in ['a',]:
     2255                G2frame.StrainKey = event.key
     2256                OnStartNewDzero(G2frame)
     2257           
    22412258               
    22422259        elif PickName == 'Image Controls':
     
    22702287                else:
    22712288                    Data['invert_y'] = True
    2272         PlotImage(G2frame,newPlot=True)
     2289        PlotImage(G2frame,newPlot=False)
    22732290           
    22742291    def OnKeyBox(event):
     
    23652382            G2imG.UpdateMasks(G2frame,Masks)
    23662383            PlotImage(G2frame,newImage=False)
    2367         elif PickName == 'Stress/Strain':
     2384        elif PickName == 'Stress/Strain' and G2frame.StrainKey:
    23682385            Xpos,Ypos = [event.xdata,event.ydata]
    23692386            if not Xpos or not Ypos or Page.toolbar._active:  #got point out of frame or zoom/pan selected
     
    23762393                del StrSta['d-zero'][-1]
    23772394                G2frame.ErrorDialog('Strain peak selection','WARNING - No points found for this ring selection')
     2395            StrSta['d-zero'] = G2mth.sortArray(StrSta['d-zero'],'Dset',reverse=True)
     2396            G2frame.StrainKey = ''
    23782397            G2imG.UpdateStressStrain(G2frame,StrSta)
    23792398            PlotStrain(G2frame,StrSta)
     
    25022521            Page.Choice = (' key press','s: spot mask','a: arc mask','r: ring mask',
    25032522                'p: polygon mask','f: frame mask',)
     2523            Page.keyPress = OnImPlotKeyPress
     2524        elif G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Stress/Strain',]:
     2525            Page.Choice = (' key press','a: add new ring',)
    25042526            Page.keyPress = OnImPlotKeyPress
    25052527    except TypeError:
Note: See TracChangeset for help on using the changeset viewer.