On 09/28/2009 03:15 AM, Pauli Virtanen wrote:
Mon, 28 Sep 2009 10:07:47 +0200, Michael.Walker wrote:
[clip]
In [7]: f = f.transpose()
In [8]: print f
[[1 3]
[2 4]]
as expected. I mention this because I think that it is worth knowing
having lost a LOT of time to it. Is it worth
Tue, 29 Sep 2009 11:08:42 +0200, Michael.Walker wrote:
[clip]
I am referring to the behaviour of numpy.numarray.transpose() being that
of numpy.transpose() instead of numarray.transpose. One expects that
You probably mean the transpose methods numpy.numarray.ndarray.transpose
and
Le mardi 29 septembre 2009 à 02:32 +0530, yogesh karpate a écrit :
Dear All,
I'm facing a bog problem in following . the code
snippet is as follows
% Compute the area
indicator###
for kT in range(leftbound,rightbound):
I'm starting with a pure python implementation and have some progress.
AFAICT, the only approach is to subclass ndarray and add the properties and
behaviors I need.
I ran into one issue though.
In my function 'as_double', I need to get to the underlying 'int' array to
pass to ldexp. I tried
This doesn't work either:
def as_double (self):
import math
def _as_double_1 (x):
return math.ldexp (x, -self.frac_bits)
vecfunc = np.vectorize (_as_double_1, otypes=[np.float])
return vecfunc (self)
In [49]: obj.as_double()
Out[49]:
On Tue, Sep 29, 2009 at 10:22 AM, Neal Becker ndbeck...@gmail.com wrote:
This doesn't work either:
def as_double (self):
import math
def _as_double_1 (x):
return math.ldexp (x, -self.frac_bits)
vecfunc = np.vectorize (_as_double_1, otypes=[np.float])
josef.p...@gmail.com wrote:
On Tue, Sep 29, 2009 at 10:22 AM, Neal Becker ndbeck...@gmail.com wrote:
This doesn't work either:
def as_double (self):
import math
def _as_double_1 (x):
return math.ldexp (x, -self.frac_bits)
vecfunc = np.vectorize (_as_double_1, otypes=[np.float])
return
On Tue, Sep 29, 2009 at 10:10, Neal Becker ndbeck...@gmail.com wrote:
I could force an additional conversion using np.array (xxx, dtype=float).
Seems wasteful.
np.asarray() will not be wasteful.
The bigger question I have is, if I've subclassed an array, how can I get at
the underlying
Pierre GM wrote:
I was thinking about something this week-end: we could create a second
list when looping on the rows, where we would store the length of each
splitted row. After the loop, we can find if these values don't match
the expected number of columns `nbcols` and where. Then, we
Does numpy use pow from math.h or something else?
I seem to be having a problem with slow pow under gcc when building an
extension, but it's not affecting numpy. So if numpy uses that, then
there is something else i'm missing.
Cheers!
Chris
___
Hi folks,
This isn't really a numpy question, and I'm doing this with regular old
python, but I figure you are the folks that would know this:
How do I get python to make a distinction between -0.0 and 0.0? IN this
case, I'm starting with user input, so:
In [3]: float(-0.0)
Out[3]: -0.0
so
On Tue, Sep 29, 2009 at 11:47, Chris Colbert sccolb...@gmail.com wrote:
Does numpy use pow from math.h or something else?
Yes.
--
Robert Kern
I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it
Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote:
[clip]
How can I identify -0.0?
signbit
--
Pauli Virtanen
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
fixed_pt arrays need to apply the overflow_policy after operations
(overflow_policy could be clip, or throw exception).
I thought __array_wrap__ would work for this, but it seems to not be called
when I need it. For example:
In [13]: obj
Out[13]: fixed_pt_array([ 0, 32, 64, 96, 128])
In
are there any particular optimization flags issued when building numpy
aside from the following?
-fwrapv -O2
On Tue, Sep 29, 2009 at 6:54 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:47, Chris Colbert sccolb...@gmail.com wrote:
Does numpy use pow from math.h or
On Sep 29, 2009, at 12:37 PM, Christopher Barker wrote:
Pierre GM wrote:
Another idea: only store the indexes of the rows that have the wrong
number of columns -- if that's a large number, then then user has
bigger
problems than memory usage!
That was my first idea, but then it adds
On Tue, Sep 29, 2009 at 11:53 AM, Christopher Barker
chris.bar...@noaa.govwrote:
Hi folks,
This isn't really a numpy question, and I'm doing this with regular old
python, but I figure you are the folks that would know this:
How do I get python to make a distinction between -0.0 and 0.0? IN
Pauli Virtanen wrote:
Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote:
[clip]
How can I identify -0.0?
signbit
perfect for numpy, but at this point I don't have a numpy dependency
(very unusual for my code!). Anyone know a pure-python way to get it?
It seems I should be able
On 09/29/2009 12:08 PM, Gökhan Sever wrote:
On Tue, Sep 29, 2009 at 11:53 AM, Christopher Barker
chris.bar...@noaa.gov mailto:chris.bar...@noaa.gov wrote:
Hi folks,
This isn't really a numpy question, and I'm doing this with
regular old
python, but I figure you are the
Well, this is messy, and nearly unreadable, but it should work and is pure
python(and I think even be endian-independent).
struct.unpack('b',struct.pack('d', X)[0])[0] = 0
(where X is the variable you want to test)
In [54]: struct.unpack('b',struct.pack('d',0.0)[0])[0] = 0
Out[54]: True
In
Christopher Barker wrote:
Pauli Virtanen wrote:
Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote:
[clip]
How can I identify -0.0?
signbit
perfect for numpy, but at this point I don't have a numpy dependency
(very unusual for my code!). Anyone know a
On Tue, Sep 29, 2009 at 10:53 AM, Christopher Barker
chris.bar...@noaa.govwrote:
Hi folks,
This isn't really a numpy question, and I'm doing this with regular old
python, but I figure you are the folks that would know this:
How do I get python to make a distinction between -0.0 and 0.0? IN
On Tue, Sep 29, 2009 at 11:01 AM, Chris Colbert sccolb...@gmail.com wrote:
are there any particular optimization flags issued when building numpy
aside from the following?
-fwrapv -O2
Numpy optimizes small integer powers using multiplication. What sort of
numbers are you looking at?
I now have a rather large patch ready which addresses the following
issues with chararrays. Would it be possible to get SVN commit
priviledges, or would you prefer a patch file?
1) Fix bugs in Trac
http://projects.scipy.org/numpy/ticket/1199 (chararray.expandtabs broken)
On 09/29/2009 11:37 AM, Christopher Barker wrote:
Pierre GM wrote:
I was thinking about something this week-end: we could create a second
list when looping on the rows, where we would store the length of each
splitted row. After the loop, we can find if these values don't match
the
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker ndbeck...@gmail.com wrote:
fixed_pt arrays need to apply the overflow_policy after operations
(overflow_policy could be clip, or throw exception).
I thought __array_wrap__ would work for this, but it seems to not be called
when I need it. For
my powers are typically doubles
I traced the problem down to the pow function in math.h just being slow...
Thanks!
On Tue, Sep 29, 2009 at 7:53 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:01 AM, Chris Colbert sccolb...@gmail.com wrote:
are there any
On Tue, Sep 29, 2009 at 11:55 AM, Michael Droettboom md...@stsci.eduwrote:
I now have a rather large patch ready which addresses the following
issues with chararrays. Would it be possible to get SVN commit
priviledges, or would you prefer a patch file?
If you are going to maintain this part
I ran across a problem while using numpy. But the problem is more of
python problem. I hope I am not too far off topic.
I have a class and a subclass:
class myclass:
def __init__(self, x):
self.x = x
def __getitem__(self, index):
if type(index) is slice:
x =
On Tue, Sep 29, 2009 at 13:09, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker ndbeck...@gmail.com wrote:
fixed_pt arrays need to apply the overflow_policy after operations
(overflow_policy could be clip, or throw exception).
I thought
I just realized that what I'm doing won't work on older versions of python,
anyway...
Things work fine on 2.6
Python 2.6.2 (r262:71600, Sep 3 2009, 09:36:43)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type help, copyright, credits or license for more information.
import struct
On Sep 29, 2009, at 1:57 PM, Bruce Southey wrote:
On 09/29/2009 11:37 AM, Christopher Barker wrote:
Pierre GM wrote:
Probably more than memory is the execution time involved in printing
these problem rows.
The rows with problems will be printed outside the loop (with at least
an
On Tue, Sep 29, 2009 at 13:19, Keith Goodman kwgood...@gmail.com wrote:
I ran across a problem while using numpy. But the problem is more of
python problem. I hope I am not too far off topic.
I have a class and a subclass:
class myclass:
def __init__(self, x):
self.x = x
- Original Message
From: Robert Kern robert.k...@gmail.com
To: Discussion of Numerical Python numpy-discussion@scipy.org
Sent: Tuesday, September 29, 2009 12:54:46 PM
Subject: Re: [Numpy-discussion] where does numpy get its pow function?
On Tue, Sep 29, 2009 at 11:47, Chris Colbert
On Tue, Sep 29, 2009 at 12:35 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern robert.k...@gmail.comwrote:
On Tue, Sep 29, 2009 at 13:09, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 13:09, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker ndbeck...@gmail.com
wrote:
fixed_pt arrays need to apply the overflow_policy after
On Tue, Sep 29, 2009 at 13:35, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 13:09, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 11:00 AM, Neal Becker
Michael:
Thanks so much, this is genuinely awesome! Don't forget to email Joe
Harrington for your T-shirt - you more than deserve it! ;-)
A few specific comments below
On Tue, Sep 29, 2009 at 10:55 AM, Michael Droettboom md...@stsci.eduwrote:
I now have a rather large patch ready which
On Tue, Sep 29, 2009 at 11:25 AM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 13:19, Keith Goodman kwgood...@gmail.com wrote:
I ran across a problem while using numpy. But the problem is more of
python problem. I hope I am not too far off topic.
I have a class and a
This seems to work now, but I'm wondering if Charles is correct, that
inheritance isn't such a great idea here.
The advantage of inheritance is I don't have to implement forwarding all the
functions, a pretty big advantage. (I wonder if there is some way to do some
of these as a generic
On Tue, Sep 29, 2009 at 11:50 AM, Robert Kern robert.k...@gmail.com wrote:
When given two specific options, I only say yes or no when I want
to be annoying.
Hey, Robert, didn't you want to put emphasis markers around want? ;-)
Annoyingly yours,
DG
On Tue, Sep 29, 2009 at 12:55 PM, Neal Becker ndbeck...@gmail.com wrote:
This seems to work now, but I'm wondering if Charles is correct, that
inheritance isn't such a great idea here.
The advantage of inheritance is I don't have to implement forwarding all
the
functions, a pretty big
On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 13:35, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern robert.k...@gmail.com
wrote:
On Tue, Sep 29, 2009 at 13:09, Charles R Harris
On Tue, Sep 29, 2009 at 14:08, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 13:35, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:23 PM, Robert Kern
On Tue, Sep 29, 2009 at 1:12 PM, Robert Kern robert.k...@gmail.com wrote:
On Tue, Sep 29, 2009 at 14:08, Charles R Harris
charlesr.har...@gmail.com wrote:
On Tue, Sep 29, 2009 at 12:48 PM, Robert Kern robert.k...@gmail.com
wrote:
On Tue, Sep 29, 2009 at 13:35, Charles R Harris
Pierre GM wrote:
Another idea: only store the indexes of the rows that have the wrong
number of columns -- if that's a large number, then then user has
bigger
problems than memory usage!
That was my first idea, but then it adds tests in the inside loop
(which is what I'm trying to
On Sep 29, 2009, at 3:28 PM, Christopher Barker wrote:
well, how does one test compare to:
read the line from the file
split the line into tokens
parse each token
I can't imagine it's significant, but I guess you only know with
profiling.
That's on the parsing part. I'd like to keep
On Tue, Sep 29, 2009 at 10:55 AM, Michael Droettboom md...@stsci.eduwrote:
2) Improve documentation
Every method now has a docstring, and a new page of routines has been
added to the Sphinx tree.
Um, where did you do this, 'cause it's not showing up in the doc wiki.
DG
Is there an easy way to get multiple subdtypes out? e.g. if I have a
dtype
dtype([('foo', 'i4'), ('bar', 'i8'), ('baz', 'S100')])
and an array with that dtype, is there a way to only get the 'foo' and
'bar'?
arr[('foo','bar')] doesn't seem to work.
David
Joe Kington wrote:
I just realized that what I'm doing won't work on older versions of
python, anyway...
What I was looking for was which actual bit the sign bit is, as
expressed as a native integer, so I can do a bitwise_and.
But now that I think about it, I only need to test zero, not all
On 09/29/2009 01:30 PM, Pierre GM wrote:
On Sep 29, 2009, at 1:57 PM, Bruce Southey wrote:
On 09/29/2009 11:37 AM, Christopher Barker wrote:
Pierre GM wrote:
Probably more than memory is the execution time involved in printing
these problem rows.
The rows with
On Tue, Sep 29, 2009 at 15:32, David Warde-Farley d...@cs.toronto.edu wrote:
Is there an easy way to get multiple subdtypes out? e.g. if I have a
dtype
dtype([('foo', 'i4'), ('bar', 'i8'), ('baz', 'S100')])
and an array with that dtype, is there a way to only get the 'foo' and
'bar'?
On Tue, Sep 29, 2009 at 15:52, Neal Becker ndbeck...@gmail.com wrote:
I need the max value of an np scalar type. I had used this code:
def get_max(is_signed, base_type, total_bits):
print 'get_max:', is_signed, base_type, total_bits
if is_signed:
return (~(base_type(-1)
On Tue, Sep 29, 2009 at 2:52 PM, Neal Becker ndbeck...@gmail.com wrote:
I need the max value of an np scalar type. I had used this code:
def get_max(is_signed, base_type, total_bits):
print 'get_max:', is_signed, base_type, total_bits
if is_signed:
return (~(base_type(-1)
Christian Heimes wrote:
How about using atan2()? :)
unless atan2 shortcuts for the easy ones, that doesn't strike me as
efficient (though with python function call overhead, maybe!).
Anyway, of course, some googling that I should have done in the first
place, revealed double.py, from Martin
I know it's a bit pointless profiling these, but just so I can avoid doing
real work for a bit...
In [1]: import sys, struct, math
In [2]: def comp_struct(x):
...: # Get the first or last byte, depending on endianness
...: # (using 'f' or 'f' loses the signbit for -0.0 in older
On Tue, Sep 29, 2009 at 16:37, Joe Kington jking...@wisc.edu wrote:
I know it's a bit pointless profiling these, but just so I can avoid doing
real work for a bit...
In [1]: import sys, struct, math
In [2]: def comp_struct(x):
...: # Get the first or last byte, depending on
Hi all,
I'm at the polishing stage on this module and at this point would like some
input on the names. Yeah, a bit late ;) As it stands the module emulates the
polynomial module in most things with the substitution of cheb for poly and
the poly1d equivalent is Cheb1d. There are also a few
On Tue, Sep 29, 2009 at 16:40, Charles R Harris
charlesr.har...@gmail.com wrote:
Oh, and is it advisable to have a __copy__ (or copy) method?
Implement __getstate__ and __setstate__. Both the pickle module and
the copy module will use those functions.
--
Robert Kern
I have come to believe
Using 'd' rather than 'f' doesn't fix the problem...
Python 2.3.4 (#1, Jan 9 2007, 16:40:09)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type help, copyright, credits or license for more information.
import struct
struct.pack('d', -0.0)
'\x00\x00\x00\x00\x00\x00\x00\x80' -- Correct
On Tue, Sep 29, 2009 at 16:49, Joe Kington jking...@wisc.edu wrote:
Using 'd' rather than 'f' doesn't fix the problem...
Python 2.3.4 (#1, Jan 9 2007, 16:40:09)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type help, copyright, credits or license for more information.
import struct
I'm assuming it's a bug that was fixed somewhere in between?
It works on my 2.5, on a PPC:
In [10]: struct.pack('d', -0.0)
Out[10]: '\x80\x00\x00\x00\x00\x00\x00\x00'
In [11]: struct.pack('d', -0.0)
Out[11]: '\x00\x00\x00\x00\x00\x00\x00\x80'
But not on 2.3.5 on the same PPC (big endian,
I have a prototype for fixed_pt without using inheritance. I think I like
it. Any thoughts?
import numpy as np
def rnd (x, frac_bits, _max):
A rounding policy
x1 = x (frac_bits-1)
if (x1 == _max):
return x1 1
else:
return (x1+1) 1
def shift_left (x,
On Tue, Sep 29, 2009 at 6:48 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
I'm assuming it's a bug that was fixed somewhere in between?
It works on my 2.5, on a PPC:
In [10]: struct.pack('d', -0.0)
Out[10]: '\x80\x00\x00\x00\x00\x00\x00\x00'
In [11]: struct.pack('d', -0.0)
Out[11]:
josef.p...@gmail.com wrote:
WindowsXP:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
struct.pack('d', -0.0)
'\x80\x00\x00\x00\x00\x00\x00\x00'
struct.pack('d', -0.0)
'\x00\x00\x00\x00\x00\x00\x00\x80'
Python 2.4.3 (#69, Mar 29 2006, 17:35:34)
On Tue, Sep 29, 2009 at 4:50 PM, Neal Becker ndbeck...@gmail.com wrote:
I have a prototype for fixed_pt without using inheritance. I think I like
it. Any thoughts?
There is a line 177 characters long ;) Looks like a step in the right
direction, though. If you add the various operations of
On Mon, Sep 28, 2009 at 8:45 PM, jah jah.mailingl...@gmail.com wrote:
On Mon, Sep 28, 2009 at 4:48 PM, josef.p...@gmail.com wrote:
On Mon, Sep 28, 2009 at 7:19 PM, jah jah.mailingl...@gmail.com wrote:
Hi,
Suppose I have a set of x,y,c data (something useful for
matplotlib.pyplot.plot()
67 matches
Mail list logo