1 from __future__
import print_function
2 from IMP
import ArgumentParser
5 __doc__ =
"Plot score distributions of good-scoring models."
9 parser = ArgumentParser(
10 description=
"Plot score distributions of good-scoring models")
11 parser.add_argument(
"-show", action=
"store_true",
12 help=
"Interactively show the plot")
13 parser.add_argument(
"score_file",
14 help=
"Score file generated by select_good")
15 parser.add_argument(
"column",
16 help=
"PMI stat file column to plot (or 'all' to "
18 return parser.parse_args()
21 def plot_column(plt, scores, column, show):
22 print(column,
"|| Mean:", scores[column].mean(),
23 "| SD:", scores[column].std())
24 plt.hist(scores[column], bins=100)
31 plt.savefig(column+
".png", dpi=300)
40 import matplotlib.pyplot
as plt
43 scores = pandas.read_csv(args.score_file, sep=
' ')
45 if args.column ==
"all":
46 print(
"Plotting all columns")
47 exclude = frozenset((
'Model_index',
'Replica_id',
'Frame_id',
'Run_id'))
48 for k
in scores.columns:
50 p = plot_column(plt, scores, k, show=
False)
52 elif args.column
in scores.columns.values:
53 plot_column(plt, scores, args.column, show=args.show)
55 raise KeyError(args.column
56 +
" is not a valid score parameter. Use 'all' or one of: "
57 +
", ".join(scores.columns.values))
60 if __name__ ==
'__main__':