Changeset 5057
- Timestamp:
- Oct 29, 2021 10:34:57 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r5043 r5057 1529 1529 G2obj.IndexAllIds(Histograms,Phases) 1530 1530 for p in Phases: 1531 if 'ISODISTORT' in Phases[p] :1531 if 'ISODISTORT' in Phases[p] and 'G2VarList' in Phases[p]['ISODISTORT']: 1532 1532 G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_SHOWISO,True) 1533 1533 break … … 3810 3810 return helptext 3811 3811 3812 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() # init for constraint 3813 isophases = [p for p in Phases if 'ISODISTORT' in Phases[p]] 3814 3812 Phases = G2frame.GetPhaseData() 3813 isophases = [p for p in Phases if 'G2VarList' in Phases[p]['ISODISTORT']] 3815 3814 if not isophases: 3816 G2frame.ErrorDialog('no ISODISTORT phases', 3817 'Unexpected error: no ISODISTORT phases') 3815 G2G.G2MessageBox(G2frame,'no ISODISTORT mode data for any phase') 3818 3816 return 3819 3817 if phase and phase not in isophases: 3820 G2frame.ErrorDialog('not ISODISTORT phase', 3821 'Unexpected error: selected phase is not an ISODISTORT phase') 3822 print('Unexpected error: selected phase is not an ISODISTORT phase', 3823 phase,isophases) 3818 G2G.G2MessageBox(G2frame,'no ISODISTORT mode data for this phase') 3819 return 3824 3820 elif not phase and len(isophases) == 1: 3825 3821 phase = isophases[0] 3826 3822 elif not phase: 3827 3823 dlg = wx.SingleChoiceDialog(G2frame,'Select phase from ISODISTORT phases', 3828 3824 'Select Phase',isophases) 3829 3825 if dlg.ShowModal() == wx.ID_OK: 3830 3826 sel = dlg.GetSelection() … … 3832 3828 else: 3833 3829 return 3834 # if len(data.get('Histograms',[])) == 0:3835 # G2frame.ErrorDialog(3836 # 'No data',3837 # 'Sorry, this computation requires that a histogram first be added to the phase'3838 # )3839 # return3840 3830 3841 3831 covdata = G2frame.GPXtree.GetItemPyData( … … 3852 3842 3853 3843 dlg = wx.Dialog(G2frame,wx.ID_ANY,'ISODISTORT mode values',#size=(630,400), 3854 3844 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 3855 3845 mainSizer = wx.BoxSizer(wx.VERTICAL) 3856 if 'ISODISTORT' not in Phases[phase]:3857 G2frame.ErrorDialog('not ISODISTORT phase',3858 'Unexpected error: selected phase is not an ISODISTORT phase')3859 return3860 3846 data = Phases[phase] 3861 3847 ISO = data['ISODISTORT'] 3862 3848 mainSizer.Add(wx.StaticText(dlg,wx.ID_ANY, 3863 'ISODISTORT mode computation for cordinates in phase '+ 3864 str(data['General'].get('Name')))) 3849 'ISODISTORT mode computation for cordinates in phase '+str(data['General'].get('Name')))) 3865 3850 aSizer = wx.BoxSizer(wx.HORIZONTAL) 3866 3851 panel1 = wxscroll.ScrolledPanel( … … 3889 3874 cval = parmDict[var][0] 3890 3875 else: 3891 dlg.EndModal(wx.ID_CANCEL) 3892 G2frame.ErrorDialog('Atom not found',"No value found for parameter "+str(var)) 3893 return 3876 cval = 0.0 3894 3877 deltaList.append(cval-pval) 3895 3878 modeVals = np.inner(ISO['Var2ModeMatrix'],deltaList) … … 3897 3880 ISO['IsoVarList'],deltaList, 3898 3881 ISO['IsoModeList'],modeVals,ISO['NormList'],ISO['G2ModeList'] ): 3899 #GSASIIpath.IPyBreak()3900 3882 if str(G2mode) in constrDict: 3901 3883 ch = G2G.HelpButton(panel2,fmtHelp(constrDict[str(G2mode)],var)) -
trunk/GSASIIdataGUI.py
r5054 r5057 6453 6453 self.ISODDataEdit = wx.Menu(title='') 6454 6454 self.ISODData.Append(menu=self.ISODDataEdit, title='Operations') 6455 self.ISODDataEdit.Append(G2G.wxID_ISODNEWPHASE,'Make new phase','From ISODISTORT cif file')6455 self.ISODDataEdit.Append(G2G.wxID_ISODNEWPHASE,'Make cif file','From ISODISTORT selection') 6456 6456 self.PostfillDataMenu() 6457 6457 -
trunk/GSASIIphsGUI.py
r5056 r5057 5903 5903 ####start of UpdateRMC 5904 5904 G2frame.GetStatusBar().SetStatusText('',1) 5905 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,True)5906 5905 if G2frame.RMCchoice == 'RMCProfile': 5907 5906 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True) … … 5909 5908 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,True) 5910 5909 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,False) 5911 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,False)5912 5910 elif G2frame.RMCchoice == 'fullrmc': 5913 5911 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,False) … … 5915 5913 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,False) 5916 5914 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,False) 5917 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,False)5918 5915 #G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,True) 5919 5916 if G2frame.FRMC.GetSizer(): … … 6649 6646 isoGrid.ForceRefresh() 6650 6647 6651 if not data['ISODISTORT']: 6648 def OnDispl(event): 6649 Obj = event.GetEventObject() 6650 idsp,dispVal = Indx[Obj.GetId()] 6651 modeDisp[idsp] = (Obj.GetValue()-100)/1000. 6652 dispVal.SetValue(modeDisp[idsp]) 6653 6654 6655 Indx = {} 6656 if 'radio' not in data['ISODISTORT']: 6657 if not data['ISODISTORT']: 6658 mainSizer = wx.BoxSizer(wx.VERTICAL) 6659 mainSizer.Add(wx.StaticText(ISODIST,label='No ISODISTORT information found for this phase'),0,WACV) 6660 SetPhaseWindow(ISODIST,mainSizer,Scroll=Scroll) 6661 return 6662 mainSizer = wx.BoxSizer(wx.VERTICAL) 6663 topSizer = wx.BoxSizer(wx.VERTICAL) 6664 bottomSizer = wx.BoxSizer(wx.VERTICAL) 6665 topSizer.Add(wx.StaticText(ISODIST,label=' ISODISTORT distortion modes for %s:'%data['General']['Name']),0,WACV) 6666 topSizer.Add(wx.StaticText(ISODIST,label=''' 6667 For use of ISODISTORT, please cite: 6668 H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISODISTORT, ISOTROPY Software Suite, iso.byu.edu. 6669 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions." 6670 J. Appl. Cryst. 39, 607-614 (2006). 6671 '''),0,WACV) 6672 topSizer.Add(wx.StaticText(ISODIST,label=' Adjust magnitude of distortion modes (-0.1 to +0.1):')) 6673 slideSizer = wx.FlexGridSizer(0,3,0,0) 6674 slideSizer.AddGrowableCol(2,1) 6675 modeDisp = np.zeros(len(data['ISODISTORT']['G2ModeList'])) 6676 for idsp,item in enumerate(data['ISODISTORT']['G2ModeList']): 6677 slideSizer.Add(wx.StaticText(ISODIST,label=item.name),0,WACV) 6678 dispVal = G2G.ValidatedTxtCtrl(ISODIST,modeDisp,idsp,xmin=-0.1,xmax=0.1,size=(50,20)) 6679 slideSizer.Add(dispVal,0,WACV) 6680 displ = wx.Slider(ISODIST,style=wx.SL_HORIZONTAL,value=int(modeDisp[idsp]*1000)+100) 6681 displ.SetRange(0,200) 6682 displ.Bind(wx.EVT_SLIDER, OnDispl) 6683 Indx[displ.GetId()] = [idsp,dispVal] 6684 slideSizer.Add(displ,1,wx.EXPAND|wx.RIGHT) 6685 topSizer.Add(slideSizer) 6686 mainSizer.Add(topSizer) 6687 SetPhaseWindow(ISODIST,mainSizer,Scroll=Scroll) 6652 6688 return 6653 6689 if ISODIST.GetSizer(): … … 13448 13484 G2frame.Bind(wx.EVT_MENU, OnViewRMC, id=G2G.wxID_VIEWRMC) 13449 13485 G2frame.Bind(wx.EVT_MENU, OnStopRMC, id=G2G.wxID_STOPRMC) 13486 # ISODISTORT 13487 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.ISODData) 13450 13488 G2frame.Bind(wx.EVT_MENU, OnNewISOPhase, id=G2G.wxID_ISODNEWPHASE) 13451 13489 # MC/SA -
trunk/imports/G2phase_CIF.py
r5043 r5057 25 25 import re 26 26 import copy 27 import os.path 27 28 import GSASIIobj as G2obj 28 29 import GSASIIspc as G2spc … … 609 610 else: 610 611 break 611 else: # no name found, use block name for lack of a better choice 612 else: # no name found, use block name for lack of a better choice; for isodistort use filename 612 613 name = blknm 613 self.Phase['General']['Name'] = name.strip() 614 if 'isodistort' in name: 615 self.Phase['General']['Name'] = os.path.split(filename)[1].split('.')[0] 616 else: 617 self.Phase['General']['Name'] = name.strip() 614 618 self.Phase['General']['Super'] = Super 615 619 self.Phase = copy.deepcopy(self.Phase) #clean copy
Note: See TracChangeset
for help on using the changeset viewer.