Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Julian Taylor
On 15.12.2014 01:40, Stefan van der Walt wrote: > On 2014-12-15 02:23:18, Julian Taylor wrote: >> already exists as np.errstate: >> >> with np.errstate(divide='ignore'): > > With 'ignore' a warning is still raised--is this by choice? > import numpy as np x = np.array([0, 1, 2.]) w

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Stefan van der Walt
On 2014-12-15 02:23:18, Julian Taylor wrote: > already exists as np.errstate: > > with np.errstate(divide='ignore'): With 'ignore' a warning is still raised--is this by choice? >>> import numpy as np >>> x = np.array([0, 1, 2.]) >>> with np.errstate(divide='ignore'): ... x/x ... __main__:2:

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Stefan van der Walt
On 2014-12-15 02:23:18, Julian Taylor wrote: > with np.errstate(divide='ignore'): Perfect, thanks! Stéfan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Pauli Virtanen
15.12.2014, 02:12, Stefan van der Walt kirjoitti: > Since the topic of context managers recently came up, what do you think > of adding a context manager for seterr? > > with np.seterr(divide='ignore'): > frac = num / denom There's this: with np.errstate(divide='ignore'): ... ___

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Julian Taylor
On 15.12.2014 01:12, Stefan van der Walt wrote: > Hi all, > > Since the topic of context managers recently came up, what do you think > of adding a context manager for seterr? > > with np.seterr(divide='ignore'): > frac = num / denom > already exists as np.errstate: with np.errstate(divid

[Numpy-discussion] Context manager for seterr

2014-12-14 Thread Stefan van der Walt
Hi all, Since the topic of context managers recently came up, what do you think of adding a context manager for seterr? with np.seterr(divide='ignore'): frac = num / denom Stéfan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://m

Re: [Numpy-discussion] Fwd: numpy.i and std::complex

2014-12-14 Thread Tom Krauss
Also see https://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.i On Sun, Dec 14, 2014 at 12:52 PM, Tom Krauss wrote: > > I know this is a month old at this point, but I wanted to state that I use > std::complex with swig all the time and it works great. I have very > similar code i

Re: [Numpy-discussion] Fwd: numpy.i and std::complex

2014-12-14 Thread Tom Krauss
I know this is a month old at this point, but I wanted to state that I use std::complex with swig all the time and it works great. I have very similar code in each of my project's ".i" files, so I am happy to see you are adding support to numpy.i. E.g. %numpy_typemaps(std::complex, NPY_CDOUBLE, in

Re: [Numpy-discussion] Bilinear interpolation (numpy only)

2014-12-14 Thread Jerome Kieffer
On Sun, 14 Dec 2014 12:52:03 +0100 "Nicolas P. Rougier" wrote: > > Thanks Jérôme, I will look into your code. Having other filter might be > useful for my case. > > While looking for code, I've also found this (pure python) implementation: > http://stackoverflow.com/questions/12729228/simple-e

Re: [Numpy-discussion] Bilinear interpolation (numpy only)

2014-12-14 Thread Nicolas P. Rougier
Thanks Jérôme, I will look into your code. Having other filter might be useful for my case. While looking for code, I've also found this (pure python) implementation: http://stackoverflow.com/questions/12729228/simple-efficient-bilinear-interpolation-of-images-in-numpy-and-python Nicolas > O

Re: [Numpy-discussion] Bilinear interpolation (numpy only)

2014-12-14 Thread Jerome Kieffer
On Sat, 13 Dec 2014 16:53:06 +0100 "Nicolas P. Rougier" wrote: > > Hi all, > > Does anyone has a simple 2D linear interpolation for resizing an image > (without scipy) ? > > Ideally, something like ```def zoom(Z, ratio): ...``` where Z is a 2D scalar > array and ratio the scaling factor. > (