#NEWLINE# def _update_channels_epochs( event , params ) : #NEWLINE# #INDENT# 'Function for changing the amount of channels and epochs per view.' #NEWLINE# from matplotlib.collections import LineCollection #NEWLINE# n_channels = int ( np . around ( params [ 'channel_slider' ] . val ) ) #NEWLINE# offset = ( params [ 'ax' ] . get_ylim ( ) [ 0 ] / n_channels ) #NEWLINE# params [ 'offsets' ] = ( ( np . arange ( n_channels ) * offset ) + ( offset / 2.0 ) ) #NEWLINE# while ( len ( params [ 'lines' ] ) > n_channels ) : #NEWLINE# #INDENT# params [ 'ax' ] . collections . pop ( ) #NEWLINE# params [ 'lines' ] . pop ( ) #NEWLINE# #UNINDENT# while ( len ( params [ 'lines' ] ) < n_epochs ) : #NEWLINE# #INDENT# lc = LineCollection ( list ( ) , linewidths = 0.5 , antialiased = False , zorder = 3 , picker = 3.0 ) #NEWLINE# params [ 'ax' ] . add_collection ( lc ) #NEWLINE# params [ 'lines' ] . append ( lc ) #NEWLINE# #UNINDENT# params [ 'ax' ] . set_yticks ( params [ 'offsets' ] ) #NEWLINE# params [ 'vsel_patch' ] . set_height ( n_channels ) #NEWLINE# params [ 'n_channels' ] = n_channels #NEWLINE# n_epochs = int ( np . around ( params [ 'epoch_slider' ] . val ) ) #NEWLINE# n_times = len ( params [ 'epochs' ] . times ) #NEWLINE# ticks = ( params [ 'epoch_times' ] + ( 0.5 * n_times ) ) #NEWLINE# params [ 'ax2' ] . set_xticks ( ticks [ : n_epochs ] ) #NEWLINE# params [ 'n_epochs' ] = n_epochs #NEWLINE# params [ 'duration' ] = ( n_times * n_epochs ) #NEWLINE# params [ 'hsel_patch' ] . set_width ( params [ 'duration' ] ) #NEWLINE# params [ 'data' ] = np . zeros ( ( len ( params [ 'data' ] ) , params [ 'duration' ] ) ) #NEWLINE# if ( ( params [ 't_start' ] + ( n_times * n_epochs ) ) > len ( params [ 'times' ] ) ) : #NEWLINE# #INDENT# params [ 't_start' ] = ( len ( params [ 'times' ] ) - ( n_times * n_epochs ) ) #NEWLINE# params [ 'hsel_patch' ] . set_x ( params [ 't_start' ] ) #NEWLINE# #UNINDENT# params [ 'plot_update_proj_callback' ] ( params )