[Numpy-discussion] Use of numarray from numpy package

2006-08-31 Thread LANDRIU David SAp
Hello,

   I learned you answered me, but I did not get 
 your message : can you send it to me again ?
 
 Thanks ,
 
   David Landriu





David Landriu DAPNIA/SAp CEA SACLAY  (France)   

Phone  : (33|0)169088785 
Fax: (33|0)169086577 

-


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Use of numarray from numpy package

2006-08-31 Thread Steve Lianoglou
On Aug 31, 2006, at 6:19 AM, LANDRIU David SAp wrote:

>I learned you answered me, but I did not get
>  your message : can you send it to me again ?

Does this help?

http://sourceforge.net/mailarchive/forum.php? 
thread_id=30384097&forum_id=4890

-steve

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Travis Oliphant
Fernando Perez wrote:
> On 8/30/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:
>
>   
>> The current behaviour makes sense, but is maybe not consistent:
>>
>> N.array([],dtype=object).size == 1
>> N.array([[],[]],dtype=object).size == 2
>> 
>
> Yes, including one more term in this check:
>
> In [5]: N.array([],dtype=object).size
> Out[5]: 1
>
> In [6]: N.array([[]],dtype=object).size
> Out[6]: 1
>
> In [7]: N.array([[],[]],dtype=object).size
> Out[7]: 2
>
> Intuitively, I'd have expected the answers to be 0,1,2, instead of 1,1,2.
>
>   

What about

N.array(3).size

N.array([3]).size

N.array([3,3]).size

Essentially, the [] is being treated as an object when you explicitly 
ask for an object array in exactly the same way as 3 is being treated as 
a number in the default case.  It's just that '[' ']' is "also" being 
used as the dimension delimiter and thus the confusion.

It is consistent.   It's a corner case, and I have no problem fixing the 
special-case code running when dtype=object so that array([], 
dtype=object) returns an empty array, if that is the consensus.

-Travis



> Cheers,
>
> f
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>   



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Unwanted upcast from uint64 to float64

2006-08-31 Thread Travis Oliphant
Torgil Svensson wrote:
> I'm using windows datetimes (100nano-seconds since 0001,1,1) as time
> in a numpy array and was hit by this behaviour.
>
>   
 numpy.__version__
 
> '1.0b4'
>   
 a=numpy.array([63292539433000L],numpy.uint64)
 t=a[0]
 t
 
> 63292539433000L
>   
 type(t)
 
> 
>   
 t+1
 
> 6.3292539433e+017
>   
 type(t+1)
 
> 
>   
 t==(t+1)
 
> True
>
> I was trying to set t larger than any time in an array. Is there any
> reason for the scalar to upcast in this case?
>   
Yes, because you are adding a signed scalar to an unsigned scalar and a 
float64 is the only thing that can handle it (well actually it should be 
the long double scalar but we've made a special case here because long 
doubles are not that common).   Add an unsigned scalar

t+numpy.uint64(1)

to get what you want.

-Travis


> //Torgil
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>   



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
In version 0.9.6 one used to be able to do this:

In [4]: numpy.__version__
Out[4]: '0.9.6'


In [6]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],
dtype=object).shape
Out[6]: (2, 3)


In beta 1 numpy.PyObject no longer exists.  I was trying to get the
same behavior with dtype=object but it doesn't work:

In [7]: numpy.__version__
Out[7]: '1.0b1'

In [8]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],
dtype=object).shape
Out[8]: (2,)


Is this an intentional change?

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] BLAS not found in numpy 1.0b4

2006-08-31 Thread Jonathan Taylor
When trying to install 1.0b4 I had trouble getting it to detect my
installed atlas.  This was because the shipped site.cfg had;

[atlas]
library_dirs = /usr/lib/atlas/3dnow/
atlas_libs = lapack, blas

but I had to change 3dnow to sse2 due to my current state of
pentiumness.  In any case it should probabally look in all the
possible locations instead of just AMD's location.

Cheers.
Jon.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Release of 1.0b5 this weekend

2006-08-31 Thread Darren Dale
On Tuesday 29 August 2006 19:24, Fernando Perez wrote:
> On 8/29/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > Classes start for me next Tuesday, and I'm teaching a class for which I
> > will be using NumPy / SciPy extensively.  I need to have a release of
> > these two (and hopefully matplotlib) that work with each other.
> >
> > Therefore, I'm going to make a 1.0b5 release of NumPy over the weekend
> > (probably Monday), and also get a release of SciPy out as well.  At that
> > point, I'll only be available for bug-fixes to 1.0.  Therefore, the next
> > release after 1.0b5 I would like to be 1.0rc1 (release-candidate 1).
>
> What's the status of these 'overwriting' messages?
>
> planck[/tmp]> python -c 'import scipy;scipy.test()'
> Overwriting info= from scipy.misc (was
>  from numpy.lib.utils)
> Overwriting fft= from scipy.fftpack.basic
> (was  '/home/fperez/tmp/local/lib/python2.3/site-packages/numpy/fft/__init__.pyc'
>> from
> /home/fperez/tmp/local/lib/python2.3/site-packages/numpy/fft/__init__.pyc)
> ...
>
> I was under the impression you'd decided to quiet them out, but they
> seem to be making a comeback.

Will these messages be included in NumPy-1.0?

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] numpy/f2py module import segfault on HP-UX11.11

2006-08-31 Thread Christophe-Blondeau




Hi everybody

I've succesfully built Numpy-1.0b4 on HP-UX 11.11 with
all tests passed succesfully (gcc 4.1.1) on Python 2.4.2

I try to import 2 basic Fortran modules compiled with numpy/f2py
(fcompiler = gfortran (gcc 4.1.1))

The modules hello1 and hello2 are almost identical:

C File hello1.f
  subroutine foo1 (a)
  integer a
  print*, "Hello from Fortran(foo1)!"
  print*, "a=",a
  end

C File hello2.f
  subroutine foo2 (a)
  integer a
  print*, "Hello from Fortran(foo2)!"
  print*, "a=",a
  end

Then run:  python -c 'import hello1; import hello2' which
ends with a beautifull segfault !
I also tried the old f2py version (based on Numeric) and everything 
goes well
Note that the importation of only ONE f2py module is OK.

Investigating a little bit further, I deleted the call to import_array()
in "hello1module.c" and "hello2module.c" and the segfault dissapear ...
It turns out that something goes wrong this the importation of
"numpy.core.multiarray"
on my system.
The same thing happends if I import multiarray by hand in the Python
session:
>>> import numpy.core.multiarray
>>> import hello1   (with import_array() deleted)
>>> import hello2   (with import_array() deleted)
---> segfault

Unfortunately thats prevents me from using Scipy because modules based
on Fortran
and compiled with numpy/f2py during the building phase also segfault.

If anyone has some help, I will greatly appreciate
Thanks
Christophe

-- 












-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Unwanted upcast from uint64 to float64

2006-08-31 Thread Torgil Svensson
> Yes, because you are adding a signed scalar to an unsigned scalar and a
> float64 is the only thing that can handle it
>
> t+numpy.uint64(1)

Thanks, this make sense. This is a good thing to have back in the head.

//Torgil


On 8/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Torgil Svensson wrote:
> > I'm using windows datetimes (100nano-seconds since 0001,1,1) as time
> > in a numpy array and was hit by this behaviour.
> >
> >
>  numpy.__version__
> 
> > '1.0b4'
> >
>  a=numpy.array([63292539433000L],numpy.uint64)
>  t=a[0]
>  t
> 
> > 63292539433000L
> >
>  type(t)
> 
> > 
> >
>  t+1
> 
> > 6.3292539433e+017
> >
>  type(t+1)
> 
> > 
> >
>  t==(t+1)
> 
> > True
> >
> > I was trying to set t larger than any time in an array. Is there any
> > reason for the scalar to upcast in this case?
> >
> Yes, because you are adding a signed scalar to an unsigned scalar and a
> float64 is the only thing that can handle it (well actually it should be
> the long double scalar but we've made a special case here because long
> doubles are not that common).   Add an unsigned scalar
>
> t+numpy.uint64(1)
>
> to get what you want.
>
> -Travis
>
>
> > //Torgil
> >
> > -
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > ___
> > Numpy-discussion mailing list
> > Numpy-discussion@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >
>
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Fernando Perez
On 8/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:

> What about
>
> N.array(3).size
>
> N.array([3]).size
>
> N.array([3,3]).size
>
> Essentially, the [] is being treated as an object when you explicitly
> ask for an object array in exactly the same way as 3 is being treated as
> a number in the default case.  It's just that '[' ']' is "also" being
> used as the dimension delimiter and thus the confusion.
>
> It is consistent.   It's a corner case, and I have no problem fixing the
> special-case code running when dtype=object so that array([],
> dtype=object) returns an empty array, if that is the consensus.

I wasn't really complaining: these are corner cases I've never seen in
real use, so I'm not really sure how critical it is to worry about
them.  Though I could see code which does automatic size/shape checks
tripping on some of them.  The shape tuples shed a bit of light on
what's going on for the surprised (like myself):

In [8]: N.array(3).shape
Out[8]: ()

In [9]: N.array([3]).shape
Out[9]: (1,)

In [10]: N.array([3,3]).shape
Out[10]: (2,)

In [11]: N.array([]).shape
Out[11]: (0,)

In [12]: N.array([[]]).shape
Out[12]: (1, 0)

In [13]: N.array([[],[]]).shape
Out[13]: (2, 0)


I won't really vote for any changes one way or another, as far as I'm
concerned it's one of those 'learn the library' things.  I do realize
that the near-ambiguity between '[]' as an empty object and '[]' as
the syntactic delimiter for a container makes this case a bit of a
gotcha.

I guess my only remaining question is: what is the difference between
outputs #8 and #11 above?  Is an empty shape tuple == array scalar,
while a (0,) shape indicates a one-dimensional array with no elements?
 If this interpretation is correct, what is the usage of the latter
kind of object, given how it can't even be indexed?

In [15]: N.array([])[0]
---
exceptions.IndexErrorTraceback (most
recent call last)

/home/fperez/research/code/mjmdim/pycode/

IndexError: index out of bounds


And is this really expected?

In [18]: N.array([]).any()
Out[18]: False

In [19]: N.array([]).all()
Out[19]: True

It's a bit funny to have an array for which 'no elements are true'
(any==false), yet 'all are true' (all==true), isn't it?

Regards,

f

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Charles R Harris
On 8/31/06, Fernando Perez <[EMAIL PROTECTED]> wrote:
On 8/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:> What about>> N.array(3).size>> N.array([3]).size>> N.array
([3,3]).size>> Essentially, the [] is being treated as an object when you explicitly> ask for an object array in exactly the same way as 3 is being treated as> a number in the default case.  It's just that '[' ']' is "also" being
> used as the dimension delimiter and thus the confusion.>> It is consistent.   It's a corner case, and I have no problem fixing the> special-case code running when dtype=object so that array([],
> dtype=object) returns an empty array, if that is the consensus.I wasn't really complaining: these are corner cases I've never seen inreal use, so I'm not really sure how critical it is to worry about
them.  Though I could see code which does automatic size/shape checkstripping on some of them.  The shape tuples shed a bit of light onwhat's going on for the surprised (like myself):In [8]: N.array(3).shape
Out[8]: ()In [9]: N.array([3]).shapeOut[9]: (1,)In [10]: N.array([3,3]).shapeOut[10]: (2,)In [11]: N.array([]).shapeOut[11]: (0,)In [12]: N.array([[]]).shapeOut[12]: (1, 0)
In [13]: N.array([[],[]]).shapeOut[13]: (2, 0)I won't really vote for any changes one way or another, as far as I'mconcerned it's one of those 'learn the library' things.  I do realizethat the near-ambiguity between '[]' as an empty object and '[]' as
the syntactic delimiter for a container makes this case a bit of agotcha.I guess my only remaining question is: what is the difference betweenoutputs #8 and #11 above?  Is an empty shape tuple == array scalar,
while a (0,) shape indicates a one-dimensional array with no elements? If this interpretation is correct, what is the usage of the latterkind of object, given how it can't even be indexed?In [15]: N.array
([])[0]---exceptions.IndexErrorTraceback (mostrecent call last)/home/fperez/research/code/mjmdim/pycode/
IndexError: index out of boundsAnd is this really expected?In [18]: N.array([]).any()Out[18]: FalseThis could be interpreted as : exists x, x element of array, s.t. x is true.
In [19]: N.array([]).all()Out[19]: TrueSeems right: for all x, x element of array, x is true.
It's a bit funny to have an array for which 'no elements are true'(any==false), yet 'all are true' (all==true), isn't it?
 Fun with empty sets! The question is, is a zero dimensional array an empty container or does it contain its value. The numpy choice of treating  zero dimensional arrays as both empty containers and scalar values makes the determination a bit ambiguous although it is consistent with the indexing convention.
Chuck
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] numpy and dtype

2006-08-31 Thread humufr
Hi, 


sorry to bother you with probably plenty of stupid question but I would like 
to clarify my mind with dtype.

I have a problem to view a recarray, I'm not sure but I suspect a bug or at 
least a problem

I have an array with some data, the array is very big but I have no problem 
with numpy.

In [44]: data_end
Out[44]:
array([[  2.6600e+02,   5.1630e+04,   1.e+00, ...,
 -1.04130435e+00,   1.47304565e+02,   4.27402449e+00],
   [  2.6600e+02,   5.1630e+04,   2.e+00, ...,
 -6.52190626e-01,   1.64214981e+02,   1.58334379e+01],
   [  2.6600e+02,   5.1630e+04,   4.e+00, ...,
 -7.65136838e-01,   1.33340195e+02,   9.84033298e+00],
   ...,
   [  9.7800e+02,   5.2431e+04,   6.3200e+02, ...,
  3.06083832e+01,   6.71210251e+01,   1.18813887e+01],
   [  9.7800e+02,   5.2431e+04,   6.3600e+02, ...,
  3.05993423e+01,   1.10403000e+02,   5.81539488e+00],
   [  9.7800e+02,   5.2431e+04,   6.4000e+02, ...,
  3.05382938e+01,   1.26916304e+01,   3.25683937e+01]])

In [45]: data_end.shape
Out[45]: (567486, 7)

In [46]: data_end.dtype
Out[46]: dtype('i2','>i4','>i2','>f4','>f4','>f4','>f4']})

In [49]: b = numpy.rec.fromarrays(data_end.transpose(),type_descr)

In [50]: b[:1]
Out[50]:
recarray([ (266, 51630, 1, 146.71420288085938, -1.041304349899292, 
147.3045654296875, 4.274024486541748)],
  dtype=[('PLATEID', '>i2'), ('MJD', '>i4'), ('FIBERID', '>i2'), 
('RA', '>f4'), ('DEC', '>f4'), ('V_DISP', '>f4'), ('V_DISP_ERR', '>f4')])

In [51]: b[1]
Out[51]: (266, 51630, 2, 146.74412536621094, -0.65219062566757202, 
164.21498107910156, 15.833437919616699)

but I obtain an error when I want to print the recarray b (it's working for 
smallest array):

In [54]: b[:10]
Out[54]:
recarray([ (266, 51630, 1, 146.71420288085938, -1.041304349899292, 
147.3045654296875, 4.274024486541748),
   (266, 51630, 2, 146.74412536621094, -0.65219062566757202, 
164.21498107910156, 15.833437919616699),
   (266, 51630, 4, 146.62857055664062, -0.76513683795928955, 
133.34019470214844, 9.8403329849243164),
   (266, 51630, 6, 146.63166809082031, -0.98827779293060303, 
146.91035461425781, 30.08709716796875),
   (266, 51630, 7, 146.91944885253906, -0.99049174785614014, 
152.96893310546875, 12.429832458496094),
   (266, 51630, 9, 146.76339721679688, -0.81043314933776855, 
347.72918701171875, 41.387767791748047),
   (266, 51630, 10, 146.62281799316406, -0.9513852596282959, 
162.53567504882812, 24.676788330078125),
   (266, 51630, 11, 146.93409729003906, -0.67040395736694336, 
266.56011962890625, 10.875675201416016),
   (266, 51630, 12, 146.96389770507812, -0.54500257968902588, 
92.040328979492188, 18.999214172363281),
   (266, 51630, 13, 146.9635009765625, -0.75935173034667969, 
72.828048706054688, 13.028598785400391)],
  dtype=[('PLATEID', '>i2'), ('MJD', '>i4'), ('FIBERID', '>i2'), 
('RA', '>f4'), ('DEC', '>f4'), ('V_DISP', '>f4'), ('V_DISP_ERR', '>f4')])


So I would like to know if it's normal. And another question is it possile to 
do, in theory, something like:

b = numpy.array(data_end,dtype=type_descr) 

or all individual array element must have the same dtype?

To replace the context, I have a big fits table, I want to use only some 
columns from the table so I did:

table = pyfits.getdata('gal_info_dr4_v5_1b.fit') #pyfits can't read, at least 
now the gzip file

#the file is a fits table file so we look in the pyfits doc to read it!

fields = ['PLATEID', 'MJD', 'FIBERID', 'RA', 'DEC','V_DISP','V_DISP_ERR']

type_descr = numpy.dtype({'names':fields,'formats':
['

/home/gruel/usr/lib/python2.4/site-packages/IPython/Prompts.py in 
__call__(self, arg)
514
515 # and now call a possibly user-defined print mechanism
--> 516 manipulated_val = self.display(arg)
517
518 # user display hooks can change the variable to be stored 
in

/home/gruel/usr/lib/python2.4/site-packages/IPython/Prompts.py in 
_display(self, arg)
538 """
539
--> 540 return self.shell.hooks.result_display(arg)
541
542 # Assign the default display method:

/home/gruel/usr/lib/python2.4/site-packages/IPython/hooks.py in __call__(self, 
*args, **kw)
132 #print "prio",prio,"cmd",cmd #dbg
133 try:
--> 134 ret = cmd(*args, **kw)
135 return ret
136 except ipapi.TryNext, exc:

/home/gruel/usr/lib/python2.4/site-packages/IPython/hooks.py in 
result_display(self, arg)
153
154 if self.rc.pprint:
--> 155 out = pformat(arg)
156 if '\n' in out:
157 # So that multi-line strings line up with the left column 
of

/usr/lib/python2.4/pprint.py in pformat(self, object)
108 def pformat(self, object):
109 sio = _StringIO()
--> 110 self._format(object, sio,

Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
On 8/31/06, Tom Denniston <[EMAIL PROTECTED]> wrote:
In version 0.9.6 one used to be able to do this:In [4]: numpy.__version__Out[4]: '0.9.6'In [6]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],dtype=object).shapeOut[6]: (2, 3)
In beta 1 numpy.PyObject no longer exists.  I was trying to get thesame behavior with dtype=object but it doesn't work:In [7]: numpy.__version__Out[7]: '1.0b1'In [8]: numpy.array([numpy.array
([4,5,6]), numpy.array([1,2,3])],dtype=object).shapeOut[8]: (2,)The latter looks more correct, in that is produces an array of objects. To get the previous behaviour there is the function vstack:
In [6]: a = array([1,2,3])
In [7]: b = array([4,5,6])In [8]: vstack([a,b])
Out[8]:array([[1, 2, 3],
   [4, 5, 6]])Chuck 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
For this simple example yes, but if one of the nice things about the array constructors is that they know that lists, tuple and arrays are just sequences and any combination of them is valid numpy input.  So for instance a list of tuples yields a 2d array.  A list of tuples of 1d arrays yields a 3d array.  A list of 1d arrays yields 2d array.  This was the case consistently across all dtypes.  Now it is the case across all of them except for the dtype=object which has this unusual behavior.  I agree that vstack is a better choice when you know you have a list of arrays but it is less useful when you don't know and you can't force a type in the vstack function so there is no longer an equivalent to the dtype=object behavior:
In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])], dtype=object)Out[7]:array([[1, 2, 3],   [4, 5, 6]], dtype=object)In [8]: numpy.vstack([numpy.array
([1,2,3]), numpy.array([4,5,6])], dtype=object)---exceptions.TypeError Traceback (most recent call last)
TypeError: vstack() got an unexpected keyword argument 'dtype'On 8/31/06, Charles R Harris <[EMAIL PROTECTED]> wrote:> On 8/31/06, Tom Denniston
> <[EMAIL PROTECTED]> wrote:> > > In version 0.9.6 one used to be able to do this:> > > > In [4]: numpy.__version__
> > Out[4]: '0.9.6'> > > > > > In [6]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])],> > dtype=object).shape> > Out[6]: (2, 3)> > > > 
> > In beta 1 numpy.PyObject no longer exists.  I was trying to get the> > same behavior with dtype=object but it doesn't work:> > > > In [7]: numpy.__version__> > Out[7]: '
1.0b1'> > > > In [8]: numpy.array([numpy.array ([4,5,6]), numpy.array([1,2,3])],> > dtype=object).shape> > Out[8]: (2,)> > > The latter looks more correct, in that is produces an array of objects. To
> get the previous behaviour there is the function vstack: > > In [6]: a = array([1,2,3])> > In [7]: b = array([4,5,6])> > In [8]: vstack([a,b])> Out[8]:> array([[1, 2, 3],
>[4, 5, 6]])> > Chuck > > > > -> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job> easier> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo> 
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> > ___> Numpy-discussion mailing list> 
Numpy-discussion@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/numpy-discussion> > > 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
On 8/31/06, Tom Denniston <[EMAIL PROTECTED]> wrote:
For this simple example yes, but if one of the nice things about the array constructors is that they know that lists, tuple and arrays are just sequences and any combination of them is valid numpy input.  So for instance a list of tuples yields a 2d array.  A list of tuples of 1d arrays yields a 3d array.  A list of 1d arrays yields 2d array.  This was the case consistently across all dtypes.  Now it is the case across all of them except for the dtype=object which has this unusual behavior.  I agree that vstack is a better choice when you know you have a list of arrays but it is less useful when you don't know and you can't force a type in the vstack function so there is no longer an equivalent to the dtype=object behavior:
In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])], dtype=object)Out[7]:array([[1, 2, 3],   [4, 5, 6]], dtype=object)
What are you trying to do? If you want integers:In [32]: a = array([array([1,2,3]), array([4,5,6])], dtype=int)In [33]: a.shapeOut[33]: (2, 3)
If you want objects, you have them:In [30]: a = array([array([1,2,3]), array([4,5,6])], dtype=object)
In [31]: a.shape
Out[31]: (2,)i.e, a is an array containing two array objects.Chuck
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] BLAS not found in numpy 1.0b4

2006-08-31 Thread Christopher Barker
Jonathan Taylor wrote:
> When trying to install 1.0b4 I had trouble getting it to detect my
> installed atlas.  This was because the shipped site.cfg had;
> 
> [atlas]
> library_dirs = /usr/lib/atlas/3dnow/
> atlas_libs = lapack, blas
> 
> but I had to change 3dnow to sse2 due to my current state of
> pentiumness.  In any case it should probabally look in all the
> possible locations instead of just AMD's location.

"All possible locations" is pretty much impossible. There really isn't 
any choice but for individuals to customize site.cfg for their setup. 
that's why it's called "site".cfg.

I would like to see a pretty good collection of examples, most of them 
commented out, in there, however. i.e.:

## for AMD atlas:
#library_dirs = /usr/lib/atlas/3dnow/
#atlas_libs = lapack, blas

## for Fedora Core 4 sse2 atlas:
#library_dirs = /usr/lib/sse2/
#atlas_libs = lapack, blas

etc, etc.


-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Christopher Barker
Fernando Perez wrote:
> In [8]: N.array(3).shape
> Out[8]: ()

> In [11]: N.array([]).shape
> Out[11]: (0,)

> I guess my only remaining question is: what is the difference between
> outputs #8 and #11 above?  Is an empty shape tuple == array scalar,
> while a (0,) shape indicates a one-dimensional array with no elements?
>  If this interpretation is correct, what is the usage of the latter
> kind of object, given how it can't even be indexed?

It can be iterated over (with zero iterations):

 >>> a = N.array([])
 >>> for i in a:
...   print i
...

whereas the scalar can not:

 >>> b = N.array(3)
 >>> b
array(3)
 >>> for i in b:
...   print i
...
Traceback (most recent call last):
   File "", line 1, in ?
TypeError: iteration over a scalar (0-dim array)

Of course the scalar isn't empty, so ti's different in that way too. Can 
there be an empty scalar? It doesn't look like it. In fact, this looks 
like it may be a bug:
 >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a
()
1
6

That's what I'd expect, but what if you start with a (0,) array:
 >>> a = N.array([]).sum(); a.shape; a.size; a
()
1
0

where did that zero come from?

 >>> N.__version__
'1.0b4'

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] BLAS not found in numpy 1.0b4

2006-08-31 Thread Charles R Harris
On 8/31/06, Christopher Barker <[EMAIL PROTECTED]> wrote:
Jonathan Taylor wrote:> When trying to install 1.0b4 I had trouble getting it to detect my> installed atlas.  This was because the shipped site.cfg had;>> [atlas]> library_dirs = /usr/lib/atlas/3dnow/
> atlas_libs = lapack, blas>> but I had to change 3dnow to sse2 due to my current state of> pentiumness.  In any case it should probabally look in all the> possible locations instead of just AMD's location.
"All possible locations" is pretty much impossible. There really isn'tany choice but for individuals to customize site.cfg for their setup.that's why it's called "site".cfg.I would like to see a pretty good collection of examples, most of them
commented out, in there, however. i.e.:I need this on fc5 x86_64[atlas]library_dirs = /usr/lib64/atlasatlas_libs = lapack, blas, cblas, atlasI think this should be automatic. Apart from debian, the /usr/lib64 directory is pretty much standard for 64bit linux distros.
Chuck 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Tim Hochberg
Christopher Barker wrote:
> Fernando Perez wrote:
>   
>> In [8]: N.array(3).shape
>> Out[8]: ()
>> 
>
>   
>> In [11]: N.array([]).shape
>> Out[11]: (0,)
>> 
>
>   
>> I guess my only remaining question is: what is the difference between
>> outputs #8 and #11 above?  Is an empty shape tuple == array scalar,
>> while a (0,) shape indicates a one-dimensional array with no elements?
>>  If this interpretation is correct, what is the usage of the latter
>> kind of object, given how it can't even be indexed?
>> 
>
> It can be iterated over (with zero iterations):
>
>  >>> a = N.array([])
>  >>> for i in a:
> ...   print i
> ...
>
> whereas the scalar can not:
>
>  >>> b = N.array(3)
>  >>> b
> array(3)
>  >>> for i in b:
> ...   print i
> ...
> Traceback (most recent call last):
>File "", line 1, in ?
> TypeError: iteration over a scalar (0-dim array)
>
> Of course the scalar isn't empty, so ti's different in that way too. Can 
> there be an empty scalar? It doesn't look like it. In fact, this looks 
> like it may be a bug:
>  >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a
> ()
> 1
> 6
>
> That's what I'd expect, but what if you start with a (0,) array:
>  >>> a = N.array([]).sum(); a.shape; a.size; a
> ()
> 1
> 0
>
> where did that zero come from?
>   
More or less from:

 >>> numpy.add.identity
0

All the ufuncs have an identity function that they use as a starting 
point for reduce and accumulate. Sum doesn't appear to actually ahve 
one, but since it's more or less the same as add.reduce it's probably 
good that it has the same behavior. Note that this also matches the 
behavior of python's built in sum, although there the identity is called 
'start'.

-tim

>  >>> N.__version__
> '1.0b4'
>
> -Chris
>
>
>
>   



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
But i have hetergenious arrays that have numbers and strings and NoneType, etc.

Take for instance:

In [11]: numpy.array([numpy.array([1,'A', None]),
numpy.array([2,2,'Some string'])], dtype=object)
Out[11]:
array([[1, A, None],
   [2, 2, Some string]], dtype=object)

In [12]: numpy.array([numpy.array([1,'A', None]),
numpy.array([2,2,'Some string'])], dtype=object).shape
Out[12]: (2, 3)

Works fine in Numeric and pre beta numpy but in beta numpy versions i get:

In [6]: numpy.array([numpy.array([1,'A', None]),
numpy.array([2,2,'Some string'])], dtype=object)
Out[6]: array([[1 A None], [2 2 Some string]], dtype=object)

In [7]: numpy.array([numpy.array([1,'A', None]),
numpy.array([2,2,'Some string'])], dtype=object).shape
Out[7]: (2,)

But a lists of lists still gives:

In [9]: numpy.array([[1,'A', None], [2,2,'Some string']], dtype=object).shape
Out[9]: (2, 3)

And if you omit the dtype and use a list of arrays then you get a
string array with 2,3 dimensions:
In [11]: numpy.array([numpy.array([1,'A', None]),
numpy.array([2,2,'Some string'])]).shape
Out[11]: (2, 3)


This new behavior strikes me as inconsistent.  One of the things I
love about numpy is the ufuncs, array constructors, etc don't care
about whether you pass a combination of lists, arrays, tuples, etc.
They just know what you _mean_.  And what you _mean_ by a list of
lists, tuple of arrays, list of arrays, etc is very consistent across
constructors and functions.  I think making an exception for
dtype=object introduces a lot of inconsistencies and it isn't clear to
me what is gained.  Does anyone commonly use the array interface in a
manner that this new behavior is actuallly favorable?  I may be
overlooking a common use case or something like that.


On 8/31/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
>
>
>
> On 8/31/06, Tom Denniston
> <[EMAIL PROTECTED]> wrote:
> >
> > For this simple example yes, but if one of the nice things about the array
> constructors is that they know that lists, tuple and arrays are just
> sequences and any combination of them is valid numpy input.  So for instance
> a list of tuples yields a 2d array.  A list of tuples of 1d arrays yields a
> 3d array.  A list of 1d arrays yields 2d array.  This was the case
> consistently across all dtypes.  Now it is the case across all of them
> except for the dtype=object which has this unusual behavior.  I agree that
> vstack is a better choice when you know you have a list of arrays but it is
> less useful when you don't know and you can't force a type in the vstack
> function so there is no longer an equivalent to the dtype=object behavior:
> >
> > In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])],
> dtype=object)
> > Out[7]:
> > array([[1, 2, 3],
> >[4, 5, 6]], dtype=object)
>
>
> What are you trying to do? If you want integers:
>
> In [32]: a = array([array([1,2,3]), array([4,5,6])], dtype=int)
>
> In [33]: a.shape
> Out[33]: (2, 3)
>
>
> If you want objects, you have them:
>
> In [30]: a = array([array([1,2,3]), array([4,5,6])], dtype=object)
>
> In [31]: a.shape
> Out[31]: (2,)
>
> i.e, a is an array containing two array objects.
>
> Chuck
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Charles R Harris
On 8/31/06, Christopher Barker <[EMAIL PROTECTED]> wrote:
Fernando Perez wrote:> In [8]: N.array(3).shape> Out[8]: ()> In [11]: N.array([]).shape> Out[11]: (0,)> I guess my only remaining question is: what is the difference between> outputs #8 and #11 above?  Is an empty shape tuple == array scalar,
> while a (0,) shape indicates a one-dimensional array with no elements?>  If this interpretation is correct, what is the usage of the latter> kind of object, given how it can't even be indexed?
It can be iterated over (with zero iterations): >>> a = N.array([]) >>> for i in a:...   print i...whereas the scalar can not: >>> b = N.array(3) >>> b
array(3) >>> for i in b:...   print i...Traceback (most recent call last):   File "", line 1, in ?TypeError: iteration over a scalar (0-dim array)Of course the scalar isn't empty, so ti's different in that way too. Can
there be an empty scalar? It doesn't look like it. In fact, this lookslike it may be a bug: >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a()16That's what I'd expect, but what if you start with a (0,) array:
 >>> a = N.array([]).sum(); a.shape; a.size; a()10where did that zero come from?I think that is correct, sums over empty sets are conventionally set to zero because they are conceived of as adding all the values in the set to zero. Typically this would be implemented as
sum = 0for i in set : sum += i;Chuck

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
On 8/31/06, Tom Denniston <[EMAIL PROTECTED]> wrote:
But i have hetergenious arrays that have numbers and strings and NoneType, etc.Take for instance:In [11]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object)Out[11]:
array([[1, A, None],   [2, 2, Some string]], dtype=object)In [12]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object).shapeOut[12]: (2, 3)Works fine in Numeric and pre beta numpy but in beta numpy versions i get:
I think you want:In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)])
In [60]: a.shapeOut[60]: (2, 3)
 Which makes good sense to me.Chuck
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
On 8/31/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
On 8/31/06, Tom Denniston <[EMAIL PROTECTED]
> wrote:

But i have hetergenious arrays that have numbers and strings and NoneType, etc.Take for instance:In [11]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object)Out[11]:
array([[1, A, None],   [2, 2, Some string]], dtype=object)In [12]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object).shapeOut[12]: (2, 3)Works fine in Numeric and pre beta numpy but in beta numpy versions i get:
I think you want:In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)])

In [60]: a.shapeOut[60]: (2, 3)
 Which makes good sense to me.OK, I changed my mind. I think you are right and this is a bug. Using svn revision 3098 I getI
n [2]: a = array([1,'A', None])---
exceptions.TypeError Traceback (most recent call last)
/home/charris/
TypeError: expected a readable buffer object Which is different than you get with beta 1 in any case. I think array should cast the objects in the list to the first common dtype, object in this case. So the previous should be shorthand for:
In [3]: a = array([1,'A', None], dtype=object)
In [4]: a.shapeOut[4]: (3,)Chuck 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
Yes one can take a toy example and hack it to work but I don't necessarily have control over the input as to whether it is a list of object arrays, list of 1d heterogenous arrays, etc.  Before I didn't need to worry about the input because numpy understood that a list of 1d arrays is a 2d piece of data.  Now it understands this for all dtypes except object.  My question was is this new set of semantics preferable to the old.

 
I think your example kind of proves my point.  Does it really make any sense for the following two ways of specifying an array give such different results?  They strike me as _meaning_ the same thing.  Doesn't it seem inconsistent to you?

 

In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)], dtype=object).shapeOut[13]: (2,)
and
In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)]).shapeOut[14]: (2, 3)
So my question is what is the _advantage_ of the new semantics?  The two examples above used to give the same results.  In what cases is it preferable for them to give different results?  How does it make life simpler?

 
 
On 8/31/06, Charles R Harris <[EMAIL PROTECTED]> wrote:

On 8/31/06, Tom Denniston <[EMAIL PROTECTED]
> wrote:



But i have hetergenious arrays that have numbers and strings and NoneType, etc.Take for instance:
In [11]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object)Out[11]: array([[1, A, None],   [2, 2, Some string]], dtype=object)In [12]: numpy.array([
numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object).shapeOut[12]: (2, 3)Works fine in Numeric and pre beta numpy but in beta numpy versions i get: 

I think you want:In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)])
In [60]: a.shapeOut[60]: (2, 3) 
  Which makes good sense to me.Chuck  -Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
wrote the last email before reading your a = array([1,'A', None]) comment.  I definately agree with you on that.
On 8/31/06, Tom Denniston <[EMAIL PROTECTED]> wrote:


Yes one can take a toy example and hack it to work but I don't necessarily have control over the input as to whether it is a list of object arrays, list of 1d heterogenous arrays, etc.  Before I didn't need to worry about the input because numpy understood that a list of 1d arrays is a 2d piece of data.  Now it understands this for all dtypes except object.  My question was is this new set of semantics preferable to the old. 

 
I think your example kind of proves my point.  Does it really make any sense for the following two ways of specifying an array give such different results?  They strike me as _meaning_ the same thing.  Doesn't it seem inconsistent to you? 

 

In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)], dtype=object).shapeOut[13]: (2,)
and
In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)]).shapeOut[14]: (2, 3)
So my question is what is the _advantage_ of the new semantics?  The two examples above used to give the same results.  In what cases is it preferable for them to give different results?  How does it make life simpler? 


 
 
On 8/31/06, Charles R Harris <[EMAIL PROTECTED]
> wrote:



On 8/31/06, Tom Denniston <[EMAIL PROTECTED] 
> wrote:



But i have hetergenious arrays that have numbers and strings and NoneType, etc.Take for instance: 
In [11]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object)Out[11]: array([[1, A, None],   [2, 2, Some string]], dtype=object)In [12]: numpy.array([ 
numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object).shapeOut[12]: (2, 3)Works fine in Numeric and pre beta numpy but in beta numpy versions i get: 

I think you want:In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)])
In [60]: a.shapeOut[60]: (2, 3) 
  Which makes good sense to me.Chuck  
-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion 


 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] Strange exp

2006-08-31 Thread Angelo Secchi

Hi,
I have the following script 

import fileinput
import string
from math import *
from scipy import *
from rpy import *
import Numeric
import shelve
import sys

def dpolya1(n,N,b,a):
a=float(a)
b=float(b)
L=784

probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L-1)+N-n))-(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(N-n+1)+special.gammaln(L*(a/b)-(a/b#)
return probs

and I observe the following "strange" (for me of course) behaviour

>>> dpolya1(1,2,0.5,0.4)
-5.9741312822170585
>>> type(dpolya1(1,2,0.5,0.4))

>>> exp(dpolya1(1,2,0.5,0.4))
Traceback (most recent call last):
  File "", line 1, in ?
AttributeError: 'numpy.ndarray' object has no attribute 'exp'

I do not understand what's wrong. Any help?
Thanks
Angelo


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-31 Thread Torgil Svensson
> Yes. fromiter(iterable, dtype, count) works.

Oh. Thanks. I probably had too old documentation to see this (15
June). If it's not updated since I'll give Travis a rest about this,
at least until 1.0 is released :)


> Regardless, L is only iterated over once.

How can this be true? If no size is given, mustn't numpy either loop
over L twice or build an internal representation on which it'll
iterate or copy in chunks?


I just found out that this works
>>> import numpy,itertools
>>> rec_dt=numpy.dtype(">i4,S10,f8")
>>> rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',-8)])
>>> numpy.fromiter(rec_iter,rec_dt,10).view(recarray)
recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0),
   (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), (5, 'y', 190.0),
   (2, 'h', -8.0), (1, 's', 4.0)],
  dtype=[('f0', '>i4'), ('f1', '|S10'), ('f2', '>> d2_dt=numpy.dtype("4f8")
>>> d2_iter=itertools.cycle([(1.0,numpy.nan,-1e10,14.0)])
>>> numpy.fromiter(d2_iter,d2_dt,10)
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: a float is required
>>> numpy.__version__
'1.0b4'

//Torgil



On 8/30/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> Torgil Svensson wrote:
> >>return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int))
> >>
> >
> > Is it possible for fromiter to take an optional shape (or count)
> > argument in addition to the dtype argument?
> Yes. fromiter(iterable, dtype, count) works.
>
> > If both is given it could
> > preallocate memory and we only have to iterate over L once.
> >
> Regardless, L is only iterated over once. In general you can't rewind
> iterators, so that's a requirement. This is accomplished by doing
> successive overallocation similar to the way appending to a list is
> handled. By specifying the count up front you save a bunch of reallocs,
> but no iteration.
>
> -tim
>
>
>
> > //Torgil
> >
> > On 8/29/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
> >
> >> On 8/29/06, Torgil Svensson <[EMAIL PROTECTED]> wrote:
> >>
> >>> something like this?
> >>>
> >>> def list2index(L):
> >>>uL=sorted(set(L))
> >>>idx=dict((y,x) for x,y in enumerate(uL))
> >>>return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int))
> >>>
> >> Wow. That's amazing. Thank you.
> >>
> >> -
> >> Using Tomcat but need to do more? Need to support web services, security?
> >> Get stuff done quickly with pre-integrated technology to make your job 
> >> easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >> ___
> >> Numpy-discussion mailing list
> >> Numpy-discussion@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >>
> >>
> >
> > -
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > ___
> > Numpy-discussion mailing list
> > Numpy-discussion@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >
> >
> >
>
>
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] For loop tips

2006-08-31 Thread Torgil Svensson
def list2index(L):
uL=sorted(set(L))
idx=dict((y,x) for x,y in enumerate(uL))
return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int,count=len(L)))

adding the count will save you a little more time, and temporary
memory [see related thread].

//Torgil

On 8/29/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
> On 8/29/06, Torgil Svensson <[EMAIL PROTECTED]> wrote:
> > something like this?
> >
> > def list2index(L):
> >uL=sorted(set(L))
> >idx=dict((y,x) for x,y in enumerate(uL))
> >return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int))
>
> Wow. That's amazing. Thank you.
>
> -
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
I submitted a ticket for this.On 8/31/06, Tom Denniston <[EMAIL PROTECTED]> wrote:
wrote the last email before reading your a = array([1,'A', None]) comment.  I definately agree with you on that.

On 8/31/06, Tom Denniston <[EMAIL PROTECTED]
> wrote:


Yes one can take a toy example and hack it to work but I don't necessarily have control over the input as to whether it is a list of object arrays, list of 1d heterogenous arrays, etc.  Before I didn't need to worry about the input because numpy understood that a list of 1d arrays is a 2d piece of data.  Now it understands this for all dtypes except object.  My question was is this new set of semantics preferable to the old. 

 
I think your example kind of proves my point.  Does it really make any sense for the following two ways of specifying an array give such different results?  They strike me as _meaning_ the same thing.  Doesn't it seem inconsistent to you? 

 

In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)], dtype=object).shapeOut[13]: (2,)
and
In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)]).shapeOut[14]: (2, 3)
So my question is what is the _advantage_ of the new semantics?  The two examples above used to give the same results.  In what cases is it preferable for them to give different results?  How does it make life simpler? 


 
 
On 8/31/06, Charles R Harris <[EMAIL PROTECTED]
> wrote:



On 8/31/06, Tom Denniston <[EMAIL PROTECTED] 
> wrote:



But i have hetergenious arrays that have numbers and strings and NoneType, etc.Take for instance: 
In [11]: numpy.array([numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object)Out[11]: array([[1, A, None],   [2, 2, Some string]], dtype=object)In [12]: numpy.array
([ 
numpy.array([1,'A', None]),numpy.array([2,2,'Some string'])], dtype=object).shapeOut[12]: (2, 3)Works fine in Numeric and pre beta numpy but in beta numpy versions i get: 

I think you want:In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)])

In [60]: a.shapeOut[60]: (2, 3) 
  Which makes good sense to me.Chuck  
-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Numpy-discussion mailing list

Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion 


 

-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Strange exp

2006-08-31 Thread Robert Kern
Angelo Secchi wrote:
> Hi,
> I have the following script 
> 
> import fileinput
> import string
> from math import *
> from scipy import *
> from rpy import *
> import Numeric
> import shelve
> import sys
> 
> def dpolya1(n,N,b,a):
> a=float(a)
> b=float(b)
> L=784
> 
> probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L-1)+N-n))-(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(N-n+1)+special.gammaln(L*(a/b)-(a/b#)
> return probs
> 
> and I observe the following "strange" (for me of course) behaviour
> 
 dpolya1(1,2,0.5,0.4)
> -5.9741312822170585
 type(dpolya1(1,2,0.5,0.4))
> 
 exp(dpolya1(1,2,0.5,0.4))
> Traceback (most recent call last):
>   File "", line 1, in ?
> AttributeError: 'numpy.ndarray' object has no attribute 'exp'
> 
> I do not understand what's wrong. Any help?

Probably rpy (which still uses Numeric, right?) is exposing Numeric's exp() 
implementation and overriding the one that you got from scipy (which is 
numpy's, 
I presume). When Numeric's exp() is confronted with an object that it doesn't 
recognize, it looks for a .exp() method to call.

If you want to avoid this situation in the future, don't use the "from foo 
import *" form. It makes debugging problems like this difficult.

-- 
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 had
  an underlying truth."
   -- Umberto Eco


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-31 Thread Tim Hochberg
Torgil Svensson wrote:
>> Yes. fromiter(iterable, dtype, count) works.
>> 
>
> Oh. Thanks. I probably had too old documentation to see this (15
> June). If it's not updated since I'll give Travis a rest about this,
> at least until 1.0 is released :)
>   
Actually I just knew 'cause I wrote it. I don't see a docstring for 
fromiter, although I though I wrote one. Maybe I just forgot?

>> Regardless, L is only iterated over once.
>> 
>
> How can this be true? If no size is given, mustn't numpy either loop
> over L twice or build an internal representation on which it'll
> iterate or copy in chunks?
>   
Well, it can't in general loop over L twice since the only method that L 
is guaranteed to have is next(); that's the extent of the iterator 
protocol. What it does is allocate an initial chunk of memory (the size 
of which I forget -- I did some tuning) and start filling it up. Once 
it's full, it does a realloc, which expands the existing chunk or 
memory, if possible, or returns a new, larger, chunk of memory with the 
data copied into it. Then we iterate on L some more until we fill up the 
new larger chunk, in which case we go get another one, etc. This is 
exactly how list.append works, although in that case the chunk of data 
is acutally a chunk of pointers to objects.

-tim
>
> I just found out that this works
>   
 import numpy,itertools
 rec_dt=numpy.dtype(">i4,S10,f8")
 rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',-8)])
 numpy.fromiter(rec_iter,rec_dt,10).view(recarray)
 
> recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0),
>(5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), (5, 'y', 190.0),
>(2, 'h', -8.0), (1, 's', 4.0)],
>   dtype=[('f0', '>i4'), ('f1', '|S10'), ('f2', '
> but what's wrong with this?
>
>   
 d2_dt=numpy.dtype("4f8")
 d2_iter=itertools.cycle([(1.0,numpy.nan,-1e10,14.0)])
 numpy.fromiter(d2_iter,d2_dt,10)
 
> Traceback (most recent call last):
>   File "", line 1, in ?
> TypeError: a float is required
>   
 numpy.__version__
 
> '1.0b4'
>
> //Torgil
>
>
>
> On 8/30/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
>   
>> Torgil Svensson wrote:
>> 
return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int))

 
>>> Is it possible for fromiter to take an optional shape (or count)
>>> argument in addition to the dtype argument?
>>>   
>> Yes. fromiter(iterable, dtype, count) works.
>>
>> 
>>> If both is given it could
>>> preallocate memory and we only have to iterate over L once.
>>>
>>>   
>> Regardless, L is only iterated over once. In general you can't rewind
>> iterators, so that's a requirement. This is accomplished by doing
>> successive overallocation similar to the way appending to a list is
>> handled. By specifying the count up front you save a bunch of reallocs,
>> but no iteration.
>>
>> -tim
>>
>>
>>
>> 
>>> //Torgil
>>>
>>> On 8/29/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
>>>
>>>   
 On 8/29/06, Torgil Svensson <[EMAIL PROTECTED]> wrote:

 
> something like this?
>
> def list2index(L):
>uL=sorted(set(L))
>idx=dict((y,x) for x,y in enumerate(uL))
>return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int))
>
>   
 Wow. That's amazing. Thank you.

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job 
 easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
 ___
 Numpy-discussion mailing list
 Numpy-discussion@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/numpy-discussion


 
>>> -
>>> Using Tomcat but need to do more? Need to support web services, security?
>>> Get stuff done quickly with pre-integrated technology to make your job 
>>> easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>> ___
>>> Numpy-discussion mailing list
>>> Numpy-discussion@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>>>
>>>
>>>
>>>   
>>
>> -
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Christopher Barker
Tim Hochberg wrote:
>> That's what I'd expect, but what if you start with a (0,) array:
>>  >>> a = N.array([]).sum(); a.shape; a.size; a
>> ()
>> 1
>> 0
>>
>> where did that zero come from?
>>   
> More or less from:
> 
>  >>> numpy.add.identity
> 0

I'm not totally sure, but I think I'd rather it raise an exception. 
However, if it's not going to, then 0 is really the only reasonable answer.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Christopher Barker
Tom Denniston wrote:
> So my question is what is the _advantage_ of the new semantics? 

what if the list don't have the same length, and therefor can not be 
made into an array, now you get a weird result:

 >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)]).shape
()

Now you get an Object scalar.

but:
 >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)],dtype=object).shape
(2,)

Now you get a length 2 array, just like before: far more consistent. 
With the old semantics, if you test your code with arrays of different 
lengths, you'll get one thing, but if they then happen to be the same 
length in some production use, the whole thing breaks -- this is a Bad Idea.

Object arrays are just plain weird, there is nothing you can do that 
will satisfy every need. I think it's best for the array constructor to 
not try to guess at what the hierarchy of sequences you *meant* to use. 
You can (and probably should) always be explicit with:

 >>> A = N.empty((2,), dtype=object)
 >>> A
array([None, None], dtype=object)
 >>> A[:] = [N.array([1,'A', None], 
dtype=object),N.array([2,2,'Somestring',5],dtype=object)]
 >>> A
array([[1 A None], [2 2 Somestring 5]], dtype=object)

-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Tom Denniston
I would think one would want to throw an error when the data has inconsistent dimensions.  This is what numpy does for other dtypes:
 
 
In [10]: numpy.array(([1,2,3], [4,5,6]))Out[10]:array([[1, 2, 3],   [4, 5, 6]])
In [11]: numpy.array(([1,3], [4,5,6]))---exceptions.TypeError Traceback (most recent call last)
TypeError: an integer is required
 
 
 
On 8/31/06, Christopher Barker <[EMAIL PROTECTED]> wrote:
Tom Denniston wrote:> So my question is what is the _advantage_ of the new semantics?what if the list don't have the same length, and therefor can not be
made into an array, now you get a weird result:>>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)]).shape()Now you get an Object scalar.but:
>>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)],dtype=object).shape(2,)Now you get a length 2 array, just like before: far more consistent.With the old semantics, if you test your code with arrays of different
lengths, you'll get one thing, but if they then happen to be the samelength in some production use, the whole thing breaks -- this is a Bad Idea.Object arrays are just plain weird, there is nothing you can do that
will satisfy every need. I think it's best for the array constructor tonot try to guess at what the hierarchy of sequences you *meant* to use.You can (and probably should) always be explicit with:>>> A = 
N.empty((2,), dtype=object)>>> Aarray([None, None], dtype=object)>>> A[:] = [N.array([1,'A', None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)]>>> Aarray([[1 A None], [2 2 Somestring 5]], dtype=object)
-Chris--Christopher Barker, Ph.D.OceanographerNOAA/OR&R/HAZMAT (206) 526-6959   voice7600 Sand Point Way NE   (206) 526-6329   faxSeattle, WA  98115   (206) 526-6317   main reception
[EMAIL PROTECTED]-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Christopher Barker
Tom Denniston wrote:
> I would think one would want to throw an error when the data has
> inconsistent dimensions.

But it doesn't have inconsistent dimensions - they are perfectly 
consistent with a (2,) array of objects. How is the code to know what 
you intended?

With numeric types, it is unambiguous to march down through the 
sequences until you get a number. As a sequence is an object, there no 
way to unambiguously do this automatically.

Perhaps the way to solve this is for the array constructor to take a 
"shape" or "rank" argument, so you could specify what you intend. But 
that's really just syntactic sugar to avoid for calling numpy.empty() first.

Perhaps a numpy.object_array() constructor would be useful, although as 
I think about it, even specifying a shape or rank would not be unambiguous!

This is a useful discussion. If we ever get a nd-array into the standard 
lib, I suspect that object arrays will get heavy use -- better to clean 
up the semantics now.

Perhaps a Wiki page on building object arrays is called for.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype=object behavior change from 0.9.6 to beta 1

2006-08-31 Thread Charles R Harris
On 8/31/06, Christopher Barker <[EMAIL PROTECTED]> wrote:
Tom Denniston wrote:> I would think one would want to throw an error when the data has> inconsistent dimensions.But it doesn't have inconsistent dimensions - they are perfectlyconsistent with a (2,) array of objects. How is the code to know what
you intended?
Same as it produces a float array from array([1,2,3.0]). Array is a
complicated function for precisely these sort of reasons, but the
convenience makes it worthwhile. So, if a list contains something that
can only be interpreted as an object, dtype should be set to object. 
With numeric types, it is unambiguous to march down through thesequences until you get a number. As a sequence is an object, there no
way to unambiguously do this automatically.Perhaps the way to solve this is for the array constructor to take a"shape" or "rank" argument, so you could specify what you intend. Butthat's really just syntactic sugar to avoid for calling 
numpy.empty() first.Perhaps a numpy.object_array() constructor would be useful, although asI think about it, even specifying a shape or rank would not be unambiguous!This is a useful discussion. If we ever get a nd-array into the standard
lib, I suspect that object arrays will get heavy use -- better to cleanup the semantics now.Perhaps a Wiki page on building object arrays is called for.-Chris
Chuck 

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] amd64 support

2006-08-31 Thread David M. Cooke
On Aug 30, 2006, at 11:53 , Keith Goodman wrote:

> I plan to build an amd64 box and run debian etch. Are there any big,
> 64-bit, show-stopping problems in numpy? Any minor annoyances?

Shouldn't be; I regularly build and test it on an amd64 box running  
Debian unstable, and I know several others use amd64 boxes too.

-- 
|>|\/|<
/--\
|David M. Cooke  http://arbutus.physics.mcmaster.ca/dmc/
|[EMAIL PROTECTED]


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion