comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » python, strange result
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
python, strange result [message #91721] Fri, 14 August 2015 08:22 Go to next message
Dae-Kyu Shin is currently offline  Dae-Kyu Shin
Messages: 25
Registered: February 2015
Junior Member
Here is example code

pro test4

compile_opt idl2

x = indgen(4)
y = indgen(3)
z = indgen(4, 3)



python.run, 'from scipy import interpolate'
f = python.interpolate.interp2d(x, y, z)
print, f(x, y)


end



The output of "f" is
0.00000000 4.0000000 8.0000000 1.0000000
5.0000000 9.0000000 2.0000000 6.0000000
10.000000 3.0000000 7.0000000 11.000000

What happend?
Exact answer is "z".
Re: python, strange result [message #91750 is a reply to message #91721] Thu, 20 August 2015 10:51 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Friday, August 14, 2015 at 9:22:50 AM UTC-6, Dae-Kyu Shin wrote:
> Here is example code
>
> pro test4
>
> compile_opt idl2
>
> x = indgen(4)
> y = indgen(3)
> z = indgen(4, 3)
>
>
>
> python.run, 'from scipy import interpolate'
> f = python.interpolate.interp2d(x, y, z)
> print, f(x, y)
>
>
> end
>
>
>
> The output of "f" is
> 0.00000000 4.0000000 8.0000000 1.0000000
> 5.0000000 9.0000000 2.0000000 6.0000000
> 10.000000 3.0000000 7.0000000 11.000000
>
> What happend?
> Exact answer is "z".

You might need to take the transpose(z) before you pass it into interp2d. IDL is column major while Python is row major.

Cheers,
Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Apply a shapefile to raster images in IDL
Next Topic: plot function performance

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:27:16 PDT 2025

Total time taken to generate the page: 0.00374 seconds