Add files via upload

This commit is contained in:
Silviu Marian Udrescu 2020-06-28 20:51:17 -04:00 committed by GitHub
parent ce8ae58a79
commit f05cb5ede3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -79,7 +79,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
# for w in range(len(eq_numbers)):
# try:
# param_dict = {}
# unsnapped_param_dict = {'p':1}
# unsnapped_param_dict = {'pp':1}
# eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
# new_numbers = zeroSnap(eq_numbers,w+1)
# for kk in range(len(new_numbers)):
@ -102,7 +102,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
for w in range(len(eq_numbers)):
try:
param_dict = {}
unsnapped_param_dict = {'p':1}
unsnapped_param_dict = {'pp':1}
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
del unsnapped_param_dict["pp"]
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)
@ -127,7 +127,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
for w in range(len(eq_numbers)):
try:
param_dict = {}
unsnapped_param_dict = {'p':1}
unsnapped_param_dict = {'pp':1}
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
del unsnapped_param_dict["pp"]
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)

View file

@ -74,7 +74,7 @@ def zeroSnap(p, top=1):
def rationalSnap(p, top=1):
"""Snap to nearest rational number using continued fraction."""
p = np.array(p)
snaps = np.array(list(bestApproximation(x,100) for x in p))
snaps = np.array(list(bestApproximation(x,10) for x in p))
chosen = np.argsort(snaps[:, 3])[:top]
d = dict(list(zip(chosen, snaps[chosen, 1:3])))
d = {k: f"{val[0]}/{val[1]}" for k,val in d.items()}