diff options
author | John Glover <glover.john@gmail.com> | 2010-11-02 16:11:00 +0000 |
---|---|---|
committer | John Glover <glover.john@gmail.com> | 2010-11-02 16:11:00 +0000 |
commit | f941ad291e1bf249e27ee1a9514e76ddc0ec32fe (patch) | |
tree | 32835700c2d9cc190c65cf340f382b7b9ee5fe9c /plot.py | |
parent | 08f2885c58cc4ae5e4ecf42aecaa043de2c5bd4c (diff) | |
download | simpl-f941ad291e1bf249e27ee1a9514e76ddc0ec32fe.tar.gz simpl-f941ad291e1bf249e27ee1a9514e76ddc0ec32fe.tar.bz2 simpl-f941ad291e1bf249e27ee1a9514e76ddc0ec32fe.zip |
Added colour to default plots (with heatmap) and some minor code tidying
Diffstat (limited to 'plot.py')
-rw-r--r-- | plot.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/plot.py b/plot.py deleted file mode 100644 index 47c3e4a..0000000 --- a/plot.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2009 John Glover, National University of Ireland, Maynooth -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from pylab import plot, show - -def _plot_frame_peaks(frame, frame_number): - "Plot one frame, which is a list of Peak objects" - x_values = [frame_number for x in range(len(frame))] - y_values = [int(peak.frequency) for peak in frame] - plot(x_values, y_values, "ro") - -def plot_peaks(peaks): - "Plot peaks found by a peak detection algorithm" - for frame_number, frame in enumerate(peaks): - _plot_frame_peaks(frame, frame_number) - -def plot_frame_peaks(peaks): - "Plot peaks in one frame" - x_values = [] - y_values = [] - for peak in peaks: - x_values.append(int(peak.frequency)) - y_values.append(peak.amplitude) - plot(x_values, y_values, 'ro') - -def plot_partials(partials, show_peaks=True): - "Plot partials created by a partial tracking algorithm" - num_frames = max([partial.get_last_frame() for partial in partials]) - peaks = [[] for f in range(num_frames)] - for partial in partials: - x_values = [] - y_values = [] - for peak_number, peak in enumerate(partial.peaks): - x_values.append(partial.starting_frame + peak_number) - y_values.append(int(peak.frequency)) - peaks[partial.starting_frame + peak_number].append(peak) - plot(x_values, y_values, "b") - if show_peaks: - plot_peaks(peaks) - |