Code
(khipu_dict, all_khipus) = kamayuq.fetch_khipus()
khipu_colors = []
for aKhipu in all_khipus:
khipu_colors += [(cord.longest_ascher_color(), cord.knotted_value()) for cord in aKhipu.cc_cords()]
def is_solid(aColor):
return len({':','%','-','*'} & set(aColor)) == 0
def is_mottled(aColor):
return aColor.count(":") > 0
def is_barberpole(aColor):
return aColor.count("-") > 0
def is_double_mottled(aColor):
return aColor.count(":") > 1
def is_double_barberpoled(aColor):
return aColor.count("-") > 1
def is_mottled_barberpoled(aColor):
return is_barberpole(aColor) and is_mottled(aColor)
solid_colors = [aColor for aColor in khipu_colors if is_solid(aColor[0])]
mottled_colors = [aColor for aColor in khipu_colors if is_mottled(aColor[0])]
barberpole_colors = [aColor for aColor in khipu_colors if is_barberpole(aColor[0])]
double_mottled_colors = [aColor for aColor in khipu_colors if is_double_mottled(aColor[0])]
mottled_barberpoled_colors = [aColor for aColor in khipu_colors if is_mottled_barberpoled(aColor[0])]
double_barberpoled_colors = [aColor for aColor in khipu_colors if is_double_barberpoled(aColor[0])]
solid_cord_values = [aColor[1] for aColor in solid_colors]
mottled_cord_values = [aColor[1] for aColor in mottled_colors]
barberpole_cord_values = [aColor[1] for aColor in barberpole_colors]
double_mottled_cord_values = [aColor[1] for aColor in double_mottled_colors]
mottled_barberpoled_cord_values = [aColor[1] for aColor in mottled_barberpoled_colors]
double_barberpoled_cord_values = [aColor[1] for aColor in double_barberpoled_colors]
num_solids = len(solid_colors)
num_mottled = len(mottled_colors)
num_barberpoles = len(barberpole_colors)
num_double_mottled = len(double_mottled_colors)
num_mottled_barberpoled = len(mottled_barberpoled_colors)
num_double_barberpoled = len(double_barberpoled_colors)
from statistics import mean, stdev
print(f" {num_solids=: 6.0f} - Average cord value={mean(solid_cord_values): 4.0f} with Std_dev={stdev(solid_cord_values): 5.0f}")
print(f" {num_mottled=: 6.0f} - Average cord value={mean(mottled_cord_values): 4.0f} with Std_dev={stdev(mottled_cord_values): 5.0f}")
print(f" {num_barberpoles=: 6.0f} - Average cord value={mean(barberpole_cord_values): 4.0f} with Std_dev={stdev(barberpole_cord_values): 5.0f}")
print(f" {num_double_mottled=: 6.0f} - Average cord value={mean(double_mottled_cord_values): 4.0f} with Std_dev={stdev(double_mottled_cord_values): 5.0f}")
print(f"{num_mottled_barberpoled=: 6.0f} - Average cord value={mean(mottled_barberpoled_cord_values): 4.0f} with Std_dev={stdev(mottled_barberpoled_cord_values): 5.0f}")
print(f" {num_double_barberpoled=: 6.0f} - Average cord value={mean(double_barberpoled_cord_values): 4.0f} with Std_dev={stdev(double_barberpoled_cord_values): 5.0f}")
num_solids= 43926 - Average cord value= 165 with Std_dev= 2494
num_mottled= 11306 - Average cord value= 102 with Std_dev= 881
num_barberpoles= 2329 - Average cord value= 118 with Std_dev= 748
num_double_mottled= 403 - Average cord value= 100 with Std_dev= 389
num_mottled_barberpoled= 68 - Average cord value= 32 with Std_dev= 122
num_double_barberpoled= 29 - Average cord value= 6 with Std_dev= 21