> Judging from his for loop, he does want the integer array. He's doing
> something like histogramming.
Yup, thanks, just goes to show that it's not good to send emails after
a glass of wine late at night with slight jetlag.
Matthew
___
Numpy-discussion
On Fri, Jan 23, 2009 at 01:11, V. Armando Sole wrote:
> Hello,
>
> In an effort to suppress for loops, I have arrived to the following situation.
>
> Through vectorial logical operations I generate a set of indices for which
> the contents of an array have to be incremented. My problem can be redu
On Fri, Jan 23, 2009 at 01:39, Matthew Brett wrote:
> Hi,
>
>> #This does not work
>> import numpy
>> a=numpy.zeros(10)
>> b=numpy.ones(4, numpy.int)
>> a[b] += 1
>
> The problem here is that you are setting a[1] to a[1]+1.
>
> I think you want:
>
> import numpy
> a=numpy.zeros(10)
> b=numpy.ones
Hi,
> #This does not work
> import numpy
> a=numpy.zeros(10)
> b=numpy.ones(4, numpy.int)
> a[b] += 1
The problem here is that you are setting a[1] to a[1]+1.
I think you want:
import numpy
a=numpy.zeros(10)
b=numpy.ones(4, numpy.bool)
a[b] += 1
Best,
Matthew
Hello,
In an effort to suppress for loops, I have arrived to the following situation.
Through vectorial logical operations I generate a set of indices for which
the contents of an array have to be incremented. My problem can be reduced
to the following:
#This works
import numpy
a=numpy.zeros(1
> 2009/1/22 Pierre GM :
> Darren,
>
>
>> The type returned by np.array is ndarray, unless I specifically set
>> subok=True, in which case I get a MyArray. The default value of
>> subok is True, so I dont understand why I have to specify subok
>> unless I want it to be False. Is my subclass missing
Hi, I just noticed that the N-D array interface page is outdated and
doesn't mention the buffer interface that is standard with Python 2.6
and Python 3.0:
http://numpy.scipy.org/array_interface.shtml
This page is linked to from http://numpy.scipy.org/
I suggest, at the minimum, modifying the pag
Ross Williamson wrote:
> Hi All
>
> I want to get out the index of values in an array. Normally WHERE
> works fine for one conditional statement but it does not work for two
> - i.e.
>
> a = array([0,1,2,3,4,5,6,7,8,9])
>
> ind, = where(a > 5)
>
> Works fine but if I wanted:
>
> ind = wher
Hi All
I want to get out the index of values in an array. Normally WHERE
works fine for one conditional statement but it does not work for two
- i.e.
a = array([0,1,2,3,4,5,6,7,8,9])
ind, = where(a > 5)
Works fine but if I wanted:
ind = where((a > 5) and (a<8))
Then it bugs out with the f
Windows XP, Pentium D, Python 2.5.2
On Thu, Jan 22, 2009 at 6:03 PM, Robert Kern wrote:
> On Thu, Jan 22, 2009 at 17:00, Wes McKinney wrote:
> > import cProfile
> >
> > def f():
> > pass
> >
> > def g():
> > for i in xrange(100):
> > f()
> >
> > cProfile.run("g()")
> >
> >>t
On Thu, Jan 22, 2009 at 17:00, Wes McKinney wrote:
> import cProfile
>
> def f():
> pass
>
> def g():
> for i in xrange(100):
> f()
>
> cProfile.run("g()")
>
>>test.py
> 103 function calls in 1.225 CPU seconds
>
>Ordered by: standard name
>
>ncalls tottime
import cProfile
def f():
pass
def g():
for i in xrange(100):
f()
cProfile.run("g()")
>test.py
103 function calls in 1.225 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
10.0000.0
Did you say "matlab" ? ;-)
> I have to debug a matlab program -- is there a way to do a "post
> mortem" debugging ?
> (I don't even know if this term even exists outside of python ;-)
> ((I want to know some local variable values and find out why our
> program crashes when "there are no particles
Hi,
I have to debug a matlab program -- is there a way to do a "post
mortem" debugging ?
(I don't even know if this term even exists outside of python ;-)
((I want to know some local variable values and find out why our
program crashes when "there are no particles found"...))
Thanks,
Sebastian Ha
On Jan 22, 2009, at 1:31 PM, Nils Wagner wrote:
>>
> Hi Pierre,
>
> Thank you. Works for me.
You're welcome, thanks for reporting!
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
On Thu, 22 Jan 2009 12:53:39 -0500
Pierre GM wrote:
> Interesting.
> The tests pass on my machine
> OS X,
> Python version 2.5.4 (r254:67916, Dec 29 2008, 17:02:44)
>[GCC 4.0.1
> (Apple Inc. build 5488)]
> nose version 0.10.4
>
>For
>> File
>> "/home/nwagner/local/lib64/python2.6/site-pack
Interesting.
The tests pass on my machine
OS X,
Python version 2.5.4 (r254:67916, Dec 29 2008, 17:02:44) [GCC 4.0.1
(Apple Inc. build 5488)]
nose version 0.10.4
For
> File
> "/home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/
> test_recfunctions.py",
> line 34, in test_zip_des
>>> numpy.__version__
'1.3.0.dev6331'
==
FAIL: Test the ignoremask option of find_duplicates
--
Traceback (most recent call last):
File
"/home/nwagner/local/l
Rich,
Basic python only supports double precision floats, so that is not an option.
NumPy does not have, as far as I know, a way to set the default precision,
although it might be a reasonable request.
As for the SWIG interface file, almost anything is possible. Can you give an
example of a f
Hi all,
I have a SWIG wrapped C library that uses 32bit floating point arrays,
using the numpy.i typemapping system for passing the arrays. For
every array that I make, I have to convert it using astype('float32'),
else python complains that I tried to pass a double-precision array.
Is there any
Darren,
> The type returned by np.array is ndarray, unless I specifically set
> subok=True, in which case I get a MyArray. The default value of
> subok is True, so I dont understand why I have to specify subok
> unless I want it to be False. Is my subclass missing something
> important?
Hello,
I have a test script:
import numpy as np
class MyArray(np.ndarray):
__array_priority__ = 20
def __new__(cls):
return np.asarray(1).view(cls).copy()
def __repr__(self):
return 'my_array'
__str__ = __repr__
def __mul__(self, other):
return s
Hi All,
Too many people in the Python community think the only way to work with
Excel files in Python is using COM on Windows.
To try and correct this, I'm giving a tutorial at this year's PyCon in
Chicago on Wednesday, 25th March that will cover working with Excel
files in Python using the pur
Hi all,
Is it possible to add a header option for savetxt ?
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
On Thu, 22 Jan 2009 11:23:43 +0100
Robert Cimrman wrote:
> Nils Wagner wrote:
>> Hi all,
>>
>> what is the best way to check if the entries (integers)
>> of an array are stored in ascending order ?
>
> Hi Nils,
>
> Try np.alltrue( ar[1:] > ar[:-1] ).
>
> r.
Thank you !
Nils
_
Nils Wagner wrote:
> Hi all,
>
> what is the best way to check if the entries (integers)
> of an array are stored in ascending order ?
Hi Nils,
Try np.alltrue( ar[1:] > ar[:-1] ).
r.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://
Hi all,
what is the best way to check if the entries (integers)
of an array are stored in ascending order ?
Nils
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Jan 19, 2009 at 7:34 PM, Hans Meine
wrote:
> On Friday 19 December 2008 03:27:12 Bradford Cross wrote:
>> This is a new project I just released.
>>
>> I know it is C#, but some of the design and idioms would be nice in
>> numpy/scipy for working with discrete event simulators, time series,
28 matches
Mail list logo