From ada11a86542e0cb20259cd930b4c030eec8db2f2 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sun, 21 Mar 2010 11:54:37 +0100 Subject: [PATCH] Aggiunta opzione per non stampare output e modificato titolo del grafico. --- Filtering/dwt.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Filtering/dwt.py b/Filtering/dwt.py index 59df114..7e69ec9 100755 --- a/Filtering/dwt.py +++ b/Filtering/dwt.py @@ -5,27 +5,32 @@ import sys from optparse import OptionParser +quiet = False + def Output (string): """Output with colors :)""" - print "\033[32;1m===>\033[0m %s" % string + if not quiet: + print "\033[32;1m===>\033[0m %s" % string def StartProgram(): """Starting banner""" - print "\033[31;1m===>\033[0m Discrete Wavelet transform started" + if not quiet: + print "\033[31;1m===>\033[0m Discrete Wavelet transform started" def EndProgram(): """End banner""" - print "", + if not quiet: + print "", def LoadingLibrariesStarted(): """Loading libraries banner""" - if __name__ == "__main__": + if __name__ == "__main__" and not quiet: print "\033[31;1m===>\033[0m Loading numeric libraries...", sys.stdout.flush () def LoadingLibrariesFinished(): """Loading libraries finished banner""" - if __name__ == "__main__": + if __name__ == "__main__" and not quiet: print "done" @@ -35,6 +40,8 @@ if __name__ == "__main__": parser.add_option("-r", "--rebuild", dest="rebuild", default=False, action="store_true", help="Make DWT and then IDWT") + parser.add_option("-q", "--quiet", dest="quiet", + default=False, action="store_true") parser.add_option("-w", "--write", dest="filewrite", default='rebuilt.raw', help="Write reconstructed samples to this file") parser.add_option("-s", "--show", dest="show", @@ -56,6 +63,8 @@ if __name__ == "__main__": if (not options.show) and (not options.rebuild): exit + quiet = options.quiet + LoadingLibrariesStarted() # Importing libraries @@ -216,7 +225,7 @@ class DWT(): # Set some nice text - title (r"Decomposition using %s filter bank" % self.filterBankName) + title (r"Wavelet decomposition using %s filter bank" % self.filterBankName) xlabel (r"time (s)") show () -- 2.1.4