-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Deme.size_at() to compute the deme size at a given time.
Closes #312.
- Loading branch information
1 parent
083dcea
commit a9db443
Showing
5 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pathlib | ||
import functools | ||
|
||
import demes | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def example_files(): | ||
cwd = pathlib.Path(__file__).parent.resolve() | ||
example_dir = cwd / "../examples" | ||
files = list(example_dir.glob("**/*.yaml")) | ||
files += list(example_dir.glob("**/*.yml")) | ||
assert len(files) > 1 | ||
return files | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def example_graphs(): | ||
return [demes.load(fn) for fn in example_files()] | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def example_demes(): | ||
return [deme for graph in example_graphs() for deme in graph.demes] |
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