File: amp-plotconvergence

package info (click to toggle)
amp 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 8,396 kB
  • sloc: python: 9,629; f90: 3,195; makefile: 58
file content (27 lines) | stat: -rwxr-xr-x 790 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
"""Tool to create convergence plots for Amp."""

import matplotlib
# The 'Agg' command must be *before* all other matplotlib imports for
# headless operation.
matplotlib.use('Agg')

from optparse import OptionParser

from amp.analysis import plot_convergence


parser = OptionParser(
    usage='usage: %prog logfile [plotfile]\n Create convergence plot'
          ' logfile is amp log file; plotfile is an optional filename '
          ' for the output that takes any allowable matplotlib format.')
options, args = parser.parse_args()

if len(args) not in [1, 2]:
    raise RuntimeError('Bad number of arguments.')
plotfile = 'convergence.pdf'
if len(args) == 2:
    plotfile = args.pop(-1)
logfile = args.pop(0)

plot_convergence(logfile=logfile, plotfile=plotfile)