Changeset 1518
- Timestamp:
- Oct 6, 2014 10:16:26 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1517 r1518 105 105 ] = [wx.NewId() for item in range(8)] 106 106 107 [ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_ APPENDDZERO,108 wxID_ STRSTAALLFIT,wxID_UPDATEDZERO,109 ] = [wx.NewId() for item in range( 7)]107 [ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE, 108 wxID_APPENDDZERO,wxID_STRSTAALLFIT,wxID_UPDATEDZERO, 109 ] = [wx.NewId() for item in range(8)] 110 110 111 111 [ wxID_BACKCOPY,wxID_LIMITCOPY, wxID_SAMPLECOPY, wxID_SAMPLECOPYSOME, wxID_BACKFLAGCOPY, wxID_SAMPLEFLAGCOPY, … … 3272 3272 self.SampleEdit.Append(id=wxID_SAMPLE1VAL, kind=wx.ITEM_NORMAL,text='Set one value', 3273 3273 help='Set one sample parameter value across multiple histograms') 3274 self.SampleEdit.Append(id=wxID_ALLSAMPLELOAD, kind=wx.ITEM_NORMAL,text='Load all samples',3274 self.SampleEdit.Append(id=wxID_ALLSAMPLELOAD, kind=wx.ITEM_NORMAL,text='Load all', 3275 3275 help='Load sample parmameters over multiple histograms') 3276 3276 … … 3455 3455 self.StrStaEdit.Append(help='Load stress/strain data from file', 3456 3456 id=wxID_STRSTALOAD, kind=wx.ITEM_NORMAL,text='Load stress/strain') 3457 self.StrStaEdit.Append(help='Load sample data from file', 3458 id=wxID_STRSTSAMPLE, kind=wx.ITEM_NORMAL,text='Load sample data') 3457 3459 self.PostfillDataMenu() 3458 3460 -
trunk/GSASIIimgGUI.py
r1472 r1518 42 42 ##### Image Data 43 43 ################################################################################ 44 44 45 def UpdateImageData(G2frame,data): 45 46 … … 1500 1501 finally: 1501 1502 dlg.Destroy() 1502 1503 1504 def OnStrStaSample(event): 1505 filename = '' 1506 dlg = wx.FileDialog(G2frame, 'Choose multihistogram metadata text file', '.', '', 1507 'metadata file (*.*)|*.*',wx.OPEN|wx.CHANGE_DIR) 1508 try: 1509 if dlg.ShowModal() == wx.ID_OK: 1510 filename = dlg.GetPath() 1511 File = open(filename,'r') 1512 S = File.readline() 1513 newItems = [] 1514 itemNames = [] 1515 Comments = [] 1516 while S: 1517 if S[0] == '#': 1518 Comments.append(S) 1519 S = File.readline() 1520 continue 1521 S = S.replace(',',' ').replace('\t',' ') 1522 Stuff = S[:-1].split() 1523 itemNames.append(Stuff[0]) 1524 newItems.append(Stuff[1:]) 1525 S = File.readline() 1526 File.close() 1527 finally: 1528 dlg.Destroy() 1529 if not filename: 1530 G2frame.ErrorDialog('Nothing to do','No file selected') 1531 return 1532 dataDict = dict(zip(itemNames,newItems)) 1533 ifany = False 1534 Names = [' ','Sample phi','Sample z','Sample load'] 1535 dlg = G2gd.G2ColumnIDDialog( G2frame,' Choose multihistogram metadata columns:', 1536 'Select columns',Comments,Names,np.array(newItems).T) 1537 try: 1538 if dlg.ShowModal() == wx.ID_OK: 1539 colNames,newData = dlg.GetSelection() 1540 dataDict = dict(zip(itemNames,newData.T)) 1541 for item in colNames: 1542 if item != ' ': 1543 ifany = True 1544 finally: 1545 dlg.Destroy() 1546 if not ifany: 1547 G2frame.ErrorDialog('Nothing to do','No columns identified') 1548 return 1549 histList = [] 1550 item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root) 1551 while item: 1552 name = G2frame.PatternTree.GetItemText(item) 1553 if name.startswith('IMG'): 1554 histList.append(name) 1555 item, cookie = G2frame.PatternTree.GetNextChild(G2frame.root, cookie) 1556 colIds = {} 1557 for i,name in enumerate(colNames): 1558 if name != ' ': 1559 colIds[name] = i 1560 for hist in histList: 1561 name = hist.split()[1] #this is file name 1562 if name in dataDict: 1563 newItems = {} 1564 for item in colIds: 1565 newItems[item] = float(dataDict[name][colIds[item]]) 1566 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,hist) 1567 stsrData = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Stress/Strain')) 1568 stsrData.update(newItems) 1569 UpdateStressStrain(G2frame,data) 1570 1503 1571 def OnFitStrSta(event): 1504 1572 Controls = G2frame.PatternTree.GetItemPyData( … … 1745 1813 G2frame.dataFrame.Bind(wx.EVT_MENU, OnCopyStrSta, id=G2gd.wxID_STRSTACOPY) 1746 1814 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadStrSta, id=G2gd.wxID_STRSTALOAD) 1747 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveStrSta, id=G2gd.wxID_STRSTASAVE) 1815 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveStrSta, id=G2gd.wxID_STRSTASAVE) 1816 G2frame.dataFrame.Bind(wx.EVT_MENU, OnStrStaSample, id=G2gd.wxID_STRSTSAMPLE) 1748 1817 if not G2frame.dataFrame.GetStatusBar(): 1749 1818 Status = G2frame.dataFrame.CreateStatusBar() -
trunk/GSASIIpwdGUI.py
r1515 r1518 1606 1606 S = File.readline() 1607 1607 continue 1608 S.replace(',',' ') 1609 S.replace('\t',' ') 1610 Stuff = S[:-1].split(' ') 1608 S = S.replace(',',' ').replace('\t',' ') 1609 Stuff = S[:-1].split() 1611 1610 itemNames.append(Stuff[0]) 1612 1611 newItems.append(Stuff[1:])
Note: See TracChangeset
for help on using the changeset viewer.