Changeset 5f768c2 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Apr 10, 2017 4:12:45 AM (8 years ago)
Author:
gonzalezm
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
82373f5
Parents:
80a49c2
Message:

Adding error message to fitting window when model does not return any finite value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r9c0f3c17 r5f768c2  
    17331733        """ 
    17341734        try: 
     1735            number_finite = np.count_nonzero(np.isfinite(y)) 
     1736            if number_finite == 0: 
     1737                logger.error("Using the present parameters the model does not return any finite value. ") 
     1738                wx.PostEvent(self.parent, StatusEvent(status=\ 
     1739                    "Computing Error: %s" % str("Model did not return any finite value."), info="error")) 
     1740                return 
    17351741            np.nan_to_num(y) 
    17361742            new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 
     
    17891795                                         index=index, weight=weight) 
    17901796 
    1791             msg = "Computation  completed!" 
     1797            msg = "Computation completed!" 
     1798            if number_finite != len(y): 
     1799                msg += ' PROBLEM: For some Q values the model returns non finite intensities!' 
     1800                logger.error("For some Q values the model returns non finite intensities.") 
     1801             
    17921802            wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 
     1803             
    17931804        except: 
    17941805            raise 
     
    18171828        that can be plot. 
    18181829        """ 
     1830        number_finite = np.count_nonzero(np.isfinite(image)) 
     1831        if number_finite == 0: 
     1832            logger.error("Using the present parameters the model does not return any finite value. ") 
     1833            wx.PostEvent(self.parent, StatusEvent(status = "Computing Error: %s" %  
     1834            str("Model did not return any finite value."), info="error")) 
     1835            return 
    18191836        np.nan_to_num(image) 
    18201837        new_plot = Data2D(image=image, err_image=data.err_data) 
     
    18761893                                      index=index, weight=weight) 
    18771894        msg = "Computation  completed!" 
     1895        if number_finite != len(image): 
     1896            msg += ' PROBLEM: For some Qx,Qy values the model returns non finite intensities!' 
     1897            logger.error("For some Qx,Qy values the model returns non finite intensities.") 
    18781898        wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 
    18791899 
Note: See TracChangeset for help on using the changeset viewer.