Ignore:
Timestamp:
Jul 11, 2016 4:36:55 AM (8 years ago)
Author:
lewis
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1d4b9e5
Parents:
033c14c
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/08/16 09:21:30)
git-committer:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/16 04:36:55)
Message:

Show error messages when extraplation, transform or extract parameters fail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/corfunc/corfunc_panel.py

    r033c14c rcdd1c3b  
    152152        Called when Extrapolate button is pressed. 
    153153        """ 
    154         if self._data is None: 
    155             msg = "Data must be loaded in order to perform an extrapolation." 
    156             wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 
    157             return 
    158154        if not self._validate_inputs: 
    159155            msg = "Invalid Q range entered." 
     
    164160        self._calculator.upperq = self.qmax 
    165161        self._calculator.background = self.background 
    166         self._extrapolated_data = self._calculator.compute_extrapolation() 
     162        try: 
     163            self._extrapolated_data = self._calculator.compute_extrapolation() 
     164        except: 
     165            msg = "Error extrapolating data." 
     166            wx.MessageBox(msg, 'error') 
     167            wx.PostEvent(self._manager.parent, 
     168                StatusEvent(status=msg, info="Error")) 
     169            self._transform_btn.Disable() 
     170            return 
    167171        # TODO: Find way to set xlim and ylim so full range of data can be 
    168172        # plotted 
     
    183187        Called when Transform button is pressed. 
    184188        """ 
    185         transformed_data = self._calculator.compute_transform( 
    186             self._extrapolated_data, self.background) 
     189        try: 
     190            transformed_data = self._calculator.compute_transform( 
     191                self._extrapolated_data, self.background) 
     192        except: 
     193            transformed_data = None 
     194        if transformed_data is None: 
     195            msg = "Error calculating Transform." 
     196            wx.MessageBox(msg, 'error') 
     197            wx.PostEvent(self._manager.parent, 
     198                StatusEvent(status=msg, info="Error")) 
     199            self._extract_btn.Disable() 
     200            return 
    187201        self._transformed_data = transformed_data 
    188202        from sas.sasgui.perspectives.corfunc.corfunc import TRANSFORM_LABEL 
     
    194208 
    195209    def extract_parameters(self, event=None): 
    196         params = None 
    197210        try: 
    198211            params = self._calculator.extract_parameters(self._transformed_data) 
     
    201214        if params is None: 
    202215            msg = "Error extracting parameters." 
     216            wx.MessageBox(msg, 'error') 
    203217            wx.PostEvent(self._manager.parent, 
    204                 StatusEvent(status=msg, info="error")) 
     218                StatusEvent(status=msg, info="Error")) 
    205219            return 
    206220        for key in OUTPUT_STRINGS.keys(): 
Note: See TracChangeset for help on using the changeset viewer.