def read_tfrs(fname, condition=None):
 check_fname(fname, 'tfr', ('-tfr.h5',))
 logger.info(('Reading %s ...' % fname))
 tfr_data = read_hdf5(fname, title='mnepython')
 for (k, tfr) in tfr_data:
  tfr['info'] = Info(tfr['info'])
 if (condition is not None):
  tfr_dict = dict(tfr_data)
  if (condition not in tfr_dict):
   keys = [('%s' % k) for k in tfr_dict]
   raise ValueError('Cannot find condition ("{0}") in this file. The file contains "{1}""'.format(condition, ' or '.join(keys)))
  out = AverageTFR(**tfr_dict[condition])
 else:
  out = [AverageTFR(**d) for d in list(zip(*tfr_data))[1]]
 return out

def read_tfrs ( fname , condition = None ) : check_fname ( fname , 'tfr' , ( '-tfr.h5' , ) ) logger . info ( ( 'Reading %s ...' % fname ) ) tfr_data = read_hdf5 ( fname , title = 'mnepython' ) for ( k , tfr ) in tfr_data : tfr [ 'info' ] = Info ( tfr [ 'info' ] ) if ( condition is not None ) : tfr_dict = dict ( tfr_data ) if ( condition not in tfr_dict ) : keys = [ ( '%s' % k ) for k in tfr_dict ] raise ValueError ( 'Cannot find condition ("{0}") in this file. The file contains "{1}""' . format ( condition , ' or ' . join ( keys ) ) ) out = AverageTFR ( ** tfr_dict [ condition ] ) else : out = [ AverageTFR ( ** d ) for d in list ( zip ( * tfr_data ) ) [ 1 ] ] return out
read tfr datasets from hdf5 file .