def _channels_changed(params, len_channels):
 if ((params['ch_start'] + params['n_channels']) > len_channels):
  params['ch_start'] = (len_channels - params['n_channels'])
 if (params['ch_start'] < 0):
  params['ch_start'] = 0
 params['plot_fun']()

def _channels_changed ( params , len_channels ) : if ( ( params [ 'ch_start' ] + params [ 'n_channels' ] ) > len_channels ) : params [ 'ch_start' ] = ( len_channels - params [ 'n_channels' ] ) if ( params [ 'ch_start' ] < 0 ) : params [ 'ch_start' ] = 0 params [ 'plot_fun' ] ( )
helper function for dealing with the vertical shift of the viewport .