You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pymatnext/cli/ns_analyse.py
+23-9Lines changed: 23 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -44,8 +44,10 @@ def main():
44
44
pressure_g.add_argument('--delta_P', help="""delta pressure to use for reweighting (works best with flat V prior)""", type=float)
45
45
p.add_argument('--entropy', '-S', action='store_true', help="""compute and print entropy (relative to entropy of lowest T structure""")
46
46
p.add_argument('--probability_entropy_minimum', type=float, help="""probability entropy mininum that indicates a problem with sampling""", default=5.0)
47
-
p.add_argument('--plot', '-p', nargs='*', help="""column names to plot, or optionally 'log(colname)'. """
48
-
"""If no column names provided, list allowed names and abort""")
47
+
p.add_argument('--plot', '-p', nargs='*', help="""column names to plot. Python expression can be used, with '{colname}' """
48
+
"""replaced by the value of the quantity, and 'natoms' by the number of atoms. """
49
+
"""Plotted on a semi-log axis if name or expression is enclosed by 'log(..)'. """
50
+
"""If no column names provided, list allowed names and abort.""")
49
51
p.add_argument('--plot_together', help="""output filename for combined plot""")
50
52
p.add_argument('--plot_together_filenames', action='store_true', help="""show filenames in combined plot""")
51
53
p.add_argument('--plot_twinx_spacing', type=float, help="""spacing for extra twinx y axes""", default=0.15)
@@ -85,13 +87,17 @@ def main():
85
87
ax= {}
86
88
87
89
defcolname(colname_str):
88
-
m=re.match(r'log\(([^)]*)\)$', colname_str)
90
+
# strip off optional log()
91
+
m=re.match(r'^log\((.*)\)$', colname_str)
92
+
ifm:
93
+
colname_str=m.group(1)
94
+
# extract col name
95
+
m=re.match(r'\{([^}]*)\}', colname_str)
89
96
ifm:
90
97
returnm.group(1)
91
98
else:
92
99
returncolname_str
93
100
94
-
95
101
forinfile_i, infileinenumerate(args.infile):
96
102
iters= []
97
103
Es= []
@@ -346,8 +352,17 @@ def str_format(fmt):
346
352
fig=Figure()
347
353
ax= {}
348
354
forfield_i, pfieldinenumerate(args.plot):
349
-
# should this be done here? should it be more general, e.g. eval()?
0 commit comments