Changeset 2780
- Timestamp:
- Apr 13, 2017 12:30:43 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r2777 r2780 109 109 [ wxID_BACKCOPY,wxID_LIMITCOPY, wxID_SAMPLECOPY, wxID_SAMPLECOPYSOME, wxID_BACKFLAGCOPY, wxID_SAMPLEFLAGCOPY, 110 110 wxID_SAMPLESAVE, wxID_SAMPLELOAD,wxID_ADDEXCLREGION,wxID_SETSCALE,wxID_SAMPLE1VAL,wxID_ALLSAMPLELOAD, 111 wxID_MAKEBACKRDF, 112 ] = [wx.NewId() for item in range(1 3)]111 wxID_MAKEBACKRDF,wxID_RESCALEALL, 112 ] = [wx.NewId() for item in range(14)] 113 113 114 114 [ wxID_INSTPRMRESET,wxID_CHANGEWAVETYPE,wxID_INSTCOPY, wxID_INSTFLAGCOPY, wxID_INSTLOAD, … … 2019 2019 self.SampleEdit.Append(id=wxID_ALLSAMPLELOAD, kind=wx.ITEM_NORMAL,text='Load all', 2020 2020 help='Load sample parmameters over multiple histograms') 2021 self.SampleEdit.Append(id=wxID_RESCALEALL, kind=wx.ITEM_NORMAL,text='Rescale all', 2022 help='Rescale all data with selected range') 2023 2021 2024 2022 2025 self.PostfillDataMenu() -
trunk/GSASIIpwdGUI.py
r2777 r2780 2172 2172 finally: 2173 2173 dlg.Destroy() 2174 G2plt.PlotPatterns(G2frame,plotType= 'SASD',newPlot=True)2174 G2plt.PlotPatterns(G2frame,plotType=histName[:4],newPlot=True) 2175 2175 UpdateSampleGrid(G2frame,data) 2176 2176 return … … 2203 2203 G2sasd.SetScale(Data,refData) 2204 2204 G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True) 2205 UpdateSampleGrid(G2frame,data) 2205 UpdateSampleGrid(G2frame,data) 2206 2207 def OnRescaleAll(event): 2208 hst = G2frame.PatternTree.GetItemText(G2frame.PatternId) 2209 histList = GetHistsLikeSelected(G2frame) 2210 x0,y0,w0 = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1][:3] 2211 if not histList: 2212 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame.dataFrame) 2213 return 2214 od = {'label_1':'Scaling range min','value_1':0.0,'label_2':'Scaling range max','value_2':10.} 2215 dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame, 2216 'Do scaling from\n'+str(hst[5:])+' to...','Rescale histograms', histList,extraOpts=od) 2217 try: 2218 if dlg.ShowModal() == wx.ID_OK: 2219 Xmin = od['value_1'] 2220 Xmax = od['value_2'] 2221 iBeg = np.searchsorted(x0,Xmin) 2222 iFin = np.searchsorted(x0,Xmax) 2223 sum0 = np.sum(y0[iBeg:iFin]) 2224 result = dlg.GetSelections() 2225 for i in result: 2226 item = histList[i] 2227 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item) 2228 xi,yi,wi = G2frame.PatternTree.GetItemPyData(Id)[1][:3] 2229 sumi = np.sum(yi[iBeg:iFin]) 2230 if sumi: 2231 Scale = sum0/sumi 2232 yi *= Scale 2233 wi /= Scale**2 2234 finally: 2235 dlg.Destroy() 2236 G2plt.PlotPatterns(G2frame,plotType=histName[:4],newPlot=True) 2237 2206 2238 2207 2239 def OnSampleCopy(event): … … 2216 2248 G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame.dataFrame) 2217 2249 return 2218 dlg = G2G.G2MultiChoiceDialog( 2219 G2frame.dataFrame, 2250 dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame, 2220 2251 'Copy sample params from\n'+str(hst[5:])+' to...', 2221 2252 'Copy sample parameters', histList) … … 2372 2403 G2frame.Bind(wx.EVT_MENU, OnCopy1Val, id=G2gd.wxID_SAMPLE1VAL) 2373 2404 G2frame.Bind(wx.EVT_MENU, OnAllSampleLoad, id=G2gd.wxID_ALLSAMPLELOAD) 2405 G2frame.Bind(wx.EVT_MENU, OnRescaleAll, id=G2gd.wxID_RESCALEALL) 2374 2406 if histName[:4] in ['SASD','REFD','PWDR']: 2375 2407 G2frame.dataFrame.SetScale.Enable(True) -
trunk/imports/G2pwd_xye.py
r2738 r2780 21 21 GSASIIpath.SetVersionNumber("$Revision$") 22 22 class xye_ReaderClass(G2IO.ImportPowderData): 23 'Routines to import powder data from a .xye file'23 'Routines to import powder data from a .xye/.chi file' 24 24 def __init__(self): 25 25 super(self.__class__,self).__init__( # fancy way to self-reference 26 extensionlist=('.xye', ),26 extensionlist=('.xye','.chi',), 27 27 strictExtension=False, 28 formatName = 'Topas xye ',29 longFormatName = 'Topas .xye powder data file'28 formatName = 'Topas xye & Fit2D chi', 29 longFormatName = 'Topas .xye & Fit2D .chi powder data file' 30 30 ) 31 31 … … 36 36 begin = True 37 37 self.GSAS = False 38 self.Chi = False 39 if '.chi' in filepointer.name: 40 self.Chi = True 38 41 for i,S in enumerate(filepointer): 39 42 if not S: … … 41 44 if i > 1000: break 42 45 if begin: 43 if gotCcomment and S.find('*/') > -1: 44 begin = False 45 continue 46 if S.strip().startswith('/*'): 47 gotCcomment = True 48 continue 49 if S[0] in ["'",'#']: 50 continue #ignore comments, if any 46 if self.Chi: 47 if i < 4: 48 continue 49 else: 50 begin = False 51 51 else: 52 begin = False 52 if gotCcomment and S.find('*/') > -1: 53 begin = False 54 continue 55 if S.strip().startswith('/*'): 56 gotCcomment = True 57 continue 58 if S[0] in ["'",'#']: 59 continue #ignore comments, if any 60 else: 61 begin = False 53 62 # valid line to read? 54 63 #vals = S.split() … … 77 86 # or (GSAS style) each line can begin with '#' 78 87 if begin: 79 if gotCcomment and S.find('*/') > -1: 80 self.comments.append(S[:-1]) 81 begin = False 82 continue 83 if S.strip().startswith('/*'): 84 self.comments.append(S[:-1]) 85 gotCcomment = True 86 continue 87 if S[0] in ["'",'#']: 88 self.comments.append(S[:-1]) 89 continue #ignore comments, if any 90 else: 91 begin = False 88 if self.Chi: 89 if i < 4: 90 continue 91 else: 92 begin = False 93 else: 94 if gotCcomment and S.find('*/') > -1: 95 self.comments.append(S[:-1]) 96 begin = False 97 continue 98 if S.strip().startswith('/*'): 99 self.comments.append(S[:-1]) 100 gotCcomment = True 101 continue 102 if S[0] in ["'",'#']: 103 self.comments.append(S[:-1]) 104 continue #ignore comments, if any 105 else: 106 begin = False 92 107 # valid line to read 93 108 #vals = S.split()
Note: See TracChangeset
for help on using the changeset viewer.