[IPython-User] unfold a function in ipython?

Chao YUE chaoyuejoy@gmail....
Wed Apr 11 11:09:51 CDT 2012


Oh, yes, maybe, I am using  0.10.1.

chao

2012/4/11 Robert Kern <robert.kern@gmail.com>

> On 4/11/12 3:21 PM, Chao YUE wrote:
> > Thanks Robert.  Can I ask a further question, I tried, but why I have
> different
> > output with yours?
> >
> > In [65]: def day_length(L,J):
> >     ....:         #D = daylength
> >     ....:     #L = latitude (in degree, north positive and south
> negative)
> >     ....:     #J = day of the year
> >     ....:
> >     ....:     P = np.arcsin(0.39795*np.cos(0.2163108 +
> > 2*np.arctan(0.9671396*np.tan(0.00860*(J-186)))))
> >     ....:     x1=np.sin(0.8333*np.pi/180) + np.sin(L*np.pi/180)*np.sin(P)
> >     ....:     x2=np.cos(L*np.pi/180)*np.cos(P)
> >     ....:     D = 24 - (24/np.pi)*np.arccos(x1/x2)
> >     ....:     return D
> >     ....:
> >
> >
> > In [69]: import pdb
> >
> > In [70]: pdb.runcall(day_length,89.5,180)
> >  > <ipython console>(6)day_length()
> > (Pdb) n
> >  > <ipython console>(7)day_length()
> > (Pdb) n
> >  > <ipython console>(8)day_length()
> > (Pdb) n
> >  > <ipython console>(9)day_length()
> > (Pdb) n
> >  > <ipython console>(10)day_length()
> > (Pdb) n
> > --Return--
> >  > <ipython console>(10)day_length()->nan
> > (Pdb) n
> > Out[70]: nan
> >
> > I guess I missed something somewhere?
>
> You are using an older version of IPython that did not store the original
> text
> for functions that are defined at the prompt. What version of IPython are
> you using?
>
> --
> 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
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>



-- 
***********************************************************************************
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
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120411/5e0f78c2/attachment.html 


More information about the IPython-User mailing list