summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/analyze-archive.py124
-rwxr-xr-xbin/analyze-timing.py59
-rwxr-xr-xbin/test_corrcoef.py8
3 files changed, 114 insertions, 77 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 475d08f..193f151 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -147,9 +147,9 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
"{} {} {:.8f}".format(
state_or_tran,
attribute,
- model.stats.generic_param_dependence_ratio(
- state_or_tran, attribute
- ),
+ model.attr_by_name[state_or_tran][
+ attr_by_name
+ ].stats.generic_param_dependence_ratio(),
)
)
@@ -157,15 +157,15 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
print(r"key attribute parameter $1 - \frac{...}{...}$")
for state_or_tran in model.by_name.keys():
for attribute in model.attributes(state_or_tran):
- for param in model.parameters():
+ for param in model.parameters:
print(
"{} {} {} {:.8f}".format(
state_or_tran,
attribute,
param,
- model.stats.param_dependence_ratio(
- state_or_tran, attribute, param
- ),
+ model.attr_by_name[state_or_tran][
+ attribute
+ ].stats.param_dependence_ratio(param),
)
)
if state_or_tran in model._num_args:
@@ -175,9 +175,9 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
state_or_tran,
attribute,
arg_index,
- model.stats.arg_dependence_ratio(
- state_or_tran, attribute, arg_index
- ),
+ model.attr_by_name[state_or_tran][
+ attribute
+ ].stats.arg_dependence_ratio(arg_index),
)
)
@@ -199,8 +199,15 @@ def print_html_model_data(raw_data, model, pm, pq, lm, lq, am, ai, aq):
print()
print(f"## {state}")
print()
- for param in model.parameters():
- print("* {} ∈ {}".format(param, model.stats.distinct_values[state][param]))
+ for param in model.parameters:
+ print(
+ "* {} ∈ {}".format(
+ param,
+ model.attr_by_name[state][
+ "power"
+ ].stats.distinct_values_by_param_name[param],
+ )
+ )
for attribute in state_attributes:
unit = ""
if attribute == "power":
@@ -225,8 +232,15 @@ def print_html_model_data(raw_data, model, pm, pq, lm, lq, am, ai, aq):
print()
print(f"## {trans}")
print()
- for param in model.parameters():
- print("* {} ∈ {}".format(param, model.stats.distinct_values[trans][param]))
+ for param in model.parameters:
+ print(
+ "* {} ∈ {}".format(
+ param,
+ model.attr_by_name[trans][
+ "duration"
+ ].stats.distinct_values_by_param_name[param],
+ )
+ )
for attribute in trans_attributes:
unit = ""
if attribute == "duration":
@@ -615,10 +629,13 @@ if __name__ == "__main__":
for state in model.states():
print("{}:".format(state))
print(f""" Number of Measurements: {len(by_name[state]["power"])}""")
- for param in model.parameters():
+ for param in model.parameters:
print(
" Parameter {} ∈ {}".format(
- param, model.stats.distinct_values[state][param]
+ param,
+ model.attr_by_name[state][
+ "power"
+ ].stats.distinct_values_by_param_name[param],
)
)
for transition in model.transitions():
@@ -626,10 +643,13 @@ if __name__ == "__main__":
print(
f""" Number of Measurements: {len(by_name[transition]["duration"])}"""
)
- for param in model.parameters():
+ for param in model.parameters:
print(
" Parameter {} ∈ {}".format(
- param, model.stats.distinct_values[transition][param]
+ param,
+ model.attr_by_name[transition][
+ "duration"
+ ].stats.distinct_values_by_param_name[param],
)
)
@@ -660,15 +680,19 @@ if __name__ == "__main__":
state,
static_model(state, attribute),
unit,
- model.stats.generic_param_dependence_ratio(state, attribute),
+ model.attr_by_name[state][
+ attribute
+ ].stats.generic_param_dependence_ratio(),
)
)
- for param in model.parameters():
+ for param in model.parameters:
print(
"{:10s} dependence on {:15s}: {:.2f}".format(
"",
param,
- model.stats.param_dependence_ratio(state, attribute, param),
+ model.attr_by_name[state][
+ attribute
+ ].stats.param_dependence_ratio(param),
)
)
@@ -681,13 +705,15 @@ if __name__ == "__main__":
static_model(trans, "energy"),
static_model(trans, "rel_energy_prev"),
static_model(trans, "rel_energy_next"),
- model.stats.generic_param_dependence_ratio(trans, "energy"),
- model.stats.generic_param_dependence_ratio(
- trans, "rel_energy_prev"
- ),
- model.stats.generic_param_dependence_ratio(
- trans, "rel_energy_next"
- ),
+ model.attr_by_name[trans][
+ "energy"
+ ].stats.generic_param_dependence_ratio(),
+ model.attr_by_name[trans][
+ "rel_energy_prev"
+ ].stats.generic_param_dependence_ratio(),
+ model.attr_by_name[trans][
+ "rel_energy_next"
+ ].stats.generic_param_dependence_ratio(),
)
)
except KeyError:
@@ -695,7 +721,9 @@ if __name__ == "__main__":
"{:10s}: {:.0f} pJ ({:.2f})".format(
trans,
static_model(trans, "energy"),
- model.stats.generic_param_dependence_ratio(trans, "energy"),
+ model.attr_by_name[trans][
+ "energy"
+ ].stats.generic_param_dependence_ratio(),
)
)
else:
@@ -723,7 +751,9 @@ if __name__ == "__main__":
"{:10s}: {:.0f} µs ({:.2f})".format(
trans,
static_model(trans, "duration"),
- model.stats.generic_param_dependence_ratio(trans, "duration"),
+ model.attr_by_name[trans][
+ "duration"
+ ].stats.generic_param_dependence_ratio(),
)
)
try:
@@ -733,13 +763,15 @@ if __name__ == "__main__":
static_model(trans, "power"),
static_model(trans, "rel_power_prev"),
static_model(trans, "rel_power_next"),
- model.stats.generic_param_dependence_ratio(trans, "power"),
- model.stats.generic_param_dependence_ratio(
- trans, "rel_power_prev"
- ),
- model.stats.generic_param_dependence_ratio(
- trans, "rel_power_next"
- ),
+ model.attr_by_name[trans][
+ "power"
+ ].stats.generic_param_dependence_ratio(),
+ model.attr_by_name[trans][
+ "rel_power_prev"
+ ].stats.generic_param_dependence_ratio(),
+ model.attr_by_name[trans][
+ "rel_power_next"
+ ].stats.generic_param_dependence_ratio(),
)
)
except KeyError:
@@ -747,7 +779,9 @@ if __name__ == "__main__":
"{:10s}: {:.0f} pJ ({:.2f})".format(
trans,
static_model(trans, "power"),
- model.stats.generic_param_dependence_ratio(trans, "power"),
+ model.attr_by_name[trans][
+ "power"
+ ].stats.generic_param_dependence_ratio(),
)
)
@@ -787,25 +821,27 @@ if __name__ == "__main__":
"{:10s} {:10s} non-param stddev {:f}".format(
state,
attribute,
- model.stats.stats[state][attribute]["std_static"],
+ model.attr_by_name[state][attribute].stats.std_static,
)
)
print(
"{:10s} {:10s} param-lut stddev {:f}".format(
state,
attribute,
- model.stats.stats[state][attribute]["std_param_lut"],
+ model.attr_by_name[state][attribute].stats.std_param_lut,
)
)
for param in sorted(
- model.stats.stats[state][attribute]["std_by_param"].keys()
+ model.attr_by_name[state][attribute].stats.std_by_param.keys()
):
print(
"{:10s} {:10s} {:10s} stddev {:f}".format(
state,
attribute,
param,
- model.stats.stats[state][attribute]["std_by_param"][param],
+ model.attr_by_name[state][attribute].stats.std_by_param[
+ param
+ ],
)
)
if info is not None:
@@ -824,10 +860,6 @@ if __name__ == "__main__":
)
if "param" in show_models or "all" in show_models:
- if not model.stats.can_be_fitted():
- logging.warning(
- "measurements have insufficient distinct numeric parameters for fitting. A parameter-aware model is not available."
- )
for state in model.states():
for attribute in model.attributes(state):
if param_info(state, attribute):
diff --git a/bin/analyze-timing.py b/bin/analyze-timing.py
index ddd49ec..1460dd3 100755
--- a/bin/analyze-timing.py
+++ b/bin/analyze-timing.py
@@ -128,21 +128,21 @@ def model_quality_table(result_lists, info_list):
def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
print("")
print(r"key attribute $1 - \frac{\sigma_X}{...}$")
- for state_or_tran in model.by_name.keys():
+ for state_or_tran in model.names:
for attribute in model.attributes(state_or_tran):
print(
"{} {} {:.8f}".format(
state_or_tran,
attribute,
- model.stats.generic_param_dependence_ratio(
- state_or_tran, attribute
- ),
+ model.attr_by_name[state_or_tran][
+ attr_by_name
+ ].stats.generic_param_dependence_ratio(),
)
)
print("")
print(r"key attribute parameter $1 - \frac{...}{...}$")
- for state_or_tran in model.by_name.keys():
+ for state_or_tran in model.names:
for attribute in model.attributes(state_or_tran):
for param in model.parameters():
print(
@@ -150,9 +150,9 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
state_or_tran,
attribute,
param,
- model.stats.param_dependence_ratio(
- state_or_tran, attribute, param
- ),
+ model.attr_by_name[state_or_tran][
+ attribute
+ ].stats.param_dependence_ratio(param),
)
)
if state_or_tran in model._num_args:
@@ -162,9 +162,9 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
state_or_tran,
attribute,
arg_index,
- model.stats.arg_dependence_ratio(
- state_or_tran, attribute, arg_index
- ),
+ model.attr_by_name[state_or_tran][
+ attr_by_name
+ ].stats.arg_dependence_ratio(arg_index),
)
)
@@ -275,7 +275,10 @@ if __name__ == "__main__":
for param in model.parameters:
print(
" {} = {}".format(
- param, model.stats.distinct_values[state][param]
+ param,
+ model.attr_by_name[state][
+ "duration"
+ ].stats.distinct_values_by_param_name[param],
)
)
@@ -284,9 +287,7 @@ if __name__ == "__main__":
state_or_trans, attribute, ylabel = kv.split(":")
fname = "param_y_{}_{}.pdf".format(state_or_trans, attribute)
plotter.plot_y(
- model.by_name[state_or_trans][attribute],
- xlabel="measurement #",
- ylabel=ylabel,
+ model.attributes(state_or_trans), xlabel="measurement #", ylabel=ylabel
)
if len(show_models):
@@ -300,7 +301,9 @@ if __name__ == "__main__":
"{:10s} dependence on {:15s}: {:.2f}".format(
"",
param,
- model.stats.param_dependence_ratio(trans, "duration", param),
+ model.attr_by_name[trans][
+ "duration"
+ ].stats.param_dependence_ratio(param),
)
)
@@ -333,27 +336,27 @@ if __name__ == "__main__":
"{:10s} {:10s} non-param stddev {:f}".format(
transition,
attribute,
- model.stats.stats[transition][attribute]["std_static"],
+ model.attr_by_name[transition][attribute].stats.std_static,
)
)
print(
"{:10s} {:10s} param-lut stddev {:f}".format(
transition,
attribute,
- model.stats.stats[transition][attribute]["std_param_lut"],
+ model.attr_by_name[transition][attribute].stats.std_param_lut,
)
)
for param in sorted(
- model.stats.stats[transition][attribute]["std_by_param"].keys()
+ model.attr_by_name[transition][attribute].stats.std_by_param.keys()
):
print(
"{:10s} {:10s} {:10s} stddev {:f}".format(
transition,
attribute,
param,
- model.stats.stats[transition][attribute]["std_by_param"][
- param
- ],
+ model.attr_by_name[transition][
+ attribute
+ ].stats.std_by_param[param],
)
)
print(
@@ -361,13 +364,13 @@ if __name__ == "__main__":
transition,
attribute,
param,
- model.stats.param_dependence_ratio(
- transition, attribute, param
- ),
+ model.attr_by_name[transition][
+ attribute
+ ].stats.param_dependence_ratio(param),
)
)
for i, arg_stddev in enumerate(
- model.stats.stats[transition][attribute]["std_by_arg"]
+ model.attr_by_name[transition][attribute].stats.std_by_arg
):
print(
"{:10s} {:10s} arg{:d} stddev {:f}".format(
@@ -379,7 +382,9 @@ if __name__ == "__main__":
transition,
attribute,
i,
- model.stats.arg_dependence_ratio(transition, attribute, i),
+ model.attr_by_name[transition][
+ attribute
+ ].stats.arg_dependence_ratio(i),
)
)
if info is not None:
diff --git a/bin/test_corrcoef.py b/bin/test_corrcoef.py
index ccb3366..755c927 100755
--- a/bin/test_corrcoef.py
+++ b/bin/test_corrcoef.py
@@ -85,7 +85,7 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq):
print(r"key attribute parameter $1 - \frac{...}{...}$")
for state_or_tran in model.by_name.keys():
for attribute in model.by_name[state_or_tran]["attributes"]:
- for param in model.parameters():
+ for param in model.parameters:
print(
"{} {} {} {:.8f}".format(
state_or_tran,
@@ -197,7 +197,7 @@ if __name__ == "__main__":
model.generic_param_dependence_ratio(state, "power"),
)
)
- for param in model.parameters():
+ for param in model.parameters:
print(
"{:10s} dependence on {:15s}: {:.2f}".format(
"", param, model.param_dependence_ratio(state, "power", param)
@@ -239,7 +239,7 @@ if __name__ == "__main__":
print("state_or_trans attribute param stddev_ratio corrcoef")
for state in model.states():
for attribute in model.attributes(state):
- for param in model.parameters():
+ for param in model.parameters:
print(
"{:10s} {:10s} {:10s} {:f} {:f}".format(
state,
@@ -251,7 +251,7 @@ if __name__ == "__main__":
)
for trans in model.transitions():
for attribute in model.attributes(trans):
- for param in model.parameters():
+ for param in model.parameters:
print(
"{:10s} {:10s} {:10s} {:f} {:f}".format(
trans,