Changeset 5057


Ignore:
Timestamp:
Oct 29, 2021 10:34:57 AM (2 years ago)
Author:
vondreele
Message:

cleanup ISODISTORT references in constraints & its phase tab
ISODISTORT tab will show either a message if no info, selection table from ISTDISTORT site, or mode list with sliders (not yet active)
cif importer makes phase name from cif file name if from ISODISTORT - this name matches that from order parameter list

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r5043 r5057  
    15291529    G2obj.IndexAllIds(Histograms,Phases)
    15301530    for p in Phases:
    1531         if 'ISODISTORT' in Phases[p]:
     1531        if 'ISODISTORT' in Phases[p] and 'G2VarList' in Phases[p]['ISODISTORT']:
    15321532            G2frame.dataWindow.ConstraintEdit.Enable(G2G.wxID_SHOWISO,True)
    15331533            break
     
    38103810        return helptext
    38113811
    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']]
    38153814    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')
    38183816        return
    38193817    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
    38243820    elif not phase and len(isophases) == 1:
    38253821        phase = isophases[0]
    38263822    elif not phase:
    38273823        dlg = wx.SingleChoiceDialog(G2frame,'Select phase from ISODISTORT phases',
    3828                                         'Select Phase',isophases)
     3824            'Select Phase',isophases)
    38293825        if dlg.ShowModal() == wx.ID_OK:
    38303826            sel = dlg.GetSelection()
     
    38323828        else:
    38333829            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     #     return
    38403830   
    38413831    covdata = G2frame.GPXtree.GetItemPyData(
     
    38523842
    38533843    dlg = wx.Dialog(G2frame,wx.ID_ANY,'ISODISTORT mode values',#size=(630,400),
    3854                        style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
     3844        style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
    38553845    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         return
    38603846    data = Phases[phase]
    38613847    ISO = data['ISODISTORT']
    38623848    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'))))
    38653850    aSizer = wx.BoxSizer(wx.HORIZONTAL)
    38663851    panel1 = wxscroll.ScrolledPanel(
     
    38893874                cval = parmDict[var][0]
    38903875            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
    38943877            deltaList.append(cval-pval)
    38953878        modeVals = np.inner(ISO['Var2ModeMatrix'],deltaList)
     
    38973880                ISO['IsoVarList'],deltaList,
    38983881                ISO['IsoModeList'],modeVals,ISO['NormList'],ISO['G2ModeList'] ):
    3899             #GSASIIpath.IPyBreak()
    39003882            if str(G2mode) in constrDict:
    39013883                ch = G2G.HelpButton(panel2,fmtHelp(constrDict[str(G2mode)],var))
  • trunk/GSASIIdataGUI.py

    r5054 r5057  
    64536453        self.ISODDataEdit = wx.Menu(title='')
    64546454        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')
    64566456        self.PostfillDataMenu()
    64576457
  • trunk/GSASIIphsGUI.py

    r5056 r5057  
    59035903####start of UpdateRMC           
    59045904        G2frame.GetStatusBar().SetStatusText('',1)
    5905         G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,True)
    59065905        if G2frame.RMCchoice == 'RMCProfile':
    59075906            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True)
     
    59095908            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,True)
    59105909            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,False)
    5911             G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,False)
    59125910        elif G2frame.RMCchoice == 'fullrmc':
    59135911            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,False)
     
    59155913            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,False)
    59165914            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,False)
    5917             G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_ISODISTORT,False)
    59185915            #G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,True)
    59195916        if G2frame.FRMC.GetSizer():
     
    66496646                isoGrid.ForceRefresh()
    66506647               
    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='''
     6667For 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)               
    66526688            return
    66536689        if ISODIST.GetSizer():
     
    1344813484        G2frame.Bind(wx.EVT_MENU, OnViewRMC, id=G2G.wxID_VIEWRMC)
    1344913485        G2frame.Bind(wx.EVT_MENU, OnStopRMC, id=G2G.wxID_STOPRMC)
     13486        # ISODISTORT
     13487        FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.ISODData)
    1345013488        G2frame.Bind(wx.EVT_MENU, OnNewISOPhase, id=G2G.wxID_ISODNEWPHASE)
    1345113489        # MC/SA
  • trunk/imports/G2phase_CIF.py

    r5043 r5057  
    2525import re
    2626import copy
     27import os.path
    2728import GSASIIobj as G2obj
    2829import GSASIIspc as G2spc
     
    609610                else:
    610611                    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
    612613                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()
    614618            self.Phase['General']['Super'] = Super
    615619            self.Phase = copy.deepcopy(self.Phase)      #clean copy
Note: See TracChangeset for help on using the changeset viewer.