Skip to content

Commit

Permalink
Merge pull request #709 from petrelharp/slim_gen
Browse files Browse the repository at this point in the history
set slim generation on tables
  • Loading branch information
grahamgower committed Dec 9, 2020
2 parents 642c668 + 8fdb0de commit 67205fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements/CI/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msprime==0.7.4
attrs==20.3.0
appdirs==1.4.4
humanize==3.1.0
pyslim==0.403
pyslim==0.500
pandas==1.1.4
numpy==1.19.4
scikit-allel==1.3.2
Expand Down
2 changes: 1 addition & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ attrs
appdirs
humanize
pre-commit
pyslim>=0.401
pyslim>=0.500
pandas
numpy
scikit-allel
Expand Down
6 changes: 4 additions & 2 deletions stdpopsim/slim_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,10 +1206,12 @@ def _recap_and_rescale(
# Node times come from SLiM generation numbers, which may have been
# divided by a scaling factor for computational tractability.
tables = ts.dump_tables()
for table in (tables.nodes, tables.migrations):
for table in (tables.nodes, tables.migrations, tables.mutations):
table.time *= slim_scaling_factor
ts_metadata = tables.metadata
ts_metadata["SLiM"]["generation"] *= slim_scaling_factor
tables.metadata = ts_metadata
ts = pyslim.SlimTreeSequence.load_tables(tables)
ts.slim_generation *= slim_scaling_factor

rng = random.Random(seed)
s1, s2 = rng.randrange(1, 2 ** 32), rng.randrange(1, 2 ** 32)
Expand Down

0 comments on commit 67205fb

Please sign in to comment.