[med-svn] [python-multipletau] 03/04: d/patches/numpy_1.11.0.patch: fix compatibility problem with NumPy_1.11.0 modified: debian/patches/series
Alex Mestiashvili
malex-guest at moszumanska.debian.org
Wed Feb 10 14:51:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
malex-guest pushed a commit to branch master
in repository python-multipletau.
commit af6a96c968e7ce969b1f2a958a19fc5b12362739
Author: Alexandre Mestiashvili <alex at biotec.tu-dresden.de>
Date: Wed Feb 10 14:31:23 2016 +0100
d/patches/numpy_1.11.0.patch: fix compatibility problem with NumPy_1.11.0
modified: debian/patches/series
---
debian/patches/numpy_1.11.0.patch | 142 ++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 143 insertions(+)
diff --git a/debian/patches/numpy_1.11.0.patch b/debian/patches/numpy_1.11.0.patch
new file mode 100644
index 0000000..04c7e81
--- /dev/null
+++ b/debian/patches/numpy_1.11.0.patch
@@ -0,0 +1,142 @@
+Description: fixes #813983, starting from Numpy 1.11.0
+ "Indexing with floats raises IndexError, e.g., a[0, 0.0]."
+Author: upstream
+--- python-multipletau.orig/multipletau/_multipletau.py
++++ python-multipletau/multipletau/_multipletau.py
+@@ -136,11 +136,11 @@
+ # Check parameters
+ if np.around(m / 2) != m / 2:
+ mold = 1 * m
+- m = int((np.around(m / 2) + 1) * 2)
++ m = np.int((np.around(m / 2) + 1) * 2)
+ warnings.warn("Invalid value of m={}. Using m={} instead"
+ .format(mold, m))
+ else:
+- m = int(m)
++ m = np.int(m)
+
+ N = N0 = len(trace)
+
+@@ -148,12 +148,12 @@
+ # The integer k defines how many times we can average over
+ # two neighboring array elements in order to obtain an array of
+ # length just larger than m.
+- k = int(np.floor(np.log2(N / m)))
++ k = np.int(np.floor(np.log2(N / m)))
+
+ # In the base2 multiple-tau scheme, the length of the correlation
+ # array is (only taking into account values that are computed from
+ # traces that are just larger than m):
+- lenG = np.int(np.floor(m + k * m / 2))
++ lenG = np.int(np.floor(m + k * m // 2))
+
+ G = np.zeros((lenG, 2), dtype=dtype)
+
+@@ -182,12 +182,13 @@
+ # Add up every second element
+ trace = (trace[:N:2] + trace[1:N + 1:2]) / 2
+ N /= 2
++ N = np.int(N)
+ # Start iteration for each m/2 values
+ for step in range(1, k + 1):
+ # Get the next m/2 values via correlation of the trace
+- for n in range(1, int(m / 2) + 1):
+- idx = int(m + n - 1 + (step - 1) * m / 2)
+- if len(trace[:N - (n + m / 2)]) == 0:
++ for n in range(1, np.int(m // 2) + 1):
++ idx = np.int(m + n - 1 + (step - 1) * m // 2)
++ if len(trace[:N - (n + m // 2)]) == 0:
+ # This is a shortcut that stops the iteration once the
+ # length of the trace is too small to compute a corre-
+ # lation. The actual length of the correlation function
+@@ -211,11 +212,11 @@
+ # k in advance.
+ break
+ else:
+- G[idx, 0] = deltat * (n + m / 2) * 2**step
++ G[idx, 0] = deltat * (n + m // 2) * 2**step
+ # This is the computationally intensive step
+- G[idx, 1] = np.sum(trace[:N - (n + m / 2)] *
+- trace[(n + m / 2):], dtype=dtype)
+- normstat[idx] = N - (n + m / 2)
++ G[idx, 1] = np.sum(trace[:N - (n + m // 2)] *
++ trace[(n + m // 2):], dtype=dtype)
++ normstat[idx] = N - (n + m // 2)
+ normnump[idx] = N
+ # Check if len(trace) is even:
+ if N % 2 == 1:
+@@ -223,6 +224,7 @@
+ # Add up every second element
+ trace = (trace[:N:2] + trace[1:N + 1:2]) / 2
+ N /= 2
++ N = np.int(N)
+
+ if normalize:
+ G[:, 1] /= traceavg**2 * normstat
+@@ -334,11 +336,11 @@
+ # Check parameters
+ if np.around(m / 2) != m / 2:
+ mold = 1 * m
+- m = int((np.around(m / 2) + 1) * 2)
++ m = np.int((np.around(m / 2) + 1) * 2)
+ warnings.warn("Invalid value of m={}. Using m={} instead"
+ .format(mold, m))
+ else:
+- m = int(m)
++ m = np.int(m)
+
+ if len(a) != len(v):
+ raise ValueError("Input arrays must be of equal length.")
+@@ -348,12 +350,12 @@
+ # The integer k defines how many times we can average over
+ # two neighboring array elements in order to obtain an array of
+ # length just larger than m.
+- k = int(np.floor(np.log2(N / m)))
++ k = np.int(np.floor(np.log2(N / m)))
+
+ # In the base2 multiple-tau scheme, the length of the correlation
+ # array is (only taking into account values that are computed from
+ # traces that are just larger than m):
+- lenG = np.int(np.floor(m + k * m / 2))
++ lenG = np.int(np.floor(m + k * m // 2))
+
+ G = np.zeros((lenG, 2), dtype=dtype)
+ normstat = np.zeros(lenG, dtype=dtype)
+@@ -379,22 +381,23 @@
+ trace1 = (trace1[:N:2] + trace1[1:N + 1:2]) / 2
+ trace2 = (trace2[:N:2] + trace2[1:N + 1:2]) / 2
+ N /= 2
++ N = np.int(N)
+
+ for step in range(1, k + 1):
+ # Get the next m/2 values of the trace
+- for n in range(1, int(m / 2) + 1):
+- idx = int(m + n - 1 + (step - 1) * m / 2)
+- if len(trace1[:N - (n + m / 2)]) == 0:
++ for n in range(1, np.int(m // 2) + 1):
++ idx = np.int(m + n - 1 + (step - 1) * m // 2)
++ if len(trace1[:N - (n + m // 2)]) == 0:
+ # Abort
+ G = G[:idx - 1]
+ normstat = normstat[:idx - 1]
+ normnump = normnump[:idx - 1]
+ break
+ else:
+- G[idx, 0] = deltat * (n + m / 2) * 2**step
++ G[idx, 0] = deltat * (n + m // 2) * 2**step
+ G[idx, 1] = np.sum(
+- trace1[:N - (n + m / 2)] * trace2[(n + m / 2):])
+- normstat[idx] = N - (n + m / 2)
++ trace1[:N - (n + m // 2)] * trace2[(n + m // 2):])
++ normstat[idx] = N - (n + m // 2)
+ normnump[idx] = N
+
+ # Check if len(trace) is even:
+@@ -404,6 +407,7 @@
+ trace1 = (trace1[:N:2] + trace1[1:N + 1:2]) / 2
+ trace2 = (trace2[:N:2] + trace2[1:N + 1:2]) / 2
+ N /= 2
++ N = np.int(N)
+
+ if normalize:
+ G[:, 1] /= traceavg1 * traceavg2 * normstat
diff --git a/debian/patches/series b/debian/patches/series
index b7a0934..d485948 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+numpy_1.11.0.patch
packaged-mathjax.path
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-multipletau.git
More information about the debian-med-commit
mailing list