Python numpy.seterrcall() Examples

The following are 30 code examples of numpy.seterrcall(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module numpy , or try the search function .
Example #1
Source File: numeric.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #2
Source File: numeric.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #3
Source File: numeric.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #4
Source File: numeric.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #5
Source File: numeric.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #6
Source File: numeric.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #7
Source File: numeric.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #8
Source File: numeric.py    From pySINDy with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #9
Source File: numeric.py    From pySINDy with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #10
Source File: numeric.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #11
Source File: numeric.py    From mxnet-lambda with Apache License 2.0 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #12
Source File: numeric.py    From mxnet-lambda with Apache License 2.0 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #13
Source File: basics.py    From pyblp with MIT License 5 votes vote down vote up
def __call__(self, decorated: Callable) -> Callable:
        """Decorate the function."""
        @functools.wraps(decorated)
        def wrapper(*args: Any, **kwargs: Any) -> Any:
            """Configure NumPy to detect numerical errors."""
            detector = NumericalErrorDetector(self.error)
            with np.errstate(divide='call', over='call', under='ignore', invalid='call'):
                np.seterrcall(detector)
                returned = decorated(*args, **kwargs)
            if detector.detected is not None:
                returned[-1].append(detector.detected)
            return returned

        return wrapper 
Example #14
Source File: numeric.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #15
Source File: numeric.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #16
Source File: numeric.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #17
Source File: util.py    From traversing_knowledge_graphs with MIT License 5 votes vote down vote up
def catch_nans():
    np.seterr(invalid='call')
    np.seterrcall(examine_nan) 
Example #18
Source File: numeric.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #19
Source File: numeric.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #20
Source File: numeric.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #21
Source File: numeric.py    From recruit with Apache License 2.0 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #22
Source File: numeric.py    From recruit with Apache License 2.0 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #23
Source File: modeller.py    From InSilicoSeq with MIT License 5 votes vote down vote up
def raw_qualities_to_histogram(qualities):
    """Approximate the distribution of base quality at each position in a read
    using a pseudo 2d kernel density estimation

    Generate cumulative distribution functions

    Args:
        qualities (list): raw count of all phred scores

    Returns:
        list: list of cumulative distribution functions. One cdf per base. The
            list has the size of the read length
    """
    logger = logging.getLogger(__name__)

    # moved this in quality_bins_to_histogram to try parallelization
    # quals = util.split_list([i for i in zip(*qualities)], n_parts=cpus)
    cdfs_list = []
    for q in qualities:
        numpy_log_handler = np.seterrcall(util.nplog)
        with np.errstate(under='ignore', divide='call'):
            try:
                kde = stats.gaussian_kde(q, bw_method=0.2 / np.std(q, ddof=1))
            except np.linalg.linalg.LinAlgError as e:
                # if np.std of array is 0, we modify the array slightly to be
                # able to divide by ~ np.std
                # this will print a FloatingPointError in DEBUG mode
                # logger.debug('np.std of quality array is zero: %s' % e)
                q = list(q)
                q[-1] += 1
                kde = stats.gaussian_kde(q, bw_method=0.2 / np.std(q, ddof=1))
            kde = kde.evaluate(range(41))
        cdf = np.cumsum(kde)
        cdf = cdf / cdf[-1]
        cdfs_list.append(cdf)
    return cdfs_list 
Example #24
Source File: numeric.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #25
Source File: numeric.py    From lambda-packs with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #26
Source File: numeric.py    From lambda-packs with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #27
Source File: numeric.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #28
Source File: numeric.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def __exit__(self, *exc_info):
        seterr(**self.oldstate)
        if self.call is not _Unspecified:
            seterrcall(self.oldcall) 
Example #29
Source File: numeric.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call) 
Example #30
Source File: numeric.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def __enter__(self):
        self.oldstate = seterr(**self.kwargs)
        if self.call is not _Unspecified:
            self.oldcall = seterrcall(self.call)