-
Notifications
You must be signed in to change notification settings - Fork 70
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 RateMap.zip(other1, other2,...) method #2876
Comments
I would volunteer to implement this, except I can't think of a clever way to do this in numpy. I've run across this exact problem many times and always end up doing a dumb/slow for loop. If anyone has any ideas on how to use numpy vectorized tricks to do that let me know and I can implement it. |
It would be nice to be able to define a RateMap with left and right intervals so that it automatically converts to the breakpoints representation. Or is this sth we want to do within stdpopsim? |
Since it's returning an iterator I don't think there's any point in trying to be clever, just a simple loop is the right way to go. From the stdpopsim perspective this is fine, because it wants to iterate over the intervals and do Python stuff to them. |
This is a separate issue - can you open one to track with an example of what you'd like to see? |
I agree with this, but if you did want to be clever with numpy, here's how to pre-compute the relevant things:
|
It would be useful to have a method that would combine two or more RateMaps and return an iterator over the distinct intervals at the rates. So, in usage, it would look like
Should be straightforward enough to implement.
The text was updated successfully, but these errors were encountered: