@@ -0,0 +1,1005 @@
+## function to calculate a N0 from an Nb an Nb/Nc Ratio and a lifetable%0A#praram Nb:  the desired Nb%0A#param NbNcRatio: the ratio Nb/Nc%0A#param maleSurvival: a list of the male survival rates for each age%0A#param femaleSurvival: a list of the female survival rates for each age%0A#param MRatio: the percentage of males in the recruitment cohort represented as a float such that 0%3CMRatio%3C1%0A%0Adef calcN0(Nb, NbNcRatio, maleSurvival, femaleSurvial, MRatio):%0A    FRatio = 1-MRatio%0A    Nc = Nb/NbNcRatio%0A    currentMaleProp=MRatio%0A    currentFemaleProp= FRatio%0A    cumPopPorp = 1%0A    #Assumes male and female survivals have same length%0A    for age in range(len(maleSurvival)):%0A        #calcualte new male Ratio%0A        currentMaleProp = currentMaleProp*maleSurvival%5Bage%5D%0A        #calculate new female ratio%0A        currentFemaleProp = currentFemaleProp*femaleSurvial%5Bage%5D%0A        #add to cumulative%0A        cumPopPorp+=currentMaleProp%0A        cumPopPorp+= currentFemaleProp%0A    #calulate N0%0A    N0 = Nc/cumPopPorp%0A%0A%0A%0A

N0 calcualtion def