Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fa5bcb0a authored by hhakim's avatar hhakim
Browse files

Fix deprecated uses of matplotlib in pyfaust.demo module + fix output of examples for doctest.

parent 25b382ad
No related branches found
No related tags found
No related merge requests found
Pipeline #834164 skipped
...@@ -59,9 +59,11 @@ def runall(): ...@@ -59,9 +59,11 @@ def runall():
"""Runs all the demos in a row. """Runs all the demos in a row.
Example: Example:
>>> from pyfaust.demo import runall, allfigs >>> from pyfaust.demo import runall, allfigs
>>> runall() >>> runall() # doctest:+ELLIPSIS
***...
>>> # benchmark data files go in DEFT_RESULTS_DIR >>> # benchmark data files go in DEFT_RESULTS_DIR
>>> allfigs() >>> allfigs() # doctest:+ELLIPSIS
***...
>>> # figures resulting from benchmark go in DEFT_FIG_DIR >>> # figures resulting from benchmark go in DEFT_FIG_DIR
""" """
def print_header(title): def print_header(title):
...@@ -260,7 +262,7 @@ class fft: ...@@ -260,7 +262,7 @@ class fft:
xlabel ('log(dim)') xlabel ('log(dim)')
figlegend(figure(1).get_axes()[0].get_lines(),['dense', 'faust', figlegend(figure(1).get_axes()[0].get_lines(),['dense', 'faust',
'fft'],loc='best') 'fft'])
if(not os.path.exists(output_dir)): if(not os.path.exists(output_dir)):
...@@ -653,13 +655,13 @@ class hadamard: ...@@ -653,13 +655,13 @@ class hadamard:
had_faust = Faust(filepath=_prefix_fname_with_dir(input_dir, had_faust = Faust(filepath=_prefix_fname_with_dir(input_dir,
hadamard._had_faust_fname)) hadamard._had_faust_fname))
fig1 = figure(1) fig1 = figure(1)
subplot("1"+str(had_faust.numfactors()+1)+'1') subplot(int("1"+str(had_faust.numfactors()+1)+'1'))
imshow(had_faust.toarray()) imshow(had_faust.toarray())
xticks([]) xticks([])
yticks([]) yticks([])
facts = []; facts = [];
for i in range(0,had_faust.numfactors()): for i in range(0,had_faust.numfactors()):
subplot("1"+str(hadamard._nfacts+1)+str(i+2)) subplot(int("1"+str(hadamard._nfacts+1)+str(i+2)))
# all factors are normally sparse # all factors are normally sparse
fac = had_faust.factors(i) fac = had_faust.factors(i)
facts.append(fac) facts.append(fac)
...@@ -670,12 +672,12 @@ class hadamard: ...@@ -670,12 +672,12 @@ class hadamard:
yticks([]) yticks([])
fig2 = figure(2) fig2 = figure(2)
subplot("1"+str(had_faust.numfactors()+1)+'1') subplot(int("1"+str(had_faust.numfactors()+1)+'1'))
imshow(had_faust.toarray()) imshow(had_faust.toarray())
xticks([]) xticks([])
yticks([]) yticks([])
for i in range(0,had_faust.numfactors()): for i in range(0,had_faust.numfactors()):
subplot("1"+str(hadamard._nfacts+1)+str(i+2)) subplot(int("1"+str(hadamard._nfacts+1)+str(i+2)))
title("nz = "+str(count_nonzero(fac))) title("nz = "+str(count_nonzero(fac)))
spy(facts[i], markersize=1) spy(facts[i], markersize=1)
xticks([]) xticks([])
...@@ -800,7 +802,7 @@ class hadamard: ...@@ -800,7 +802,7 @@ class hadamard:
ymax = max(max(mean_mult_times[:,t[2]]), ymax = max(max(mean_mult_times[:,t[2]]),
max(mean_mult_times[:,t[3]])) max(mean_mult_times[:,t[3]]))
subplot("22"+t[0]) subplot(int("22"+t[0]))
title('Runtime Hadamard '+t[1]) title('Runtime Hadamard '+t[1])
grid(True) grid(True)
#hold(True) #hold(True)
...@@ -815,7 +817,7 @@ class hadamard: ...@@ -815,7 +817,7 @@ class hadamard:
ymin = min(t[2]) ymin = min(t[2])
ymax = max(t[2]) ymax = max(t[2])
subplot("22"+t[0]) subplot(int("22"+t[0]))
title('Speedup Hadamard '+t[1]) title('Speedup Hadamard '+t[1])
grid(True) grid(True)
#hold(True) #hold(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment