From 9aea3c4c732e7667c8f82f1708dcce5049b6f1d0 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Wed, 7 Apr 2010 09:40:52 +0200 Subject: [PATCH] Spostata importazione della libreria pylab che ci mette un sacco di tempo solo nel posto in cui serve. --- Filtering/dwt.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Filtering/dwt.py b/Filtering/dwt.py index e3a3419..fda5204 100755 --- a/Filtering/dwt.py +++ b/Filtering/dwt.py @@ -69,11 +69,6 @@ LoadingLibrariesStarted() # Importing libraries try: - from pylab import show, plot, title, xlabel, ylabel, rcParams -except ImportError: - print "Errore nell'importazione della libreria pylab. Installare python-matplotlib" - sys.exit(1) -try: from numpy import array, sqrt, memmap, roll, inf from numpy.linalg import norm except ImportError: @@ -81,13 +76,6 @@ except ImportError: sys.exit(1) import time import Filtering - -params = { - "text.usetex": True, - 'font.family': 'serif', -} - -rcParams.update(params) @@ -184,6 +172,24 @@ class DWT(): """ Shows the result of filtering """ + + # Carichiamo la libreria pylab che non abbiamo caricato prima + # perché ci mette un sacco di tempo e non ci server nel caso + # della ricostruzione. + try: + from pylab import show, plot, title, xlabel, ylabel, rcParams + + params = { + "text.usetex": True, + 'font.family': 'serif', + } + + rcParams.update(params) + + except ImportError: + print "Errore nell'importazione della libreria pylab. Installare python-matplotlib" + sys.exit(1) + # We set the frequency to have seconds (and not samples) # in the x-axis of the plot. -- 2.1.4