Changeset 196608d in sasview
- Timestamp:
- Jan 6, 2010 8:18:56 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 4d270706
- Parents:
- 2389bd4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_loader.py
re5664f2 r196608d 7 7 def choose_data_file(parent, location=None): 8 8 path = None 9 if location ==None:9 if location == None: 10 10 location = os.getcwd() 11 11 … … 51 51 else: 52 52 errdy = 0.0 53 if len(toks) ==4:53 if len(toks) == 4: 54 54 has_dx = True 55 55 errdx = float(toks[3]) … … 63 63 print "READ ERROR", line 64 64 65 if has_dy ==False:65 if has_dy == False: 66 66 file_dy = None 67 if has_dx ==False:67 if has_dx == False: 68 68 file_dx = None 69 69 … … 100 100 # Load data 101 101 try: 102 output =L.load(path)102 output = L.load(path) 103 103 except: 104 104 load_error(sys.exc_value) … … 112 112 filename = os.path.basename(path) 113 113 114 if not output.__class__.__name__ =="list":114 if not output.__class__.__name__ == "list": 115 115 ## Creating a Data2D with output 116 116 if hasattr(output,'data'): 117 new_plot = Data2D(image=None, err_image=None)117 new_plot = Data2D(image=None, err_image=None) 118 118 119 119 else: 120 msg ="Loading 1D data: "121 wx.PostEvent(parent, StatusEvent(status= 122 new_plot = Data1D(x=[], y=[], dx=None, dy=None)120 msg = "Loading 1D data: " 121 wx.PostEvent(parent, StatusEvent(status="%s %s"%(msg, output.filename))) 122 new_plot = Data1D(x=[], y=[], dx=None, dy=None) 123 123 124 124 new_plot.copy_from_datainfo(output) … … 126 126 127 127 ## data 's name 128 if output.filename ==None or output.filename=="":128 if output.filename is None or output.filename == "": 129 129 output.filename = str(filename) 130 130 ## name of the data allow to differentiate data when plotted 131 name = output.filename131 name = output.filename 132 132 if not name in parent.indice_load_data.keys(): 133 parent.indice_load_data[name] =0133 parent.indice_load_data[name] = 0 134 134 else: 135 135 ## create a copy of the loaded data 136 parent.indice_load_data[name] +=1136 parent.indice_load_data[name] += 1 137 137 name = name +"[%i]"%parent.indice_load_data[name] 138 138 … … 145 145 ##group_id specify on which panel to plot this data 146 146 new_plot.group_id = name 147 new_plot.is_data = True147 new_plot.is_data = True 148 148 ##post data to plot 149 149 if hasattr(new_plot,"title"): 150 title = str(new_plot.title)151 if title == "":152 title =str(name)150 title = str(new_plot.title) 151 if title == "": 152 title = str(name) 153 153 else: 154 154 title = str(name) 155 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title= 155 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=title )) 156 156 157 157 ## the output of the loader is a list , some xml files contain more than one data … … 160 160 for item in output: 161 161 try: 162 dx =item.dx163 dxl =item.dxl164 dxw =item.dxw162 dx = item.dx 163 dxl = item.dxl 164 dxw = item.dxw 165 165 except: 166 dx =None167 dxl =None168 dxw =None166 dx = None 167 dxl = None 168 dxw = None 169 169 170 170 new_plot = Data1D(x=item.x,y=item.y,dx=dx,dy=item.dy) … … 174 174 new_plot.dxw = dxw 175 175 176 name = str(item.run[0])176 name = str(item.run[0]) 177 177 if not name in parent.indice_load_data.keys(): 178 parent.indice_load_data[name] =0178 parent.indice_load_data[name] = 0 179 179 else: 180 180 ## create a copy of the loaded data … … 185 185 # counter arguments stronger? Is this feature developed 186 186 # to please at least 80% of the users or a special few? 187 parent.indice_load_data[name] +=1188 name = name + "(copy %i)"%parent.indice_load_data[name]187 parent.indice_load_data[name] += 1 188 name = name + "(copy %i)"%parent.indice_load_data[name] 189 189 190 190 new_plot.name = name … … 196 196 new_plot.is_data =True 197 197 if hasattr(item,"title"): 198 title = item.title199 if title =="":200 title =str(name)198 title = item.title 199 if title == "": 200 title = str(name) 201 201 else: 202 title = name202 title = name 203 203 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title))) 204 204 i+=1
Note: See TracChangeset
for help on using the changeset viewer.