diff --git a/ltfatpy/comp/assert_sigreshape_pre.py b/ltfatpy/comp/assert_sigreshape_pre.py
index 2a4d98a923ffe2ba3a584109eaee203a30558ef8..afbfada48de448b7ac05a1938daf346e0831367b 100644
--- a/ltfatpy/comp/assert_sigreshape_pre.py
+++ b/ltfatpy/comp/assert_sigreshape_pre.py
@@ -89,7 +89,7 @@ def assert_sigreshape_pre(f, L=None, dim=None):
 
     # ---- Reshape f to a matrix.
     if f.size != 0:
-        f = np.reshape(f, (f.shape[0], f.size / f.shape[0]))
+        f = np.reshape(f, (f.shape[0], f.size // f.shape[0]))
 
     W = f.shape[1]
 
diff --git a/ltfatpy/fourier/isevenfunction.py b/ltfatpy/fourier/isevenfunction.py
index ffa8f94e9704b846920f8665bf7096e1b35c4e17..437f5e8148d2f3235b8e3261eb87690d15584c5f 100644
--- a/ltfatpy/fourier/isevenfunction.py
+++ b/ltfatpy/fourier/isevenfunction.py
@@ -55,15 +55,15 @@ def isevenfunction(f, tol=1e-10, centering='wp'):
     if centering == 'wp':
         # Determine middle point of sequence.
         if L % 2 == 0:
-            middle = L / 2
+            middle = L // 2
         else:
-            middle = (L+1) / 2
+            middle = (L+1) // 2
 
         # Relative norm of difference between the parts of the signal.
         d = (LA.norm(f[1:middle] - np.conj(np.flipud(f[L-middle+1:L]))) /
              LA.norm(f))
     elif centering == 'hp':
-        middle = np.floor(L/2)
+        middle = int(np.floor(L/2))
         d = (LA.norm(f[0:middle] - np.conj(np.flipud(f[L-middle:L]))) /
              LA.norm(f))
     else:
diff --git a/ltfatpy/fourier/middlepad.py b/ltfatpy/fourier/middlepad.py
index 0f89d57d39fb67e1ceb6f516cea2a86c99824ebf..b7222b3834698f3327ab0846981557038f4d6146 100644
--- a/ltfatpy/fourier/middlepad.py
+++ b/ltfatpy/fourier/middlepad.py
@@ -91,16 +91,16 @@ def middlepad(f, L, dim=None, centering='wp'):
                     if L % 2 == 0:
 
                         # L even. Use average of endpoints.
-                        h = np.concatenate((f[:L/2, :],
-                                            (f[np.newaxis, L/2, :] +
-                                             f[np.newaxis, Lorig-L/2, :]) / 2,
-                                            f[Lorig-L/2+1:Lorig, :]))
+                        h = np.concatenate((f[:L//2, :],
+                                            (f[np.newaxis, L//2, :] +
+                                             f[np.newaxis, Lorig-L//2, :]) / 2,
+                                            f[Lorig-L//2+1:Lorig, :]))
 
                     else:
 
                         # No problem, just cut.
-                        h = np.concatenate((f[:(L+1)/2, :],
-                                            f[Lorig-(L-1)/2:Lorig, :]))
+                        h = np.concatenate((f[:(L+1)//2, :],
+                                            f[Lorig-(L-1)//2:Lorig, :]))
 
                 else:
                     d = L - Lorig
@@ -108,17 +108,17 @@ def middlepad(f, L, dim=None, centering='wp'):
                     # Extend
                     if Lorig % 2 == 0:
                         # Lorig even. We must split a value.
-                        h = np.concatenate((f[:Lorig/2, :],
-                                            f[np.newaxis, Lorig/2, :]/2,
+                        h = np.concatenate((f[:Lorig//2, :],
+                                            f[np.newaxis, Lorig//2, :]/2,
                                             np.zeros((d-1, W), dtype=f.dtype),
-                                            f[np.newaxis, Lorig/2, :]/2,
-                                            f[Lorig/2+1:Lorig, :]))
+                                            f[np.newaxis, Lorig//2, :]/2,
+                                            f[Lorig//2+1:Lorig, :]))
 
                     else:
                         # Lorig is odd, we can just insert zeros.
-                        h = np.concatenate((f[:(Lorig+1)/2, :],
+                        h = np.concatenate((f[:(Lorig+1)//2, :],
                                             np.zeros((d, W), dtype=f.dtype),
-                                            f[(Lorig+1)/2:Lorig, :]))
+                                            f[(Lorig+1)//2:Lorig, :]))
 
         elif centering == 'hp':
 
@@ -140,14 +140,14 @@ def middlepad(f, L, dim=None, centering='wp'):
                     # L even
 
                     # No problem, just cut.
-                    h = np.concatenate((f[:L/2, :], f[Lorig-L/2:Lorig, :]))
+                    h = np.concatenate((f[:L//2, :], f[Lorig-L//2:Lorig, :]))
 
                 else:
                     # Average of endpoints.
-                    h = np.concatenate((f[:(L-1)/2, :],
-                                        (f[np.newaxis, (L-1)/2, :] +
-                                         f[np.newaxis, Lorig-(L+1)/2, :]) / 2,
-                                        f[Lorig-(L-1)/2:Lorig, :]))
+                    h = np.concatenate((f[:(L-1)//2, :],
+                                        (f[np.newaxis, (L-1)//2, :] +
+                                         f[np.newaxis, Lorig-(L+1)//2, :]) / 2,
+                                        f[Lorig-(L-1)//2:Lorig, :]))
 
             else:
 
@@ -157,17 +157,17 @@ def middlepad(f, L, dim=None, centering='wp'):
                 if Lorig % 2 == 0:
 
                     # Lorig even. We can just insert zeros in the middle.
-                    h = np.concatenate((f[:Lorig/2, :],
+                    h = np.concatenate((f[:Lorig//2, :],
                                         np.zeros((d, W), dtype=f.dtype),
-                                        f[Lorig/2:Lorig, :]))
+                                        f[Lorig//2:Lorig, :]))
 
                 else:
                     # Lorig odd. We need to split a value in two
-                    h = np.concatenate((f[:(Lorig-1)/2, :],
-                                        f[np.newaxis, (Lorig-1)/2, :]/2,
+                    h = np.concatenate((f[:(Lorig-1)//2, :],
+                                        f[np.newaxis, (Lorig-1)//2, :]/2,
                                         np.zeros((d-1, W), f.dtype),
-                                        f[np.newaxis, (Lorig-1)/2, :]/2,
-                                        f[(Lorig+1)/2:Lorig, :]))
+                                        f[np.newaxis, (Lorig-1)//2, :]/2,
+                                        f[(Lorig+1)//2:Lorig, :]))
 
     else:
         # we don't want this function to return a reference or a view to the
diff --git a/ltfatpy/gabor/dgt.py b/ltfatpy/gabor/dgt.py
index aa4f5379514a824ee8bf5e005203f4cadafbc1d0..2f44a71525acb8c46bfab5888e551e7969ceb829 100644
--- a/ltfatpy/gabor/dgt.py
+++ b/ltfatpy/gabor/dgt.py
@@ -184,7 +184,7 @@ def dgt(f, g, a, M, L=None, pt='freqinv'):
     c = comp_sepdgt(f, gnum, a, M, pt)
     # flags_do_timeinv = 1
     order = assert_groworder(order)
-    permutedshape = (M, L/a) + permutedshape[1:]
+    permutedshape = (M, L//a) + permutedshape[1:]
     c = assert_sigreshape_post(c, dim, permutedshape, order)
 
     if [i for i in c.shape if i > 2] and c.shape[0] == 1:
diff --git a/ltfatpy/gabor/gabframediag.py b/ltfatpy/gabor/gabframediag.py
index de1ca6a62eacc205823b4dc3154ac1e48a9cc180..97881294ad2bfc478929b3fb365271a47519b7ae 100644
--- a/ltfatpy/gabor/gabframediag.py
+++ b/ltfatpy/gabor/gabframediag.py
@@ -57,7 +57,7 @@ def gabframediag(g, a, M, L):
 
     # compute the diagonal
     glong2 = np.abs(fir2long(g, L))**2
-    N = L/a
+    N = L//a
 
     # The diagonal is a-periodic, so compute a single period by summing up
     # glong2 in slices.
diff --git a/ltfatpy/gabor/gabphasegrad.py b/ltfatpy/gabor/gabphasegrad.py
index 6b0de41120ace7fd96ee7561d935b3408d336eb0..f63e02ae52a5d8a046c34ceb771edcc14114f50c 100644
--- a/ltfatpy/gabor/gabphasegrad.py
+++ b/ltfatpy/gabor/gabphasegrad.py
@@ -305,7 +305,7 @@ def gabphasegrad(method, *args, **kwargs):
         # NOTE: in the following lines, the shape of phl is changed so that
         # broadcasting works in the following addition with cphase when cphase
         # has more than two dimensions
-        new_shape = np.ones((len(cphase.shape), ))
+        new_shape = np.ones((len(cphase.shape), ), dtype=int)
         new_shape[0] = phl.shape[0]
         new_shape[1] = phl.shape[1]
         phl = phl.reshape(tuple(new_shape))
diff --git a/ltfatpy/gabor/instfreqplot.py b/ltfatpy/gabor/instfreqplot.py
index 8e80eb7945e31a1d5381948f3337cb5b5a879d21..c44a68d773ca7ed22baaa1f172ada103eb8c23da 100644
--- a/ltfatpy/gabor/instfreqplot.py
+++ b/ltfatpy/gabor/instfreqplot.py
@@ -162,7 +162,7 @@ def instfreqplot(f, fs=None, tfr=1., wlen=None, nf=None, thr=None, fmax=None,
     if nf:
         plotdgt(coef, a, fs=fs, **kwargs)
     else:
-        coef = coef[:np.floor(M/2)+1, :]
+        coef = coef[:int(np.floor(M/2))+1, :]
         plotdgtreal(coef, a, M, fs=fs, **kwargs)
 
     return coef
diff --git a/ltfatpy/sigproc/firkaiser.py b/ltfatpy/sigproc/firkaiser.py
index 6ac0970949f31fb8000f2b74b474bf868e9dc150..3315357200702f98a6d5d05330ffa16a78c7ecb0 100644
--- a/ltfatpy/sigproc/firkaiser.py
+++ b/ltfatpy/sigproc/firkaiser.py
@@ -106,7 +106,7 @@ def firkaiser(L, beta, centering='wp', norm='null'):
             (centering == 'hp' and L % 2 == 1)):
         # Explicitly zero last element. This is done to get the right
         # symmetry, and because that element sometimes turn negative.
-        g[np.floor(L/2.)] = 0.
+        g[int(np.floor(L/2.))] = 0.
 
     """
     elif stype == 'derived':
diff --git a/ltfatpy/sigproc/groupthresh.py b/ltfatpy/sigproc/groupthresh.py
index 07500159876dd99b14684db9c5b56b6e60cc34f4..cb3866541ba9835a1399256b890192c69f2235e0 100644
--- a/ltfatpy/sigproc/groupthresh.py
+++ b/ltfatpy/sigproc/groupthresh.py
@@ -105,8 +105,8 @@ def groupthresh(xi, lamb, dim=1, group_type='group', thresh_type='soft'):
             # or an empty array. Here an equivalent test is written using a
             # more explicit formulation.
             if M_ii.size != 0:
-                tau_ii = float(lamb * np.linalg.norm(y[:M_ii+1], 1) /
-                               (1. + lamb*(M_ii+1)))
+                tau_ii = float(lamb * np.linalg.norm(y[:M_ii[0]+1], 1) /
+                               (1. + lamb*(M_ii[0]+1)))
             else:
                 tau_ii = 0.
 
diff --git a/ltfatpy/sigproc/long2fir.py b/ltfatpy/sigproc/long2fir.py
index eece29592da6f8a55e798eaf006cd418b25f6068..60cd4548811a34cb875724e9f33c631e039b6acb 100644
--- a/ltfatpy/sigproc/long2fir.py
+++ b/ltfatpy/sigproc/long2fir.py
@@ -74,11 +74,11 @@ def long2fir(g, L, centering='unsymmetric'):
     elif centering == 'wp':
         g = middlepad(g, L)
         if L % 2 == 0:
-            g[L/2] = 0
+            g[L//2] = 0
     elif centering == 'hp':
         g = middlepad(g, L, centering='hp')
         if L % 2 == 1:
-            g[np.ceil(L/2) - 1] = 0
+            g[int(np.ceil(L/2)) - 1] = 0
     else:
         raise ValueError("centering should take 'hp','wp' or 'unsymmetric'" +
                          " values.")