Ignore:
Timestamp:
Jul 27, 2020 10:42:49 PM (3 years ago)
Author:
toby
Message:

implement variable limits; show cell under Dij vals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r4523 r4534  
    1919from __future__ import division, print_function
    2020import wx
     21import numpy as np
     22import numpy.linalg as nl
    2123import GSASIIpath
    2224GSASIIpath.SetVersionNumber("$Revision$")
     
    2729import GSASIIphsGUI as G2phsGUI
    2830import GSASIIctrlGUI as G2G
    29 import numpy as np
    30 import numpy.linalg as nl
     31import GSASIIpy3 as G2py3
    3132
    3233WACV = wx.ALIGN_CENTER_VERTICAL
     
    392393            UseList[G2frame.hist]['HStrain'][1][pid] = Obj.GetValue()
    393394           
     395        hSizer = wx.BoxSizer(wx.VERTICAL)
    394396        hstrainSizer = wx.FlexGridSizer(0,6,5,5)
    395397        Hsnames = G2spc.HStrainNames(SGData)
    396398        parms = zip(Hsnames,UseList[G2frame.hist]['HStrain'][1],range(len(Hsnames)))
     399        allzero = True
    397400        for Pa,ref,Id in parms:
    398401            hstrainRef = wx.CheckBox(DData,wx.ID_ANY,label=Pa)
     
    402405            hstrainRef.Bind(wx.EVT_CHECKBOX, OnHstrainRef)
    403406            hstrainSizer.Add(hstrainRef,0,WACV|wx.LEFT,5)
    404             hstrainVal = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['HStrain'][0],Id,nDig=(10,3,'g'))
     407            hstrainVal = G2G.ValidatedTxtCtrl(DData,
     408                        UseList[G2frame.hist]['HStrain'][0],Id,nDig=(10,3,'g'),
     409                        OnLeave=OnNewValueReDraw)
     410            if abs(UseList[G2frame.hist]['HStrain'][0][Id]) > 1e-8:
     411                allzero = False
    405412            hstrainSizer.Add(hstrainVal,0,WACV)
    406         return hstrainSizer
     413        hSizer.Add(hstrainSizer,0,WACV)
     414        if not allzero:   # show Dij shifted unit cell
     415            DijVals = UseList[G2frame.hist]['HStrain'][0][:]
     416            # apply the Dij values to the reciprocal cell
     417            newA = []
     418            Dijdict = dict(zip(G2spc.HStrainNames(SGData),DijVals))
     419            for Aij,lbl in zip(G2lat.cell2A(data['General']['Cell'][1:7]),
     420                            ['D11','D22','D33','D12','D13','D23']):
     421                newA.append(Aij + Dijdict.get(lbl,0.0))
     422            cell = G2lat.A2cell(newA)   # convert back to direct cell
     423            laue = generalData['SGData']['SGLaue']
     424            if laue == '2/m':
     425                laue += generalData['SGData']['SGUniq']
     426            for cellGUI in G2py3.cellGUIlist:
     427                if laue in cellGUI[0]:
     428                    useGUI = cellGUI
     429                    break
     430            else:
     431                return hSizer
     432            cellstr = ''
     433            for txt,fmt,ifEdit,Id in zip(*useGUI[2:]):
     434                if cellstr: cellstr += ", "
     435                cellstr += txt+fmt.format(cell[Id])
     436            cellstr += ', Vol = {:.3f}'.format(G2lat.calc_V(newA))
     437            hSizer.Add(wx.StaticText(DData,wx.ID_ANY,'     '+cellstr),0,WACV)
     438        return hSizer
    407439       
    408440    def PoTopSizer(POData):
     
    967999
    9681000    ######################################################################
    969     # Beginning of UpdateDData execution here
     1001    ### Beginning of UpdateDData execution here
    9701002    ######################################################################
    9711003    G2frame.SetStatusText('',1)
Note: See TracChangeset for help on using the changeset viewer.