Commit ed5d13c2 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

renamed

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4714
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 51ef9273
#!/usr/bin/env python2
## @file pspecplot.py
## @file specplot.py
# @brief Plot power spectras.
#
# -----------------------------------------------------------------------------
#
# $Id: pspecplot.py 616 2012-05-05 00:03:30Z uhcnl $
# $Id: specplot.py 616 2012-05-05 00:03:30Z uhcnl $
# @author Daniel Armbruster
# \date 08/02/2012
#
......@@ -33,10 +33,11 @@
# 04/05/2012 V0.2 Stable for TFSoftware.
# 12/05/2012 V0.3 Plot multiple datafiles; provide legend;
# provide setting legfontsize
# 23/05/2012 V0.4 renamed to specplot
#
# =============================================================================
"""
Plot an simple power spectrum using python's matplotlib.
Plot spectrum using python's matplotlib.
"""
import sys
......@@ -46,8 +47,8 @@ import string
import matplotlib
import matplotlib.pyplot as plt
__version__ = "V0.3"
__subversion__ = "$Id: pspecplot.py 616 2012-05-05 00:03:30Z uhcnl $"
__version__ = "V0.4"
__subversion__ = "$Id: specplot.py 616 2012-05-05 00:03:30Z uhcnl $"
__license__ = "GPLv2"
__author__ = "Daniel Armbruster"
__copyright__ = "Copyright (c) 2012 by Daniel Armbruster"
......@@ -59,22 +60,22 @@ class Error(Exception):
self.msg = str(msg)
def display(self):
sys.stderr.write("pspecplot (ERROR): " + self.msg + "\n")
sys.stderr.write("specplot (ERROR): " + self.msg + "\n")
class Usage(Error):
def display(self):
usage_text = "Version: "+__version__+"\nLicense: "+__license__+ \
"\n"+__subversion__+"\nAuthor: "+__author__+ """
Usage: pspecplot [-v|--verbose] [--overwrite] [--oformat arg] [--outbase arg]
Usage: specplot [-v|--verbose] [--overwrite] [--oformat arg] [--outbase arg]
[-t|--title arg] [--orientation arg] [--nologlog] [-g|--grid]
[--xlabel arg] [--ylabel arg] [--xlim val:val]
[--ylim val:val]
[--legend arg] [--legpos arg] [--legfontsize arg]
DATAFILE [DATAFILE [...]]
or: pspecplot -h|--help"""
or: specplot -h|--help"""
if 0 != len(self.msg):
sys.stderr.write("pspecplot: " + self.msg + "\n")
sys.stderr.write("specplot: " + self.msg + "\n")
sys.stderr.write(usage_text)
if 0 != len(self.msg):
sys.stderr.write("\n")
......@@ -227,7 +228,7 @@ def main(argv=None):
raise Error("Given DATAFILE '{0}' is an empty file.".format(datafile))
if verbose:
sys.stdout.write( \
"pspecplot: Reading file '{0}' ... \n".format(datafile))
"specplot: Reading file '{0}' ... \n".format(datafile))
try:
x = []
y = []
......@@ -251,7 +252,7 @@ def main(argv=None):
# generate plot
if verbose:
sys.stdout.write("pspecplot: Preparing plot ... \n")
sys.stdout.write("specplot: Preparing plot ... \n")
fig = plt.figure()
ax = fig.add_subplot(111)
......@@ -279,7 +280,7 @@ def main(argv=None):
# legend specific
if 'unset' != legpos:
try:
sys.stdout.write("pspecplot: Plotting legend ...\n")
sys.stdout.write("specplot: Plotting legend ...\n")
ax.legend(legend_handlers, legargs, loc=legpos, \
prop={"size":legfontsize})
except:
......@@ -288,7 +289,7 @@ def main(argv=None):
if len(outbase):
if verbose:
sys.stdout.write( \
"pspecplot: Saving plot to file '{0}' ... \n".format( \
"specplot: Saving plot to file '{0}' ... \n".format( \
outbase+"."+string.lower(oformat)))
try:
plt.savefig(outbase+"."+string.lower(oformat), \
......@@ -297,7 +298,7 @@ def main(argv=None):
raise Usage(err.message)
else:
if verbose:
sys.stdout.write("pspecplot: Generating interactive plot ... \n")
sys.stdout.write("specplot: Generating interactive plot ... \n")
plt.show()
except Error as err:
......@@ -311,4 +312,4 @@ def main(argv=None):
if __name__ == "__main__":
sys.exit(main())
# ----- END OF pspecplot.py -----
# ----- END OF specplot.py -----
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment