From 205f94d0f864abf81b98b56b5683682704ff4e1d Mon Sep 17 00:00:00 2001 From: "Per.Andreas.Brodtkorb" Date: Thu, 15 Jul 2010 09:54:41 +0000 Subject: [PATCH] Fixed a bug in findcross in c_functions.c Recompiled binaries for Windows xp 32bit --- pywafo/src/wafo/c_library.pyd | Bin 58077 -> 58077 bytes pywafo/src/wafo/data/info.py | 36 +++++++++---------- pywafo/src/wafo/misc.py | 25 +++++++------ pywafo/src/wafo/mvn.pyd | Bin 81181 -> 81181 bytes pywafo/src/wafo/mvnprdmod.pyd | Bin 129125 -> 129125 bytes pywafo/src/wafo/plotbackend.py | 6 ++-- pywafo/src/wafo/rindmod.pyd | Bin 388523 -> 388523 bytes pywafo/src/wafo/source/c_codes/c_functions.c | 4 +-- pywafo/src/wafo/source/c_codes/c_library.pyd | Bin 58077 -> 58077 bytes pywafo/src/wafo/source/mvnprd/mvnprdmod.pyd | Bin 129125 -> 129125 bytes pywafo/src/wafo/source/rind2007/rindmod.pyd | Bin 388523 -> 388523 bytes 11 files changed, 37 insertions(+), 34 deletions(-) diff --git a/pywafo/src/wafo/c_library.pyd b/pywafo/src/wafo/c_library.pyd index c0af1f9358457cb0b80b74ffa673dd1cd39d9f2b..4b0e89999fc4ed0bb561959d54c7a71897ca89b1 100644 GIT binary patch delta 1318 zcmY+DdrVVT7{JeIFQdK?p;BMsdm*o)-EE6|P(5=pWoGXO(ApiN={_!%N1Jj;v$ zbrHpI0`2xmh93#VK8qrF4&_Po@D0=3CN+oAT#_2ZI-3NMwBJn z50lX)nOP)?LW{CQ*emeC#RRMuu7-v|BHnFFM7P4i{Ss&G8FTh>sf}n&uw@{Tyjgi2 z;>qn9!H?xNr-6&OF*)Lz{`JAaU}8x;#z(7o#5P)U0P4po?%Qr6r#w7fdFwk*-(zvD zYto(}wFUON@iUY-=dq8fSKRKk3eRS;UXNW*7UCq{N{D{pKnPR_r8<8pUaDR{2k|01 z7)c1Rhphx8g)2u2A?!n8Y2R)pqa>Eu5Q!zW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zVKQUkc*X!EDX8&ln()N>r*!p zBKO971V|J=d-E^=!!Ua9P+;O#sd+w1YEG(v-KQ>zUHh0-!L7+l4=>v(H9N8pUk5BA z$dNqn`(@&)^3mt2ztq)m3H)|Gov#uG^%wORiD4XS1duG*Ov)8Xg__!%ToyLzS$%>2nBJks(lBfQH4;af zNJ!dAi6U6>qM}uCSN0c%x*lDh?vgHqYv!C>GvCAa@+16J{ullh{}=x^ z|A1fQaUoC$71jyy!WMxNUpm>cW=G(E5?S=E<7c9`G*da^mGKKP3_$z?_K4pybSk z>Q;6sbBTKqcRoX+P{1Rs{MuGT9Ivjd;t<*O`pTRvMCzX*7DOu0zAp{6Jc1maJ987C zGBtJ;z?l}CU**HQtwmr8rngmrJIK0: # Trick to avoid turning points on the crossinglevel. if iz[0] == 0: if len(iz) == n: @@ -283,14 +283,15 @@ def _findcross(xn): return zeros(0, dtype=np.int) diz = diff(iz) - ix = iz((diz > 1).argmax()) - if not any(ix): + if len(diz)>0 and (diz>1).any(): + ix = iz[(diz > 1).argmax()] + else: ix = iz[-1] #x(ix) is a up crossing if x(1:ix) = v and x(ix+1) > v. #x(ix) is a downcrossing if x(1:ix) = v and x(ix+1) < v. - xn[0:ix] = -xn[ix + 1] - iz = iz[ix::] + xn[0:ix+1] = -xn[ix + 1] + iz = iz[ix+1::] for ix in iz.tolist(): xn[ix] = xn[ix - 1] @@ -328,6 +329,8 @@ def findcross(x, v=0.0, kind=None): ------- >>> from matplotlib import pylab as plb >>> ones = plb.ones + >>> findcross([0, 1, -1, 1],0) + array([0, 1, 2]) >>> v = 0.75 >>> t = plb.linspace(0,7*plb.pi,250) >>> x = plb.sin(t) @@ -988,7 +991,7 @@ def findoutliers(x, zcrit=0.0, dcrit=None, ddcrit=None, verbose=False): indg = ones(xn.size, dtype=bool) if ind.size > 1: - ind = unique1d(ind) + ind = unique(ind) indg[ind] = 0 indg, = nonzero(indg) @@ -1862,8 +1865,8 @@ def tranproc(x, f, x0, *xi): return y #y0,y1,y2,y3,y4 - - +def test_find_cross(): + t = findcross([0, 0, 1, -1, 1],0) def test_common_shape(): @@ -1979,8 +1982,8 @@ def _test_parse_kwargs(): print out1 if __name__ == "__main__": - if False: # True:# + if True:# False: # import doctest doctest.testmod() else: - _test_discretize2() + test_find_cross() diff --git a/pywafo/src/wafo/mvn.pyd b/pywafo/src/wafo/mvn.pyd index 758b1aa73c03dc5c24222b0cd709d63437f9ed0b..2d0a0645d9e0e4493e468416d90be0b035b9e364 100644 GIT binary patch delta 32 mcmbRHi)HRFmI)oqEXQmocKb3nOEGP{t$7^8-OPSMtP}v^Aq@8b delta 32 mcmbRHi)HRFmI)oqx0B5$cKb4`hB0out$7^8-OPSMtP}w4=MAs` diff --git a/pywafo/src/wafo/mvnprdmod.pyd b/pywafo/src/wafo/mvnprdmod.pyd index e144ff7b472ed469d1c99e339b63a02c8f75a8db..dd135d44fe2e1fef75d5066a47ba5addca60e9f6 100644 GIT binary patch delta 35 pcmaF*f&J+R_6Z%#?8j^;cKb5rYc<~5dW%sj86>csJ%urD3IHKE4txLr delta 35 pcmaF*f&J+R_6Z%#_ma&gcKb33q&42!dW%sj86>csJ%urD3IHxk4>bS) diff --git a/pywafo/src/wafo/plotbackend.py b/pywafo/src/wafo/plotbackend.py index 4bd251e..9c80173 100644 --- a/pywafo/src/wafo/plotbackend.py +++ b/pywafo/src/wafo/plotbackend.py @@ -1,13 +1,13 @@ """ Modify this file if another plotbackend is wanted. """ - +import warnings if False: try: from scitools import easyviz as plotbackend print('wafo.wafodata: plotbackend is set to scitools.easyviz') except: - print('wafo: Unable to load scitools.easyviz as plotbackend') + warnings.warn('wafo: Unable to load scitools.easyviz as plotbackend') plotbackend = None else: try: @@ -15,5 +15,5 @@ else: plotbackend.interactive(True) print('wafo.wafodata: plotbackend is set to matplotlib.pyplot') except: - print('wafo: Unable to load matplotlib.pyplot as plotbackend') + warnings.warn('wafo: Unable to load matplotlib.pyplot as plotbackend') plotbackend = None \ No newline at end of file diff --git a/pywafo/src/wafo/rindmod.pyd b/pywafo/src/wafo/rindmod.pyd index f4953c78c6bb39013abeb72f754b6069b2f62cac..dfa681d02b25fe53e7d5764e13e9b25fd0cfb007 100644 GIT binary patch delta 47 zcmZ2|TYU9x@d+Kwe8+4jcKb5@v1q*2dW*637E|jj=GI#*TW_&yiGw7!vrDipxe5RR C{S+hs delta 47 zcmZ2|TYU9x@d+KwPm;|icKb5TE@`~gdW*637E|jj=GI#*TW_&yiGw7!vrDipxe5Ri CCluKL diff --git a/pywafo/src/wafo/source/c_codes/c_functions.c b/pywafo/src/wafo/source/c_codes/c_functions.c index ac37a56..febbc6b 100644 --- a/pywafo/src/wafo/source/c_codes/c_functions.c +++ b/pywafo/src/wafo/source/c_codes/c_functions.c @@ -140,13 +140,13 @@ void findcross(double *y, double v, int *ind, int n, int *info) for (i=1; i v){ - ind[ix] = i; /* first crossing is a up-crossing*/ + ind[ix] = i-1; /* first crossing is a up-crossing*/ ix++; dcross=1; /*The next crossing is a down-crossing*/ goto L120; diff --git a/pywafo/src/wafo/source/c_codes/c_library.pyd b/pywafo/src/wafo/source/c_codes/c_library.pyd index c0af1f9358457cb0b80b74ffa673dd1cd39d9f2b..4b0e89999fc4ed0bb561959d54c7a71897ca89b1 100644 GIT binary patch delta 1318 zcmY+DdrVVT7{JeIFQdK?p;BMsdm*o)-EE6|P(5=pWoGXO(ApiN={_!%N1Jj;v$ zbrHpI0`2xmh93#VK8qrF4&_Po@D0=3CN+oAT#_2ZI-3NMwBJn z50lX)nOP)?LW{CQ*emeC#RRMuu7-v|BHnFFM7P4i{Ss&G8FTh>sf}n&uw@{Tyjgi2 z;>qn9!H?xNr-6&OF*)Lz{`JAaU}8x;#z(7o#5P)U0P4po?%Qr6r#w7fdFwk*-(zvD zYto(}wFUON@iUY-=dq8fSKRKk3eRS;UXNW*7UCq{N{D{pKnPR_r8<8pUaDR{2k|01 z7)c1Rhphx8g)2u2A?!n8Y2R)pqa>Eu5Q!zW47Gp!z0j7f^Yv>d`}N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>r*!p zBKO971V|J=d-E^=!!Ua9P+;O#sd+w1YEG(v-KQ>zUHh0-!L7+l4=>v(H9N8pUk5BA z$dNqn`(@&)^3mt2ztq)m3H)|Gov#uG^%wORiD4XS1duG*Ov)8Xg__!%ToyLzS$%>2nBJks(lBfQH4;af zNJ!dAi6U6>qM}uCSN0c%x*lDh?vgHqYv!C>GvCAa@+16J{ullh{}=x^ z|A1fQaUoC$71jyy!WMxNUpm>cW=G(E5?S=E<7c9`G*da^mGKKP3_$z?_K4pybSk z>Q;6sbBTKqcRoX+P{1Rs{MuGT9Ivjd;t<*O`pTRvMCzX*7DOu0zAp{6Jc1maJ987C zGBtJ;z?l}CU**HQtwmr8rngmrJIKcsJ%urD3IHKE4txLr delta 35 pcmaF*f&J+R_6Z%#_ma&gcKb33q&42!dW%sj86>csJ%urD3IHxk4>bS) diff --git a/pywafo/src/wafo/source/rind2007/rindmod.pyd b/pywafo/src/wafo/source/rind2007/rindmod.pyd index f4953c78c6bb39013abeb72f754b6069b2f62cac..dfa681d02b25fe53e7d5764e13e9b25fd0cfb007 100644 GIT binary patch delta 47 zcmZ2|TYU9x@d+Kwe8+4jcKb5@v1q*2dW*637E|jj=GI#*TW_&yiGw7!vrDipxe5RR C{S+hs delta 47 zcmZ2|TYU9x@d+KwPm;|icKb5TE@`~gdW*637E|jj=GI#*TW_&yiGw7!vrDipxe5Ri CCluKL