Michael McNeil Forbes | 1 Mar 2008 11:46
Picon
Picon

scipy trac ticket #600 UnivariateSpline error.

Hi,

Could someone please reclassify ticket #600: I did not classify it  
properly when I submitted it and now I can't figure out how to  
reclassify it.  It has a small patch to ensure that spline evaluation  
preserves the shape of the input array:

The following demonstrates the problem:

 >>> from scipy.interpolate import UnivariateSpline
 >>> from numpy import shape
 >>> f = UnivariateSpline([0,1,2,3],[0,1,2,3])
 >>> shape(4)
()
 >>> shape(f(4))
(1,)

Thanks,
Michael.
Michael McNeil Forbes | 1 Mar 2008 15:53
Picon
Picon

Subtle fitpack2 bug: resize (but only in doctest)

Hi,

I have been running into a very strange and hard to track down bug  
with fitpack2.py.  When I run certain tests as doctests, then I get  
the following error:

       File "/data/apps/Python-2.5.1/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/ 
interpolate/fitpack2.py", line 91, in __init__
         data = self._reset_nest(data)
       File "/data/apps/Python-2.5.1/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/site-packages/scipy/ 
interpolate/fitpack2.py", line 128, in _reset_nest
         t.resize(nest)
     ValueError: cannot resize an array that has been referenced or  
is referencing
     another array in this way.  Use the resize function

I am doing a simple 1d interpolation, but the tricky part is that  
this only occurs when I am running under the doctest module: if I  
import the file at an interpreter prompt and then run the doctests,  
there is no problem.

The problem is at line 128 in fitpack2.py which occurs in this context:

128        t,c,fpint,nrdata = data[8].copy(),data[9].copy(),\
129                           data[11].copy(),data[12].copy()
130        t.resize(nest)
131        c.resize(nest)
132        fpint.resize(nest)
(Continue reading)

Gabriel Gellner | 1 Mar 2008 20:17
Picon
Favicon

Re: ANN: Enthought Python Distribution - Beta

Oh man this is good for me. I have had real problems convincing some users to
try python because it is 'free'. Having a support version that I can let them
use that is compatible with my open source version, is a life saver. 

Does it allow for f2py to compile without setting up the compilers myself in
windows. I often use this to make callback functions, and it will help make me
convince some people.

Gabriel 

On Fri, Feb 29, 2008 at 12:49:38AM -0600, Travis E. Oliphant wrote:
> Matthew Brett wrote:
> >>  With the bundle - yes of course.  I mean, if the bundle becomes the
> >>  defacto standard for deploying python, numpy etc, and the charges
> >>  worry people, then they may be less likely to try it.  I've no idea
> >>  whether that will be a big factor - I guess it's difficult to say.
> >>     
> >
> > For example - imagine the following scenario.  Someone moderately
> > junior has just joined a company or government institution.  They
> > become keen on python, start playing with python, VTK and so on, and
> > try and persuade others in the company to try it.  If they find they
> > have to ask the accounts people for money before they install the
> > bundle, or they have to build it all from scratch, they may not, which
> > means lost users.
> >   
> 
> We try to advertise and make very clear that there is no charge at all 
> even for commercial users to just try EPD.   That same moderately junior 
> person could get EPD from the internet, install it and show all their 
(Continue reading)

Gabriel Gellner | 1 Mar 2008 21:20
Picon
Favicon

ctypes callbacks, changing signature

I am wrapping some ode solvers using ctypes. And I have run into, what I
imagine is, a common problem.

The expected C callback is of the form

void func(int n, double t, double* y, double* yprime);

which I can wrap fine using ctypes. But I would like to be able to use a
python (or f2py generated) function of the normal form

def func(t, y):
    # some callculations
    return yprime

# instead of
def func(n, t, y, prime):
    return None

My question is what do people usually do in this case? Any tips suggestions,
examples.

Thanks a bunch.

Gabriel
Robert Kern | 1 Mar 2008 21:26
Picon
Gravatar

Re: ctypes callbacks, changing signature

On Sat, Mar 1, 2008 at 2:20 PM, Gabriel Gellner <ggellner <at> uoguelph.ca> wrote:
> I am wrapping some ode solvers using ctypes. And I have run into, what I
>  imagine is, a common problem.
>
>  The expected C callback is of the form
>
>  void func(int n, double t, double* y, double* yprime);
>
>  which I can wrap fine using ctypes. But I would like to be able to use a
>  python (or f2py generated) function of the normal form
>
>  def func(t, y):
>     # some callculations
>     return yprime
>
>  # instead of
>  def func(n, t, y, prime):
>     return None
>
>  My question is what do people usually do in this case? Any tips suggestions,
>  examples.

Wrap it with a function of the required signature.

--

-- 
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."
(Continue reading)

Robert Kern | 1 Mar 2008 23:21
Picon
Gravatar

Re: ANN: Enthought Python Distribution - Beta

On Sat, Mar 1, 2008 at 1:17 PM, Gabriel Gellner <ggellner <at> uoguelph.ca> wrote:
> Oh man this is good for me. I have had real problems convincing some users to
>  try python because it is 'free'. Having a support version that I can let them
>  use that is compatible with my open source version, is a life saver.
>
>  Does it allow for f2py to compile without setting up the compilers myself in
>  windows. I often use this to make callback functions, and it will help make me
>  convince some people.

g77 is provided along with mingw.

--

-- 
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
Luis Pedro Coelho | 2 Mar 2008 21:12
Picon
Favicon

[PATCH] scipy.stats.entropy documentation should mention log base

Hello,

It took me a while to figure out that stats.entropy does it logarithms base e. 
I expected it to work base 2 (from where I'm coming from, that's the 
traditional definition of entropy, but maybe other communities have other 
expectations).

The attached patch adds a sentence to the documentation to that effect. It 
also adds an entropy2() function which works base 2.

regards,
--
Luís Pedro Coelho
PhD Student in Computational Biology, CMU
http://www.luispedro.org
Attachment (entropy.patch): text/x-diff, 1464 bytes
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Pearu Peterson | 3 Mar 2008 11:55
Picon
Picon
Favicon

Re: f2py + f90 file


dmitrey wrote:
> Pearu, could you take a look at the toms/587 routine (another one 
> constrained LLS)?
> I guess it could be connected to scipy.
> f2py yields lots of bugs when I try to build .so-file.
> (I have downloaded the one with option "include (unoptimized) BLAS 
> routines" turned on, tgz file ~48 kb with a single file inside 587 that 
> I have renamed to toms587.f).
> 
> http://netlib.org/cgi-bin/netlibfiles.pl?filename=/toms/587
> Here's full output below. (Unfortunately I'm not skilled in Fortran)

The file has some non-Fortran footer. I cleaned it up and then it 
compiles with g77. You can grab the file from

   http://cens.ioc.ee/~pearu/toms587.f

HTH,
Pearu
halish | 3 Mar 2008 17:19

Google Summer of Code 2008 and SciPy

Hello,
my name is Mateusz Haligowski and I am a student of the third (and the
last) year of Baccalaureate studies at the University of Gdańsk. I
study Econometrics and Statistics.

Last year I participated in GSoC, writing a plugin for Scribus (DTP
software). It was a great fun, but this year I'm longing to write
something connected with my studies.

I would like to ask, whether SciPy is planning to participate as a
mentoring organisation in GSoC this year? I've received a message on
python-gsoc mailing list, that you would need some econometric
functions, and that would be a perfect thing for me.

The registration process for mentoring organisations started today,
ie. Monday the 3rd of March. It will last until 12th March. The
details are available on http://code.google.com/soc/faqs.html.

I'm really encouraging SciPy to participate in GSoC.

Regards,
Mateusz Haligowski

(I try to stay at #scipy recently as halish, if you would like to talk to me)
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Russel Howe | 5 Mar 2008 06:51

Help with f2py

I am attempting to add support for lsodi from odepack to
scipy.integrate.ode.  I have almost succeeded, but to be complete I
would like to be able to recover values of ydot during integration.  The
documentation for lsodi recommends a call to intdy to return these
values.  How do I write a pyf file for this function?

  From the lsodi documentation:

c   call intdy (t, k, rwork(21), nyh, dky, iflag)
c
c the input parameters are..
c
c t         = value of independent variable where answers are desired
c             (normally the same as the t last returned by lsodi).
c             for valid results, t must lie between tcur - hu and tcur.
c             (see optional outputs for tcur and hu.)
c k         = integer order of the derivative desired.  k must satisfy
c             0 .le. k .le. nqcur, where nqcur is the current order
c             (see optional outputs).  the capability corresponding
c             to k = 0, i.e. computing y(t), is already provided
c             by lsodi directly.  since nqcur .ge. 1, the first
c             derivative dy/dt is always available with intdy.
c rwork(21) = the base address of the history array yh.
c nyh       = column length of yh, equal to the initial value of neq.

t, k, and nyh are simple but how do I pass the base address of an array?
       Further digging shows the the yh array has dimensions (neq, nqcur)
both of which are accessible at call time but unknown at compile time.
I use this information to construct an apropriate 2-d array to pass to
intdy, but I don't see how to pass the full dimensions to f2py.
(Continue reading)


Gmane