Ejemplo n.º 1
0
def test(filename):
    pylab.ylabel('Low Pass mmHG')
    pylab.xlabel('Time')
    times = hirate[:,0] / 1000.
    lt =  '%s-' % color
    pylab.plot(times, lpd, lt)
    peaks, troughs = util.find_peaks_and_troughs(lpd, eps=.05, edit=False)
    if peaks[0] < troughs[0]:
        peaks = peaks[1:]
    if troughs[-1] > peaks[-1]:
        troughs = troughs[:-1]
    pylab.plot(times[peaks], lpd[peaks], 'ro')
    pylab.plot(times[troughs], lpd[troughs], 'bo')
    deltas_l = (lpd[peaks] - lpd[troughs])[:-1]
    deltas_r = lpd[peaks[:-1]] - lpd[troughs[1:]]
    deltas = (deltas_r + deltas_l) / 2.
    peaks = (peaks[1:] + peaks[:-1])/2
    troughs = (troughs[1:] + troughs[:-1])/2
    pylab.subplot(212)
    pylab.ylabel('Cuff Compliance mmHG')
    pylab.xlabel('cuff pressure mmHG')
    dV = 2 ## mL
    pylab.plot(lpd[troughs], dV/deltas, lt)
Ejemplo n.º 2
0
def plot_hirate(hirate, color):
    dt = 0.004
    n_tap = 100
    fmax = 10 ## Hz
    lp_taps = util.get_lowpass_taps(fmax, dt, n_tap)
    delay_taps = zeros(defaults['n_tap'])
    delay_taps[defaults['n_tap'] // 2] = 1
    
    lpd = util.filter(hirate[:,1] - hirate[0, 1], lp_taps) + hirate[0, 1]

    ax = pylab.subplot(211)
    times = hirate[:,0]
    pylab.plot(times, lpd)
    peaks, troughs = util.find_peaks_and_troughs(lpd, eps=.1, edit=False)
    if peaks[0] < troughs[0]:
        peaks = peaks[1:]
    if peaks[-1] < troughs[-1]:
        troughs = troughs[:-1]
    pylab.plot(times[peaks], lpd[peaks], 'ro')
    pylab.plot(times[troughs], lpd[troughs], 'bo')
    deltas = lpd[peaks] - lpd[troughs]
    print std(deltas)
    pylab.subplot(212)
    pylab.plot(lpd[troughs], deltas)