473,387 Members | 1,596 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,387 software developers and data experts.

Python : Having trouble with using the interpolate function

Expand|Select|Wrap|Line Numbers
  1.     # Imported array of data from a text file. This code works with no problems.
  2.     q1, a1 = loadtxt("values.txt", unpack = True, skiprows = 1)
  3.     print q1
  4.     print a1
  5.  
  6.     # Creating a while loop for this part of the code. This code works with no problems.
  7.     a = 3
  8.     b = -2
  9.     c = -9
  10.     q = 0.5
  11.     qt = 0.1
  12.  
  13.     while q < 1.5:
  14.         print q, a
  15.         q += qt
  16.         a = a + b*qt
  17.         b = b + c*qt
  18.  
  19.     # This interpolation does not work. I am unable to figure it out.
  20.     # TypeError: object of type 'float' has no len()
  21.  
  22.     from scipy.interpolate import interp1d
  23.     f = interp1d(q,a,'cubic')
  24.     q1 = linspace(0.5,1.4,25)
  25.     a1 = f(q1)
  26.     plot(q1,a1, '-',  q,a, 'o')
  27.     show()
  28.  
  29.  
Thanks.
Sep 20 '14 #1
0 1081

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

Similar topics

3
by: Jason | last post by:
I am having trouble using the CONTAINS function in sql server(enterprise manager). I am typing the following: Select * FROM mytable WHERE CONTAINS(myfield,'mystring') This returns the...
1
by: moondaddy | last post by:
I'm running vb.net 1.1 and I need to register a dll using regsvcs.exe and am getting the error: Command "RegSvcs.exe" is not valid. the path to the dll I want to register is: D:\nwis\Apps\CSLA...
0
by: Eric | last post by:
Hi, I've been trying in vain to get the number of copies a user wants to print after they've closed the PrintDialog form. Apparantly this value is sometimes found in the DEVMODE struct for the...
0
by: Kent P. Iler | last post by:
Hi, I have a data repeater that is returning a list of events. One of the things I want to do is give the user a way to edit or delete an event. My plan was to use an Imagebutton that would...
0
by: RML | last post by:
Hi, I have created a Windows Service which when started, retrieves a file from an FTP server (running W2K Server) via an FTP call. The service is "dependant" on the lanmanworkstation service,...
5
by: tkondal | last post by:
Hi all. I just started looking at Python's ctypes lib and I am having trouble using it for a function. For starters, here's my Python code: from ctypes import*; myStringDLL=...
9
by: devranger | last post by:
I am using the below CURL Function and can not figure out why it is not retruning the results from the post. Can anyone take a look and tell me what I may be doing wrong? I am just not seeing...
2
by: Stu | last post by:
Hi guys, I've been having trouble getting the clock function to work portably, please could I get some thoughts? <Possibly OT comments> It works fine on my laptop (under WinXP) and on my...
2
Ajm113
by: Ajm113 | last post by:
Ok, I want to disable any html tags, but the problem is when I do add in the nl2br function with a htmlentities it displays the tags for the <br>! I even keep seeing rn every time I enter a return in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.