#NEWLINE# def _open_options( params ) : #NEWLINE# #INDENT# 'Function for opening the option window.' #NEWLINE# import matplotlib.pyplot as plt #NEWLINE# import matplotlib as mpl #NEWLINE# if ( params [ 'fig_options' ] is not None ) : #NEWLINE# #INDENT# plt . close ( params [ 'fig_options' ] ) #NEWLINE# params [ 'fig_options' ] = None #NEWLINE# return #NEWLINE# #UNINDENT# width = 10 #NEWLINE# height = 3 #NEWLINE# fig_options = figure_nobar ( figsize = ( width , height ) , dpi = 80 ) #NEWLINE# fig_options . canvas . set_window_title ( 'View settings' ) #NEWLINE# params [ 'fig_options' ] = fig_options #NEWLINE# ax_channels = plt . axes ( [ 0.15 , 0.1 , 0.65 , 0.1 ] ) #NEWLINE# ax_epochs = plt . axes ( [ 0.15 , 0.25 , 0.65 , 0.1 ] ) #NEWLINE# ax_button = plt . axes ( [ 0.85 , 0.1 , 0.1 , 0.25 ] ) #NEWLINE# ax_check = plt . axes ( [ 0.15 , 0.4 , 0.4 , 0.55 ] ) #NEWLINE# plt . axis ( 'off' ) #NEWLINE# params [ 'update_button' ] = mpl . widgets . Button ( ax_button , 'Update' ) #NEWLINE# params [ 'channel_slider' ] = mpl . widgets . Slider ( ax_channels , 'Channels' , 1 , len ( params [ 'ch_names' ] ) , valfmt = '%0.0f' , valinit = params [ 'n_channels' ] ) #NEWLINE# params [ 'epoch_slider' ] = mpl . widgets . Slider ( ax_epochs , 'Epochs' , 1 , len ( params [ 'epoch_times' ] ) , valfmt = '%0.0f' , valinit = params [ 'n_epochs' ] ) #NEWLINE# params [ 'checkbox' ] = mpl . widgets . CheckButtons ( ax_check , [ 'Channel names visible' , 'Event-id visible' , 'Epoch-id visible' , 'Zeroline visible' ] , actives = params [ 'settings' ] ) #NEWLINE# update = partial ( _update_channels_epochs , params = params ) #NEWLINE# params [ 'update_button' ] . on_clicked ( update ) #NEWLINE# labels_callback = partial ( _toggle_labels , params = params ) #NEWLINE# params [ 'checkbox' ] . on_clicked ( labels_callback ) #NEWLINE# close_callback = partial ( _settings_closed , params = params ) #NEWLINE# params [ 'fig_options' ] . canvas . mpl_connect ( 'close_event' , close_callback ) #NEWLINE# try : #NEWLINE# #INDENT# params [ 'fig_options' ] . canvas . draw ( ) #NEWLINE# params [ 'fig_options' ] . show ( warn = False ) #NEWLINE# if ( params [ 'fig_proj' ] is not None ) : #NEWLINE# #INDENT# params [ 'fig_proj' ] . canvas . draw ( ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass