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',
49 for k
in scores.columns:
51 p = plot_column(plt, scores, k, show=
False)
53 elif args.column
in scores.columns.values:
54 plot_column(plt, scores, args.column, show=args.show)
56 raise KeyError(args.column
57 +
" is not a valid score parameter. Use 'all' or one of: "
58 +
", ".join(scores.columns.values))
61 if __name__ ==
'__main__':