aegis_sim.utilities.analysis.reproduction

 1from aegis_sim.utilities.analysis.survival import get_survivorship
 2
 3
 4def get_fertility_potential(interval_phenotypes, AGE_LIMIT):
 5    # TODO Ensure that you are slicing the phenotype array at right places
 6    # TODO Ensure that fertility is 0 before maturity
 7    fertility = interval_phenotypes.iloc[:, AGE_LIMIT:]
 8    y = fertility
 9    return y
10
11
12def get_fertility(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
13    fertility_potential = get_fertility_potential(interval_phenotypes, AGE_LIMIT)
14    fertility_potential = fertility_potential.T.reset_index(drop=True).T
15    fertility_potential.loc[:, range(0, MATURATION_AGE)] = 0
16    y = fertility_potential
17    return y
18
19
20def get_cumulative_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
21    # https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13289
22    # BUG fertility is 0 before maturity
23    survivorship = get_survivorship(interval_phenotypes).T.reset_index(drop=True).T
24    fertility = get_fertility(interval_phenotypes, MATURATION_AGE).T.reset_index(drop=True).T
25    y = (survivorship * fertility).cumsum(axis=1)
26    return y
27
28
29def get_lifetime_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
30    # BUG fertility is 0 before maturity
31    survivorship = get_survivorship(interval_phenotypes, AGE_LIMIT).T.reset_index(drop=True).T
32    fertility = get_fertility(interval_phenotypes, AGE_LIMIT, MATURATION_AGE).T.reset_index(drop=True).T
33    # y = np.sum((np.array(survivorship) * np.array(fertility)), axis=1)
34    y = (survivorship * fertility).sum(axis=1)
35    return y
def get_fertility_potential(interval_phenotypes, AGE_LIMIT):
 5def get_fertility_potential(interval_phenotypes, AGE_LIMIT):
 6    # TODO Ensure that you are slicing the phenotype array at right places
 7    # TODO Ensure that fertility is 0 before maturity
 8    fertility = interval_phenotypes.iloc[:, AGE_LIMIT:]
 9    y = fertility
10    return y
def get_fertility(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
13def get_fertility(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
14    fertility_potential = get_fertility_potential(interval_phenotypes, AGE_LIMIT)
15    fertility_potential = fertility_potential.T.reset_index(drop=True).T
16    fertility_potential.loc[:, range(0, MATURATION_AGE)] = 0
17    y = fertility_potential
18    return y
def get_cumulative_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
21def get_cumulative_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
22    # https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13289
23    # BUG fertility is 0 before maturity
24    survivorship = get_survivorship(interval_phenotypes).T.reset_index(drop=True).T
25    fertility = get_fertility(interval_phenotypes, MATURATION_AGE).T.reset_index(drop=True).T
26    y = (survivorship * fertility).cumsum(axis=1)
27    return y
def get_lifetime_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
30def get_lifetime_reproduction(interval_phenotypes, AGE_LIMIT, MATURATION_AGE):
31    # BUG fertility is 0 before maturity
32    survivorship = get_survivorship(interval_phenotypes, AGE_LIMIT).T.reset_index(drop=True).T
33    fertility = get_fertility(interval_phenotypes, AGE_LIMIT, MATURATION_AGE).T.reset_index(drop=True).T
34    # y = np.sum((np.array(survivorship) * np.array(fertility)), axis=1)
35    y = (survivorship * fertility).sum(axis=1)
36    return y