Changeset 368


Ignore:
Timestamp:
Sep 9, 2011 9:59:47 AM (12 years ago)
Author:
vondreele
Message:

fix controls setup & refine enable/disable
add print option to GSASIIstruct.py input routines
needed for new parameter summary feature in GSASII.py
begin view parmater summary stuff

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r345 r368  
    6363
    6464[wxID_FILECLOSE, wxID_FILEEXIT, wxID_FILEOPEN,  wxID_FILESAVE, wxID_FILESAVEAS,
    65 wxID_REFINE, wxID_SOLVE, wxID_MAKEPDFS,
    66 ] = [wx.NewId() for _init_coll_File_Items in range(8)]
     65wxID_REFINE, wxID_SOLVE, wxID_MAKEPDFS, wxID_VIEWLSPARMS,
     66] = [wx.NewId() for _init_coll_File_Items in range(9)]
    6767
    6868[wxID_PWDRREAD,wxID_SNGLREAD,wxID_ADDPHASE,wxID_DELETEPHASE,
     
    145145            id=wxID_MAKEPDFS, kind=wx.ITEM_NORMAL,text='Make new PDFs')
    146146        self.Bind(wx.EVT_MENU, self.OnMakePDFs, id=wxID_MAKEPDFS)
     147        self.ViewLSParms = parent.Append(help='View least squares parameters',
     148            id=wxID_VIEWLSPARMS, kind=wx.ITEM_NORMAL,text='View LS parms')
     149        self.Bind(wx.EVT_MENU, self.OnViewLSParms, id=wxID_VIEWLSPARMS)
    147150        self.Refine = parent.Append(help='', id=wxID_REFINE, kind=wx.ITEM_NORMAL,
    148151            text='Refine')
    149         self.Refine.Enable(True)
     152        self.Refine.Enable(False)
    150153        self.Bind(wx.EVT_MENU, self.OnRefine, id=wxID_REFINE)
    151154        self.Solve = parent.Append(help='', id=wxID_SOLVE, kind=wx.ITEM_NORMAL,
     
    10561059                        elif name == 'Controls':
    10571060                            data = self.PatternTree.GetItemPyData(item)
    1058                             if data != [0] and data != {}:
     1061                            if data:
    10591062                                self.Refine.Enable(True)
    10601063                                self.Solve.Enable(True)         #not right but something needed here
     
    13431346            finally:
    13441347                dlg.Destroy()
     1348
     1349    def OnViewLSParms(self,event):
     1350        parmDict = {}
     1351        self.OnFileSave(event)
     1352        Histograms,Phases = G2str.GetUsedHistogramsAndPhases(self.GSASprojectfile)
     1353        phaseVary,phaseDict,pawleyLookup = G2str.GetPhaseData(Phases,Print=False)
     1354        hapVary,hapDict,controlDict = G2str.GetHistogramPhaseData(Phases,Histograms,Print=False)
     1355        histVary,histDict,controlDict = G2str.GetHistogramData(Histograms,Print=False)
     1356        varyList = phaseVary+hapVary+histVary
     1357        parmDict.update(phaseDict)
     1358        parmDict.update(hapDict)
     1359        parmDict.update(histDict)
     1360        parmKeys = parmDict.keys()
     1361        parmKeys.sort()
     1362        for parm in parmKeys:
     1363            line = parm+str(parmDict[parm])
     1364            if parm in varyList:
     1365                line += ' True'
     1366            else:
     1367                line += ' False'
     1368            print line
     1369
     1370
    13451371       
    13461372    def OnRefine(self,event):
  • trunk/GSASIIgrid.py

    r367 r368  
    737737            self.ExportPattern.Enable(False)
    738738            data = self.PatternTree.GetItemPyData(item)
    739             if data == [0] or data == {}:           #fill in defaults
     739            if not data:           #fill in defaults
    740740                data = {
    741741                    #least squares controls
    742                     'deriv type':'analytic','min dM/M':0.0001,
     742                    'deriv type':'analytic','min dM/M':0.0001,'shift factor':1.0,
    743743                    #Fourier controls
    744744                    'mapType':'Fobs','d-max':100.,'d-min':0.2,'histograms':[],
  • trunk/GSASIIphsGUI.py

    r367 r368  
    20692069        if UseList:
    20702070            self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,True)
     2071            self.Refine.Enable(True)
    20712072        else:
    2072             self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False)           
     2073            self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False)
     2074            self.Refine.Enable(False)           
    20732075        generalData = data['General']       
    20742076        SGData = generalData['SGData']
  • trunk/GSASIIstruct.py

    r367 r368  
    342342   
    343343       
    344 def GetPhaseData(PhaseData):
    345    
    346        
    347     print ' Phases:'
     344def GetPhaseData(PhaseData,Print=True):
     345   
     346       
     347    if Print: print ' Phases:'
    348348    phaseVary = []
    349349    phaseDict = {}
     
    359359        except KeyError:
    360360            PawleyRef = []
    361         print '\n Phase name: ',General['Name']
     361        if Print: print '\n Phase name: ',General['Name']
    362362        SGData = General['SGData']
    363363        SGtext = G2spc.SGPrint(SGData)
    364         for line in SGtext: print line
     364        if Print:
     365            for line in SGtext: print line
    365366        cell = General['Cell']
    366367        A = G2lat.cell2A(cell[1:7])
     
    368369        if cell[0]:
    369370            phaseVary = cellVary(pfx,SGData)
    370         print '\n Unit cell: a =','%.5f'%(cell[1]),' b =','%.5f'%(cell[2]),' c =','%.5f'%(cell[3]), \
     371        if Print: print '\n Unit cell: a =','%.5f'%(cell[1]),' b =','%.5f'%(cell[2]),' c =','%.5f'%(cell[3]), \
    371372            ' alpha =','%.3f'%(cell[4]),' beta =','%.3f'%(cell[5]),' gamma =', \
    372373            '%.3f'%(cell[6]),' volume =','%.3f'%(cell[7]),' Refine?',cell[0]
    373374        if Atoms:
    374             print '\n Atoms:'
     375            if Print: print '\n Atoms:'
    375376            line = '   name    type  refine?   x         y         z    '+ \
    376377                '  frac site sym  mult I/A   Uiso     U11     U22     U33     U12     U13     U23'
     
    379380            elif General['Type'] == 'macromolecular':
    380381                line = ' res no  residue  chain '+line
    381             print line
     382            if Print: print line
    382383            if General['Type'] == 'nuclear':
    383                 print 135*'-'
     384                if Print: print 135*'-'
    384385                for at in Atoms:
    385386                    line = '%7s'%(at[0])+'%7s'%(at[1])+'%7s'%(at[2])+'%10.5f'%(at[3])+'%10.5f'%(at[4])+ \
     
    391392                        for i in range(6):
    392393                            line += '%8.4f'%(at[11+i])
    393                     print line
     394                    if Print: print line
    394395                    if 'X' in at[2]:
    395396                        xId,xCoef = G2spc.GetCSxinel(at[7])
     
    496497                    refl[7] = 0
    497498
    498 def GetHistogramPhaseData(Phases,Histograms):
     499def GetHistogramPhaseData(Phases,Histograms,Print=True):
    499500   
    500501    def PrintSize(hapData):
     
    556557        pId = Phases[phase]['pId']
    557558        for histogram in HistoPhase:
    558             print '\n Phase: ',phase,' in histogram: ',histogram
    559559            hapData = HistoPhase[histogram]
    560560            Histogram = Histograms[histogram]
     
    611611                            hapVary.append(pfx+item+sfx)
    612612                           
    613             print '\n Phase fraction  : %10.4f'%(hapData['Scale'][0]),' Refine?',hapData['Scale'][1]
    614             print ' Extinction coeff: %10.4f'%(hapData['Extinction'][0]),' Refine?',hapData['Extinction'][1]
    615             if hapData['Pref.Ori.'][0] == 'MD':
    616                 Ax = hapData['Pref.Ori.'][3]
    617                 print ' March-Dollase PO: %10.4f'%(hapData['Pref.Ori.'][1]),' Refine?',hapData['Pref.Ori.'][2], \
    618                     ' Axis: %d %d %d'%(Ax[0],Ax[1],Ax[2])               
    619             PrintSize(hapData['Size'])
    620             PrintMuStrain(hapData['Mustrain'],SGData)
     613            if Print:
     614                print '\n Phase: ',phase,' in histogram: ',histogram
     615                print '\n Phase fraction  : %10.4f'%(hapData['Scale'][0]),' Refine?',hapData['Scale'][1]
     616                print ' Extinction coeff: %10.4f'%(hapData['Extinction'][0]),' Refine?',hapData['Extinction'][1]
     617                if hapData['Pref.Ori.'][0] == 'MD':
     618                    Ax = hapData['Pref.Ori.'][3]
     619                    print ' March-Dollase PO: %10.4f'%(hapData['Pref.Ori.'][1]),' Refine?',hapData['Pref.Ori.'][2], \
     620                        ' Axis: %d %d %d'%(Ax[0],Ax[1],Ax[2])               
     621                PrintSize(hapData['Size'])
     622                PrintMuStrain(hapData['Mustrain'],SGData)
    621623            HKLd = np.array(G2lat.GenHLaue(dmin,SGData,A))
    622624            refList = []
     
    749751            PrintMuStrainAndSig(hapData['Mustrain'],SizeMuStrSig['Mustrain'],SGData)
    750752   
    751 def GetHistogramData(Histograms):
     753def GetHistogramData(Histograms,Print=True):
    752754   
    753755    def GetBackgroundParms(hId,Background):
     
    866868        histVary += sampVary
    867869
    868         print '\n Histogram: ',histogram,' histogram Id: ',hId
    869         print 135*'-'
    870         Units = {'C':' deg','T':' msec'}
    871         units = Units[controlDict[pfx+'histType'][2]]
    872         Limits = controlDict[pfx+'Limits']
    873         print ' Instrument type: ',Sample['Type']
    874         print ' Histogram limits: %8.2f%s to %8.2f%s'%(Limits[0],units,Limits[1],units)     
    875         PrintSampleParms(Sample)
    876         PrintInstParms(Inst)
    877         PrintBackground(Background)
     870        if Print:
     871            print '\n Histogram: ',histogram,' histogram Id: ',hId
     872            print 135*'-'
     873            Units = {'C':' deg','T':' msec'}
     874            units = Units[controlDict[pfx+'histType'][2]]
     875            Limits = controlDict[pfx+'Limits']
     876            print ' Instrument type: ',Sample['Type']
     877            print ' Histogram limits: %8.2f%s to %8.2f%s'%(Limits[0],units,Limits[1],units)     
     878            PrintSampleParms(Sample)
     879            PrintInstParms(Inst)
     880            PrintBackground(Background)
    878881       
    879882    return histVary,histDict,controlDict
     
    14831486    histVary,histDict,controlDict = GetHistogramData(Histograms)
    14841487    calcControls.update(controlDict)
    1485     varyList = phaseVary+histVary+hapVary
     1488    varyList = phaseVary+hapVary+histVary
    14861489    parmDict.update(phaseDict)
    14871490    parmDict.update(hapDict)
Note: See TracChangeset for help on using the changeset viewer.