Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 6:42 PM, John Hunter  wrote:
> On Thu, Oct 13, 2011 at 5:36 PM, Eric Firing  wrote:
>
>>> It would be nice to have a social interface for the mpl gallery like the
>>> one similar to the R-gallery
>>> [http://www.r-bloggers.com/the-r-graph-gallery-goes-social/]
>>
>> I think that the priority should go towards massive pruning,
>> organization, and cleanup of the gallery.  This would be a great project
>> for a new contributor to mpl.
>
> So as to not hijack poor Christoph's thread, who after all is looking
> for mpl alternatives, and not to abuse numpy-discussion's bandwidth
> with mpl issues, I have opened and issue on the github tracker as an
> "open thread" to register gripes and suggestions for mpl doc and
> gallery improvements, particularly as it regards API usage
>
> https://github.com/matplotlib/matplotlib/issues/524

I started, but I would like to mention that I'm very happy with the
pyplot interface (even if sometimes it takes a bit of time to figure
out which options to use).

Josef

>
> JDH
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread John Hunter
On Thu, Oct 13, 2011 at 5:36 PM, Eric Firing  wrote:

>> It would be nice to have a social interface for the mpl gallery like the
>> one similar to the R-gallery
>> [http://www.r-bloggers.com/the-r-graph-gallery-goes-social/]
>
> I think that the priority should go towards massive pruning,
> organization, and cleanup of the gallery.  This would be a great project
> for a new contributor to mpl.

So as to not hijack poor Christoph's thread, who after all is looking
for mpl alternatives, and not to abuse numpy-discussion's bandwidth
with mpl issues, I have opened and issue on the github tracker as an
"open thread" to register gripes and suggestions for mpl doc and
gallery improvements, particularly as it regards API usage

https://github.com/matplotlib/matplotlib/issues/524

JDH
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Eric Firing
On 10/13/2011 12:22 PM, Gökhan Sever wrote:
>
>
> On Thu, Oct 13, 2011 at 4:15 PM, Benjamin Root  > wrote:
>
> Myself and other developers would greatly appreciate help from the
> community to point out which examples are too confusing or out of
> date. We
>
>
> It would be nice to have a social interface for the mpl gallery like the
> one similar to the R-gallery
> [http://www.r-bloggers.com/the-r-graph-gallery-goes-social/]

I think that the priority should go towards massive pruning, 
organization, and cleanup of the gallery.  This would be a great project 
for a new contributor to mpl.

Eric

>
>
> --
> Gökhan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Skipper Seabold
On Thu, Oct 13, 2011 at 6:22 PM, Gökhan Sever  wrote:
>
>
> On Thu, Oct 13, 2011 at 4:15 PM, Benjamin Root  wrote:
>>
>> Myself and other developers would greatly appreciate help from the
>> community to point out which examples are too confusing or out of date. We
>
> It would be nice to have a social interface for the mpl gallery like the one
> similar to the R-gallery
> [http://www.r-bloggers.com/the-r-graph-gallery-goes-social/]

Big +1. Just yesterday I wanted to add some cool "notes to self"
plots. IIRC there was a lightning talk at SciPy conference two summers
ago about starting a web site just like this. Don't know what happened
though.

Skipper
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 4:15 PM, Benjamin Root  wrote:

> Myself and other developers would greatly appreciate help from the
> community to point out which examples are too confusing or out of date. We
>

It would be nice to have a social interface for the mpl gallery like the one
similar to the R-gallery [
http://www.r-bloggers.com/the-r-graph-gallery-goes-social/]


-- 
Gökhan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Benjamin Root
On Thursday, October 13, 2011, John Salvatier 
wrote:
> Thank you John, those are looking useful.
>

I have been working to improve the docs.  One of the frustrating things
about the docs is the information overload in some places and the lack of
information elsewhere.  Further, the rigidity of the docs have not been
helpful.

The docs really present itself in 2 ways: the gallery/examples and the APIs.
 The latter is geared for the devs while the former is geared for helping
users with the question "how do I make a plot look like this?".

Myself and other developers would greatly appreciate help from the community
to point out which examples are too confusing or out of date. We would also
greatly welcome all critiques, suggestions, and comments on the docs.

Of course, what would be welcomed even more are patches!

Cheers!
Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 4:03 PM, Gökhan Sever  wrote:

>
> I think, IPython is great for interaction with the OO interface of the
> matlab.  Just starting simple with:
>
> fig=plt.figure()
> ax=plt.gca()
> and keep tabbing ax., fig. or any object you create on the canvas
> .tab to get its methods and attributes. Another approach is start with the
> pylab interface and query detailed help/code with ?? in IPython (e.g.
> plt.xlabel??)
>

Sorry s/matlab/matplotlib. I am not sure if matlab has IPython like
interface to introspect objects. Definitely IDL doesn't.


-- 
Gökhan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 3:21 PM, Zachary Pincus wrote:

> I keep meaning to use matplotlib as well, but every time I try I also get
> really turned off by the matlabish interface in the examples. I get that
> it's a selling point for matlab refugees, but I find it counterintuitive in
> the same way Christoph seems to.
>
> I'm glad to hear the OO interface isn't as clunky as it looks on some of
> the doc pages, though. This is good news. Can anyone point out any good
> tutorials/docs on using matplotlib idiomatically via its OO interface?
>
> Zach


I think, IPython is great for interaction with the OO interface of the
matlab.  Just starting simple with:

fig=plt.figure()
ax=plt.gca()
and keep tabbing ax., fig. or any object you create on the canvas
.tab to get its methods and attributes. Another approach is start with the
pylab interface and query detailed help/code with ?? in IPython (e.g.
plt.xlabel??)


-- 
Gökhan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread John Salvatier
Thank you John, those are looking useful.

On Thu, Oct 13, 2011 at 2:39 PM, John Hunter  wrote:

>
>
>
>
> On Oct 13, 2011, at 4:21 PM, Zachary Pincus 
> wrote:
>
> > I keep meaning to use matplotlib as well, but every time I try I also get
> really turned off by the matlabish interface in the examples. I get that
> it's a selling point for matlab refugees, but I find it counterintuitive in
> the same way Christoph seems to.
> >
> > I'm glad to hear the OO interface isn't as clunky as it looks on some of
> the doc pages, though. This is good news. Can anyone point out any good
> tutorials/docs on using matplotlib idiomatically via its OO interface?
> >
> >
>
> I would start with these examples
>
> http://matplotlib.sourceforge.net/examples/api/index.html
>
> These examples use pyplot only for figure generation, mostly because this
> is the easiest way to get a Figure instance correctly wired across user
> interface toolkits, but use the API for everything else.
>
> And this tutorial, which explains the central object hierarchy:
>
> http://matplotlib.sourceforge.net/users/artists.html
>
> For a deeper dive, these tutorials may be of interest too:
>
> http://matplotlib.sourceforge.net/users/transforms_tutorial.html
>
> http://matplotlib.sourceforge.net/users/path_tutorial.html
>
>
> http://matplotlib.sourceforge.net/users/event_handling.html
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread John Hunter




On Oct 13, 2011, at 4:21 PM, Zachary Pincus  wrote:

> I keep meaning to use matplotlib as well, but every time I try I also get 
> really turned off by the matlabish interface in the examples. I get that it's 
> a selling point for matlab refugees, but I find it counterintuitive in the 
> same way Christoph seems to.
> 
> I'm glad to hear the OO interface isn't as clunky as it looks on some of the 
> doc pages, though. This is good news. Can anyone point out any good 
> tutorials/docs on using matplotlib idiomatically via its OO interface?
> 
> 

I would start with these examples

http://matplotlib.sourceforge.net/examples/api/index.html

These examples use pyplot only for figure generation, mostly because this is 
the easiest way to get a Figure instance correctly wired across user interface 
toolkits, but use the API for everything else. 

And this tutorial, which explains the central object hierarchy:

http://matplotlib.sourceforge.net/users/artists.html

For a deeper dive, these tutorials may be of interest too:

http://matplotlib.sourceforge.net/users/transforms_tutorial.html

http://matplotlib.sourceforge.net/users/path_tutorial.html


http://matplotlib.sourceforge.net/users/event_handling.html


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread John Salvatier
I second that request.

On Thu, Oct 13, 2011 at 2:21 PM, Zachary Pincus wrote:

> I keep meaning to use matplotlib as well, but every time I try I also get
> really turned off by the matlabish interface in the examples. I get that
> it's a selling point for matlab refugees, but I find it counterintuitive in
> the same way Christoph seems to.
>
> I'm glad to hear the OO interface isn't as clunky as it looks on some of
> the doc pages, though. This is good news. Can anyone point out any good
> tutorials/docs on using matplotlib idiomatically via its OO interface?
>
> Zach
>
>
>
> On Oct 13, 2011, at 3:21 PM, Joe Kington wrote:
>
> > Have a look at Chaco: http://code.enthought.com/chaco/  If you're
> wanting a more pythonic api, it's a good choice.
> >
> > Personally, I still prefer matplotlib.
> >
> > You don't every need to touch the state machine interface.
> >
> > The OO interface is slighly un-pythonic, but it's hardly clunky. I think
> you're referring to one of the webpage examples of it which avoids _any_
> convenience functions.  You can still use the convenience functions without
> having to rely on the state machine in any way. E.g.:
> >
> > import matplotlib.pyplot as plt
> >
> > fig, axes = plt.subplots(ncols=4)
> >
> > for ax in axes:
> > ax.plot(range(10))
> >
> > plt.show()
> >
> > All in all, matplotlib deliberately tries to mimic matlab for a lot of
> the conventions.  This is mostly to make it easier to switch if you're
> already familiar with matlab.
> >
> > To each his own, but for better or worse, matplotlib is the most widely
> used plotting library for python.  It's worth getting a bit more familiar
> with, if nothing else just to see past some of the rough edges.
> >
> > -Joe
> >
> >
> >
> > On Thu, Oct 13, 2011 at 1:58 PM, Christoph Groth  wrote:
> > Hello,
> >
> > Is it just me who thinks that matplotlib is ugly and a pain to use?  So
> > far I haven't found a decent alternative usable from within python.  (I
> > haven't tried all the packages out there.)  I'm mostly interested in 2d
> > plots.  Who is happy enough with a numpy-compatible plotting package to
> > recommend it?
> >
> > Thanks,
> >
> > Christoph
> >
> >
> >
> >
> > A few things I can't stand about matplotlib:
> >
> >  * It works as a state machine.  (There is an OO-API, too, but it's ugly
> >   and cumbersome to use, and most examples use the state machine mode
> >   or, even worse, a mixture of OO and global state.)
> >
> >  * It uses inches by default. (I propose to switch to nails: 1 nail = 3
> >   digits = 2 1/4 inches = 1/16 yard.)
> >
> >  * subplot(211)  (ugh!)
> >
> >  * Concepts are named in a confusing way. ("ax = subplot(112)" anyone?)
> >
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Zachary Pincus
I keep meaning to use matplotlib as well, but every time I try I also get 
really turned off by the matlabish interface in the examples. I get that it's a 
selling point for matlab refugees, but I find it counterintuitive in the same 
way Christoph seems to.

I'm glad to hear the OO interface isn't as clunky as it looks on some of the 
doc pages, though. This is good news. Can anyone point out any good 
tutorials/docs on using matplotlib idiomatically via its OO interface?

Zach



On Oct 13, 2011, at 3:21 PM, Joe Kington wrote:

> Have a look at Chaco: http://code.enthought.com/chaco/  If you're wanting a 
> more pythonic api, it's a good choice.
> 
> Personally, I still prefer matplotlib.
> 
> You don't every need to touch the state machine interface. 
> 
> The OO interface is slighly un-pythonic, but it's hardly clunky. I think 
> you're referring to one of the webpage examples of it which avoids _any_ 
> convenience functions.  You can still use the convenience functions without 
> having to rely on the state machine in any way. E.g.:
> 
> import matplotlib.pyplot as plt
> 
> fig, axes = plt.subplots(ncols=4)
> 
> for ax in axes:
> ax.plot(range(10))
> 
> plt.show()
> 
> All in all, matplotlib deliberately tries to mimic matlab for a lot of the 
> conventions.  This is mostly to make it easier to switch if you're already 
> familiar with matlab.
> 
> To each his own, but for better or worse, matplotlib is the most widely used 
> plotting library for python.  It's worth getting a bit more familiar with, if 
> nothing else just to see past some of the rough edges.
> 
> -Joe
> 
> 
> 
> On Thu, Oct 13, 2011 at 1:58 PM, Christoph Groth  wrote:
> Hello,
> 
> Is it just me who thinks that matplotlib is ugly and a pain to use?  So
> far I haven't found a decent alternative usable from within python.  (I
> haven't tried all the packages out there.)  I'm mostly interested in 2d
> plots.  Who is happy enough with a numpy-compatible plotting package to
> recommend it?
> 
> Thanks,
> 
> Christoph
> 
> 
> 
> 
> A few things I can't stand about matplotlib:
> 
>  * It works as a state machine.  (There is an OO-API, too, but it's ugly
>   and cumbersome to use, and most examples use the state machine mode
>   or, even worse, a mixture of OO and global state.)
> 
>  * It uses inches by default. (I propose to switch to nails: 1 nail = 3
>   digits = 2 1/4 inches = 1/16 yard.)
> 
>  * subplot(211)  (ugh!)
> 
>  * Concepts are named in a confusing way. ("ax = subplot(112)" anyone?)
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Russell E. Owen
In article <8739ew90ry@falma.de>, Christoph Groth  
wrote:

> Hello,
> 
> Is it just me who thinks that matplotlib is ugly and a pain to use?  So
> far I haven't found a decent alternative usable from within python.  (I
> haven't tried all the packages out there.)  I'm mostly interested in 2d
> plots.  Who is happy enough with a numpy-compatible plotting package to
> recommend it?

I know folks who like HippoDraw and use it instead of matplotlib due to 
its speed. Veusz sounds promising. Both use Qt as a back end. I've not 
used either because I need Tcl/TK as a back end for much of my work.

-- Russell

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Joe Kington
Have a look at Chaco: http://code.enthought.com/chaco/  If you're wanting a
more pythonic api, it's a good choice.

Personally, I still prefer matplotlib.

You don't every need to touch the state machine interface.

The OO interface is slighly un-pythonic, but it's hardly clunky. I think
you're referring to one of the webpage examples of it which avoids _any_
convenience functions.  You can still use the convenience functions without
having to rely on the state machine in any way. E.g.:

import matplotlib.pyplot as plt

fig, axes = plt.subplots(ncols=4)

for ax in axes:
ax.plot(range(10))

plt.show()

All in all, matplotlib deliberately tries to mimic matlab for a lot of the
conventions.  This is mostly to make it easier to switch if you're already
familiar with matlab.

To each his own, but for better or worse, matplotlib is the most widely used
plotting library for python.  It's worth getting a bit more familiar with,
if nothing else just to see past some of the rough edges.

-Joe



On Thu, Oct 13, 2011 at 1:58 PM, Christoph Groth  wrote:

> Hello,
>
> Is it just me who thinks that matplotlib is ugly and a pain to use?  So
> far I haven't found a decent alternative usable from within python.  (I
> haven't tried all the packages out there.)  I'm mostly interested in 2d
> plots.  Who is happy enough with a numpy-compatible plotting package to
> recommend it?
>
> Thanks,
>
> Christoph
>
>
>
>
> A few things I can't stand about matplotlib:
>
>  * It works as a state machine.  (There is an OO-API, too, but it's ugly
>   and cumbersome to use, and most examples use the state machine mode
>   or, even worse, a mixture of OO and global state.)
>
>  * It uses inches by default. (I propose to switch to nails: 1 nail = 3
>   digits = 2 1/4 inches = 1/16 yard.)
>
>  * subplot(211)  (ugh!)
>
>  * Concepts are named in a confusing way. ("ax = subplot(112)" anyone?)
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Christoph Groth
Hello,

Is it just me who thinks that matplotlib is ugly and a pain to use?  So
far I haven't found a decent alternative usable from within python.  (I
haven't tried all the packages out there.)  I'm mostly interested in 2d
plots.  Who is happy enough with a numpy-compatible plotting package to
recommend it?

Thanks,

Christoph




A few things I can't stand about matplotlib:

 * It works as a state machine.  (There is an OO-API, too, but it's ugly
   and cumbersome to use, and most examples use the state machine mode
   or, even worse, a mixture of OO and global state.)

 * It uses inches by default. (I propose to switch to nails: 1 nail = 3
   digits = 2 1/4 inches = 1/16 yard.)

 * subplot(211)  (ugh!)

 * Concepts are named in a confusing way. ("ax = subplot(112)" anyone?)

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NumPy foundations

2011-10-13 Thread Bruce Southey
On 10/13/2011 10:53 AM, Chris.Barker wrote:
> On 10/13/11 6:03 AM, Linus Jundén wrote:
>> I am about to make a NumPy presentation for my colleges in about a
>> week. I want to tell them something about the history of the library
>> and what kind of code it relies on.
>> Is NumPy based on some external code like e.g. BLAS, LAPACK etc or is
>> it coded from scratch? Anyone out there that can settle the question?
> It was coded from scratch -- though does have hooks to BLAS and LAPACK
> for linear algebra operations. It was originally written by Jim Hugunin,
> who later went on to write Jython, and then Iron Python. It doesn't look
> like he updates his web page often, but you should find some good stuff
> here:
>
> http://hugunin.net/index.html
>
> As you seem to know, the current numpy code base evolved from the
> original "Numeric" code, also informed by the "numarray" fork.
>
> Here is some intro text from "Numerical Python: An Open Source Project",
> Sept 7, 2001:
>
> """
> Numerical Python is the outgrowth of a long collaborative design process
> carried out by the Matrix SIG of the Python Software Activity (PSA). Jim
> Hugunin, while a graduate student at MIT, wrote most of the code and
> initial documentation. When Jim joined CNRI and began working on
> JPython, he didn't have the time to maintain Numerical Python so Paul
> Dubois at LLNL agreed to become the maintainer of Numerical Python.
> David Ascher, working as a consultant to LLNL, wrote most of this
> document, incorporating contributions from Konrad Hinsen and Travis
> Oliphant, both of whom are major contributors to Numerical Python.
> """
>
> I have a paper copy still, but managed to find it on the web, too:
>
> [http://dsnra.jpl.nasa.gov/software/Python/numpydoc/index.html]
>
> That's the oldest form of the doc I could find quickly.
>
> -Chris
>
>
>
>
>
A view of the history can be found at:
http://www.scipy.org/History_of_SciPy/

I thought Paul DuBois had more on this as I only managed to find this:
http://web.archive.org/web/20010410225234/http://pfdubois.com/numpy/

Not clear if Numerical-15 could not link to external lapack libraries 
but Numeric 16 (29-Aug-2000) onwards could. You can find 
Numerical-15.3.tgz (08-May-2000) or later Numeric versions on the web 
(sourceforge only has Numeric 24 onwards):
http://ftp.heanet.ie/mirrors/sourceforge/n/project/nu/numpy/OldFiles/


Bruce




___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 1:17 PM, Chao YUE  wrote:
> Dear all,
>
> I use numpy version 1.5.1 which is installed by default when I do sudo
> apt-get install numpy on ubuntu 11.04.
> but it seems that for np.ma.concatenate(arrays, axis), the axis parameter is
> not working?
>
> In [460]: a=np.arange(10)
>
> In [461]: a=np.ma.masked_array(a,a<3)
>
> In [462]: a
> Out[462]:
> masked_array(data = [-- -- -- 3 4 5 6 7 8 9],
>  mask = [ True  True  True False False False False False False
> False],
>    fill_value = 99)
>
>
> In [463]: b=np.arange(10)
>
> In [464]: b=np.ma.masked_array(a,b>7)
>
> In [465]: b
> Out[465]:
> masked_array(data = [-- -- -- 3 4 5 6 7 -- --],
>  mask = [ True  True  True False False False False False  True
> True],
>    fill_value = 99)
>
>
> In [466]: c=np.ma.concatenate((a,b),axis=0)
>
> In [467]: c
> Out[467]:
> masked_array(data = [-- -- -- 3 4 5 6 7 8 9 -- -- -- 3 4 5 6 7 -- --],
>  mask = [ True  True  True False False False False False False
> False  True  True
>   True False False False False False  True  True],
>    fill_value = 99)
>
>
> In [468]: c.shape
> Out[468]: (20,)
>
> In [469]: c=np.ma.concatenate((a,b),axis=1)

maybe you want numpy.ma.column_stack

for concatenate you need to add extra axis first

something like
c=np.ma.concatenate((a[:,None], b[:,None]),axis=1)  (not tested)

Josef

>
> In [470]: c.shape
> Out[470]: (20,)
>
> cheers,
>
> Chao
>
> --
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

2011-10-13 Thread Chao YUE
Dear all,

I use numpy version 1.5.1 which is installed by default when I do sudo
apt-get install numpy on ubuntu 11.04.
but it seems that for np.ma.concatenate(arrays, axis), the axis parameter is
not working?

In [460]: a=np.arange(10)

In [461]: a=np.ma.masked_array(a,a<3)

In [462]: a
Out[462]:
masked_array(data = [-- -- -- 3 4 5 6 7 8 9],
 mask = [ True  True  True False False False False False False
False],
   fill_value = 99)


In [463]: b=np.arange(10)

In [464]: b=np.ma.masked_array(a,b>7)

In [465]: b
Out[465]:
masked_array(data = [-- -- -- 3 4 5 6 7 -- --],
 mask = [ True  True  True False False False False False  True
True],
   fill_value = 99)


In [466]: c=np.ma.concatenate((a,b),axis=0)

In [467]: c
Out[467]:
masked_array(data = [-- -- -- 3 4 5 6 7 8 9 -- -- -- 3 4 5 6 7 -- --],
 mask = [ True  True  True False False False False False False
False  True  True
  True False False False False False  True  True],
   fill_value = 99)


In [468]: c.shape
Out[468]: (20,)

In [469]: c=np.ma.concatenate((a,b),axis=1)

In [470]: c.shape
Out[470]: (20,)

cheers,

Chao

-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Marc Shivers
you could use bitwise comparison with paretheses:

In [8]: (a>4)&(a<8)
Out[8]:
array([False, False, False, False, False,  True,  True,  True, False,
   False, False], dtype=bool)

On Thu, Oct 13, 2011 at 12:13 PM, Chao YUE  wrote:

> Dear all,
>
> sorry for this stupid question but I cannot find it in numpy tutorial or
> google.
> suppose I have a=np.arange(11).
>
> In [32]: a < 8
> Out[32]:
> array([ True,  True,  True,  True,  True,  True,  True,  True, False,
>False, False], dtype=bool)
>
> In [34]: a > 4
> Out[34]:
> array([False, False, False, False, False,  True,  True,  True,  True,
> True,  True], dtype=bool)
>
> how can I have boolean index like 4 < a < 8
> np.where(a>4 and a<8);or plainly input "a>4 and a<8" doesn't work.
>
> thanks,
>
> Chao
>
> --
>
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> 
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
Thanks. I starts to use python do some real data processing and has bunch of
questions.

Chao

2011/10/13 Benjamin Root 

> On Thu, Oct 13, 2011 at 11:13 AM, Chao YUE  wrote:
>
>> Dear all,
>>
>> sorry for this stupid question but I cannot find it in numpy tutorial or
>> google.
>> suppose I have a=np.arange(11).
>>
>> In [32]: a < 8
>> Out[32]:
>> array([ True,  True,  True,  True,  True,  True,  True,  True, False,
>>False, False], dtype=bool)
>>
>> In [34]: a > 4
>> Out[34]:
>> array([False, False, False, False, False,  True,  True,  True,  True,
>> True,  True], dtype=bool)
>>
>> how can I have boolean index like 4 < a < 8
>> np.where(a>4 and a<8);or plainly input "a>4 and a<8" doesn't work.
>>
>> thanks,
>>
>> Chao
>>
>>
> Unfortunately, you can't use "and", "or", "not" keywords with boolean
> arrays because numpy can't overload them.  Instead, use the bitwise
> operators: '&', '|', and '~'.  Be careful, though, because of operator
> precedence is different for bitwise operators than the boolean keywords.  I
> am in the habit of always wrapping my boolean expressions in parentheses,
> just in case.
>
> (a > 4) & (a < 8)
>
> is what you want.  Note that "a > 4 & a < 8" would be evaluated in a
> different order -- "4 & a" would be first.
>
> I hope that helps!
>
> Ben Root
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Benjamin Root
On Thu, Oct 13, 2011 at 11:13 AM, Chao YUE  wrote:

> Dear all,
>
> sorry for this stupid question but I cannot find it in numpy tutorial or
> google.
> suppose I have a=np.arange(11).
>
> In [32]: a < 8
> Out[32]:
> array([ True,  True,  True,  True,  True,  True,  True,  True, False,
>False, False], dtype=bool)
>
> In [34]: a > 4
> Out[34]:
> array([False, False, False, False, False,  True,  True,  True,  True,
> True,  True], dtype=bool)
>
> how can I have boolean index like 4 < a < 8
> np.where(a>4 and a<8);or plainly input "a>4 and a<8" doesn't work.
>
> thanks,
>
> Chao
>
>
Unfortunately, you can't use "and", "or", "not" keywords with boolean arrays
because numpy can't overload them.  Instead, use the bitwise operators: '&',
'|', and '~'.  Be careful, though, because of operator precedence is
different for bitwise operators than the boolean keywords.  I am in the
habit of always wrapping my boolean expressions in parentheses, just in
case.

(a > 4) & (a < 8)

is what you want.  Note that "a > 4 & a < 8" would be evaluated in a
different order -- "4 & a" would be first.

I hope that helps!

Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 10:13 AM, Chao YUE  wrote:

> Dear all,
>
> sorry for this stupid question but I cannot find it in numpy tutorial or
> google.
> suppose I have a=np.arange(11).
>
> In [32]: a < 8
> Out[32]:
> array([ True,  True,  True,  True,  True,  True,  True,  True, False,
>False, False], dtype=bool)
>
> In [34]: a > 4
> Out[34]:
> array([False, False, False, False, False,  True,  True,  True,  True,
> True,  True], dtype=bool)
>
> how can I have boolean index like 4 < a < 8
> np.where(a>4 and a<8);or plainly input "a>4 and a<8" doesn't work.
>
> thanks,
>
> Chao
>

I1 a=np.arange(11)

I2 a[(a<8) & (a>4)]
O2 array([5, 6, 7])

-- 
Gökhan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
Dear all,

sorry for this stupid question but I cannot find it in numpy tutorial or
google.
suppose I have a=np.arange(11).

In [32]: a < 8
Out[32]:
array([ True,  True,  True,  True,  True,  True,  True,  True, False,
   False, False], dtype=bool)

In [34]: a > 4
Out[34]:
array([False, False, False, False, False,  True,  True,  True,  True,
True,  True], dtype=bool)

how can I have boolean index like 4 < a < 8
np.where(a>4 and a<8);or plainly input "a>4 and a<8" doesn't work.

thanks,

Chao

-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NumPy foundations

2011-10-13 Thread Chris.Barker
On 10/13/11 6:03 AM, Linus Jundén wrote:
> I am about to make a NumPy presentation for my colleges in about a
> week. I want to tell them something about the history of the library
> and what kind of code it relies on.

> Is NumPy based on some external code like e.g. BLAS, LAPACK etc or is
> it coded from scratch? Anyone out there that can settle the question?

It was coded from scratch -- though does have hooks to BLAS and LAPACK 
for linear algebra operations. It was originally written by Jim Hugunin, 
who later went on to write Jython, and then Iron Python. It doesn't look 
like he updates his web page often, but you should find some good stuff 
here:

http://hugunin.net/index.html

As you seem to know, the current numpy code base evolved from the 
original "Numeric" code, also informed by the "numarray" fork.

Here is some intro text from "Numerical Python: An Open Source Project", 
Sept 7, 2001:

"""
Numerical Python is the outgrowth of a long collaborative design process 
carried out by the Matrix SIG of the Python Software Activity (PSA). Jim 
Hugunin, while a graduate student at MIT, wrote most of the code and 
initial documentation. When Jim joined CNRI and began working on 
JPython, he didn't have the time to maintain Numerical Python so Paul 
Dubois at LLNL agreed to become the maintainer of Numerical Python. 
David Ascher, working as a consultant to LLNL, wrote most of this 
document, incorporating contributions from Konrad Hinsen and Travis 
Oliphant, both of whom are major contributors to Numerical Python.
"""

I have a paper copy still, but managed to find it on the web, too:

[http://dsnra.jpl.nasa.gov/software/Python/numpydoc/index.html]

That's the oldest form of the doc I could find quickly.

-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

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

chris.bar...@noaa.gov
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread Chao YUE
Yes, np.unique() is exactly what I want. thanks.

chao

2011/10/13 Benjamin Root 

>
>
> On Thursday, October 13, 2011, Chao YUE  wrote:
> > Dear all,
> >
> > if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3])
> containing some values that are flag for data quality.
> > how can list all the values in this array, like doing a descriptive
> statistics. I guess I should use Scipy statistics ?
> > Thanks for any ideas.
> >
> > Chao
> >
>
> Would np.unique() do the job?
>
> Ben Root
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread Benjamin Root
On Thursday, October 13, 2011, Chao YUE  wrote:
> Dear all,
>
> if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3])
containing some values that are flag for data quality.
> how can list all the values in this array, like doing a descriptive
statistics. I guess I should use Scipy statistics ?
> Thanks for any ideas.
>
> Chao
>

Would np.unique() do the job?

Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 9:14 AM, Chao YUE  wrote:
> Dear all,
>
> if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3]) containing
> some values that are flag for data quality.
> how can list all the values in this array, like doing a descriptive
> statistics. I guess I should use Scipy statistics ?
> Thanks for any ideas.

Not sure what you are asking for

np.unique to get unique values
selecting by mask: mask = (myarr == 3), arr[mask]
or statistics of another variable by groups/flags: np.bincount(arr,
weights=myvar)

Josef


>
> Chao
>
> --
> ***
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> 
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] NumPy foundations

2011-10-13 Thread Benjamin Root
On Thursday, October 13, 2011, Linus Jundén  wrote:
> Hello everyone!
>
> I am about to make a NumPy presentation for my colleges in about a
> week. I want to tell them something about the history of the library
> and what kind of code it relies on. While researching and preparing
> for this presentation I found it very hard to find information about
> the origins of the numeric code. I might of course dive into the
> source code itself but thought that someone else might have the same
> questions. That's what the list is for, right?
>
> Is NumPy based on some external code like e.g. BLAS, LAPACK etc or is
> it coded from scratch? Anyone out there that can settle the question?
>
> Regards
> Linus Jundén
> Umeå University, Sweden
>

Travis O. gave a good presentation about this at scipy 2010.  Is there a
recording somewhere?

Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread Chao YUE
Dear all,

if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3]) containing
some values that are flag for data quality.
how can list all the values in this array, like doing a descriptive
statistics. I guess I should use Scipy statistics ?
Thanks for any ideas.

Chao

-- 
***
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] NumPy foundations

2011-10-13 Thread Linus Jundén
Hello everyone!

I am about to make a NumPy presentation for my colleges in about a
week. I want to tell them something about the history of the library
and what kind of code it relies on. While researching and preparing
for this presentation I found it very hard to find information about
the origins of the numeric code. I might of course dive into the
source code itself but thought that someone else might have the same
questions. That's what the list is for, right?

Is NumPy based on some external code like e.g. BLAS, LAPACK etc or is
it coded from scratch? Anyone out there that can settle the question?

Regards
Linus Jundén
Umeå University, Sweden
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion