Changeset 129b269


Ignore:
Timestamp:
Mar 6, 2013, 10:57:30 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
18a0552
Parents:
9f8e8a9
Message:

demos/demo_onset_file.py: indent, hide y-axis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_onset_file.py

    r9f8e8a9 r129b269  
    3939    if read < hop_s: break
    4040
    41 # do plotting
    42 from numpy import arange
    43 import matplotlib.pyplot as plt
    44 allsamples_max = (allsamples_max > 0) * allsamples_max
    45 allsamples_max_times = [ float(t) * hop_s / downsample / samplerate for t in range(len(allsamples_max)) ]
    46 plt1 = plt.axes([0.1, 0.75, 0.8, 0.19])
    47 plt2 = plt.axes([0.1, 0.1, 0.8, 0.65], sharex = plt1)
    48 plt.rc('lines',linewidth='.8')
    49 plt1.plot(allsamples_max_times,  allsamples_max, '-b')
    50 plt1.plot(allsamples_max_times, -allsamples_max, '-b')
    51 for stamp in onsets: plt1.plot([stamp, stamp], [-1., 1.], '-r')
    52 plt1.axis(xmin = 0., xmax = max(allsamples_max_times) )
    53 plt1.xaxis.set_visible(False)
    54 desc_times = [ float(t) * hop_s / samplerate for t in range(len(desc)) ]
    55 desc_plot = [d / max(desc) for d in desc]
    56 plt2.plot(desc_times, desc_plot, '-g')
    57 tdesc_plot = [d / max(desc) for d in tdesc]
    58 for stamp in onsets: plt2.plot([stamp, stamp], [min(tdesc_plot), max(desc_plot)], '-r')
    59 plt2.plot(desc_times, tdesc_plot, '-y')
    60 plt2.axis(ymin = min(tdesc_plot), ymax = max(desc_plot))
    61 plt.xlabel('time (s)')
    62 #plt.savefig('/tmp/t.png', dpi=200)
    63 plt.show()
     41if 1:
     42    # do plotting
     43    from numpy import arange
     44    import matplotlib.pyplot as plt
     45    allsamples_max = (allsamples_max > 0) * allsamples_max
     46    allsamples_max_times = [ float(t) * hop_s / downsample / samplerate for t in range(len(allsamples_max)) ]
     47    plt1 = plt.axes([0.1, 0.75, 0.8, 0.19])
     48    plt2 = plt.axes([0.1, 0.1, 0.8, 0.65], sharex = plt1)
     49    plt.rc('lines',linewidth='.8')
     50    plt1.plot(allsamples_max_times,  allsamples_max, '-b')
     51    plt1.plot(allsamples_max_times, -allsamples_max, '-b')
     52    for stamp in onsets: plt1.plot([stamp, stamp], [-1., 1.], '-r')
     53    plt1.axis(xmin = 0., xmax = max(allsamples_max_times) )
     54    plt1.xaxis.set_visible(False)
     55    plt1.yaxis.set_visible(False)
     56    desc_times = [ float(t) * hop_s / samplerate for t in range(len(desc)) ]
     57    desc_plot = [d / max(desc) for d in desc]
     58    plt2.plot(desc_times, desc_plot, '-g')
     59    tdesc_plot = [d / max(desc) for d in tdesc]
     60    for stamp in onsets: plt2.plot([stamp, stamp], [min(tdesc_plot), max(desc_plot)], '-r')
     61    plt2.plot(desc_times, tdesc_plot, '-y')
     62    plt2.axis(ymin = min(tdesc_plot), ymax = max(desc_plot))
     63    plt.xlabel('time (s)')
     64    #plt.savefig('/tmp/t.png', dpi=200)
     65    plt.show()
Note: See TracChangeset for help on using the changeset viewer.