Hi,
I wrote sample code and it works fine.
This is my code, in case anyone else want to know how to use it:
#include Python.h
#include structmember.h
#include numpy/arrayobject.h
static PyObject *
print_a1(PyObject *dummy, PyObject *args)
{
npy_intp dims[3]; /* PyArray_AsCArray is for ndim =
Hello,
I cannot quite understand whether ndarray.base is the closest base,
the one from which the view was made or the ultimate base, the one
actually containing the data.
I think the documentation and the actual behaviour mismatch.
In [1]: import numpy as np
In [2]: x = np.arange(12)
In [3]: y =
Mon, 21 Sep 2009 09:35:47 +0100, Citi, Luca wrote:
I cannot quite understand whether ndarray.base is the closest base, the
one from which the view was made or the ultimate base, the one actually
containing the data.
I think the documentation and the actual behaviour mismatch.
The closest
On Fri, Sep 18, 2009 at 10:26 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
Jaroslav Hajek wrote:
string lengths determined
c-style null termination
Hmm, this didn't seem to work for me. But maybe I was doing something
else wrong. Thanks.
well, I notice that for a length-n string,
Thanks for your quick answer.
Is there a reason for that?
Am I wrong or it only makes life harder, such as:
while (PyArray_Check(base) !PyArray_CHKFLAGS(base, NPY_OWNDATA)) {
base = PyArray_BASE(base);
}
plus the possible error you underlined, plus the fact that
this keeps a chain of
Mon, 21 Sep 2009 10:51:52 +0100, Citi, Luca wrote:
Thanks for your quick answer.
Is there a reason for that?
Am I wrong or it only makes life harder, such as:
while (PyArray_Check(base) !PyArray_CHKFLAGS(base, NPY_OWNDATA)) {
base = PyArray_BASE(base);
}
plus the possible error
I think you do not need to do the chain up walk on view creation.
If the assumption is that base is the ultimate base, on view creation
you can do something like (pseudo-code):
view.base = parent if parent.owndata else parent.base
___
NumPy-Discussion
Xavier Gnata wrote:
Hi,
I have a large 2D numpy array as input and a 1D array as output.
In between, I would like to use C code.
C is requirement because it has to be fast and because the algorithm
cannot be written in a numpy oriented way :( (no way...really).
Which tool should I use to
I'm trying to read about subclassing. When I view
http://docs.scipy.org/doc/numpy/user/basics.subclassing.html?highlight=subclass#module-
numpy.doc.subclassing
It seems the examples show the _outputs_ of tests, but I don't see the
actual example code.
e.g., the first example renders like
Hi!
On Monday 21 September 2009 12:31:27 Citi, Luca wrote:
I think you do not need to do the chain up walk on view creation.
If the assumption is that base is the ultimate base, on view creation
you can do something like (pseudo-code):
view.base = parent if parent.owndata else parent.base
David Warde-Farley a écrit :
On 20-Sep-09, at 2:17 PM, Romain Brette wrote:
Would anyone have thoughts about what the best hardware would be for
Numpy? In
particular, I am wondering about Intel Core i7 vs Xeon. Also, I feel
that the
limiting factor might be memory speed and cache rather
One thing I'm really missing is something like matlab's fixed-pt toolbox.
I'd love to see this added to numpy.
A fixed point integer (fpi) type is based on an integer, but keeps track of
where the 'binary point' is. When created, the fpi has a specified number
of fractional bits and integer
A Monday 21 September 2009 13:59:39 Romain Brette escrigué:
David Warde-Farley a écrit :
On 20-Sep-09, at 2:17 PM, Romain Brette wrote:
Would anyone have thoughts about what the best hardware would be for
Numpy? In
particular, I am wondering about Intel Core i7 vs Xeon. Also, I feel
hi,
Definitely memory speed is probably the biggest thing to consider.
Also using 64bit if you need to do lots of calculations, and cache
things.
ACML is another alternative... but I've never tried linking it with numpy
http://developer.amd.com/cpu/Libraries/acml/Pages/default.aspx
AMD Phenom
On Mon, Sep 21, 2009 at 8:59 PM, Romain Brette romain.bre...@ens.fr wrote:
David Warde-Farley a écrit :
On 20-Sep-09, at 2:17 PM, Romain Brette wrote:
Would anyone have thoughts about what the best hardware would be for
Numpy? In
particular, I am wondering about Intel Core i7 vs Xeon. Also,
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com wrote:
numpy arrays of fpi should support all numeric operations. Also mixed
fpi/integer operations.
I'm not sure how to go about implementing this. At first, I was thinking to
just subclass numpy array. But, I don't think
Just because I have a ruler handy :)
On my laptop with qx9300, I invert that 5000, 5000 double (float64)
matrix in 14.67s.
Granted my cpu cores were all at about 75 degrees during that process..
Cheers!
Chris
On Mon, Sep 21, 2009 at 4:53 PM, David Cournapeau courn...@gmail.com wrote:
On
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com wrote:
numpy arrays of fpi should support all numeric operations. Also mixed
fpi/integer operations.
I'm not sure how to go about implementing this. At first, I was thinking
to just subclass numpy
Hello there,
Given a masked array such as this one:
In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1)
In [20]: x
Out[20]:
masked_array(data = [-- -- 0 -- 2],
mask = [ True True False True False],
fill_value = 99)
When you make an assignemnt in the vein of x[x
2009/9/21 Ernest Adrogué eadro...@gmx.net
Hello there,
Given a masked array such as this one:
In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1)
In [20]: x
Out[20]:
masked_array(data = [-- -- 0 -- 2],
mask = [ True True False True False],
fill_value = 99)
On Mon, Sep 21, 2009 at 10:57, Neal Becker ndbeck...@gmail.com wrote:
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com wrote:
numpy arrays of fpi should support all numeric operations. Also mixed
fpi/integer operations.
I'm not sure how to go about
Hi there --
I have been working on a small Python package whose central data object
comes from Numpy (the record array object).
I would like to produce documentation that looks like Numpy's, and am
planning to follow Numpy's docstring standard.
Numpy uses Sphinx to generate documentation (e.g.
Robert Kern wrote:
On Mon, Sep 21, 2009 at 10:57, Neal Becker ndbeck...@gmail.com wrote:
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com
wrote:
numpy arrays of fpi should support all numeric operations. Also mixed
fpi/integer operations.
I'm not
On Mon, Sep 21, 2009 at 12:03, Elaine Angelino
elaine.angel...@gmail.com wrote:
Hi there --
I have been working on a small Python package whose central data object
comes from Numpy (the record array object).
I would like to produce documentation that looks like Numpy's, and am
planning to
On Mon, Sep 21, 2009 at 12:02, Neal Becker ndbeck...@gmail.com wrote:
Robert Kern wrote:
On Mon, Sep 21, 2009 at 10:57, Neal Becker ndbeck...@gmail.com wrote:
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com
wrote:
numpy arrays of fpi should support
On Mon, Sep 21, 2009 at 1:08 PM, Robert Kern robert.k...@gmail.com wrote:
On Mon, Sep 21, 2009 at 12:03, Elaine Angelino
elaine.angel...@gmail.com wrote:
Hi there --
I have been working on a small Python package whose central data object
comes from Numpy (the record array object).
I would
On Mon, Sep 21, 2009 at 7:27 AM, Neal Becker ndbeck...@gmail.com wrote:
I'm trying to read about subclassing. When I view
http://docs.scipy.org/doc/numpy/user/basics.subclassing.html?highlight=subclass#module-
numpy.doc.subclassing
It seems the examples show the _outputs_ of tests, but I
thanks robert!
yes i saw this (http://svn.scipy.org/svn/numpy/trunk/doc/sphinxext/) but is
there a good description of how to use this? i'm looking for a standard
recipe that could be followed by myself and others. e.g. what functions to
call and in what order... i would like to emulate what
On Mon, Sep 21, 2009 at 12:20, Elaine Angelino
elaine.angel...@gmail.com wrote:
thanks robert!
yes i saw this (http://svn.scipy.org/svn/numpy/trunk/doc/sphinxext/) but is
there a good description of how to use this? i'm looking for a standard
recipe that could be followed by myself and
Wes McKinney wrote:
Any clue why I'm seeing this behavior? np.take's documentation says it
does the same thing as fancy indexing, but from this example I'm not
so sure:
The code used to implement np.take is not the same as that used in fancy
indexing. np.take's mission is simpler, so it uses
On 21-Sep-09, at 1:20 PM, Elaine Angelino wrote:
thanks robert!
yes i saw this (http://svn.scipy.org/svn/numpy/trunk/doc/sphinxext/)
but is there a good description of how to use this? i'm looking for
a standard recipe that could be followed by myself and others.
e.g. what functions
ok a couple more questions:
1) how does sphinxext relate to numpydoc?
sphinxext in scipy source tree --
http://svn.scipy.org/svn/numpy/trunk/doc/sphinxext/
numpydoc on PyPI --
http://pypi.python.org/pypi?%3Aaction=searchterm=numpydocsubmit=search
2) what about postprocess.py, should i be using
Robert Kern wrote:
On Mon, Sep 21, 2009 at 12:02, Neal Becker ndbeck...@gmail.com wrote:
Robert Kern wrote:
On Mon, Sep 21, 2009 at 10:57, Neal Becker ndbeck...@gmail.com wrote:
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com
wrote:
numpy arrays
I asked this question at
http://stackoverflow.com/questions/1449139/simple-object-recognition and get
lots of nice feedback, and finally I have managed to implement what I
wanted.
What I was looking for is named connected component labelling or analysis
for my connected component extraction
I
I believe that pretty generic connected-component finding is already
available with scipy.ndimage.label, as David suggested at the
beginning of the thread...
This function takes a binary array (e.g. zeros where the background
is, non-zero where foreground is) and outputs an array where each
ma, 2009-09-21 kello 13:35 -0400, Elaine Angelino kirjoitti:
ok a couple more questions:
1) how does sphinxext relate to numpydoc?
sphinxext in scipy source tree --
http://svn.scipy.org/svn/numpy/trunk/doc/sphinxext/
numpydoc on PyPI -- http://pypi.python.org/pypi?%
ndimage.label works differently than what I have done here.
Later using find_objects you can get slices for row or column basis. Not
possible to construct a dynamical structure to find objects that are in the
in both axis.
Could you look at the stackoverflow article once again and comment back?
Hi all,
I've installed python 2.5 on my centos 5.3 x86_64 machine (system
standard is 2.4), and now I want to install numpy for it. However, the
build fails. The final message is:
EnvironmentError: math library missing; rerun setup.py after setting
the MATHLIB env variable
However, from looking
Hello,
I have downloaded numpy 1.3rc2 sources and compiled it on Ubuntu Hardy
Linux x86_64. numpy.test() seems to run ok as well.
Here is the bug I can reproduce
import numpy as np
a=np.zeros((2*1024*1024*1024 + 1), dtype=uint8)
a[:]=1
# returns immediately
a.mean()
0.0
On Mon, Sep 21, 2009 at 6:45 PM, Gökhan Sever gokhanse...@gmail.com wrote:
I asked this question at
http://stackoverflow.com/questions/1449139/simple-object-recognition and get
lots of nice feedback, and finally I have managed to implement what I
wanted.
What I was looking for is named
On Mon, Sep 21, 2009 at 12:39, Neal Becker ndbeck...@gmail.com wrote:
1. Where would I find this new datetime dtype?
It's in the SVN trunk.
2. Don't know exactly what 'parameterized' dtypes are. Does this mean that
the dtype for 8.1 format fixed-pt is different from the dtype for 6.2
A Monday 21 September 2009 19:45:27 Kashyap Ashwin escrigué:
Hello,
I have downloaded numpy 1.3rc2 sources and compiled it on Ubuntu Hardy
Linux x86_64. numpy.test() seems to run ok as well.
Here is the bug I can reproduce
import numpy as np
a=np.zeros((2*1024*1024*1024 + 1),
ma, 2009-09-21 kello 13:15 -0400, Skipper Seabold kirjoitti:
On Mon, Sep 21, 2009 at 7:27 AM, Neal Becker ndbeck...@gmail.com wrote:
I'm trying to read about subclassing. When I view
http://docs.scipy.org/doc/numpy/user/basics.subclassing.html?highlight=subclass#module-
I think Zachary is right, ndimage does what you want:
In [48]: image = array(
[[0,0,0,1,1,0,0],
[0,0,0,1,1,1,0],
[0,0,0,1,0,0,0],
[0,0,0,0,0,0,0],
[0,1,0,0,0,0,0],
[0,1,1,0,0,0,0],
[0,0,0,0,1,1,0],
[0,0,0,0,1,1,1]])
In [57]: import scipy.ndimage as ndimage
In [58]: labels, num_found =
On Mon, Sep 21, 2009 at 12:30 PM, Francesc Alted fal...@pytables.orgwrote:
A Monday 21 September 2009 19:45:27 Kashyap Ashwin escrigué:
Hello,
I have downloaded numpy 1.3rc2 sources and compiled it on Ubuntu Hardy
Linux x86_64. numpy.test() seems to run ok as well.
Here is the
On Sep 21, 2009, at 12:17 PM, Ryan May wrote:
2009/9/21 Ernest Adrogué eadro...@gmx.net
Hello there,
Given a masked array such as this one:
In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1)
In [20]: x
Out[20]:
masked_array(data = [-- -- 0 -- 2],
mask = [ True True
David Cournapeau wrote:
Xavier Gnata wrote:
Hi,
I have a large 2D numpy array as input and a 1D array as output.
In between, I would like to use C code.
C is requirement because it has to be fast and because the algorithm
cannot be written in a numpy oriented way :( (no way...really).
Yes, it happens for the trunk as well.
import numpy as np
a=np.zeros((2*1024*1024*1024 + 1), dtype=uint8)
a[:]=1
# returns immediately
a.mean()
0.0
print a
[0 0 0 ..., 0 0 0]
The bug only happens when the nElements 2G (2^31). So for
dtype=uint16/32, the bug
Xavier Gnata wrote:
David Cournapeau wrote:
That's only a data point, but I almost always use cython in those cases,
I'm a second data point, but I think there are many more. Judging from
the SciPy conference, Cython is the preferred method for new projects.
Should I read that to learn you
On 21-Sep-09, at 2:55 PM, Xavier Gnata wrote:
Should I read that to learn you cython and numpy interact?
Or is there another best documentation (with examples...)?
You should have a look at the Bresenham algorithm thread you posted. I
went to the trouble of converting some Python code for
Ahh my blindness and apologies :)
The nice feeling of reinventing the wheel...
Probably I forgot to reshape the image data in the first place before
applying into ndimage.label().
However, this was a nice example to understand recursion, and get to know
some basics of computer vision and few
I can confirm this bug for the last svn.
Also:
a.put([2*1024*1024*1024 + 100,], 8)
IndexError: index out of range for array
in this case, I think the error is that in
numpy/core/src/multiarray/item_selection.c
in PyArray_PutTo line 209 should be:
intp i, chunk, ni, max_item, nv, tmp;
Why does indexing seem to transpose this array?
In [14]: x = arange(8).reshape((2,2,2))
In [15]: x[0,:,:]
Out[15]:
array([[0, 1],
[2, 3]])
In [16]: x[0,:,[0,1]]
Out[16]:
array([[0, 2],
[1, 3]])
Thanks,
Jonathan.
___
NumPy-Discussion
On 21-Sep-09, at 10:53 AM, David Cournapeau wrote:
Concerning the hardware, I have just bought a core i7 (the cheapest
model is ~ 200$ now, with 4 cores and 8 Mb of shared cache), and the
thing flies for floating point computation. My last computer was a
pentium 4 so I don't have a lot of
21/09/09 @ 14:43 (-0400), thus spake Pierre GM:
On Sep 21, 2009, at 12:17 PM, Ryan May wrote:
2009/9/21 Ernest Adrogué eadro...@gmx.net
Hello there,
Given a masked array such as this one:
In [19]: x = np.ma.masked_equal([-1, -1, 0, -1, 2], -1)
In [20]: x
Out[20]:
On 21-Sep-09, at 3:36 PM, Jonathan Taylor wrote:
Why does indexing seem to transpose this array?
In [14]: x = arange(8).reshape((2,2,2))
In [15]: x[0,:,:]
Out[15]:
array([[0, 1],
[2, 3]])
In [16]: x[0,:,[0,1]]
Out[16]:
array([[0, 2],
[1, 3]])
The last example in this
Also, what about PyArray_PutMask()
That function also has a line like int i, chunk, ni, max_item, nv,
tmp;
Should that be changed as well?
(Your patch does not fix my original issue.)
BTW, in numpy 1.3, that is present in numpy/core/src/multiarraymodule.c.
Can someone please give me a
On Sep 21, 2009, at 4:23 PM, Ernest Adrogué wrote:
This explains why x[x == 3] = 4 works as expected, whereas
x[x == 0] = 4 ruins everything. Basically, any condition that matches
0 will match every masked item as well.
There's room for improvement here indeed. I need to check first
I think the original bug is due to
line 535 of numpy/core/src/multiarray/ctors.c (svn)
that should be:
intp numcopies, nbytes;
instead of:
int numcopies, nbytes;
To resume:
in line 535 of numpy/core/src/multiarray/ctors.c
and
in line 209 of numpy/core/src/multiarray/item_selection.c
int
Hi, Luca,
On Mon, Sep 21, 2009 at 4:52 PM, Citi, Luca lc...@essex.ac.uk wrote:
I think the original bug is due to
line 535 of numpy/core/src/multiarray/ctors.c (svn)
that should be:
intp numcopies, nbytes;
instead of:
int numcopies, nbytes;
To resume:
in line 535 of
On Tue, Sep 22, 2009 at 12:57 AM, Neal Becker ndbeck...@gmail.com wrote:
David Cournapeau wrote:
On Mon, Sep 21, 2009 at 9:00 PM, Neal Becker ndbeck...@gmail.com wrote:
numpy arrays of fpi should support all numeric operations. Also mixed
fpi/integer operations.
I'm not sure how to go
Here it is...
http://projects.scipy.org/numpy/ticket/1229
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Sep 21, 2009 at 11:32 AM, Pauli Virtanen p...@iki.fi wrote:
The `sphinx.ext.doctest` extension is not enabled, so the testcode::
etc. directives are not available. I'm not sure if it should be enabled
-- it would be cleaner to just replace the testcode:: stuff with the
ordinary example
I forgot to mention that the second array, which I wish
to conditionally select elements from using tmax_idx,
has the same dimensions as the speed array, That is,
(ntimes, nlon, nlat) = U.shape
And tmax_idx has dimensions of (nlon, nlat).
Daran
--
My apology for the simplemindedness of
Thanks Fernando for the quick response.
Today this is the 3rd time I am hitting an unsupported feature in the Python
lands.
1-) No attribute docstrings
2-) Look this question:
http://stackoverflow.com/questions/1458203/reading-a-float-from-string
and 3rd is this.
However I think I influenced
65 matches
Mail list logo