Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set generation time #574

Open
hyanwong opened this issue Jul 16, 2024 · 2 comments
Open

Set generation time #574

hyanwong opened this issue Jul 16, 2024 · 2 comments

Comments

@hyanwong
Copy link

I have a model from an ms command line:

d = demes.from_ms("-eN 0.01 0.1 -eN 0.06 1 -eN 0.2 0.5 -eN 1 1 -eN 2 2", N0=1e4)

I would like to convert that demes object to be measured in units of years, with a generation time of 25 years. I see a d.in_generations converter, but nothing to go the other way? What's the best way to do this?

@grahamgower
Copy link
Member

Hey Yan,

This seems like a strange omission, but until now no one has asked for it. Below is a function I wrote to do this for stdpopsim models. It should probably be pulled into demes-python, with appropriate tests. Does this do what you want?

https://github.com/popsim-consortium/stdpopsim/blob/160098560cdf281d833e934c2e74b40b0d9bc5b7/maintenance/convert_to_demes.py#L14-L44

@hyanwong
Copy link
Author

Yep, that looks right to me. Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants