-
Notifications
You must be signed in to change notification settings - Fork 76
adding time slice to ts.samples() #1700
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
A few questions:
|
59d4682
to
f36fc0b
Compare
LGTM, thanks @mufernando!
|
I agree... except, how do we deal with the probably most common use for this, which is to get everyone alive at a given time (eg 0.0)? For that most people would probably try One option would be to make the argument I agree about the testing, and be sure to include some times like |
f36fc0b
to
7e84ef0
Compare
I agree with @petrelharp that one of the most used cases would be to look at a single time point (t=0), so I went ahead and added two new parameters I never seem to know exactly how to test on a single known answer, so I did the next best thing (that I could think of) which was to re-implement the behavior independently using a simple for loop instead of numpy. |
ah, also unsure whether theses tests should be where they are within |
Codecov Report
@@ Coverage Diff @@
## main #1700 +/- ##
==========================================
+ Coverage 93.36% 93.79% +0.42%
==========================================
Files 27 27
Lines 24235 23590 -645
Branches 1089 1089
==========================================
- Hits 22627 22126 -501
+ Misses 1573 1429 -144
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Looks good @mufernando. I'm not sure there's much point in having
That seems straightforward enough? |
Done! waiting for a review and then I can squash and rebase. |
LGTM! I added a few more tests, including one where we build a simple explicit tree sequence. |
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.
LGTM, some minor changes in how we handle the type polymorphism suggested.
We should add some simple tests to make sure that numpy arrays are supported as input. I.e, something like
x = np.array([1, 2])
ts.samples(time=x[0]) # time == 1
ts.samples(time=x) # time between 1 and 2
Updated to work with numpy arrays (including 0d and (1,) arrays). Added some tests with these types of array also. |
ce9fc27
to
cf8829e
Compare
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.
LGTM, thanks @mufernando. One final comment about using parametrize in tests rather than loops to get better visibility on test examples.
cf8829e
to
aece147
Compare
I think we are ready to merge! Thanks you all! |
Sorry, one more thing! (see comments) |
aece147
to
9677a97
Compare
Fixed it! |
9677a97
to
04d2458
Compare
04d2458
to
1efee21
Compare
Description
WIP
Fixes #1692
PR Checklist: