Changeset aed159f in sasview for src/sas


Ignore:
Timestamp:
Oct 26, 2018 5:58:45 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
75906a1
Parents:
33812c3
Message:

Minor corrections to Inversion after PK's CR

Location:
src/sas
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    r6ae7466 raed159f  
    473473            self._calculator.set_qmax(qmax) 
    474474            if np.size(self.logic.data.dy) == 0 or np.all(self.logic.data.dy) == 0: 
    475                 self.logic.data.dy = self._calculator.add_errors(self.logic.data.y) 
     475                self._calculator.add_errors() 
    476476            self.updateDataList(data) 
    477477            self.populateDataComboBox(self.logic.data.filename, data) 
  • src/sas/qtgui/Utilities/GuiUtils.py

    r8748751 raed159f  
    9595    except ImportError: 
    9696        pass 
    97         #logging.error("Error loading %s/%s: %s" % (path, confg_file, sys.exc_value)) 
    9897    except ValueError: 
    9998        print("Value error") 
     
    102101        if fObj is not None: 
    103102            fObj.close() 
    104     #logging.info("GuiManager loaded %s/%s" % (path, confg_file)) 
    105103    return config_module 
    106104 
  • src/sas/sascalc/pr/fit/expression.py

    r1431dab raed159f  
    209209"""%("\n    ".join(assignments),"\n    ".join(code)) 
    210210 
    211     #print("Function: "+functiondef) 
    212     exec(functiondef) in globals, locals 
     211    exec(functiondef, globals, locals) 
    213212    retfn = locals['eval_expressions'] 
    214213 
  • src/sas/sascalc/pr/invertor.py

    reeea6a3 raed159f  
    227227        return None 
    228228 
    229     def add_errors(self, yvalues): 
    230         """ 
    231         Adds errors to data set is they are not avaialble 
    232         :return: 
    233         """ 
    234         stats_errors = np.zeros(len(yvalues)) 
    235         for i in range(len(yvalues)): 
    236             # Scale the error so that we can fit over several decades of Q 
    237             scale = 0.05 * np.sqrt(yvalues[i]) 
    238             min_err = 0.01 * yvalues[i] 
    239             stats_errors[i] = scale * np.sqrt(np.fabs(yvalues[i])) + min_err 
    240         logger.warning("Simulated errors have been added to the data set\n") 
    241         return stats_errors 
     229    def add_errors(self, sigma=0.05): 
     230        """ 
     231        Adds errors to data set is they are not available. 
     232        Uses  $\Delta y = \sigma | y |$. 
     233        """ 
     234        self.dy = sigma * np.fabs(self.y) 
    242235 
    243236    def clone(self): 
     
    514507            # We were not able to estimate the errors 
    515508            # Return an empty error matrix 
    516             logger.error(sys.exc_value) 
     509            logger.error(sys.exc_info()[1]) 
    517510 
    518511        # Keep a copy of the last output 
     
    559552            # number of terms 
    560553            best_alpha, _, _ = self.estimate_alpha(self.nfunc) 
    561             logger.warning("Invertor.estimate_numterms: %s" % sys.exc_value) 
     554            logger.warning("Invertor.estimate_numterms: %s" % sys.exc_info()[1]) 
    562555            return self.nfunc, best_alpha, "Could not estimate number of terms" 
    563556 
     
    646639 
    647640        except: 
    648             message = "Invertor.estimate_alpha: %s" % sys.exc_value 
     641            message = "Invertor.estimate_alpha: %s" % sys.exc_info()[1] 
    649642            return 0, message, elapsed 
    650643 
     
    763756 
    764757            except: 
    765                 msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_value 
     758                msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_info()[1] 
    766759                raise RuntimeError(msg) 
    767760        else: 
Note: See TracChangeset for help on using the changeset viewer.