before deleting unused fragments
This commit is contained in:
parent
3057bca96d
commit
88866dac58
@ -6,46 +6,59 @@ import os
|
|||||||
import inspect
|
import inspect
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import itertools as it
|
import itertools as it
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class MySettings(object):
|
class MySettings(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.f_results = os.path.join(os.getcwd(), "results.out")
|
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||||
self.only_slice_candidates = True
|
self.only_slice_candidates = True
|
||||||
|
self.only_slice_candidates = False
|
||||||
|
self.default_limit = 3
|
||||||
|
|
||||||
|
|
||||||
def main(arg):
|
def main(arg):
|
||||||
try:
|
try:
|
||||||
tests(int(arg[1]))
|
limit = int(arg[1])
|
||||||
except:
|
except:
|
||||||
tests()
|
limit = None
|
||||||
|
second_knot_sum_formula = "[[k[0], k[1], k[2]], [k[3], k[4]], \
|
||||||
|
|
||||||
def tests(limit=10):
|
|
||||||
k_size = 5
|
|
||||||
settings = MySettings()
|
|
||||||
knot_sum_formula = "[[k[0], k[1], k[2]], [k[3], k[4]], \
|
|
||||||
[-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
[-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
||||||
|
first_knot_sum_formula = "[[k[0], k[1], k[2]], [k[3]],\
|
||||||
|
[-k[0], -k[1], -k[3]], [-k[2]]]"
|
||||||
|
tests(second_knot_sum_formula, limit)
|
||||||
|
tests(first_knot_sum_formula, limit)
|
||||||
|
|
||||||
# F = get_function_of_theta_for_sum([k_3], [-k_2],
|
|
||||||
# [-k_0, -k_1, -k_3],
|
def is_trivial_combination(knot_sum):
|
||||||
# [k_0, k_1, k_2])
|
if len(knot_sum) == 4:
|
||||||
|
oposit_to_first = [-k for k in knot_sum[0]]
|
||||||
|
if oposit_to_first in knot_sum:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def tests(knot_sum_formula, limit=None):
|
||||||
|
settings = MySettings()
|
||||||
|
if limit is None:
|
||||||
|
limit = settings.default_limit
|
||||||
|
|
||||||
|
k_vector_size = extract_max(knot_sum_formula) + 1
|
||||||
|
|
||||||
with open(settings.f_results, 'w') as f_results:
|
with open(settings.f_results, 'w') as f_results:
|
||||||
combinations = it.combinations_with_replacement(range(1, limit + 1),
|
combinations = it.combinations_with_replacement(range(1, limit + 1),
|
||||||
k_size)
|
k_vector_size)
|
||||||
for comb in combinations:
|
for comb in combinations:
|
||||||
if settings.only_slice_candidates:
|
if settings.only_slice_candidates and k_vector_size == 5:
|
||||||
k = [comb[0], 4 * comb[0] + comb[1],
|
comb = [comb[0], 4 * comb[0] + comb[1],
|
||||||
4 * (4 * comb[0] + comb[1]) + comb[2],
|
4 * (4 * comb[0] + comb[1]) + comb[2],
|
||||||
4 * comb[0] + comb[3],
|
4 * comb[0] + comb[3],
|
||||||
4 * (4 * comb[0] + comb[3]) + comb[4]]
|
4 * (4 * comb[0] + comb[3]) + comb[4]]
|
||||||
else:
|
|
||||||
k = comb
|
k = comb
|
||||||
|
|
||||||
if k[3] == k[1] and k[2] == k[4]:
|
|
||||||
continue
|
|
||||||
knot_sum = eval(knot_sum_formula)
|
knot_sum = eval(knot_sum_formula)
|
||||||
|
|
||||||
|
if is_trivial_combination(knot_sum):
|
||||||
|
continue
|
||||||
result = eval_cable_for_thetas(knot_sum)
|
result = eval_cable_for_thetas(knot_sum)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
knot_description, null_comb, all_comb = result
|
knot_description, null_comb, all_comb = result
|
||||||
@ -281,6 +294,11 @@ def get_number_of_combinations(*arg):
|
|||||||
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
||||||
return number_of_combinations
|
return number_of_combinations
|
||||||
|
|
||||||
|
def extract_max(string):
|
||||||
|
numbers = re.findall('\d+',string)
|
||||||
|
numbers = map(int,numbers)
|
||||||
|
return max(numbers)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__' and '__file__' in globals():
|
if __name__ == '__main__' and '__file__' in globals():
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user