Re: [Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?

2014-12-10 Thread Stephan Hoyer
On Sun, Dec 7, 2014 at 11:31 PM, Pierre Haessig pierre.haes...@crans.org wrote: Instead of putting this function in stride_tricks (which is quite hidden), could it be added instead as a boolean flag to the existing `reshape` method ? Something like: x.reshape(y.shape, broadcast=True) What

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Sebastian Berg
On Mi, 2014-12-10 at 07:25 +, Sturla Molden wrote: Nathaniel Smith n...@pobox.com wrote: This should be pretty trivial to implement. AFAICT you don't need any complicated cython I have a bad habit of thinking in terms of too complicated C instead of just using NumPy.

[Numpy-discussion] Fwd: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-10 Thread Nathaniel Smith
-- Forwarded message -- From: Bruno Cauet brunoca...@gmail.com Date: 10 Dec 2014 17:07 Subject: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition To: python-...@python.org, python-l...@python.org Cc: Dan Stromberg strom...@gmail.com Hi all, Last year a survey was conducted

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Chris Barker
On Tue, Dec 9, 2014 at 11:03 PM, Sturla Molden sturla.mol...@gmail.com wrote: Nathaniel Smith n...@pobox.com wrote: @contextmanager def tmp_zeros(*args, **kwargs): arr = np.zeros(*args, **kwargs) try: yield arr finally: arr.resize((0,),

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Eric Moore
The second argument is named `refcheck` rather than check_refs. Eric On Wed, Dec 10, 2014 at 2:36 PM, Chris Barker chris.bar...@noaa.gov wrote: On Tue, Dec 9, 2014 at 11:03 PM, Sturla Molden sturla.mol...@gmail.com wrote: Nathaniel Smith n...@pobox.com wrote: @contextmanager def

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Andrea Gavana
On 10 December 2014 at 20:36, Chris Barker chris.bar...@noaa.gov wrote: On Tue, Dec 9, 2014 at 11:03 PM, Sturla Molden sturla.mol...@gmail.com wrote: Nathaniel Smith n...@pobox.com wrote: @contextmanager def tmp_zeros(*args, **kwargs): arr = np.zeros(*args, **kwargs) try:

[Numpy-discussion] Question about dtype

2014-12-10 Thread Valentin Haenel
Hi, I am using numpy version 1.9.0 and Python 2.7.9 and have a question about the dtype: In [14]: np.dtype(f8) Out[14]: dtype('float64') In [15]: np.dtype(uf8) Out[15]: dtype('float64') In [16]: np.dtype([(f8, f8)]) Out[16]: dtype([('f8', 'f8')]) So far so good. Now what happens if I use

Re: [Numpy-discussion] help using np.correlate to produce correlograms.

2014-12-10 Thread Jose Guzman
Dear Pierre, thank you very much for your time to correct my notebook and to point me in the direction of my wrong lag estimation. It has been very useful! Best Jose On 09/12/14 17:23, Pierre Haessig wrote: Hi, Le 08/12/2014 22:02, Jose Guzman a écrit : I'm trying to compute the cross

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Chris Barker
On Wed, Dec 10, 2014 at 11:44 AM, Andrea Gavana andrea.gav...@gmail.com wrote: The argument is not check_refs, but refcheck. thanks -- yup, that works. Useful -- but dangerous! I haven't managed to trigger a segfault yet but it sure looks like I could... -CHB -- Christopher Barker,

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Nathaniel Smith
On Wed, Dec 10, 2014 at 9:03 PM, Chris Barker chris.bar...@noaa.gov wrote: On Wed, Dec 10, 2014 at 11:44 AM, Andrea Gavana andrea.gav...@gmail.com wrote: The argument is not check_refs, but refcheck. thanks -- yup, that works. Useful -- but dangerous! I haven't managed to trigger a

Re: [Numpy-discussion] Question about dtype

2014-12-10 Thread Nathaniel Smith
On Wed, Dec 10, 2014 at 8:26 PM, Valentin Haenel valen...@haenel.co wrote: Hi, I am using numpy version 1.9.0 and Python 2.7.9 and have a question about the dtype: In [14]: np.dtype(f8) Out[14]: dtype('float64') In [15]: np.dtype(uf8) Out[15]: dtype('float64') In [16]: np.dtype([(f8,

Re: [Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?

2014-12-10 Thread Nathaniel Smith
On Sun, Dec 7, 2014 at 7:10 AM, Stephan Hoyer sho...@gmail.com wrote: I recently wrote function to manually broadcast an ndarray to a given shape according to numpy's broadcasting rules (using strides): https://github.com/xray/xray/commit/7aee4a3ed2dfd3b9aff7f3c5c6c68d51df2e3ff3 The same

Re: [Numpy-discussion] Should ndarray be a context manager?

2014-12-10 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: I haven't managed to trigger a segfault yet but it sure looks like I could... You can also trigger random errors. If the array is small, Python's memory mamager might keep the memory in the heap for reuse by PyMem_Malloc. And then you can actually

Re: [Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?

2014-12-10 Thread Stephan Hoyer
On Wed, Dec 10, 2014 at 4:00 PM, Nathaniel Smith n...@pobox.com wrote: 2) Add a broadcast_to(arr, shape) function, which broadcasts the array to exactly the shape given, or else errors out if this is not possible. I like np.broadcast_to as a new function. We can document it alongside

Re: [Numpy-discussion] Symbol table not found compiling numpy from git repository on Windows

2014-12-10 Thread melmell
Hey Guys, I'm having the same problem with building a python wrapper for a C library using windows. Tried applying the patch mentioned above, but still receiving the following error message. Any thoughts? Thanks Mel Looking for python34.dll Building import library (arch=AMD64):