Changeset 368
- Timestamp:
- Sep 9, 2011 9:59:47 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r345 r368 63 63 64 64 [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)]65 wxID_REFINE, wxID_SOLVE, wxID_MAKEPDFS, wxID_VIEWLSPARMS, 66 ] = [wx.NewId() for _init_coll_File_Items in range(9)] 67 67 68 68 [wxID_PWDRREAD,wxID_SNGLREAD,wxID_ADDPHASE,wxID_DELETEPHASE, … … 145 145 id=wxID_MAKEPDFS, kind=wx.ITEM_NORMAL,text='Make new PDFs') 146 146 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) 147 150 self.Refine = parent.Append(help='', id=wxID_REFINE, kind=wx.ITEM_NORMAL, 148 151 text='Refine') 149 self.Refine.Enable( True)152 self.Refine.Enable(False) 150 153 self.Bind(wx.EVT_MENU, self.OnRefine, id=wxID_REFINE) 151 154 self.Solve = parent.Append(help='', id=wxID_SOLVE, kind=wx.ITEM_NORMAL, … … 1056 1059 elif name == 'Controls': 1057 1060 data = self.PatternTree.GetItemPyData(item) 1058 if data != [0] and data != {}:1061 if data: 1059 1062 self.Refine.Enable(True) 1060 1063 self.Solve.Enable(True) #not right but something needed here … … 1343 1346 finally: 1344 1347 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 1345 1371 1346 1372 def OnRefine(self,event): -
trunk/GSASIIgrid.py
r367 r368 737 737 self.ExportPattern.Enable(False) 738 738 data = self.PatternTree.GetItemPyData(item) 739 if data == [0] or data == {}: #fill in defaults739 if not data: #fill in defaults 740 740 data = { 741 741 #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, 743 743 #Fourier controls 744 744 'mapType':'Fobs','d-max':100.,'d-min':0.2,'histograms':[], -
trunk/GSASIIphsGUI.py
r367 r368 2069 2069 if UseList: 2070 2070 self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,True) 2071 self.Refine.Enable(True) 2071 2072 else: 2072 self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False) 2073 self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False) 2074 self.Refine.Enable(False) 2073 2075 generalData = data['General'] 2074 2076 SGData = generalData['SGData'] -
trunk/GSASIIstruct.py
r367 r368 342 342 343 343 344 def GetPhaseData(PhaseData ):345 346 347 print ' Phases:'344 def GetPhaseData(PhaseData,Print=True): 345 346 347 if Print: print ' Phases:' 348 348 phaseVary = [] 349 349 phaseDict = {} … … 359 359 except KeyError: 360 360 PawleyRef = [] 361 print '\n Phase name: ',General['Name']361 if Print: print '\n Phase name: ',General['Name'] 362 362 SGData = General['SGData'] 363 363 SGtext = G2spc.SGPrint(SGData) 364 for line in SGtext: print line 364 if Print: 365 for line in SGtext: print line 365 366 cell = General['Cell'] 366 367 A = G2lat.cell2A(cell[1:7]) … … 368 369 if cell[0]: 369 370 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]), \ 371 372 ' alpha =','%.3f'%(cell[4]),' beta =','%.3f'%(cell[5]),' gamma =', \ 372 373 '%.3f'%(cell[6]),' volume =','%.3f'%(cell[7]),' Refine?',cell[0] 373 374 if Atoms: 374 print '\n Atoms:'375 if Print: print '\n Atoms:' 375 376 line = ' name type refine? x y z '+ \ 376 377 ' frac site sym mult I/A Uiso U11 U22 U33 U12 U13 U23' … … 379 380 elif General['Type'] == 'macromolecular': 380 381 line = ' res no residue chain '+line 381 print line382 if Print: print line 382 383 if General['Type'] == 'nuclear': 383 print 135*'-'384 if Print: print 135*'-' 384 385 for at in Atoms: 385 386 line = '%7s'%(at[0])+'%7s'%(at[1])+'%7s'%(at[2])+'%10.5f'%(at[3])+'%10.5f'%(at[4])+ \ … … 391 392 for i in range(6): 392 393 line += '%8.4f'%(at[11+i]) 393 print line394 if Print: print line 394 395 if 'X' in at[2]: 395 396 xId,xCoef = G2spc.GetCSxinel(at[7]) … … 496 497 refl[7] = 0 497 498 498 def GetHistogramPhaseData(Phases,Histograms ):499 def GetHistogramPhaseData(Phases,Histograms,Print=True): 499 500 500 501 def PrintSize(hapData): … … 556 557 pId = Phases[phase]['pId'] 557 558 for histogram in HistoPhase: 558 print '\n Phase: ',phase,' in histogram: ',histogram559 559 hapData = HistoPhase[histogram] 560 560 Histogram = Histograms[histogram] … … 611 611 hapVary.append(pfx+item+sfx) 612 612 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) 621 623 HKLd = np.array(G2lat.GenHLaue(dmin,SGData,A)) 622 624 refList = [] … … 749 751 PrintMuStrainAndSig(hapData['Mustrain'],SizeMuStrSig['Mustrain'],SGData) 750 752 751 def GetHistogramData(Histograms ):753 def GetHistogramData(Histograms,Print=True): 752 754 753 755 def GetBackgroundParms(hId,Background): … … 866 868 histVary += sampVary 867 869 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) 878 881 879 882 return histVary,histDict,controlDict … … 1483 1486 histVary,histDict,controlDict = GetHistogramData(Histograms) 1484 1487 calcControls.update(controlDict) 1485 varyList = phaseVary+h istVary+hapVary1488 varyList = phaseVary+hapVary+histVary 1486 1489 parmDict.update(phaseDict) 1487 1490 parmDict.update(hapDict)
Note: See TracChangeset
for help on using the changeset viewer.