In [21]:
import sys
sys.path.append('..')

In [71]:
import bz2
from collections import defaultdict
import random

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [3]:
import trout
reps = 20
project = 'trout'
start_cycle = 50

In [67]:
def calc_pyr(parents):
    full_sibs_cnt = defaultdict(int)
    for parents, ofs in parents.items():
        nofs = len(ofs)
        full_sibs_cnt[nofs - 1] += nofs
    return full_sibs_cnt

def add_dict(d1, d2):
    for k, v in d2.items():
        d1[k] += v

def compute_pyr(project, N0, model, rep):
    sibs = []
    unrel = []
    f = bz2.open('../data/%s/%d%s%d.sim.bz2' % (project, N0, model, rep), 'rt', encoding='utf8')
    curr_cycle = 0
    pyr = defaultdict(int)
    for l in f:
        toks = l.rstrip().split(' ')
        cycle, rep, ind, sex, father, mother, age = tuple([int(x) for x in toks])
        if cycle < start_cycle or age > 1:
            continue
        if cycle > curr_cycle:
            if curr_cycle != 0:
                my_pyr = calc_pyr(parents)
                add_dict(pyr, my_pyr)
            parents = defaultdict(list)
            curr_cycle = cycle
        parents[(father, mother)].append(ind)
    my_pyr = calc_pyr(parents)
    add_dict(pyr, my_pyr)
    return pyr

def calc_frac_sibs(parents, samp_size):
    all_inds = []
    parent_count = defaultdict(int)
    for inds in parents.values():
        all_inds.extend(inds)
    samp_inds = random.sample(all_inds, samp_size)
    for ind in samp_inds:
        for my_parents, inds in parents.items():
            if ind in inds:
                parent_count[my_parents] += 1
    unrels = 0
    rels = 0
    for parents, cnt in parent_count.items():
        if cnt == 1:
            unrels += 1
        else:
            rels += cnt
    return rels / samp_size

def compute_sibs(project, N0, model, rep, samp_size):
    f = bz2.open('../data/%s/%d%s%d.sim.bz2' % (project, N0, model, rep), 'rt', encoding='utf8')
    curr_cycle = 0
    frac_sibs = []
    for l in f:
        toks = l.rstrip().split(' ')
        cycle, rep, ind, sex, father, mother, age = tuple([int(x) for x in toks])
        if cycle < start_cycle or age > 1:
            continue
        if cycle > curr_cycle:
            if curr_cycle != 0:
                frac_sibs.append(calc_frac_sibs(parents, samp_size))
            parents = defaultdict(list)
            curr_cycle = cycle
        parents[(father, mother)].append(ind)
    frac_sibs.append(calc_frac_sibs(parents, samp_size))
    return frac_sibs

In [68]:
def plot_pyr(ax, pyr):
    nsibs = list(pyr.keys())
    nsibs.sort()
    tot_num = sum(pyr.values())
    cnt = []
    for i, sibs in enumerate(nsibs):
        if i >= 5:
            cnt[4] += pyr[sibs] / tot_num
        else:
            cnt.append(pyr[sibs] / tot_num)
    print(nsibs, cnt,min([len(nsibs), 5]) )
    ax.bar(nsibs[:min([len(nsibs), 5])], cnt)

In [69]:
models = list(trout.Nbs.keys())
models.sort()

In [77]:
for samp_size in [25, 50]:
    for model, N0 in models:
        Nb = trout.Nbs[(model, N0)]
        frac_sibs = compute_sibs(project, N0, model, 0, samp_size)
        Nb = trout.Nbs[(model, N0)]
        print(samp_size, model, Nb, 100 * np.mean(frac_sibs))


25 bullpred 50 4.41684210526
25 bullpred 100 0.989473684211
25 bullpred 200 0.185263157895
25 bullt2 10 49.6884210526
25 bullt2 20 19.2378947368
25 bullt2 30 9.71368421053
25 bullt2 40 5.46947368421
25 bullt2 50 3.47789473684
25 bullt2 75 1.6
25 bullt2 100 0.934736842105
25 bulltrout 25 15.4021052632
25 bulltrout 50 4.40842105263
25 bulltrout 100 0.985263157895
25 bulltrout 200 0.227368421053
25 fraley 50 3.69684210526
25 fraley 100 0.922105263158
25 mosquito 25 18.4347474747
25 mosquito 40 7.04242424242
25 mosquito 50 4.27151515152
25 mosquito 100 0.962424242424
25 shepard 50 4.04210526316
25 shepard 100 0.909473684211
25 synseaweed 20 25.8884848485
25 synseaweed 40 7.15717171717
25 synseaweed 50 4.56161616162
25 synseaweed 100 1.06666666667
25 wfrog 25 16.3957894737
25 wfrog 50 3.89473684211
25 wfrog 100 1.00210526316
50 bullpred 50 7.88
50 bullpred 100 2.04421052632
50 bullpred 200 0.48
50 bullt2 10 68.2547368421
50 bullt2 20 32.8547368421
50 bullt2 30 17.4063157895
50 bullt2 40 10.6442105263
50 bullt2 50 7.40421052632
50 bullt2 75 3.43157894737
50 bullt2 100 1.92842105263
50 bulltrout 25 27.4168421053
50 bulltrout 50 8.33684210526
50 bulltrout 100 1.92421052632
50 bulltrout 200 0.494736842105
50 fraley 50 7.39578947368
50 fraley 100 1.88
50 mosquito 25 33.1236363636
50 mosquito 40 13.9042424242
50 mosquito 50 8.74787878788
50 mosquito 100 2.08
50 shepard 50 8.09473684211
50 shepard 100 1.94315789474
50 synseaweed 20 42.5624242424
50 synseaweed 40 13.7422222222
50 synseaweed 50 8.79272727273
50 synseaweed 100 2.12484848485
50 wfrog 25 30.28
50 wfrog 50 7.73263157895
50 wfrog 100 2.10526315789

In [45]:
print(len(trout.Nbs))
fig, axs = plt.subplots(5, 6, figsize=(26, 18), sharey=True)
cnt = 0
for model, N0 in models:
    #if model == 'bullt2':
    #    continue
    Nb = trout.Nbs[(model, N0)]
    pyr = compute_pyr(project, N0, model, 0)
    i = cnt % 5
    j = cnt // 5
    axs[i, j].set_title('%s %d' % (model, Nb))
    plot_pyr(axs[i, j], pyr)
    print(model, Nb, comps, pyr)
    cnt += 1


29
[0, 1, 2, 3, 4, 5, 6, 7] [0.7476023391812866, 0.19730437204121415, 0.043909774436090225, 0.008732943469785575, 0.002450570871623503] 5
bullpred 50 352380 defaultdict(<class 'int'>, {0: 134232, 1: 35426, 2: 7884, 3: 1568, 4: 345, 5: 66, 6: 21, 7: 8})
[0, 1, 2, 3, 4] [0.8600524934383202, 0.12327669567619837, 0.014537919602154994, 0.0018566100290095316, 0.0002762812543168946] 5
bullpred 100 352380 defaultdict(<class 'int'>, {0: 311296, 1: 44620, 2: 5262, 3: 672, 4: 100})
[0, 1, 2, 3, 4] [0.9257764017887857, 0.06951221190230478, 0.004396284829721362, 0.0003082215342277262, 6.879944960440316e-06] 5
bullpred 200 352380 defaultdict(<class 'int'>, {0: 672808, 1: 50518, 2: 3195, 3: 224, 4: 5})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 118, 119, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 136, 138, 140, 142, 145, 147, 148, 149, 150, 151, 154, 155, 157, 158, 161, 169, 170, 171, 174, 177, 178, 179, 180, 195, 200, 202, 220, 229, 230, 237, 305, 505] [0.006041340976202883, 0.016529442417926005, 0.027389265242313707, 0.0348097967691506, 0.915230154594407] 5
bullt2 10 352380 defaultdict(<class 'int'>, {0: 3478, 1: 9516, 2: 15768, 3: 20040, 4: 21890, 5: 24144, 6: 24388, 7: 24304, 8: 21573, 9: 21390, 10: 19569, 11: 19212, 12: 17498, 13: 16926, 14: 16035, 15: 15200, 16: 15572, 17: 12852, 18: 12046, 19: 11820, 20: 11067, 21: 10340, 22: 10189, 23: 9096, 24: 9325, 25: 7384, 26: 8181, 27: 8344, 28: 7105, 29: 6090, 30: 6479, 31: 6272, 32: 5643, 33: 4998, 34: 3955, 35: 4428, 36: 3626, 37: 4826, 38: 3393, 39: 3960, 40: 3321, 41: 3864, 42: 3870, 43: 3256, 44: 3015, 45: 2806, 46: 2350, 47: 2208, 48: 2352, 49: 2250, 50: 2550, 51: 2028, 52: 2438, 53: 1458, 54: 1870, 55: 1792, 56: 1767, 57: 1392, 58: 1534, 59: 1320, 60: 1342, 61: 1178, 62: 1134, 63: 1408, 64: 1300, 65: 1122, 66: 1407, 67: 884, 68: 483, 69: 1260, 70: 1633, 71: 1008, 72: 1168, 73: 888, 74: 1125, 75: 380, 76: 847, 77: 1092, 78: 869, 79: 880, 80: 891, 81: 738, 82: 664, 83: 504, 84: 1190, 85: 946, 86: 783, 87: 264, 88: 356, 89: 450, 90: 728, 91: 736, 92: 744, 93: 376, 94: 475, 95: 672, 96: 291, 97: 196, 98: 297, 99: 400, 100: 404, 101: 102, 102: 515, 103: 520, 104: 315, 105: 318, 106: 428, 107: 648, 108: 109, 109: 660, 110: 222, 111: 224, 112: 113, 113: 342, 114: 345, 115: 696, 116: 351, 118: 357, 119: 120, 121: 244, 122: 246, 123: 248, 124: 125, 126: 127, 127: 384, 128: 129, 129: 260, 130: 131, 131: 132, 132: 665, 133: 268, 134: 135, 136: 137, 138: 139, 140: 141, 142: 286, 145: 438, 147: 148, 148: 149, 149: 450, 150: 302, 151: 456, 154: 155, 155: 156, 157: 158, 158: 159, 161: 162, 169: 170, 170: 342, 171: 172, 174: 175, 177: 178, 178: 179, 179: 180, 180: 181, 195: 196, 200: 201, 202: 203, 305: 306, 220: 221, 229: 230, 230: 231, 237: 238, 505: 506})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 109, 113, 114, 116, 118, 119, 122, 129, 134, 145] [0.027945894390011272, 0.05984392612503252, 0.07775340327755137, 0.07911904968351686, 0.7553377265238876] 5
bullt2 20 352380 defaultdict(<class 'int'>, {0: 32230, 1: 69018, 2: 89673, 3: 91248, 4: 84765, 5: 75786, 6: 68208, 7: 59888, 8: 54333, 9: 48430, 10: 43395, 11: 38820, 12: 33189, 13: 30814, 14: 27630, 15: 23936, 16: 21896, 17: 20628, 18: 17822, 19: 15940, 20: 13860, 21: 13046, 22: 12259, 23: 10440, 24: 9100, 25: 9230, 26: 7749, 27: 7616, 28: 7192, 29: 6150, 30: 5208, 31: 5632, 32: 6105, 33: 4896, 34: 5285, 35: 4320, 36: 3885, 37: 4560, 38: 4329, 39: 3640, 40: 3034, 41: 2772, 42: 3311, 43: 2552, 44: 2610, 45: 2622, 46: 2679, 47: 2304, 48: 2499, 49: 1850, 50: 1479, 51: 1976, 52: 1855, 53: 1512, 54: 2035, 55: 1176, 56: 1026, 57: 1508, 58: 1829, 59: 1440, 60: 915, 61: 1364, 62: 693, 63: 1088, 64: 520, 65: 462, 66: 871, 67: 544, 68: 552, 69: 630, 70: 568, 71: 648, 72: 438, 73: 740, 74: 300, 75: 836, 76: 462, 77: 156, 78: 237, 79: 720, 80: 405, 81: 246, 82: 249, 83: 252, 84: 510, 85: 86, 86: 435, 87: 616, 88: 178, 89: 90, 90: 182, 91: 184, 92: 93, 93: 94, 94: 380, 95: 192, 96: 97, 97: 98, 98: 99, 100: 202, 102: 206, 105: 106, 106: 107, 109: 110, 113: 114, 114: 115, 116: 117, 118: 119, 119: 120, 122: 123, 129: 130, 134: 135, 145: 146})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 93, 95, 96] [0.060966549194060894, 0.10518227511699116, 0.11169276099139176, 0.1009486394361315, 0.621209775261425] 5
bullt2 30 352380 defaultdict(<class 'int'>, {0: 105527, 1: 182060, 2: 193329, 3: 174732, 4: 149170, 5: 125112, 6: 105574, 7: 90680, 8: 75051, 9: 64290, 10: 54219, 11: 47148, 12: 39754, 13: 33054, 14: 27495, 15: 24544, 16: 22559, 17: 19836, 18: 16720, 19: 15700, 20: 13587, 21: 12078, 22: 11454, 23: 9624, 24: 9125, 25: 8814, 26: 8424, 27: 6608, 28: 6525, 29: 5670, 30: 5766, 31: 4608, 32: 4752, 33: 3672, 34: 3220, 35: 3744, 36: 3034, 37: 3154, 38: 3198, 39: 3160, 40: 2050, 41: 2310, 42: 2150, 43: 2244, 44: 2430, 45: 2254, 46: 2021, 47: 1584, 48: 1421, 49: 1450, 50: 1122, 51: 1092, 52: 689, 53: 756, 54: 385, 55: 840, 56: 570, 57: 522, 58: 531, 59: 660, 60: 610, 61: 558, 62: 378, 63: 512, 64: 325, 65: 396, 66: 268, 67: 136, 68: 414, 69: 490, 70: 142, 71: 72, 72: 73, 73: 222, 74: 150, 75: 380, 76: 231, 77: 78, 78: 395, 79: 80, 80: 81, 81: 246, 82: 83, 83: 84, 85: 86, 86: 87, 87: 88, 93: 94, 95: 192, 96: 97})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 68, 70, 80] [0.09754472494429663, 0.1430869405325892, 0.1326679213446687, 0.10945291712635473, 0.5172474960520904] 5
bullt2 40 352380 defaultdict(<class 'int'>, {0: 225460, 1: 330724, 2: 306642, 3: 252984, 4: 206480, 5: 164808, 6: 132370, 7: 106512, 8: 84312, 9: 67680, 10: 54615, 11: 46128, 12: 36465, 13: 33138, 14: 28275, 15: 24112, 16: 21590, 17: 19548, 18: 17613, 19: 15580, 20: 14322, 21: 11968, 22: 12075, 23: 10368, 24: 9100, 25: 8034, 26: 7479, 27: 5992, 28: 6322, 29: 5610, 30: 5208, 31: 4608, 32: 4026, 33: 3876, 34: 3010, 35: 3096, 36: 2331, 37: 1900, 38: 1833, 39: 1720, 40: 1804, 41: 1218, 42: 1333, 43: 836, 44: 945, 45: 828, 46: 1081, 47: 480, 48: 686, 49: 600, 50: 306, 51: 364, 52: 212, 53: 216, 54: 440, 55: 280, 56: 285, 57: 174, 58: 295, 60: 122, 61: 62, 62: 126, 63: 192, 64: 65, 65: 198, 66: 67, 68: 69, 70: 71, 80: 81})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 68] [0.13391308864265927, 0.17024584487534625, 0.1460412049861496, 0.11276038781163435, 0.4370394736842106] 5
bullt2 50 352380 defaultdict(<class 'int'>, {0: 386741, 1: 491670, 2: 421767, 3: 325652, 4: 251010, 5: 192822, 6: 147707, 7: 111600, 8: 86589, 9: 68370, 10: 55825, 11: 44592, 12: 37063, 13: 33460, 14: 30105, 15: 25184, 16: 23307, 17: 19224, 18: 16891, 19: 15100, 20: 13062, 21: 11616, 22: 9798, 23: 9264, 24: 7975, 25: 6760, 26: 6318, 27: 5096, 28: 5191, 29: 3720, 30: 3658, 31: 3040, 32: 2343, 33: 2856, 34: 1925, 35: 2052, 36: 1295, 37: 646, 38: 975, 39: 840, 40: 779, 41: 672, 42: 516, 43: 308, 44: 540, 45: 322, 46: 282, 47: 96, 48: 196, 49: 250, 50: 153, 51: 156, 52: 159, 53: 54, 54: 55, 55: 112, 56: 114, 57: 58, 68: 69})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44] [0.21291543206318095, 0.21538433158471204, 0.15719882400415058, 0.10934271055513922, 0.30515870179281723] 5
bullt2 75 352380 defaultdict(<class 'int'>, {0: 923361, 1: 934068, 2: 681732, 3: 474192, 4: 325735, 5: 225708, 6: 159292, 7: 115856, 8: 89667, 9: 72160, 10: 57079, 11: 48852, 12: 38948, 13: 33334, 14: 29295, 15: 23728, 16: 19261, 17: 16380, 18: 12787, 19: 10900, 20: 8925, 21: 7172, 22: 5957, 23: 4512, 24: 3375, 25: 3380, 26: 2376, 27: 2100, 28: 1653, 29: 1020, 30: 1147, 31: 672, 32: 297, 33: 306, 34: 490, 35: 216, 36: 185, 37: 190, 38: 273, 39: 80, 43: 44, 44: 45})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 36] [0.27932486388384753, 0.24066441966986432, 0.1565455016852476, 0.0982103534698816, 0.22525486129115893] 5
bullt2 100 352380 defaultdict(<class 'int'>, {0: 1616034, 1: 1392364, 2: 905694, 3: 568196, 4: 360605, 5: 234654, 6: 166894, 7: 121456, 8: 92718, 9: 72140, 10: 55660, 11: 44676, 12: 36530, 13: 27552, 14: 22050, 15: 16384, 16: 12818, 17: 10728, 18: 7296, 19: 5360, 20: 4620, 21: 2948, 22: 2438, 23: 1680, 24: 1100, 25: 910, 26: 729, 27: 336, 28: 232, 29: 240, 30: 124, 31: 192, 32: 33, 35: 72, 36: 37})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0.6000734394124847, 0.25400244798041616, 0.09488372093023256, 0.03314565483476132, 0.017894736842105265] 5
bulltrout 25 352380 defaultdict(<class 'int'>, {0: 49026, 1: 20752, 2: 7752, 3: 2708, 4: 985, 5: 324, 6: 77, 7: 48, 8: 18, 9: 10})
[0, 1, 2, 3, 4, 5, 6] [0.7550030248033878, 0.19310344827586207, 0.04088929219600726, 0.009122807017543859, 0.0018814277071990322] 5
bulltrout 50 352380 defaultdict(<class 'int'>, {0: 124802, 1: 31920, 2: 6759, 3: 1508, 4: 255, 5: 42, 6: 14})
[0, 1, 2, 3, 4, 5] [0.8693066944982853, 0.11611152527210378, 0.013132548084091249, 0.001312062024750261, 0.00013717012076934547] 5
bulltrout 100 352380 defaultdict(<class 'int'>, {0: 291522, 1: 38938, 2: 4404, 3: 440, 4: 40, 5: 6})
[0, 1, 2, 3] [0.9310415590167564, 0.06515095593120249, 0.003653945522994021, 0.00015353952904702148] 4
bulltrout 200 352380 defaultdict(<class 'int'>, {0: 630641, 1: 44130, 2: 2475, 3: 104})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 19] [0.476997438651574, 0.26718003800710566, 0.12793687515492028, 0.06129389407584896, 0.06659175411055109] 5
fraley 50 352380 defaultdict(<class 'int'>, {0: 288655, 1: 161684, 2: 77421, 3: 37092, 4: 18410, 5: 9906, 6: 5824, 7: 2856, 8: 1503, 9: 750, 10: 440, 11: 276, 12: 182, 13: 98, 14: 15, 17: 18, 19: 20})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [0.65288032287291, 0.23323778930895314, 0.0750407709414381, 0.025114899925871015, 0.013726216950827774] 5
fraley 100 352380 defaultdict(<class 'int'>, {0: 792662, 1: 283174, 2: 91107, 3: 30492, 4: 11120, 5: 3768, 6: 1211, 7: 424, 8: 99, 9: 10, 10: 33})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 10] [0.4494038423450188, 0.33618934442463855, 0.14428995840760547, 0.04930085165379283, 0.020816003168944344] 5
mosquito 25 352380 defaultdict(<class 'int'>, {0: 226904, 1: 169742, 2: 72852, 3: 24892, 4: 7190, 5: 2130, 6: 805, 7: 280, 8: 72, 10: 33})
[0, 1, 2, 3, 4, 5, 6, 7] [0.614417226153753, 0.29045182362547634, 0.07712574850299402, 0.015126111413536564, 0.0028790903042400047] 5
mosquito 40 352380 defaultdict(<class 'int'>, {0: 507908, 1: 240102, 2: 63756, 3: 12504, 4: 1955, 5: 360, 6: 49, 7: 16})
[0, 1, 2, 3, 4, 5, 6] [0.6816363636363636, 0.2570851370851371, 0.05243578643578643, 0.007772967772967773, 0.0010697450697450697] 5
mosquito 50 352380 defaultdict(<class 'int'>, {0: 708561, 1: 267240, 2: 54507, 3: 8080, 4: 1000, 5: 84, 6: 28})
[0, 1, 2, 3, 4, 5] [0.833211082790522, 0.15120928915321438, 0.014544038516001133, 0.0009968847352024922, 3.870480505994525e-05] 5
mosquito 100 352380 defaultdict(<class 'int'>, {0: 1765241, 1: 320352, 2: 30813, 3: 2112, 4: 70, 5: 12})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [0.47240176464553196, 0.3043890427823946, 0.13594952293013235, 0.05375192366882118, 0.03350774597311994] 5
shepard 50 352380 defaultdict(<class 'int'>, {0: 230225, 1: 148344, 2: 66255, 3: 26196, 4: 10475, 5: 3708, 6: 1428, 7: 480, 8: 135, 9: 60, 10: 44})
[0, 1, 2, 3, 4, 5, 6, 7] [0.6772468063362289, 0.2443924374041901, 0.06154522227899847, 0.013743484925907, 0.003072049054675524] 5
shepard 100 352380 defaultdict(<class 'int'>, {0: 662686, 1: 239138, 2: 60222, 3: 13448, 4: 2520, 5: 408, 6: 70, 7: 8})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20] [0.4404838508542212, 0.2772864446938521, 0.14724279835390947, 0.07063224841002619, 0.06435465768799102] 5
synseaweed 20 352380 defaultdict(<class 'int'>, {0: 176612, 1: 111178, 2: 59037, 3: 28320, 4: 13545, 5: 6312, 6: 3024, 7: 1416, 8: 693, 9: 370, 10: 154, 11: 144, 12: 65, 13: 28, 14: 15, 15: 16, 20: 21})
[0, 1, 2, 3, 4, 5, 6, 7, 8] [0.637719881744272, 0.2532076866223208, 0.08053954175905395, 0.02171470805617147, 0.006818181818181819] 5
synseaweed 40 352380 defaultdict(<class 'int'>, {0: 517701, 1: 205554, 2: 65382, 3: 17628, 4: 4275, 5: 1050, 6: 126, 7: 48, 8: 36})
[0, 1, 2, 3, 4, 5, 6, 7] [0.6991148196945298, 0.22820670472844387, 0.05774264382960035, 0.012171961157468403, 0.0027638705899575462] 5
synseaweed 50 352380 defaultdict(<class 'int'>, {0: 716348, 1: 233832, 2: 59166, 3: 12472, 4: 2335, 5: 426, 6: 63, 7: 8})
[0, 1, 2, 3, 4, 5] [0.8370841112547274, 0.1428110488773996, 0.018061180525635503, 0.0018880750634305136, 0.0001555842788070276] 5
synseaweed 100 352380 defaultdict(<class 'int'>, {0: 1748585, 1: 298318, 2: 37728, 3: 3944, 4: 295, 5: 30})
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [0.37359886201991466, 0.32139402560455194, 0.1791891891891892, 0.07834992887624466, 0.04746799431009958] 5
wfrog 25 352380 defaultdict(<class 'int'>, {0: 52528, 1: 45188, 2: 25194, 3: 11016, 4: 4155, 5: 1608, 6: 518, 7: 232, 8: 99, 9: 40, 10: 22})
[0, 1, 2, 3, 4, 5, 6] [0.6201878433457381, 0.2868119794435584, 0.07586390217969165, 0.014304447988658516, 0.002831827042353358] 5
wfrog 50 352380 defaultdict(<class 'int'>, {0: 174986, 1: 80924, 2: 21405, 3: 4036, 4: 670, 5: 108, 6: 21})
[0, 1, 2, 3, 4, 5] [0.7822551353257515, 0.18933968086044256, 0.025860883364189367, 0.0024191131094066826, 0.00012518734020982103] 5
wfrog 100 352380 defaultdict(<class 'int'>, {0: 443656, 1: 107384, 2: 14667, 3: 1372, 4: 65, 5: 6})

In [19]:
print(len(trout.Nbs), trout.Nbs)


29 {('bullt2', 1214): 20, ('fraley', 637): 50, ('fraley', 1278): 100, ('bullt2', 1822): 30, ('mosquito', 428): 100, ('bullpred', 381): 100, ('shepard', 513): 50, ('bulltrout', 86): 25, ('bullpred', 765): 200, ('wfrog', 597): 100, ('bullt2', 2433): 40, ('bulltrout', 353): 100, ('bullt2', 3040): 50, ('bullt2', 4565): 75, ('bullt2', 6090): 100, ('bulltrout', 713): 200, ('bullpred', 189): 50, ('synseaweed', 207): 50, ('shepard', 1030): 100, ('bullt2', 606): 10, ('mosquito', 102): 25, ('wfrog', 297): 50, ('mosquito', 210): 50, ('bulltrout', 174): 50, ('synseaweed', 164): 40, ('wfrog', 148): 25, ('synseaweed', 422): 100, ('mosquito', 167): 40, ('synseaweed', 81): 20}

In [ ]: