trying to interpolate...

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

trying to interpolate...

apalomba
I am trying to write an interpolate function that
allows me to interpolate between two sets of numbers.
It would basically map (x1, y1) on to (x2, y2).

def interpmap(pos, x1, y1, x2, y2, base):
    pass

Where pos is some value between x1 and y1,
interpmap returns the interpolated value between
x2 and y2. I want to use SciPy.​interpolate.​interpolate.​interp2d
to do this.
http://www.scipy.org/doc/api_docs/SciPy.interpolate.interpolate.interp2d.html


My first problem is when I include the following line of code:

from scipy import interpolate

python crashes. Is there any reason why I would not
be able to import this?




Thanks,
Anthony

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

Pauli Virtanen-3
On Wed, 16 Feb 2011 16:35:58 -0600, Anthony Palomba wrote:
> http://www.scipy.org/doc/api_docs/SciPy.html

Those are obsolete docs. See current ones here: http://docs.scipy.org/

> My first problem is when I include the following line of code:
>
> from scipy import interpolate
>
> python crashes.

That should work. Where did you download your Scipy and Numpy (and which
files did you download)?

--
Pauli Virtanen

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

apalomba
Well I thinkI downloaded them scipy.org

I am running things on windows. In my C:\Python26\Lib\site-packages
folder, I see numpy-1.3.0-py2.6.egg-info and scipy-0.8.0-py2.6.egg-info.

Should I try downloading and installing the latest version?



-ap



On Wed, Feb 16, 2011 at 5:28 PM, Pauli Virtanen <[hidden email]> wrote:
On Wed, 16 Feb 2011 16:35:58 -0600, Anthony Palomba wrote:
> http://www.scipy.org/doc/api_docs/SciPy.html

Those are obsolete docs. See current ones here: http://docs.scipy.org/

> My first problem is when I include the following line of code:
>
> from scipy import interpolate
>
> python crashes.

That should work. Where did you download your Scipy and Numpy (and which
files did you download)?

--
Pauli Virtanen

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

Pauli Virtanen-3
On Wed, 16 Feb 2011 17:55:59 -0600, Anthony Palomba wrote:
> Well I thinkI downloaded them scipy.org
>
> I am running things on windows. In my C:\Python26\Lib\site-packages
> folder, I see numpy-1.3.0-py2.6.egg-info and scipy-0.8.0-py2.6.egg-info.
>
> Should I try downloading and installing the latest version?

Yes: If I remember correctly, the Scipy 0.8.0 binary requires
Numpy >= 1.4.

--
Pauli Virtanen

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

apalomba
Okay installed the latest numpy, that seems to fix things.
So back to the real problem...

I am trying to write an interpolate function that
allows me to interpolate between two sets of numbers.
It would basically map (x1, y1) on to (x2, y2).

def interpmap(pos, x1, y1, x2, y2, base):
    pass

Where pos is some value between x1 and y1,
interpmap returns the interpolated mapped value between
x2 and y2.

What should I be suing to implement this?
Interp1d? Interp2d?



Thanks,
Anthony




On Wed, Feb 16, 2011 at 6:00 PM, Pauli Virtanen <[hidden email]> wrote:
On Wed, 16 Feb 2011 17:55:59 -0600, Anthony Palomba wrote:
> Well I thinkI downloaded them scipy.org
>
> I am running things on windows. In my C:\Python26\Lib\site-packages
> folder, I see numpy-1.3.0-py2.6.egg-info and scipy-0.8.0-py2.6.egg-info.
>
> Should I try downloading and installing the latest version?

Yes: If I remember correctly, the Scipy 0.8.0 binary requires
Numpy >= 1.4.

--
Pauli Virtanen

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

Chris Barker - NOAA Federal
On 2/17/11 11:01 AM, Anthony Palomba wrote:
> def interpmap(pos, x1, y1, x2, y2, base):
>      pass
>
> Where pos is some value between x1 and y1,
> interpmap returns the interpolated mapped value between
> x2 and y2.
>
> What should I be suing to implement this?
> Interp1d? Interp2d?

I'm not sure what "base" is, but that sure looks like interp1d to me:

1d means that you have a function y = f(x), defined on some points x,
and you want to interpolate to find f(x) for other values of x.

2d is the same, but for f(x,y) ...

-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

[hidden email]
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: trying to interpolate...

eat-3
In reply to this post by apalomba
Hi,

On Thu, Feb 17, 2011 at 9:01 PM, Anthony Palomba <[hidden email]> wrote:
Okay installed the latest numpy, that seems to fix things.
So back to the real problem...


I am trying to write an interpolate function that
allows me to interpolate between two sets of numbers.
It would basically map (x1, y1) on to (x2, y2).

def interpmap(pos, x1, y1, x2, y2, base):
    pass

Where pos is some value between x1 and y1,
interpmap returns the interpolated mapped value between
x2 and y2.

What should I be suing to implement this?
Interp1d? Interp2d?
I hope this simple example will help:
In []: from scipy.interpolate import interp1d as ip
In []: x= arange(9)
In []: y= randn(9)
In []: f= ip(x, y, bounds_error= False)
In []: x= linspace(0, 9, 123)
In []: y= f(x) 

My two cents,
eat


Thanks,
Anthony





On Wed, Feb 16, 2011 at 6:00 PM, Pauli Virtanen <[hidden email]> wrote:
On Wed, 16 Feb 2011 17:55:59 -0600, Anthony Palomba wrote:
> Well I thinkI downloaded them scipy.org
>
> I am running things on windows. In my C:\Python26\Lib\site-packages
> folder, I see numpy-1.3.0-py2.6.egg-info and scipy-0.8.0-py2.6.egg-info.
>
> Should I try downloading and installing the latest version?

Yes: If I remember correctly, the Scipy 0.8.0 binary requires
Numpy >= 1.4.

--
Pauli Virtanen

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user