[Numpy-discussion] Re: Numpy not working

2023-12-11 Thread Friedrich Romstedt
Hi Christophe, Am So., 10. Dez. 2023 um 19:49 Uhr schrieb Christophe Nassar : > > "(tf) C:\*\\\DiffMorph-master\DiffMorph-master>morph.py -s > images/img_1.jpg -t images/img_2.jpg > Traceback (most recent call last): > File "C:\Users\chris\Desktop\DiffMorph-master\DiffMorph-master\m

[Numpy-discussion] Re: Enhancement: np.convolve(..., mode="normalized")

2023-11-23 Thread Friedrich Romstedt
Hi Filip, Am Mi., 22. Nov. 2023 um 14:24 Uhr schrieb : > > Convolution is often used for smoothing noisy data; a typical use will keep > the 'same' length of data and may look like this: > > >convol = 2**-np.linspace(-2,2,100)**2; > >y2 = np.convolve(y,convol/np.sum(convol), mode='same')

[Numpy-discussion] Re: Feature query: fetch top/bottom k from array

2022-02-23 Thread Friedrich Romstedt
Am Di., 22. Feb. 2022 um 14:25 Uhr schrieb Joseph Bolton : > > I find myself often requiring the indices and/or values of the top (or > bottom) k items in a numpy array. There has been discussion about this last year: https://mail.python.org/archives/list/numpy-discussion@python.org/thread/F4P5U

[Numpy-discussion] Re: An article on numpy data types

2021-12-26 Thread Friedrich Romstedt
Am Sa., 25. Dez. 2021 um 10:03 Uhr schrieb Lev Maximov : > > https://axil.github.io/numpy-data-types.html > Speaking of zero-dimensional arrays more realistic example where you can run > into them is when you iterate over a numpy array with nditer: There seems to be missing an "a" before "more".

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-03-29 Thread Friedrich Romstedt
Hi Matti, Sebastian and Lev, Am Mo., 15. Feb. 2021 um 18:50 Uhr schrieb Lev Maximov : > > Try adding > view->suboffsets = NULL; > view->internal = NULL; > to Image_getbuffer finally I got it working easily using Lev's pointer cited above. I didn't follow the valgrind approach furthermore

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-02-16 Thread Friedrich Romstedt
Hi Lev, Am Di., 16. Feb. 2021 um 11:50 Uhr schrieb Lev Maximov : > > I've reproduced the error you've described and got rid of it without valgrind. > Those two lines are enough to avoid the segfault. Okay, good to know, I'll try it! Thanks for looking into it. > But feel free to find it yourself

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-02-16 Thread Friedrich Romstedt
Hello again, Am Mo., 15. Feb. 2021 um 16:57 Uhr schrieb Sebastian Berg : > > On Mon, 2021-02-15 at 10:12 +0100, Friedrich Romstedt wrote: > > Last week I updated my example code to be more slim. There now > > exists > > a single-file extension module: > > https:

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-02-15 Thread Friedrich Romstedt
Hi, Am Do., 4. Feb. 2021 um 09:07 Uhr schrieb Friedrich Romstedt : > Am Mo., 1. Feb. 2021 um 09:46 Uhr schrieb Matti Picus : > > Typically, one would create a complete example and then pointing to the > > code (as repo or pastebin, not as an attachment to a mail here). > &g

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-02-04 Thread Friedrich Romstedt
Hello Matti, Am Mo., 1. Feb. 2021 um 09:46 Uhr schrieb Matti Picus : > > [...] > > It is very hard to help you from this description. It may be a refcount > problem, it may be a buffer protocol problem, it may be something else. Yes, indeed! > Typically, one would create a complete example and t

Re: [Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-01-31 Thread Friedrich Romstedt
Hi, Am Di., 26. Jan. 2021 um 09:48 Uhr schrieb Friedrich Romstedt : > > [...] The following Python > code crashes:: > > image = <... Image production ...> > ar = numpy.asarray(image) > > However, when I say:: > > image = <... Image prod

[Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

2021-01-26 Thread Friedrich Romstedt
Hi, This is with Python 3.8.2 64-bit and numpy 1.19.2 on Windows 10. I'd like to be able to convert some C++ extension type to a numpy array by using ``numpy.asarray``. The extension type implements the Python buffer interface to support this. The extension type, called "Image" here, holds some