473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

help to use nearest neighbour interpolation of Scipy

1
Hi all,
I am very new to Python. I want to use the functionality within NumPy and SciPy to do a nearest neighbour interpolation for multi-variable data I have.
1. I have a text file (points.dat) in each line I have a sample for (x1, x2, x3,..., x14). The number of line is 1600. So I have 1600 sample with 14 variables.
2. I have a text file(value.dat) in each line I have only one value corresponding to the sample in that line.
3. I want to use Nearest neighbor Interpolation of Scipy to make interpolation for a new sample . This sample however is saved in another text file (TestSample.txt) but it is column-wise. it means that in line 1 I have only x1, in line 2 I have only x2,... to x14.

Can you please help to write some lines of codes to use NumpY loadtxt and Scipy interpolate.NearestNDinterpolator to import the data, and build the interpolant, and make use of scipy.spatial.cKDTree to test with a new sample for obtaining the value of interpolation?

I have written some codes but I have problem with data dimensions and etc.
Thank you.
Sep 3 '13 #1
0 1389

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: John Hunter | last post by:
I have a list of two tuples containing x and y coord (x0, y0) (x1, y1) ... (xn, yn) Given a new point x,y, I would like to find the point in the list closest to x,y. I have to do this a...
2
by: Alex | last post by:
Hi, I need to perform cubic spline interpolation of a dataset. I am using scipy. When I pass two arrays (x,y) to the interpolate.splrep(x,y) function I get the following traceback Traceback...
5
by: querypk | last post by:
Did anyone try to install Scipy package on python2.4 linux version. I see only python2.3 version of scipy released. When I try to install I get an dependency warning saying scipy cannot find...
4
by: Travis Stewart | last post by:
Hi, I am not very familiar with C++ so the problems I am having might be simple and I just cannot see them or I am totally unaware of why something would be incorrect. Anyway, I'm using the ANN...
14
by: Charles Banas | last post by:
I'm not sure if this is the right place to ask about this, but I've seen several posts in the past regarding Akima's Bivariate Interpolations routines, and i'm wondering if someone can give me some...
1
by: maryjones11289 | last post by:
Hi All, I'm trying to write/find code that creates a Ternary Search Tree in Visual Basic (VB6 or .NET). Here's my situation: What I have is an array consisting of 60,000 string elements. All...
8
by: Jerry | last post by:
I am a MySQL and PHP newbie. I am having trouble getting the $w variable in my code below passed to mysql. When I use the value of $w directly in the Where clause, the correct rows are returned....
5
by: swtstrawberry | last post by:
All the basic stuff I get like cin/cout...but the interpolation formula, the for/while loop, and reading in the desired altitude...i dont get it....please help...anybody here are the directions I...
3
by: Michele Simionato | last post by:
I want to interpolate a data distribution with a function depending on various parameters; the function can be a Gaussian, a Breit-Wigner, a custom function. Where should I look? I am getting lost...
3
oll3i
by: oll3i | last post by:
When i have DNA test data like the data below just few first rows pasted here first number is the number of rows and second number is the number of columns 21st column is a decision 1186 21 1 2...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.