Re: [Numpy-discussion] loadtxt bug?

2007-11-23 Thread Alan G Isaac
> On Fri, Nov 23, 2007 at 07:58:13AM -0500, Alan G Isaac wrote:
>> Specifically, is it not the case that the last line of 
>> a text file is not guaranteed to have a terminator?  Does 
>> this not raise the possibility that a digit will be 
>> clipped from the last line? 


On Fri, 23 Nov 2007, Gael Varoquaux apparently wrote:
> Yes. If the line does not end by a terminator you have a problem. 


I do not know how common this situation is, but:
- it is common enough that some editors address it 
  explicitly (e.g., Vim, Epsilon)
- Java's TextReader addresses it explicitly
  http://www.cs.arizona.edu/~reges/teachers/TextReader.html>

Based on these considerations an unterminated final line 
looks like a possibility.  If so, perhaps that should be 
addressed by changing that line I pointed out in `loadtxt`.

Cheers,
Alan Isaac



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] OT: A Way to Approximate and Compress a 3D Surface

2007-11-23 Thread Stefan van der Walt
On Fri, Nov 23, 2007 at 10:19:47AM -0600, Geoffrey Zhu wrote:
> One thing about triangulation I haven't figured out is how to add
> multiple such functions together. So if I have a set of triangles that
> represent f1(x,y) and another set of triangles that represent f2(x,y),
> is there any quick way to get f1(x,y)+f2(x,y) from the triangulation
> results of the parts?

As a simple, and probably naïeve, first guess: if f1 is defined at a
point but f2 is not, interpolate f2 to that point and add to f1.
Thus, the result of f1+f2 will have points in the locations where
either f1 or f2 have them.  Thereafter, you can again simplify the
mesh.

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Pierre GM

> This seems to work without any problem now:
> class ndarray_inMrcFile(N.ndarray):
> def __array_finalize__(self,obj):
> self.Mrc = getattr(obj, 'Mrc', None)
>
> Comments?

That should work if you want a subclass of ndarray. That probably won't if you 
want a subclass of memmap. Once again, I'd do a 
def __new__(**options)
   N.memmap.__new__(**options)
or something to this effect...
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Pierre GM

> 2.) I guess the   """class ndarray_inMrcFile(N.memmap):
> pass""" construct is to simplistic 
>Could someone suggest a *minimal* definition, so that my attributes
> would be preserved ?

Mmh, I would at least try to explicitly call the N.memmap.__new__

> A few comments about the wiki page:
> 1)  The example does not show the printed info, such as "__new__
> received %s", in the example session

OK, I'll edit the example

> 2) I don't understand, why in the example the "info" attribute is set
> in "__new__()", even though the text above says:
> """However, we need to keep in mind that any attribute that we define
> in the __new__ method will be shared among all the instances. If we
> want instance-specific attributes, we still need some specific
> initialization. We cannot use the __init__ method, as it won't be
> called. That's where __array_finalize__ comes to play."""

Yeah, that's not very clear.
Well, look at the code of the example.
In line 11, we call a view of the array, with our class as argument. That 
calls __array_finalize__, with "subarr" as the obj argument.  
__array_finalize__ sets a default "info" attribute: an empty dictionary, as 
the argumnet doesn't have an info attribute yet. 
In lines 14-18, we set the "info" argument of our object to the value we want.


> 3) the text about "The __array_finalize__ method"  should at least
> once say that it is defined as "def __array_finalize__(self,obj)"  --
> otherwise I could only guess where the "obj" comes from.

OK, same as for 1.

> 4) related to the text after: "In other terms, __array_finalize__ is
> called" How do I know if a function or method actually  invokes __new__ 
> ;-) ?  Would I have to study the numpy source ?

As a rule of thumb, __new__ is called each time you have a construction like 
MyClass(whatverargumentisneeded). When you rely on views (such as w/ 
the .view method, or ravel, or transpose...), you call __array_finalize__ . 
You don't really have to study the numpy code (even if it helps)


> 5) For the "__array_finalize__ method" there a text that says:
> """Subclasses inherit a default implementation of this method that
> does nothing""" --- but how about "__new__()" :  what happens if you
> don't define that (either) ?

Try. The ndarray doesn't have a **keywords option: you can't pass extra 
parameters to ndarray.__new__. In other terms, if you need to pass some 
specific parameter to your class (in our example, info), you'll choke 
ndarray.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] OT: A Way to Approximate and Compress a 3D Surface

2007-11-23 Thread Geoffrey Zhu
Hi Bob, Anne, and everyone,

On Nov 21, 2007 1:41 PM, Bob Lewis <[EMAIL PROTECTED]> wrote:
> On 11/20/07, Anne Archibald posted:
>
> > Subject:
> > Re: [Numpy-discussion] OT: A Way to Approximate and Compress a 3D Surface
> > From:
> > "Anne Archibald" <[EMAIL PROTECTED]>
> > Date:
> > Tue, 20 Nov 2007 17:13:31 -0500
> > To:
> > "Discussion of Numerical Python" 
> >
> > To:
> > "Discussion of Numerical Python" 
> >
> >
> > On 20/11/2007, Geoffrey Zhu <[EMAIL PROTECTED]> wrote:
> >
> >> I have N tabulated data points { (x_i, y_i, z_i) } that describes a 3D
> >> surface. The surface is pretty "smooth." However, the number of data
> >> points is too large to be stored and manipulated efficiently. To make
> >> it easier to deal with, I am looking for an easy method to compress
> >> and approximate the data. Maybe the approximation can be described by
> >> far fewer number of coefficients.
> >>
> >> If you can give me some hints about possible numpy or non-numpy
> >> solutions or let me know where is better to ask this kind of question,
> >> I would really appreciate it.
> >
> > This is an important task in computer graphics, in particular, in the
> > field of multiresolution modelling. If you look up "surface
> > simplification" you'll find many references to articles. I don't know
> > of a library offhand that does it, let alone one that is accessible
> > from python, but you could try looking at a toolkit that does
> > isosurface visualization - these are surfaces that can often be
> > simplified enormously. In particular it looks like VTK might be able
> > to do what you want.
>
> Anne Archibald is correct that surface simplification may ultimately
> be of great help.  Other place to look besides VTK are GTS, the GNU
> Triangulated Surface library, and CGAL, the Computational Geometry
> Algorithms Library, which has a Python binding.
>
> It occurs to me, though, that we should first verify that you do
> indeed have a surface in the first place.  All you tell us is that you
> have a set of N points in 3-space.  Are they connected?  That is, does
> each point have well-defined neighbors?  If so, do these vertices and
> connections form a mesh that defines a surface?
>
>- Bob Lewis
>
>
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

First I'd like to thank everyone for helping me on this.  It does look
like surface simplification will greatly help my problem.

Yes, I indeed have a surface and the points are connected. In fact, I
have a function z=f(x,y). Except at certain points, it is continuous
and smooth. It is very computationally intensive to calculate f(x,y),
so I have to calculate certain points {(x_i,y_i_,z_i)} and store the
data in a database. However, I have thousands of such functions and
therefore a lot of points to deal with and that makes manipulating and
storing them difficult and slow.

One thing about triangulation I haven't figured out is how to add
multiple such functions together. So if I have a set of triangles that
represent f1(x,y) and another set of triangles that represent f2(x,y),
is there any quick way to get f1(x,y)+f2(x,y) from the triangulation
results of the parts?

Thanks again for all your help,
Geoffrey
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Pierre GM

> First try seems to show that just changing my class def to:
> class ndarray_inMrcFile(N.memmap):
>  def __array_finalize__(self,obj):
>   self.Mrc = getattr(obj, 'Mrc', None)
>
> Seems to add the wanted attribute back into result of transpose().

Yep. Specific subclass attributes should be defined in __array_finalize__.

> However now I get (many!) exceptions like:
> Exception exceptions.AttributeError: "'ndarray_inMrcFile' object has no
> attribut e '_mmap'" in  ndarray_inMrcFile([ 6,
>
> Do I need to call super.__array_finalize__(obj) first ?

Nope, you just need a __new__ that calls the __new__ of you parent class. Keep 
it minimal.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Sebastian Haase
On Nov 23, 2007 5:01 PM, Sebastian Haase <[EMAIL PROTECTED]> wrote:
>
> On Nov 23, 2007 4:43 PM, Sebastian Haase <[EMAIL PROTECTED]> wrote:
> > On Nov 23, 2007 3:37 PM, Pierre GM <[EMAIL PROTECTED]> wrote:
> > > On Friday 23 November 2007 03:25:37 Sebastian Haase wrote:
> > > > Hi,
> > > > this question might habe been answered before:
> > > > I have my own ndarray-derived class. I did this, so that I can add
> > > > another "custom attribute" -- let's say
> > > > arr.filename
> > >
> > > Sebastian,
> > > Could you post the __new__ and __array_finalize__ for your class ? Are you
> > > sure you update the attribute in __array_finalize__ ?
> > > And this page may come handy:
> > > http://www.scipy.org/Subclasses
> >
> > Aah - I guess I did not do my homework ;-)
> > Here is my code:
> > class ndarray_inMrcFile(N.memmap):
> > pass
> >
> > data = self.data
> > data.__class__ = ndarray_inMrcFile
> >
> > Two points:
> > 1.) Please don't get distracted by the way how I change the class type
> > "after the fact". I get the data as a memmaped slice from a file. Then
> > I do some (potentially not entirely clean) acrobatic to have this
> > slice change it's class-type so that I can attach the original memmap
> > (+ other attributes, such as filename) onto the ndarray
> >
> > 2.) I guess the   """class ndarray_inMrcFile(N.memmap):
> > pass""" construct is to simplistic 
> >Could someone suggest a *minimal* definition, so that my attributes
> > would be preserved ?
> >
> >
> > A few comments about the wiki page:
> > 1)  The example does not show the printed info, such as "__new__
> > received %s", in the example session
> >
> > 2) I don't understand, why in the example the "info" attribute is set
> > in "__new__()", even though the text above says:
> > """However, we need to keep in mind that any attribute that we define
> > in the __new__ method will be shared among all the instances. If we
> > want instance-specific attributes, we still need some specific
> > initialization. We cannot use the __init__ method, as it won't be
> > called. That's where __array_finalize__ comes to play."""
> >
> > 3) the text about "The __array_finalize__ method"  should at least
> > once say that it is defined as "def __array_finalize__(self,obj)"  --
> > otherwise I could only guess where the "obj" comes from.
> >
> > 4) related to the text after: "In other terms, __array_finalize__ is called"
> > How do I know if a function or method actually  invokes __new__  ;-)
> > ?  Would I have to study the numpy source ?
> >
> > 5) For the "__array_finalize__ method" there a text that says:
> > """Subclasses inherit a default implementation of this method that
> > does nothing""" --- but how about "__new__()" :  what happens if you
> > don't define that (either) ?
> >
> > (Hope these comments are helpful)
> >
> > Thanks for the help,
> > Sebastian
> >
>
>
> First try seems to show that just changing my class def to:
> class ndarray_inMrcFile(N.memmap):
>  def __array_finalize__(self,obj):
>   self.Mrc = getattr(obj, 'Mrc', None)
>
> Seems to add the wanted attribute back into result of transpose().
> However now I get (many!) exceptions like:
> Exception exceptions.AttributeError: "'ndarray_inMrcFile' object has no 
> attribut
> e '_mmap'" in  ndarray_inMrcFile([ 6,
>
> Do I need to call super.__array_finalize__(obj) first ?
>
> -Sebastian
>
This seems to work without any problem now:
class ndarray_inMrcFile(N.ndarray):
def __array_finalize__(self,obj):
self.Mrc = getattr(obj, 'Mrc', None)

Comments?

-Sebastian
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Sebastian Haase
On Nov 23, 2007 4:43 PM, Sebastian Haase <[EMAIL PROTECTED]> wrote:
> On Nov 23, 2007 3:37 PM, Pierre GM <[EMAIL PROTECTED]> wrote:
> > On Friday 23 November 2007 03:25:37 Sebastian Haase wrote:
> > > Hi,
> > > this question might habe been answered before:
> > > I have my own ndarray-derived class. I did this, so that I can add
> > > another "custom attribute" -- let's say
> > > arr.filename
> >
> > Sebastian,
> > Could you post the __new__ and __array_finalize__ for your class ? Are you
> > sure you update the attribute in __array_finalize__ ?
> > And this page may come handy:
> > http://www.scipy.org/Subclasses
>
> Aah - I guess I did not do my homework ;-)
> Here is my code:
> class ndarray_inMrcFile(N.memmap):
> pass
>
> data = self.data
> data.__class__ = ndarray_inMrcFile
>
> Two points:
> 1.) Please don't get distracted by the way how I change the class type
> "after the fact". I get the data as a memmaped slice from a file. Then
> I do some (potentially not entirely clean) acrobatic to have this
> slice change it's class-type so that I can attach the original memmap
> (+ other attributes, such as filename) onto the ndarray
>
> 2.) I guess the   """class ndarray_inMrcFile(N.memmap):
> pass""" construct is to simplistic 
>Could someone suggest a *minimal* definition, so that my attributes
> would be preserved ?
>
>
> A few comments about the wiki page:
> 1)  The example does not show the printed info, such as "__new__
> received %s", in the example session
>
> 2) I don't understand, why in the example the "info" attribute is set
> in "__new__()", even though the text above says:
> """However, we need to keep in mind that any attribute that we define
> in the __new__ method will be shared among all the instances. If we
> want instance-specific attributes, we still need some specific
> initialization. We cannot use the __init__ method, as it won't be
> called. That's where __array_finalize__ comes to play."""
>
> 3) the text about "The __array_finalize__ method"  should at least
> once say that it is defined as "def __array_finalize__(self,obj)"  --
> otherwise I could only guess where the "obj" comes from.
>
> 4) related to the text after: "In other terms, __array_finalize__ is called"
> How do I know if a function or method actually  invokes __new__  ;-)
> ?  Would I have to study the numpy source ?
>
> 5) For the "__array_finalize__ method" there a text that says:
> """Subclasses inherit a default implementation of this method that
> does nothing""" --- but how about "__new__()" :  what happens if you
> don't define that (either) ?
>
> (Hope these comments are helpful)
>
> Thanks for the help,
> Sebastian
>


First try seems to show that just changing my class def to:
class ndarray_inMrcFile(N.memmap):
 def __array_finalize__(self,obj):
  self.Mrc = getattr(obj, 'Mrc', None)

Seems to add the wanted attribute back into result of transpose().
However now I get (many!) exceptions like:
Exception exceptions.AttributeError: "'ndarray_inMrcFile' object has no attribut
e '_mmap'" in http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Sebastian Haase
On Nov 23, 2007 3:37 PM, Pierre GM <[EMAIL PROTECTED]> wrote:
> On Friday 23 November 2007 03:25:37 Sebastian Haase wrote:
> > Hi,
> > this question might habe been answered before:
> > I have my own ndarray-derived class. I did this, so that I can add
> > another "custom attribute" -- let's say
> > arr.filename
>
> Sebastian,
> Could you post the __new__ and __array_finalize__ for your class ? Are you
> sure you update the attribute in __array_finalize__ ?
> And this page may come handy:
> http://www.scipy.org/Subclasses

Aah - I guess I did not do my homework ;-)
Here is my code:
class ndarray_inMrcFile(N.memmap):
pass

data = self.data
data.__class__ = ndarray_inMrcFile

Two points:
1.) Please don't get distracted by the way how I change the class type
"after the fact". I get the data as a memmaped slice from a file. Then
I do some (potentially not entirely clean) acrobatic to have this
slice change it's class-type so that I can attach the original memmap
(+ other attributes, such as filename) onto the ndarray

2.) I guess the   """class ndarray_inMrcFile(N.memmap):
pass""" construct is to simplistic 
   Could someone suggest a *minimal* definition, so that my attributes
would be preserved ?


A few comments about the wiki page:
1)  The example does not show the printed info, such as "__new__
received %s", in the example session

2) I don't understand, why in the example the "info" attribute is set
in "__new__()", even though the text above says:
"""However, we need to keep in mind that any attribute that we define
in the __new__ method will be shared among all the instances. If we
want instance-specific attributes, we still need some specific
initialization. We cannot use the __init__ method, as it won't be
called. That's where __array_finalize__ comes to play."""

3) the text about "The __array_finalize__ method"  should at least
once say that it is defined as "def __array_finalize__(self,obj)"  --
otherwise I could only guess where the "obj" comes from.

4) related to the text after: "In other terms, __array_finalize__ is called"
How do I know if a function or method actually  invokes __new__  ;-)
?  Would I have to study the numpy source ?

5) For the "__array_finalize__ method" there a text that says:
"""Subclasses inherit a default implementation of this method that
does nothing""" --- but how about "__new__()" :  what happens if you
don't define that (either) ?

(Hope these comments are helpful)

Thanks for the help,
Sebastian
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Patch for numpy.i (not C89 compliant)

2007-11-23 Thread Bill Spotz
Thanks, Matthieu.

On Nov 23, 2007, at 2:24 AM, Matthieu Brucher wrote:

> Hi,
>
> I submitted a ticket and then a patch for numpy.i
> (http://projects.scipy.org/scipy/numpy/ticket/620). the problem is
> that some typemaps use a C99 syntax whereas most C compiler still are
> only C89 compliant (mainly Visual Studio).
>
>
> Matthieu
> --  
> French PhD student
> Website : http://miles.developpez.com/
> Blogs : http://matt.eifelle.com and http://blog.developpez.com/? 
> blog=92
> LinkedIn : http://www.linkedin.com/in/matthieubrucher
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

** Bill Spotz  **
** Sandia National Laboratories  Voice: (505)845-0170  **
** P.O. Box 5800 Fax:   (505)284-0154  **
** Albuquerque, NM 87185-0370Email: [EMAIL PROTECTED] **




___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Stefan van der Walt
Hi Sebastian

On Fri, Nov 23, 2007 at 09:25:37AM +0100, Sebastian Haase wrote:
> Hi,
> this question might habe been answered before:
> I have my own ndarray-derived class. I did this, so that I can add
> another "custom attribute" -- let's say
> arr.filename
> All works very except, except when I do
> arr2 = arr.transpose()
> my arr2 is still of the *type* of my derived class, however trying a
> arr2.filename
> now gives me an AtttributeError.
> 
> What am I doing wrong? How can this be fixed?
> (I'm using numpy 1.0.1 - please let me know if this has been fixed
> since)

Show us the code, then we can take a look.  I assume you have read

http://www.scipy.org/Subclasses

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] freebsd patch

2007-11-23 Thread Stefan van der Walt
Hi all,

Ticket 618 [1] proposes a patch to make numpy pass all tests on
FreeBSD.  Would anyone familiar with FreeBSD please glance over the
patch, apply it and make sure that it works as intended?

Thanks
Stéfan

[1] http://scipy.org/scipy/numpy/ticket/618
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Patch for numpy.i (not C89 compliant)

2007-11-23 Thread Stefan van der Walt
On Fri, Nov 23, 2007 at 10:24:07AM +0100, Matthieu Brucher wrote:
> I submitted a ticket and then a patch for numpy.i
> (http://projects.scipy.org/scipy/numpy/ticket/620). the problem is
> that some typemaps use a C99 syntax whereas most C compiler still are
> only C89 compliant (mainly Visual Studio).

Thanks, Matthieu.  It is fixed in SVN.

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Pierre GM
On Friday 23 November 2007 03:25:37 Sebastian Haase wrote:
> Hi,
> this question might habe been answered before:
> I have my own ndarray-derived class. I did this, so that I can add
> another "custom attribute" -- let's say
> arr.filename

Sebastian,
Could you post the __new__ and __array_finalize__ for your class ? Are you 
sure you update the attribute in __array_finalize__ ?
And this page may come handy:
http://www.scipy.org/Subclasses
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] loadtxt bug?

2007-11-23 Thread Gael Varoquaux
On Fri, Nov 23, 2007 at 07:58:13AM -0500, Alan G Isaac wrote:
> > On Thu, Nov 22, 2007 at 11:14:07PM -0500, Alan G Isaac wrote:
> >> In numpy.core.numeric.py you will find loadtxt, which uses 
> >> the following::
> >> line = line[:line.find(comments)].strip()



> On Fri, 23 Nov 2007, Gael Varoquaux apparently wrote:
> > Unless you are sure that line always ends with a "\n". This is the case 
> > in the code you are refering too. Unless I am missing some thing. 


> I am not understanding your comment here.  In the line of 
> code above, is there a problem or not?

I don't know.

> Specifically, is it not the case that the last line of 
> a text file is not guaranteed to have a terminator?  

This is what I do not know, and I would appreciate to be enlightened.

> Does this not raise the possibility that a digit will be 
> clipped from the last line?

Yes. If the line does not end by a terminator you have a problem.

Sorry if I am adding more confusion than help, I was just raising another
question, or rather a comment on your question, rather than giving an
answer.

Gaël
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] loadtxt bug?

2007-11-23 Thread Alan G Isaac
> On Thu, Nov 22, 2007 at 11:14:07PM -0500, Alan G Isaac wrote:
>> In numpy.core.numeric.py you will find loadtxt, which uses 
>> the following::
>> line = line[:line.find(comments)].strip()



On Fri, 23 Nov 2007, Gael Varoquaux apparently wrote:
> Unless you are sure that line always ends with a "\n". This is the case 
> in the code you are refering too. Unless I am missing some thing. 


I am not understanding your comment here.  In the line of 
code above, is there a problem or not?

Specifically, is it not the case that the last line of 
a text file is not guaranteed to have a terminator?  E.g.,
http://www.neppert.com/ioutilities/doc/com/neppert/io/TextReader.html>
Does this not raise the possibility that a digit will be 
clipped from the last line?

Of course strip will afterwards strip any line terminators.

Cheers,
Alan Isaac



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Patch for numpy.i (not C89 compliant)

2007-11-23 Thread Matthieu Brucher
Hi,

I submitted a ticket and then a patch for numpy.i
(http://projects.scipy.org/scipy/numpy/ticket/620). the problem is
that some typemaps use a C99 syntax whereas most C compiler still are
only C89 compliant (mainly Visual Studio).


Matthieu
-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy : your experiences?

2007-11-23 Thread Yves Revaz
Rahul Garg wrote:

>a) Can you guys tell me briefly about the kind of problems you are
>tackling with numpy and scipy?
>  
>
Reduction of large N-body simulations of astrophysical gravitational 
systems (N up to 268 millions).
See http://aramis.obspm.fr/~revaz/pNbody/.

>b) Have you ever felt that numpy/scipy was slow and had to switch to
>C/C++/Fortran?
>  
>
Some specific functions are missing in numpy and a pure python 
implementation
is too slow. In that case, I implement the specific function in C, as a 
python module.

>c) Do you use any form of parallel processing? Multicores? SMPs?
>Clusters? If yes how did u utilize them?
>
>
>  
>
Yes, my toolbox is now nearly completely parallelized with mpi4py.
Some parallelization parts are also implemented in C modules.
It works fine on beowulf clusters, multicores or smps.





-- 
(o o)
oOO--(_)--OOo---
  Yves Revaz
  Lerma Batiment A   Tel : ++ 33 (0) 1 40 51 20 79
  Observatoire de Paris  Fax : ++ 33 (0) 1 40 51 20 02 
  77 av Denfert-Rochereaue-mail : [EMAIL PROTECTED]
  F-75014 Paris  Web : http://obswww.unige.ch/~revaz/
  FRANCE 


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

2007-11-23 Thread Sebastian Haase
Hi,
this question might habe been answered before:
I have my own ndarray-derived class. I did this, so that I can add
another "custom attribute" -- let's say
arr.filename
All works very except, except when I do
arr2 = arr.transpose()
my arr2 is still of the *type* of my derived class, however trying a
arr2.filename
now gives me an AtttributeError.

What am I doing wrong? How can this be fixed?
(I'm using numpy 1.0.1 - please let me know if this has been fixed since)

Thanks,
Sebastian Haase
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Adding ACML support

2007-11-23 Thread David Cournapeau
On Nov 23, 2007 3:02 AM, Matthieu Brucher <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to get numpy work with AMD's MKL. The problem is that they not
> give a CBLAS interface, only the BLAS one.
> Can the numpy distutils check the existence of the cblas interface somewhere
> ? For the moment, it checks something with BLAS (but no actual testing takes
> place), but not CBLAS.
>
My understanding, but that's only from having read the distutils
sources, is that you don't check for cblas. You implement a acml
checker, like MKL, but you have to define NO_ATLAS_INFO to 1 to say
that cblas is not available (if you read the setup.py of numpy.core,
which needs cblas and not blas, you will see that's how it is decide
whether _dotblas should be built or not).

David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy : your experiences?

2007-11-23 Thread Gael Varoquaux
On Fri, Nov 16, 2007 at 07:50:07PM -0700, Rahul Garg wrote:
> It would be awesome if you guys could respond to some of the following
> questions :

OK, I'll take a bit of time to do this.

> a) Can you guys tell me briefly about the kind of problems you are
> tackling with numpy and scipy?

My day-to-day use is data processing of an atomic physics experiment
(Bose Einstein condensation). The data created by the experiment is
retrived from a bunch of instruments (scopes, cameras, and sensors) and
stored in an HDF5 file for each run, along with the parameters of the
run. This is done in Matlab for historical reasons, and MatLab is an
absolute pain for this. I have implemented a similar system in Python for
another experiment (I wrote an article sumerizing the lessons learnt and
the patterns to follow, hell this was the fourth experiment control
system I built, each time using a different platform
www.gael-varoquaux.info/computers/agile_computer_control_of_an_experiment.pdf
). The data is first stored on a windows box that runs the experiment,
then it is downloaded by our Linux server that keeps a hash table of all
the experiments ran and some figures of merit.

The data processing is done on the Linux box (quite often connected
remotely using Nomachine's NX). The data is accessed in a database-like
way through a custom Python module (1000 LOC). Recently I have switched
to a object-relationnal-mapping-like loading of the HDF5-files
(hierarchical data trees) through a database-like interface. It rocks,
IMHO.

We do simple fitting, blurring, filter, averaging, fft, ... on the data,
and plot the results.

Another of my uses is for simple toy models. Recently I have been
elaborating a statistical model of an experiment, so I was running Monte
Carlo simulations, but I have ran dynamical model integrations, and
linear algebra calculations always revolving around the physics of
cold atomic gases.

> b) Have you ever felt that numpy/scipy was slow and had to switch to
> C/C++/Fortran?

Never. However I really like the fact that I can if I need to. When
controling instruments in Python I often have to use their C SDK. In
which case I use Pyrex or Ctypes.

> c) Do you use any form of parallel processing? Multicores? SMPs?
> Clusters? If yes how did u utilize them?

No. Most often I am limited by IO.

I have the feeling that unlike most people on the list, my main work is
not on a computer, but on an experiment.

Gaël
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion