-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add Deme.size_at() to compute the deme size at a given time. #314
Conversation
Codecov Report
@@ Coverage Diff @@
## main #314 +/- ##
==========================================
+ Coverage 98.15% 98.24% +0.08%
==========================================
Files 8 8
Lines 1573 1595 +22
==========================================
+ Hits 1544 1567 +23
+ Misses 29 28 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good - just a small suggestion for the error message.
:rtype: float | ||
""" | ||
for epoch in self.epochs: | ||
if epoch.start_time >= time >= epoch.end_time: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's the sleep deprivation, but I can't get my head around this condition - shouldn't it be epoch.start_time <= time < epoch.end_time
? As in, we break if the time is within this epoch's interval?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things: (1) start_time > end_time
, so we must have start_time > time >= end_time
. And (2) we also want to accept time=math.inf
, so we check start_time >= time >= end_time
. Given this is in a loop, and the epochs are time-sorted, the start_time == time
condition is only hit for the first epoch, and only if the time is infinity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, I'm thinking backwards in time as usual, thanks, my bad!
Closes #312.