Skip to content

Commit

Permalink
Changing int by int division //
Browse files Browse the repository at this point in the history
  • Loading branch information
SRimbaud committed May 18, 2017
1 parent bd6b173 commit 1dac60e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bispy/timefrequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def extractRidges(self, parThresh=4, parMinD=3):

# Extract ridges
print('Extracting ridges')
self.ridges = _extractRidges(self.S0[:int(self.Nfft / 2), :], parThresh, parMinD)
self.ridges = _extractRidges(self.S0[:self.Nfft // 2, :], parThresh, parMinD)


def plotStokes(self, cmocean=False):
Expand All @@ -259,10 +259,10 @@ def plotStokes(self, cmocean=False):
N = np.size(self.t)
fig, ax = plt.subplots(ncols=3, figsize=(12, 5), sharey=True)

im0 = ax[0].imshow(self.S1n[:int(self.Nfft / 2), :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[int(self.Nfft / 2-1)]], vmin=-1, vmax=+1)
im0 = ax[0].imshow(self.S1n[:self.Nfft // 2, :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[self.Nfft // 2-1]], vmin=-1, vmax=+1)

im1 = ax[1].imshow(self.S2n[:int(self.Nfft / 2), :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[int(self.Nfft / 2-1)]], vmin=-1, vmax=+1)
im2 = ax[2].imshow(self.S3n[:int(self.Nfft / 2), :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[int(self.Nfft / 2-1)]], vmin=-1, vmax=+1)
im1 = ax[1].imshow(self.S2n[:self.Nfft // 2, :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[self.Nfft // 2-1]], vmin=-1, vmax=+1)
im2 = ax[2].imshow(self.S3n[:self.Nfft // 2, :], origin='lower', interpolation='none', aspect='auto',cmap=cmap, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[self.Nfft // 2-1]], vmin=-1, vmax=+1)

# adjust figure
fig.subplots_adjust(left=0.05, top=0.8, right=0.99, wspace=0.05)
Expand Down Expand Up @@ -340,10 +340,10 @@ def plotRidges(self, quivertdecim=10, cmocean=False):

N = np.size(self.t)
fig, ax = plt.subplots(ncols=3, figsize=(12, 5), sharey=True)
im0 = ax[0].imshow(self.S0[:int(self.Nfft / 2), :], interpolation='none', origin='lower', aspect='auto',cmap=cmap_S0, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[int(self.Nfft / 2-1)]])
im0 = ax[0].imshow(self.S0[:self.Nfft // 2, :], interpolation='none', origin='lower', aspect='auto',cmap=cmap_S0, extent=[int(self.t.min()), int(self.t.max()), 0, self.f[self.Nfft // 2-1]])


im1 = ax[1].quiver(self.t[::int(self.spacing)][::quivertdecim], self.f[:int(self.Nfft / 2)], np.real(ori[:int(self.Nfft / 2), ::quivertdecim]), (np.imag(ori[:int(self.Nfft / 2), ::quivertdecim])), theta[:int(self.Nfft / 2), ::quivertdecim], clim=[-np.pi/2, np.pi/2], cmap=cmap_theta, headaxislength=0,headlength=0.001, pivot='middle',width=0.005, scale=15)
im1 = ax[1].quiver(self.t[::int(self.spacing)][::quivertdecim], self.f[:int(self.Nfft / 2)], np.real(ori[:self.Nfft // 2, ::quivertdecim]), (np.imag(ori[:self.Nfft // 2, ::quivertdecim])), theta[:self.Nfft // 2, ::quivertdecim], clim=[-np.pi/2, np.pi/2], cmap=cmap_theta, headaxislength=0,headlength=0.001, pivot='middle',width=0.005, scale=15)

for r in self.ridges:
points = np.array([self.t[::self.spacing][r[1]], self.f[r[0]]]).T.reshape(-1, 1, 2)
Expand Down Expand Up @@ -371,7 +371,6 @@ def plotRidges(self, quivertdecim=10, cmocean=False):
cbar1.ax.xaxis.set_ticks_position('top')

cbarax2 = fig.add_axes([0.686, 0.83, 0.303, 0.03])
print("-----Bug line im2-----\n{0}".format(im2))
cbar2 = fig.colorbar(im2, cax=cbarax2, ticks=[-np.pi/4, 0, np.pi/4], orientation='horizontal')
cbar2.ax.set_xticklabels([r'$-\frac{\pi}{4}$', r'$0$', r'$\frac{\pi}{4}$'])
cbar2.ax.xaxis.set_ticks_position('top')
Expand All @@ -384,7 +383,7 @@ def plotRidges(self, quivertdecim=10, cmocean=False):
ax[0].set_ylabel('Frequency [Hz]')

ax[0].set_title('Time-Frequency energy density', y=1.14)

ax[1].set_title('Instantaneous orientation', y=1.14)
ax[2].set_title('Instantaneous ellipticity', y=1.14)

Expand Down

0 comments on commit 1dac60e

Please sign in to comment.