f

#### About a value error called 'ValueError: A value in x_new is below the interpolation range'

```Dear all,

I am trying to calculate correlation coefficients between one time series d=
ata and other time series. However,there are some missing values. So, I int=
erploated each time series with 1d interpolation in scipy and got correlati=
on coefficients between them. This code works well for some data sets, but =
doesn't for some others. Following is actual error I got:
0.0708904109589
0.0801369863014
0.0751141552511
0.0938356164384
0.0769406392694
Traceback (most recent call last):
File "error_removed.py", line 56, in <module>
i2 =3D interp(indices)
File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/in=
terpolate/interpolate.py", line 394, in __call__
out_of_bounds =3D self._check_bounds(x_new)
File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/in=
terpolate/interpolate.py", line 449, in _check_bounds
raise ValueError("A value in x_new is below the interpolation "
ValueError: A value in x_new is below the interpolation range.
--------------------------------------------------------------------
This time is 'x_new is below the interpolation range", but some times, it s=
hows=20
"above interpolation range.'

I would like to make some self-contained code, but, I am not sure how to ma=
ke it to represent my case well.
I just put all of my code here. I apologize for this inconvenience.
-----------------------------------------------------------------------
---------
a =3D []
c =3D 4
with open(filin1, 'r') as f1:
arrays =3D [map(float, line.split()) for line in f1]
newa =3D [[x[1],x[2]] for x in arrays]

o =3D newa[58]
f =3D open(filin, "r")
percent1 =3D []
for columns in ( raw.strip().split() for raw in f ):
a.append(columns[63])
x =3D np.array(a, float)

not_nan =3D np.logical_not(np.isnan(x))
indices =3D np.arange(len(x))
interp =3D interp1d(indices[not_nan], x[not_nan])
#interp =3D np.interp(indices, indices[not_nan], x[not_nan])
i1 =3D interp(indices)

f.close
h1 =3D []
p1 =3D []
while c <278:
c =3D c + 1
d =3D c - 5
b =3D []

f.seek(0,0)
for columns in ( raw.strip().split() for raw in f ):

b.append(columns[c])
y =3D np.array(b, float)
h =3D haversine.distance(o, newa[d])
n =3D len(y)
l =3D b.count('nan')
percent =3D l/8760.
percent1 =3D percent1 + [percent]
#print l, percent

if percent < 0.1:
not_nan =3D np.logical_not(np.isnan(y))
indices =3D np.arange(len(y))

interp =3D interp1d(indices[not_nan], y[not_nan])
#interp =3D np.interp(indices, indices[not_nan], x[not_nan]=
)
i2 =3D interp(indices)

pearcoef =3D sp.pearsonr(i1,i2)
p =3D pearcoef[0]
p1 =3D p1 + [p]
h1 =3D h1 + [h]
print percent

print h1
print p1
print len(p1)
plt.plot(h1, p1, 'o')
plt.xlabel('Distance(km)')
plt.ylabel('Correlation coefficient')
plt.grid(True)
plt.show()
---------------------------------------------------------------
For any help or advice, I will really appreciate.

Best regards,

Isaac
```
 0
winefrog (28)
2/6/2013 12:51:46 AM
comp.lang.python 77058 articles. 6 followers.

0 Replies
3400 Views

Similar Articles

[PageSpeed] 25

Similar Artilces:

error: expected declaration specifiers or '...' before 'Value'
Hello, i need help fix this compile error error: expected declaration specifiers or '...' before 'Value' where Value is defined in another header, say "a.h" in "a.h" ------------------------------------------- typedef struct { int type; ssize_t size; char* data; } Value; ------------------------------------------- in "b.h" ------------------------------------------- #include "a.h" int applypatch(const char* source_filename, const char* target_filename, const char* target_sha1_str, size_t target_size, int num_patches, char** const patch_sha1_str, Value** patch_data); ------------------------------------------- the compile error occurs at b.h saying error: expected declaration specifiers or '...' before 'Value' but Value is already defined by the typedef clause in a.h, so what is the problem here and how do i fix this? Regards, pete wrote: > Li Zhou wrote: >> >> Hello, i need help fix this compile error >> >> error: expected declaration specifiers or '...' before 'Value' >> >> where Value is defined in another header, say "a.h" >> >> in "a.h" >> ------------------------------------------- >> typedef struct { >> int type; >> ssize_t size; >> char* ...

Return value of 'each', 'current', 'next', 'end'
These array functions: 'each', 'current', 'next', 'end' They return a reference or a value. let's say I want to modify the last value of an array without iterating through all of them. I would do: <? end(\$array) ; current(\$array)="new value" ; ?> is that posible?? Thanks. Hermann.Richter@gmail.com wrote: > These array functions: 'each', 'current', 'next', 'end' > > They return a reference or a value. They return values. > let's say I want to modify the last value of an array without it...

Function '+' is not defined for values of class 'uint8'.. please rectify the error
hi, F=fft(polarMap); a1=abs(F); l1=length(sig); sig1=10*sig; for i=1:wx for j=1:wy if(j<11&&i==1&&((a1(i,j)+sig1(i,j))<256)&&(a1(i,j)+sig1(i,j))>256) a2=a1+sig1(i,j); else a2=a1; end end end F1=ifft(a2); wm=uint8(F1); wm2=wm+original; figure(4),imshow(wm2);title('watermarked image'); _____________________________________________________________________ error message is: ??? Error using ==> + Function '+' is not defined for values of class 'uint8'...

TIP #194: Procedures as Values via '''apply'''
TIP #194: PROCEDURES AS VALUES VIA '''APPLY''' ================================================ Version: \$Revision: 1.1 \$ Author: Miguel Sofer <msofer_at_users.sf.net> State: Draft Type: Project Tcl-Version: 8.5 Vote: Pending Created: Friday, 30 April 2004 URL: http://purl.org/tcl/tip/194.html WebEdit: http://purl.org/tcl/tip/edit/194 Post-History: ------------------------------------------------------------------------- ABSTRACT ========== This TIP proposes a new command, tentatively named ...

`'exp' is not defined for values of class 'zpk'.'
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, To draw the Bode diagram of a nonrational transfer function, I'm using zpk. Here, I need to multiply be exp(-0.18s), and I thus do sa = zpk('s'); HD = exp(-0.18*sa)*H bode(HD) where H is the result of tf applied on a serie of coefficients (H is the rational transfer function that is multiplied by the exponential factor). However, I'm getting == `'exp' is not defined for values of class 'zpk'.' == Is it normal? I'm using MATLAB 7.0.0.19901 (R14, May 06, 2004). This might have been implemented in next ...

TO_CHAR(date-value, 'HH24') returns error: type, length or value of arg is incorrect (42815)
I'm trying to convert some schema creation scripts that were used on MS SQL Server to DB2 (v8.2) and have a problem with the following select statement (snippet) used for a view: SELECT col1, col2, timestamp-col1, TO_CHAR(timestamp-col1, 'HH24') FROM ... When creating the view that uses this statement, I get the following error: > SQL0171N The data type, length or value of argument "2" of routine > "SYSIBM.TO_CHAR" is incorrect. SQLSTATE=42815 I tried using 'HH24:MI:SS', but this didn't...

Why does 'uint64_t i = -UINT64_MAX' have value '1'?
What is the value of -(max-val-of-an-unsigned-type)? According to my compiler, -UINT32_MAX = 1, and -UINT64_MAX is also 1 (test code below). From the C99 LRM, p79: "The result of the unary - operator is the negative of its (promoted) operand. The integer promotions are performed on the operand, and the result has the promoted type." As far as I can make out from p43, uint32_t and uint64_t are unchanged by the integer promotions. So how do you take the negative of an unsigned operand, and how can the compiler get the result '1' without using a temporary of a higher precisio...

'ArgumentError: bad value for range' for range of Times
Hi, When using the calendar_date_select plugin, Rails kept throwing an ArgumentError: 'bad value for range', but only on Windows (fine on OSX). Playing around in the console I get... >> 38.years.ago..10.years.ago => Tue Jun 23 19:12:11 +1000 1970..Tue Jun 23 19:12:11 +1000 1998 >> 39.years.ago..10.years.ago ArgumentError: bad value for range Any ideas? Thanks -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Just guessing: 39 years ago is before 1970, I believe there is some sort of problem in Windows with dates prior to 1970. David Bird wrote: | Hi, | | When using ...

Parse error: parse error, expecting `','' or `';''
I'm getting the following error Parse error: parse error, expecting `','' or `';'' in /home/notarywe/public_html/php/update2.php on line 108 Here is line 108 <input type="text" name="ud_first" value="<? echo "\$first" size="20"?>"></td> Any help would be appreciated. On 3-Aug-2003, "entoone" <entoone@pacbell.net> wrote: > I'm getting the following error Parse error: parse error, expecting `','' > or > `';'' in /home/notarywe/public_h...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ##...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ########################################################################### #define MODULE #define __KERNEL__ #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> /* printk */ #include <linux/fs.h> / #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> /* proc file system */ #include <linux/fcntl.h> #include <asm/system.h> /* cli, flags */ #include <asm/uaccess.h> /* copy from/to user */ /*Registers to get qadc access*/ volatile unsigned short * qadcmcr = (unsigned short *)0x40190000; volatile unsigned short * qacr0 = (unsigned short *)0x4019000a; volatile unsigned short * qacr1 = (unsigned short *)0x4019000c; volatile unsigned short * qacr2 = (unsigned short *)0x4019000e; volatile unsigned short * qasr0 = (unsigned short *)0x40190010; volatile unsigned short * qasr1...

Basic array stuff... Why [0] & ['key'] and [1] & ['value'] 'duplication'?
I've been studying this for hours, searching the www & usenet, and still can't figure out why 'each' returns an array of four key/value pairs, when it looks like just two pairs would suffice... That is, it looks to me like [0] & ['key'] are the same, and also [1] & ['value'], so what's the point of duplicating them? I'm assuming that in fact there are serious differences between [0] and ['key'] and between [1] and [value], but I haven't a clue what that might be. Any hints, URLs, explanaitons, etc. most welcome! Thank you. ...

assigned values in 'ByRef' call
In the following PHP code, the final printed line shows 'frob: something'. Why is it not 'frob: else'? After all, if I replace the first line with \$frob = "something"; test (\$frob); then the final printed line does show 'frob: else' Csaba Gabor from Vienna PHP 5.2.4 on WinXP Pro test (\$frob = "something"); print "frob: \$frob <br>\n"; function test(&\$val) { print "val pre: \$val <br>\n"; \$val = "else"; print "val post: \$val <br>\n"; } On Nov 6, 8:27 pm, Csaba Gabor <dans...@g...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

'UndefinedObject' error not caught with 'on: Error do:'
Hi, I'm having some trouble getting 'on: Error do:' to work. In the code below, subdExpression contains a maths-type formula that the user has entered, with their variables substituted for the correct values. eg If they enter 'a + 1', a gets replaced with their value for it. But if a does not exist, I want to tell them the error. [result := Compiler evaluate: subdExpression] on: Error do: [:ex | Transcript show: 'error'; cr. ^MessageBox errorMsg: 'There was an error in calculating the answer' caption: 'Calculation Error' ] . But at the moment, with or without the error handling code, the Transcript prints out Error: UndefinedObject>>doIt at line 1: undeclared 'a' and nothing else, the program just continues. Does anyone know what I'm doing wrong? Thanks, Sarah Sarah, > I'm having some trouble getting 'on: Error do:' to work. In the code > below, subdExpression contains a maths-type formula that the user has > entered, with their variables substituted for the correct values. eg > If they enter 'a + 1', a gets replaced with their value for it. But > if a does not exist, I want to tell them the error. > > [result := Compiler evaluate: subdExpression] on: Error do: [:ex | > Transcript show: 'error'; cr. > ^MessageBox errorMsg: 'There was an error in calculating the answer' > caption: 'Calcula...

Throw 'Error()' or 'new Error()'?
With custom exceptions, we have to create a new instance before we throw them: function AppError(msg) { this.msg = msg; // just an example } throw new AppError("I did bad"); To throw a StopIteration, on the other hand, we have to throw it directly: throw StopIteration; // object StopIteration throw new StopIteration(); // TypeError With Error, both are possible: throw Error("oops"); // object Error throw new Error("oops"); // object Error I've seen both forms a number of times now. AppError and Error are functions (St...

Function 'eq' is not defined for values of class 'cell'
Hello, I'm trying to build a matrix 'Counts' which represents the counts of the unique combinations of two arrays, sys1 and sys2: sys1=['a';'t';'c';'g';'a']; sys2=['g';'g';'c';'c';'g']; I want to count those who are 'a' in sys1 and 'g' in sys2 etc... the matrix should be: c g (unique in sys2) a 0 2 c 1 0 g 1 0 t 0 1 To do that I use this code: A=unique(sys1); B=unique(sys2); a=length(A); b=length(B); Counts=[]; for i=1:a for j=1:b Counts(i,j)=length(find((sys1==A(i)) &...

Function 'eq' is not defined for values of class 'cell'.
i have a cell array C , and C{1,1} consists of 20000 strings,i.e. 'T', 'A' , capital letters of english alphabet. when i write the control : if C{1,1}(1) == 'T' y=1 end it gives the error "Function 'eq' is not defined for values of class 'cell' " . i have to check these strings but how...thnx in advance.. kadir wrote: > i have a cell array C , and C{1,1} consists of 20000 strings,i.e. > 'T', 'A' , capital letters of english alphabet. when i write the > control : > if C{1,1}(1) == 'T' > y=1 > end > > it gives the error "Function 'eq' is not defined for values of class > 'cell' " . i have to check these strings but how...thnx in advance.. What exactly is the type of C{1,1}(1)? Obviously it is not a character otherwise your comparison would work (most likely it is cell array). For the comparison you have to extract a character. -Herbert On 2006-11-29 15:29 kadir said the following: > i have a cell array C , and C{1,1} consists of 20000 strings,i.e. > 'T', 'A' , capital letters of english alphabet. when i write the > control : > if C{1,1}(1) == 'T' > y=1 > end > > it gives the error "Function 'eq' is not defined for values of class > 'cell' " . i have to check these strings but how...thnx in advance.. Use strcmp or strcmpi to compare strings /PB -- "Never att...

"Function '+' is not defined for values of class 'uint8'
Hi,please help! Thank you very much! I'm using Matlab V6.5.0180913a R13. I encountered a strange problem to deal with a image. a1 = 0; A = imread('abc','bmp'); //A now becomes a matrix of 480x640x3 a1 = A(1,1,1) + A(1,1,2) + A(1,1,3); but an error message in the following was reported: " Error using ==> + Function '+' is not defined for values of class 'uint8' " I then tried: a1 = int16(1); b1 = int16(1); c1 = int16(1); c1 = a1 + b1; Well, still an error message was shown: " Error using ==> + Function '+' is not defined f...

which is more 'pythonic' / 'better' ?
hi, there are 2 versions of a simple code. which is preferred? === if len(line) >= (n+1): text = line[n] else: text = 'nothing' === === try: text = line[n] except IndexError: text = 'nothing' === which is the one you would use? thanks, gabor gabor wrote: > hi, > > there are 2 versions of a simple code. > which is preferred? > > > === > if len(line) >= (n+1): > text = line[n] > else: > text = 'nothing' > === > > > === > try: > text = line[n] > except IndexError: > text = '...

How is there an 'error' with 'no message'
I have a form with many fields, each of which has their separate record sources in a split db. Today, several users throughout the afternoon encountered the following message when accessing various dropdowns on the form: "Error (-1517). There is no message for this error." Three questions: 1. Has anyone encountered this error before? 2. If so, how was it overcome? 3. How can MS produce an error message that states : "There is no message for this error"? It would seem to me that if MS has assigned a number to an error, they must know that it can happen. If they k...

createElement('input').onchange assigned function passing 'this' values
hello, when i create elements and want to assign events to them, i have realised that if the function assigned to that element has no parameters, then the parent node values can be attained. e.g. aTextBox=document.createElement('input'); aTextBox.onchange=calculateOneRow2; will enable the function "calculateOneRow2" to draw on the "this.parentNode;" object. if however i pass a variable, for example: aTextBox.onchange=function(){calculateOneRow2(5);}; then anything attached to "this." doesn't exist. i'm sure this is fundamental javascript p...

What's the additional value of 'EnumMap' ?
What's the additional value of 'EnumMap' ? I'm asking this, because it seems to me that the same result can be accomplished by using a plain 'HashMap' (?). See these two examples : ****** Example 01 (with 'EnumMap') : public enum TrafficLightColor { red, orange, green }; public void getInstruction() { EnumMap<TrafficLightColor, String> instructions = new EnumMap<TrafficLightColor, String>(TrafficLightColor.class); instructions.put(TrafficLightColor.red, "Stop"); instructions.put(TrafficLightColo...

Error parsing value for property 'top'
I have a function which finds the x and y coordinate of any object in the document by referring to offsetLeft or offsetTop value of the object's offsetParent, all the way to the top of the DOM, i.e.: function get_y(obj) { var coord = 0; while (obj.offsetParent) { coord += obj.offsetTop; obj = obj.offsetParent; } return coord; } function get_x(obj) { /* same as above function, but with offsetLeft in place of offsetTop */ } Now, I've tested this function out many, many times on documents built using table models, and it works perfectly. However, I tried to ...

Web resources about - About a value error called 'ValueError: A value in x_new is below the interpolation range' - comp.lang.python

Resources last updated: 3/10/2016 4:58:12 PM