Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
60695137
Commit
60695137
authored
Jan 31, 2019
by
thomas.forbriger
Browse files
croposp [WP]: start croposplot.py
parent
7fdbe0ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/python/visu/croposplot.py
View file @
60695137
...
...
@@ -25,6 +25,121 @@
# 31/01/2019 V1.0 Thomas Forbriger
#
# ============================================================================
__version__
=
"croposplot 2019-01-31 V1.0"
__author__
=
"Thomas Forbriger"
# ----------------------------------------------------------------------------
# backend
# -------
# For screen-plots an appropriate backend must be chosen. This should be done
# by an entry in ~/.config/matplotlib/matplotlibrc like
# backend : qt5agg
#
# Alternatively the first two statements may be set to:
#
# import matplotlib
# matplotlib.use('qt5agg')
#
# However, the backend then would be hardcoded, which is not desired.
#
# ----------------------------------------------------------------------------
import
sys
import
os
import
getopt
import
string
import
numpy
as
np
import
matplotlib.pyplot
as
plt
# ============================================================================
def
usage
():
"""
print usage information
"""
print
(
__version__
)
print
(
'Usage: '
+
sys
.
argv
[
0
]
+
' [-v] file [file [file ...]]'
)
print
(
' or: '
+
sys
.
argv
[
0
]
+
' --help|-h'
)
# ----------------------------------------------------------------------------
def
help
():
"""
print online help
"""
usage
()
print
(
"""
Read multicolumn output files of spectral values as written by croposp and
create graphical diagrams.
file ... multicolumn spectral data output of croposp
-v be verbose
-o file write to file
"""
)
# ============================================================================
def
main
(
argv
=
None
):
"""
main body of program
evaluate command line options and control processing
"""
if
argv
is
None
:
argv
=
sys
.
argv
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'hvo:'
,
[
'help'
])
except
getopt
.
GetoptError
as
err
:
print
(
err
.
msg
)
exit
(
0
)
verbose
=
False
global
DEBUG
DEBUG
=
False
outfile
=
'x11'
for
(
opt
,
arg
)
in
opts
:
if
opt
==
'-v'
:
verbose
=
True
elif
opt
==
'-D'
:
DEBUG
=
True
elif
opt
==
'-o'
:
outfile
=
arg
elif
(
opt
==
'-h'
)
or
(
opt
==
'--help'
):
help
()
exit
(
0
)
else
:
usage
()
exit
(
0
)
if
DEBUG
:
print
(
opts
)
print
(
args
)
if
len
(
args
)
<
1
and
len
(
opts
)
<
1
:
usage
()
exit
(
0
)
print
(
__version__
)
print
(
"Read croposp output files and create diagram"
)
Figure
=
plt
.
figure
()
for
specfile
in
args
:
if
verbose
:
print
(
'read file %s'
%
specfile
)
data
=
np
.
loadtxt
(
specfile
,
unpack
=
False
)
for
i
in
range
(
1
,
len
(
data
[
0
,:])
-
1
):
plt
.
plot
(
data
[:,
0
],
data
[:,
i
])
if
outfile
==
'x11'
:
plt
.
show
(
True
)
else
:
plt
.
savefig
(
outfile
,
papertype
=
'a4'
,
orientation
=
'landscape'
)
return
0
# ============================================================================
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
# ----- END OF croposplot.py -----
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment