def _check_psd_data(inst, tmin, tmax, picks, proj):
 from ..io.base import BaseRaw
 from ..epochs import BaseEpochs
 from ..evoked import Evoked
 if (not isinstance(inst, (BaseEpochs, BaseRaw, Evoked))):
  raise ValueError('epochs must be an instance of Epochs, Raw, orEvoked. Got type {0}'.format(type(inst)))
 time_mask = _time_mask(inst.times, tmin, tmax, sfreq=inst.info['sfreq'])
 if (picks is None):
  picks = _pick_data_channels(inst.info, with_ref_meg=False)
 if proj:
  inst = inst.copy().apply_proj()
 sfreq = inst.info['sfreq']
 if isinstance(inst, BaseRaw):
  (start, stop) = np.where(time_mask)[0][[0, (-1)]]
  (data, times) = inst[picks, start:(stop + 1)]
 elif isinstance(inst, BaseEpochs):
  data = inst.get_data()[:, picks][:, :, time_mask]
 elif isinstance(inst, Evoked):
  data = inst.data[picks][:, time_mask]
 return (data, sfreq)

def _check_psd_data ( inst , tmin , tmax , picks , proj ) : from . . io . base import BaseRaw from . . epochs import BaseEpochs from . . evoked import Evoked if ( not isinstance ( inst , ( BaseEpochs , BaseRaw , Evoked ) ) ) : raise ValueError ( 'epochs must be an instance of Epochs, Raw, orEvoked. Got type {0}' . format ( type ( inst ) ) ) time_mask = _time_mask ( inst . times , tmin , tmax , sfreq = inst . info [ 'sfreq' ] ) if ( picks is None ) : picks = _pick_data_channels ( inst . info , with_ref_meg = False ) if proj : inst = inst . copy ( ) . apply_proj ( ) sfreq = inst . info [ 'sfreq' ] if isinstance ( inst , BaseRaw ) : ( start , stop ) = np . where ( time_mask ) [ 0 ] [ [ 0 , ( - 1 ) ] ] ( data , times ) = inst [ picks , start : ( stop + 1 ) ] elif isinstance ( inst , BaseEpochs ) : data = inst . get_data ( ) [ : , picks ] [ : , : , time_mask ] elif isinstance ( inst , Evoked ) : data = inst . data [ picks ] [ : , time_mask ] return ( data , sfreq )
helper to do checks on psd data / pull arrays from inst .