Changeset 466 for sans/utils
- Timestamp:
- Dec 12, 2008 5:12:52 PM (14 years ago)
- Location:
- sans/utils/bt5/bt5plot2
- Files:
-
- 202 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/utils/bt5/bt5plot2/bt5plot2
r464 r466 43 43 "on_xaxis_loglin_activate" : self.handle_xaxis_loglin, 44 44 "on_yaxis_loglin_activate" : self.handle_yaxis_loglin, 45 "on_plot_type_activate" : self.handle_plot_type_change} 45 "on_plot_type_activate" : self.handle_plot_type_change, 46 "on_btn_ClearPlot_clicked" : self.handle_clearplot} 46 47 # "on_tv_plotlist_key_press_event" : self.handle_plotlist_keypress} 47 48 … … 122 123 self.filelist.clear() 123 124 for filename in filenames: 124 data,metadata = usans.getBT5DataFromFile(filename) 125 if data != 0: 126 self.filelist.append([filename, 0, (data,metadata), 0, 0]) 127 125 if usans.isBT5Data(filename): 126 self.filelist.append([filename, 0, 0, 0, 0]) 128 127 return 129 128 … … 148 147 149 148 if model[path][1]: 149 #load data 150 data,metadata = usans.getBT5DataFromFile(model[path][0]) 151 model[path][2] = (data,metadata) 150 152 #add plot 151 153 self.add_plot(model, path) … … 175 177 176 178 data,metadata = model[path][2] 177 179 178 180 if type == 'total': 179 181 #generate totals … … 203 205 cnttime = metadata['mon'] 204 206 for mval in mvals: 205 207 ydata.append((data[mval][1] + data[mval][2] + data[mval][4] + data[mval][5] + data[mval][6])/cnttime) 206 208 else: 207 209 #Must be counting in monitor base so normalize by monitor 208 210 moncts = metadata['mon'] 209 211 for mval in mvals: 210 212 ydata.append((data[mval][1] + data[mval][2] + data[mval][4] + data[mval][5] + data[mval][6])/cnttime) 211 213 212 214 model[path][3] = [xdata, ydata] … … 265 267 self.axis.lines.remove(line) 266 268 267 269 if (len(self.axis.lines) > 0): 268 270 self.rescale_and_redraw() 269 271 else: 270 272 self.canvas.draw() 271 273 272 274 return … … 293 295 self.axis.set_yscale('log') 294 296 295 self. rescale_and_redraw()297 self.canvas.draw() 296 298 return 297 299 … … 304 306 return 305 307 308 def handle_clearplot(self,widget): 309 310 model = self.filelistview.get_model() 311 iter = model.iter_children(None) 312 while iter: 313 path = model.get_path(iter) 314 if model[path][1] != 0: 315 for line in model[path][4]: 316 self.axis.lines.remove(line) 317 model[path][1] = not model[path][1] 318 iter = model.iter_next(iter) 319 320 self.canvas.draw() 321 return 322 306 323 def rescale_and_redraw(self): 307 324 -
sans/utils/bt5/bt5plot2/bt5plot2.glade
r464 r466 498 498 <property name="relief">GTK_RELIEF_NORMAL</property> 499 499 <property name="focus_on_click">True</property> 500 <signal name="clicked" handler="on_btn_ClearPlot_clicked" last_modification_time="Fri, 12 Dec 2008 21:42:52 GMT"/> 500 501 501 502 <child> -
sans/utils/bt5/bt5plot2/usans.py
r462 r466 14 14 return 1 15 15 16 def isBT5Data(fileName): 17 18 inputfile = open(fileName, "r") 19 inputdata = inputfile.readlines() 20 21 if len(inputdata) < 2: 22 inputfile.close() 23 return 0 24 elif inputdata[1].find('Filename') > 0: 25 inputfile.close() 26 return 1 27 else: 28 inputfile.close() 29 return 0 30 31 16 32 def getBT5DataFromFile(fileName): 17 33 ''' … … 23 39 motlist = [] 24 40 25 #print "File: ",fileName 26 inputfile = open(fileName, "r") 41 if isBT5Data(fileName): 27 42 28 inputdata = inputfile.readlines() 43 #print "File: ",fileName 44 inputfile = open(fileName, "r") 29 45 30 if len(inputdata) < 2: 31 inputfile.close() 32 return 0,0 46 inputdata = inputfile.readlines() 33 47 34 if inputdata[1].find('Filename') > 0: 35 36 mdtmp = inputdata[0].replace("'","") 48 mdtmp = inputdata[0].replace("'", "") 37 49 mdtmp = mdtmp.split() 38 50 39 51 #Sundry metadata about run settings 40 52 (metadata['filename'], metadata['datetime'], 41 metadata['mon'],metadata['prefactor'],42 metadata['base'],metadata['numpnts'],43 metadata['type']) = (mdtmp[0],' '.join(mdtmp[1:5]),float(mdtmp[6]),int(mdtmp[7]),mdtmp[8],int(mdtmp[9]),mdtmp[10])53 metadata['mon'], metadata['prefactor'], 54 metadata['base'], metadata['numpnts'], 55 metadata['type']) = (mdtmp[0], ' '.join(mdtmp[1:5]), float(mdtmp[6]), int(mdtmp[7]), mdtmp[8], int(mdtmp[9]), mdtmp[10]) 44 56 45 57 #Comment string … … 63 75 64 76 inputfile.close() 65 return detdata, metadata77 return detdata, metadata 66 78 67 79 else: 68 inputfile.close()69 80 return 0,0 70 81
Note: See TracChangeset
for help on using the changeset viewer.