Changeset a0a4486 in sasview for invariantview/perspectives


Ignore:
Timestamp:
Mar 24, 2010 6:14:33 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
da87bce
Parents:
d3fac18
Message:

error checking on data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/invariant_panel.py

    rd3fac18 ra0a4486  
    9191        #Draw the panel 
    9292        self._do_layout() 
     93        if self.parent is not None: 
     94            msg = "" 
     95            wx.PostEvent(self.parent, StatusEvent(status= msg)) 
    9396        
     97    def err_check_on_data(self): 
     98        """ 
     99            Check if data is valid for further computation 
     100        """ 
     101        flag = False 
     102        #edit the panel 
     103        if self._data is not None: 
     104            if len(self._data.x[self._data.x==0]) > 0: 
     105                flag = True 
     106                msg = "Invariant: one of your q-values is zero. Delete that entry before proceeding" 
     107                wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))  
     108        return flag 
     109     
    94110    def set_data(self, data): 
    95111        """ 
     
    99115        #edit the panel 
    100116        if self._data is not None: 
     117            self.err_check_on_data() 
    101118            data_name = self._data.name 
    102119            data_qmin = min (self._data.x) 
     
    342359        msg= "" 
    343360        wx.PostEvent(self.parent, StatusEvent(status= msg)) 
    344         if self._data is None: 
     361        if self._data is None or self.err_check_on_data(): 
    345362            return 
     363     
    346364        #clear outputs textctrl  
    347365        self._reset_output() 
     
    370388        #check the type of extrapolation 
    371389        extrapolation = self.get_extrapolation_type(low_q=low_q, high_q=high_q) 
    372         #prepare a new container to put result of invariant 
    373         self.inv_container = InvariantContainer() 
     390        
    374391        #Compute invariant 
    375392        try: 
     
    415432        self.surface_tcl.Clear() 
    416433        self.surface_err_tcl.Clear() 
     434        #prepare a new container to put result of invariant 
     435        self.inv_container = InvariantContainer() 
    417436         
    418437    def _define_structure(self): 
Note: See TracChangeset for help on using the changeset viewer.