Re: [Numpy-discussion] Equivalent to IDL's help function

2013-10-18 Thread Chris Barker
On Mon, Oct 7, 2013 at 10:15 AM, Siegfried Gonzi
 wrote:
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A   FLOAT = Array[23, 23]

am I missing something, or is this what you get when you type a name
on the command line:

In [15]: a = np.ones((2,3), dtype=np.float32)

In [16]: a
Out[16]:
array([[ 1.,  1.,  1.],
   [ 1.,  1.,  1.]], dtype=float32)

or print a

etc...


-- 

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] Equivalent to IDL's help function

2013-10-07 Thread Aronne Merrelli
There isn't anything quite the same. (I think what you are really asking
for is a way to print the essential info about one variable name, at least
that is how I would use the IDL "help" procedure). In IPython, I use the
whos magic to do something similar, although it just prints this info for
all variables or all variables of one class, rather than just one variable.
I do not think there is a way to do it for just one variable.

Here are some examples - you can see this works quite well but it will
become unwieldy if your interactive namespace becomes large:

In [1]: x = 1; y = 2; z = 3.3; d = {'one':1, 'two':2, 'three':3}

In [2]: whos
Variable   Type Data/Info
-
d  dict n=3
x  int  1
y  int  2
z  float3.3

In [3]: whos dict
Variable   TypeData/Info

d  dictn=3

In [4]: xa = np.arange(111); ya = np.ones((22,4))

In [5]: whos ndarray
Variable   Type   Data/Info
---
xa ndarray111: 111 elems, type `int64`, 888 bytes
ya ndarray22x4: 88 elems, type `float64`, 704 bytes




On Mon, Oct 7, 2013 at 12:15 PM, Siegfried Gonzi
wrote:

> Hi all
>
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A   FLOAT = Array[23, 23]
>
> or
>
> IDL> a = create_struct('idl',23)
>
> IDL> help,a
>
> gives:
>
> A   STRUCT= ->  Array[1]
>
> ==
>
> I have been looking for it ever since using numpy. It would make my life
> so much easier.
>
>
> Thanks, Siegfried
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> ___
> 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] Equivalent to IDL's help function

2013-10-07 Thread Nathaniel Smith
The other answers tell you how to access Python's excellent quick reference
documentation, but from your examples I'm not sure if that's what you're
looking for? If you just want to know what value some variable has at the
interactive prompt, just type its name and hit enter. (This is a general
feature of the prompt: it shows you the value returned by whatever you
type, whether that be a single variable or a complex expression.)

Some other useful commands: dir(x), type(x)

-n
On 7 Oct 2013 18:17, "Siegfried Gonzi"  wrote:

> Hi all
>
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A   FLOAT = Array[23, 23]
>
> or
>
> IDL> a = create_struct('idl',23)
>
> IDL> help,a
>
> gives:
>
> A   STRUCT= ->  Array[1]
>
> ==
>
> I have been looking for it ever since using numpy. It would make my life
> so much easier.
>
>
> Thanks, Siegfried
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> ___
> 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] Equivalent to IDL's help function

2013-10-07 Thread Benjamin Root
On Mon, Oct 7, 2013 at 1:15 PM, Siegfried Gonzi
wrote:

> Hi all
>
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A   FLOAT = Array[23, 23]
>
> or
>
> IDL> a = create_struct('idl',23)
>
> IDL> help,a
>
> gives:
>
> A   STRUCT= ->  Array[1]
>
> ==
>
> I have been looking for it ever since using numpy. It would make my life
> so much easier.
>
>
> Thanks, Siegfried
>
>
help(a)

Note that this is an inherent feature of python, not just numpy. So, you
can do help(range) or help(np.zeros) or any such thing.

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


Re: [Numpy-discussion] Equivalent to IDL's help function

2013-10-07 Thread Aron Ahmadia
If you're using IPython (strongly recommended)

a?
a??

If you're just using Python

help(a)

A


On Mon, Oct 7, 2013 at 1:15 PM, Siegfried Gonzi
 wrote:
> Hi all
>
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A   FLOAT = Array[23, 23]
>
> or
>
> IDL> a = create_struct('idl',23)
>
> IDL> help,a
>
> gives:
>
> A   STRUCT= ->  Array[1]
>
> ==
>
> I have been looking for it ever since using numpy. It would make my life so 
> much easier.
>
>
> Thanks, Siegfried
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> ___
> 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] Equivalent to IDL's help function

2013-10-07 Thread Siegfried Gonzi
Hi all

What is the equivalent to IDL its help function, e.g.

==
IDL> a = make_array(23,23,)

IDL> help,a 

will result in:

A   FLOAT = Array[23, 23]

or

IDL> a = create_struct('idl',23)

IDL> help,a

gives:

A   STRUCT= ->  Array[1]

==

I have been looking for it ever since using numpy. It would make my life so 
much easier.


Thanks, Siegfried


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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