#NEWLINE# def _get_and_verify_data_sizes( data , n_signals = None , n_times = None , times = None ) : #NEWLINE# #INDENT# 'Helper function to get and/or verify the data sizes and time scales' #NEWLINE# if ( not isinstance ( data , ( list , tuple ) ) ) : #NEWLINE# #INDENT# raise ValueError ( 'data has to be a list or tuple' ) #NEWLINE# #UNINDENT# n_signals_tot = 0 #NEWLINE# for this_data in data : #NEWLINE# #INDENT# ( this_n_signals , this_n_times ) = this_data . shape #NEWLINE# if ( n_times is not None ) : #NEWLINE# #INDENT# if ( this_n_times != n_times ) : #NEWLINE# #INDENT# raise ValueError ( 'all input time series must have the same number of time points' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# n_times = this_n_times #NEWLINE# #UNINDENT# n_signals_tot += this_n_signals #NEWLINE# if hasattr ( this_data , 'times' ) : #NEWLINE# #INDENT# this_times = this_data . times #NEWLINE# if ( times is not None ) : #NEWLINE# #INDENT# if np . any ( ( times != this_times ) ) : #NEWLINE# #INDENT# warn ( 'time scales of input time series do not match' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# times = this_times #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( n_signals is not None ) : #NEWLINE# #INDENT# if ( n_signals != n_signals_tot ) : #NEWLINE# #INDENT# raise ValueError ( 'the number of time series has to be the same in each epoch' ) #NEWLINE# #UNINDENT# #UNINDENT# n_signals = n_signals_tot #NEWLINE# return ( n_times , n_times , times )