# plot spectrogram (only im is used for colorbar)
spec, fq, t, im = ax.specgram(array, Fs= sample_rate, cmap='magma', vmin=-120, vmax=0)
# divide array into stereo components
left, right = split(array, channels, name)
# plot spectrograms
specl, fql, tl, iml = ax1.specgram(left, Fs=sample_rate, cmap='magma', vmin=-120, vmax=0)
specr, fqr, tr, imr = ax2.specgram(right, Fs=sample_rate, cmap='magma', vmin=-120, vmax=0)
So it looks like there are four steps to each unit test of a function in these plotting functions:
[ ] create dummy array
[ ] plot dummy array with plotting function
[ ] get data from api
[ ] assert data equal to intended result
Which part of the output of matplotlib ax.specgram is the one I can test with?
ax.specgram returns 3 arrays (periodograms, fq & segment midpoint times):
From the matplotlib docs:
spectrum2D array: Columns are the periodograms of successive segments.
freqs1-D array: The frequencies corresponding to the rows in spectrum.
t1-D array: The times corresponding to midpoints of segments (i.e., the columns in spectrum).
So currently these arrays are stored in the spec, fq & t variables. However, my plot function does not return these arrays and only makes a call to plt.show(). So I'll want to return these in the output of the function to be able to test them. At that point though I'm testing that matplotlib's code works instead of testing my code.
60
Spectrogram: lines 64, 137, 172, 173
So it looks like there are four steps to each unit test of a function in these plotting functions:
Which part of the output of matplotlib ax.specgram is the one I can test with?
ax.specgram returns 3 arrays (periodograms, fq & segment midpoint times): From the matplotlib docs: spectrum2D array: Columns are the periodograms of successive segments. freqs1-D array: The frequencies corresponding to the rows in spectrum. t1-D array: The times corresponding to midpoints of segments (i.e., the columns in spectrum).
So currently these arrays are stored in the spec, fq & t variables. However, my plot function does not return these arrays and only makes a call to plt.show(). So I'll want to return these in the output of the function to be able to test them. At that point though I'm testing that matplotlib's code works instead of testing my code.
I think I'll forgo this.
What are the test cases for this output?