Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

im2 not defined in frequency.py #4

Closed
SRimbaud opened this issue May 18, 2017 · 0 comments
Closed

im2 not defined in frequency.py #4

SRimbaud opened this issue May 18, 2017 · 0 comments

Comments

@SRimbaud
Copy link
Contributor

SRimbaud commented May 18, 2017

Working with python 3.6.1

Sometimes in the function plotRidges the var im2 is ot defined at line 374. When there is no ridges the for loop doesn't define im2 which rises bugs.

        for r in self.ridges: #sometimes self.ridges is empty.
            points = np.array([self.t[::self.spacing][r[1]], self.f[r[0]]]).T.reshape(-1, 1, 2)
            segments = np.concatenate([points[:-1], points[1:]], axis=1)

            lc = LineCollection(segments, cmap=plt.get_cmap(cmap_chi),
                                norm=plt.Normalize(-np.pi / 4, np.pi / 4))
            lc.set_array(chi[(r[0], r[1])])
            lc.set_linewidth(5)
            im2 = ax[2].add_collection(lc)

        #im2 = ax[2].imshow(chi, vmin=-np.pi/4, vmax=np.pi/4,  interpolation='none', origin='lower', aspect='auto', cmap='coolwarm', extent=[self.t.min(), self.t.max(), 0, self.f[N/2-1]])

        # adjust figure
        fig.subplots_adjust(left=0.05, top=0.8, right=0.99, wspace=0.05)

        cbarax0 = fig.add_axes([0.05, 0.83, 0.303, 0.03])
        cbar0 = fig.colorbar(im0, cax=cbarax0, orientation='horizontal', ticks=[0, np.max(self.S0)])
        cbar0.ax.set_xticklabels(['', ''])
        cbar0.ax.xaxis.set_ticks_position('top')

        cbarax1 = fig.add_axes([0.369, 0.83, 0.303, 0.03])
        cbar1 = fig.colorbar(im1, cax=cbarax1, orientation='horizontal', ticks=[-np.pi/2, 0, np.pi/2])
        cbar1.ax.set_xticklabels([r'$-\frac{\pi}{2}$', r'$0$', r'$\frac{\pi}{2}$'])
        cbar1.ax.xaxis.set_ticks_position('top')

        cbarax2 = fig.add_axes([0.686, 0.83, 0.303, 0.03])
        ###Consequently im2 is not defined here when self.ridges is empty.
        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}$'])
@SRimbaud SRimbaud changed the title im2 not defines in frequency.py im2 not defined in frequency.py May 18, 2017
@jflamant jflamant closed this as completed Jul 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants