Changeset 9cec2dd in sasview for invariantview/src/sans/perspectives/invariant/invariant.py
- Timestamp:
- Oct 21, 2011 2:17:13 PM (13 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:
- 3ecaa2b
- Parents:
- 054f004
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/src/sans/perspectives/invariant/invariant.py
r64b4f0f r9cec2dd 20 20 from sans.guiframe.dataFitting import Data1D 21 21 from sans.guiframe.events import NewPlotEvent 22 from sans.guiframe.events import StatusEvent 22 23 from sans.guiframe.gui_style import GUIFRAME_ID 23 24 from .invariant_state import Reader as reader … … 150 151 receive a list of data and compute invariant 151 152 """ 153 msg = "" 152 154 data = None 153 155 if data_list is None: … … 157 159 data = data_list[0] 158 160 else: 159 msg = "invariant panel does not allow multiple data!\n" 161 data_1d_list = [] 162 data_2d_list = [] 163 error_msg = "" 164 # separate data into data1d and data2d list 165 for data in data_list: 166 if data is not None: 167 if issubclass(data.__class__, Data1D): 168 data_1d_list.append(data) 169 else: 170 error_msg += " %s type %s \n" % (str(data.name), 171 str(data.__class__.__name__)) 172 data_2d_list.append(data) 173 if len(data_2d_list) > 0: 174 msg = "Invariant does not support the following data types:\n" 175 msg += error_msg 176 if len(data_1d_list) == 0: 177 wx.PostEvent(self.parent, 178 StatusEvent(status=msg, info='error')) 179 return 180 msg += "Invariant panel does not allow multiple data!\n" 160 181 msg += "Please select one.\n" 161 182 from invariant_widgets import DataDialog 162 dlg = DataDialog(data_list=data_ list, text=msg)183 dlg = DataDialog(data_list=data_1d_list, text=msg) 163 184 if dlg.ShowModal() == wx.ID_OK: 164 185 data = dlg.get_data() 165 186 if data is None: 187 msg += "invariant receives no data. \n" 188 wx.PostEvent(self.parent, 189 StatusEvent(status=msg, info='error')) 166 190 return 167 if issubclass(data.__class__, Data1D): 191 if not issubclass(data.__class__, Data1D): 192 msg += "invariant cannot be computed for data of " 193 msg += "type %s\n" % (data.__class__.__name__) 194 wx.PostEvent(self.parent, 195 StatusEvent(status=msg, info='error')) 196 return 197 else: 168 198 wx.PostEvent(self.parent, NewPlotEvent(plot=data, 169 199 title=data.title)) … … 171 201 self.compute_helper(data) 172 202 except: 173 msg = " PrviewSet_data: " + str(sys.exc_value)203 msg = "Invariant Set_data: " + str(sys.exc_value) 174 204 wx.PostEvent(self.parent, StatusEvent(status=msg, 175 205 info="error"))
Note: See TracChangeset
for help on using the changeset viewer.