Code
# Khipus w/Broken Primaries= 156
Let’s identify all khipus with primary cords that are known to be broken (i.e they have a beginning or termination that is broken or cut). This may be useful in identifying “orphaned khipu”, khipu which have been split and are now identified as two separate khipu.
# Khipus w/Broken Primaries= 156
We can count the number of broken cords by checking the cord termination. Note that this count does not include khipus with loose strings, that have become detached from their khipu.
(khipu_dict, all_khipus) = kamayuq.fetch_khipus()
def num_broken_cords(aKhipu):
return len([aCord for aCord in aKhipu.cc_cords() if aCord.is_broken()])
broken_cord_khipus = [(aKhipu.name(), num_broken_cords(aKhipu)) for aKhipu in all_khipus if num_broken_cords(aKhipu) > 0]
broken_cord_khipus = dict(sorted(broken_cord_khipus, key=lambda x: x[1], reverse=True))
print(f"# Khipus w/Broken Cords = {len(broken_cord_khipus)}")
# Khipus w/Broken Cords = 523
As an example, of how incomplete most khipus are let’s look at top cord khipus and see how many of them are incomplete.
from fieldmark_khipu_summary import Fieldmark_TopCords
aFieldmark = Fieldmark_TopCords()
fieldmark_dataframe = aFieldmark.dataframes[0].dataframe
top_cords_df = fieldmark_dataframe[fieldmark_dataframe.num_top_cords > 0]
top_cord_khipus = top_cords_df.kfg_name.tolist()
top_cords_df['broken_cords'] = [broken_cord_khipus.get(aKhipu,0) for aKhipu in top_cord_khipus]
top_cords_df['broken_primary'] = [1 if khipu_dict[aKhipu].primary_cord.is_broken() else 0 for aKhipu in top_cord_khipus]
broken_top_cords_mask = [(item[0]>0 or item[1]>0) for item in zip(top_cords_df['broken_cords'].to_list(), top_cords_df['broken_primary'].to_list())]
broken_top_cords_df = top_cords_df[['kfg_name', 'num_cords', 'num_top_cords', 'broken_cords', 'broken_primary']]
broken_top_cords_df.sort_values(['num_top_cords'], ascending=[False]);
print(f"# Khipus w/Top Cords = {len(top_cords_df)}")
num_broken_primary_top_cord_khipus = sum([(num_broken > 0) for num_broken in broken_top_cords_df['broken_primary'].to_list()])
print(f"# Top Cord Khipus w/Broken Primaries = {num_broken_primary_top_cord_khipus}")
num_broken_cord_top_cord_khipus = sum([(num_broken > 0) for num_broken in broken_top_cords_df['broken_cords'].to_list()])
print(f"# Top Cord Khipus w/Broken Cords = {num_broken_cord_top_cord_khipus}")
kfg_name | num_cords | num_top_cords | broken_cords | broken_primary | |
---|---|---|---|---|---|
272 | AS006 | 92 | 28 | 8 | 0 |
51 | UR119 | 304 | 24 | 44 | 1 |
53 | AS066 | 172 | 24 | 18 | 0 |
55 | UR118 | 321 | 22 | 51 | 0 |
79 | UR149 | 256 | 17 | 115 | 1 |
... | ... | ... | ... | ... | ... |
6 | UR001 | 572 | 1 | 11 | 0 |
441 | AS004 | 22 | 1 | 0 | 0 |
145 | UR255 | 89 | 1 | 17 | 0 |
131 | AS013 | 90 | 1 | 31 | 1 |
257 | UR048 | 61 | 1 | 13 | 0 |
# Khipus w/Top Cords = 49
# Top Cord Khipus w/Broken Primaries = 15
# Top Cord Khipus w/Broken Cords = 44
plotly.offline.init_notebook_mode(connected = False);
fig = px.scatter(broken_top_cords_df,
x='num_top_cords', y='broken_cords',
hover_name='kfg_name', hover_data=['num_cords', 'num_top_cords', 'broken_cords', 'broken_primary'],
size="num_cords",
color='broken_primary', color_continuous_scale=['#3c3fff', '#ff3030',],
title=f"<b>Broken Top Cords</b> - Red=BrokenPrimary, Size=#Cords",
width=944, height=944).update_coloraxes(showscale=False).show()