def _make_stim_channel(trigger_chs, slope, threshold, stim_code, trigger_values):
 if (slope == '+'):
  trig_chs_bin = (trigger_chs > threshold)
 elif (slope == '-'):
  trig_chs_bin = (trigger_chs < threshold)
 else:
  raise ValueError("slope needs to be '+' or '-'")
 if (stim_code == 'binary'):
  trigger_values = (2 ** np.arange(len(trigger_chs)))
 elif (stim_code != 'channel'):
  raise ValueError(("stim_code must be 'binary' or 'channel', got %s" % repr(stim_code)))
 trig_chs = (trig_chs_bin * trigger_values[:, np.newaxis])
 return np.array(trig_chs.sum(axis=0), ndmin=2)

def _make_stim_channel ( trigger_chs , slope , threshold , stim_code , trigger_values ) : if ( slope == '+' ) : trig_chs_bin = ( trigger_chs > threshold ) elif ( slope == '-' ) : trig_chs_bin = ( trigger_chs < threshold ) else : raise ValueError ( "slope needs to be '+' or '-'" ) if ( stim_code == 'binary' ) : trigger_values = ( 2 ** np . arange ( len ( trigger_chs ) ) ) elif ( stim_code != 'channel' ) : raise ValueError ( ( "stim_code must be 'binary' or 'channel', got %s" % repr ( stim_code ) ) ) trig_chs = ( trig_chs_bin * trigger_values [ : , np . newaxis ] ) return np . array ( trig_chs . sum ( axis = 0 ) , ndmin = 2 )
create synthetic stim channel from multiple trigger channels .