def getSamplingTimeBasedOnFreq(sim,phase,samplingWin=50): carrier_freq=[0.1,0.5,0.9][phase-1] a= np.where(sim.X[:,sim.siteUnderSelection,:].mean(1)>carrier_freq)[0] ft=sim.getTrueGenerationTimes().max() if len(a): t= sim.getTrueGenerationTimes()[np.where(sim.X[:,sim.siteUnderSelection,:].mean(1)>carrier_freq)[0].min()] else: t=sim.getTrueGenerationTimes().max() return min(t,ft-samplingWin)
def Load(s=0.1, experimentID=0, nu0=0.005, numReplicates=3, step=10, ModelName='TimeSeries', samplingWindow=50, L=50000, depthRate=30): if not s: nu0=0.005 sim = Simulation.load(s=s, experimentID=experimentID % 100, nu0=nu0, numReplicates=numReplicates, step=step, ExperimentName=ModelName, All=True, L=L, replicates=range(numReplicates), depthRate=depthRate) sim.experimentID=experimentID startGen=0 sim.setSamplingTimes(maxGeneration=min(startGen+samplingWindow,sim.getTrueGenerationTimes()[-1]),step=step,startGeneration=startGen) sim.createDF() return sim