Created
February 9, 2018 20:02
-
-
Save andrewkern/043d9bf5cf83c703e045a65640665049 to your computer and use it in GitHub Desktop.
timing replicates with msprime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import msprime | |
now = time.clock() | |
theta=2 | |
nsamp=100 | |
m = 0.1 | |
numReps=100 | |
for i in list(range(numReps)): | |
ts = msprime.simulate( | |
Ne=1/2, | |
population_configurations=[ | |
msprime.PopulationConfiguration(sample_size=nsamp), | |
msprime.PopulationConfiguration(sample_size=nsamp)], | |
migration_matrix=[[0, m], [m, 0]], | |
mutation_rate=theta / 2) | |
print('time w/o num_reps: {}'.format(str(time.clock()-now))) | |
now = time.clock() | |
ts = msprime.simulate( | |
Ne=1/2, | |
population_configurations=[ | |
msprime.PopulationConfiguration(sample_size=nsamp), | |
msprime.PopulationConfiguration(sample_size=nsamp)], | |
migration_matrix=[[0, m], [m, 0]], | |
mutation_rate=theta / 2, num_replicates=numReps) | |
for tree in ts: | |
pass | |
print('time w/ num_reps: {}'.format(str(time.clock()-now))) | |
#time w/o num_reps: 0.2576809999999998 | |
#time w/ num_reps: 0.03723999999999972 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment