#NEWLINE# @ helper . needs_qt #NEWLINE# def start( self , current , selections ) : #NEWLINE# #INDENT# current . progress . begin ( 'Creating Spectogram' ) #NEWLINE# signals = current . analog_signals ( ( self . which_signals + 1 ) ) #NEWLINE# if ( not signals ) : #NEWLINE# #INDENT# current . progress . done ( ) #NEWLINE# raise SpykeException ( 'No signals selected!' ) #NEWLINE# #UNINDENT# num_signals = len ( signals ) #NEWLINE# columns = int ( round ( sp . sqrt ( num_signals ) ) ) #NEWLINE# current . progress . set_ticks ( num_signals ) #NEWLINE# samples = self . nfft_index [ self . fft_samples ] #NEWLINE# win = PlotDialog ( toolbar = True , wintitle = ( 'Signal Spectogram (FFT window size %d)' % samples ) ) #NEWLINE# for c in xrange ( num_signals ) : #NEWLINE# #INDENT# pW = BaseImageWidget ( win , yreverse = False , lock_aspect_ratio = False ) #NEWLINE# plot = pW . plot #NEWLINE# s = signals [ c ] #NEWLINE# v = mlab . specgram ( s , NFFT = samples , noverlap = ( samples / 2 ) , Fs = s . sampling_rate . rescale ( pq . Hz ) ) #NEWLINE# interpolation = 'nearest' #NEWLINE# if self . interpolate : #NEWLINE# #INDENT# interpolation = 'linear' #NEWLINE# #UNINDENT# img = make . image ( sp . log ( v [ 0 ] ) , ydata = [ v [ 1 ] [ 0 ] , v [ 1 ] [ ( - 1 ) ] ] , xdata = [ ( v [ 2 ] [ 0 ] + s . t_start . rescale ( pq . s ) ) , ( v [ 2 ] [ ( - 1 ) ] + s . t_start . rescale ( pq . s ) ) ] , interpolation = interpolation ) #NEWLINE# plot . add_item ( img ) #NEWLINE# if ( not self . show_color_bar ) : #NEWLINE# #INDENT# plot . disable_unused_axes ( ) #NEWLINE# #UNINDENT# title = '' #NEWLINE# if ( s . recordingchannel and s . recordingchannel . name ) : #NEWLINE# #INDENT# title = s . recordingchannel . name #NEWLINE# #UNINDENT# if ( s . segment and s . segment . name ) : #NEWLINE# #INDENT# if title : #NEWLINE# #INDENT# title += ' , ' #NEWLINE# #UNINDENT# title += s . segment . name #NEWLINE# #UNINDENT# plot . set_title ( title ) #NEWLINE# plot . set_axis_title ( plot . Y_LEFT , 'Frequency' ) #NEWLINE# plot . set_axis_unit ( plot . Y_LEFT , s . sampling_rate . dimensionality . string ) #NEWLINE# plot . set_axis_title ( plot . X_BOTTOM , 'Time' ) #NEWLINE# time_unit = ( 1 / s . sampling_rate ) . simplified #NEWLINE# plot . set_axis_unit ( plot . X_BOTTOM , time_unit . dimensionality . string ) #NEWLINE# win . add_plot_widget ( pW , c , column = ( c % columns ) ) #NEWLINE# current . progress . step ( ) #NEWLINE# #UNINDENT# current . progress . done ( ) #NEWLINE# win . add_custom_image_tools ( ) #NEWLINE# win . add_x_synchronization_option ( True , range ( num_signals ) ) #NEWLINE# win . add_y_synchronization_option ( True , range ( num_signals ) ) #NEWLINE# win . show ( )