-
Notifications
You must be signed in to change notification settings - Fork 51
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 find_fastest_DDtheta_mocks_bin_refs() function to Corrfunc/mocks/DDtheta_mocks #216
Add find_fastest_DDtheta_mocks_bin_refs() function to Corrfunc/mocks/DDtheta_mocks #216
Conversation
Encountered an error while testing, and am not sure why.
in the argument, locally I get the error
Here is what I have done:
Any suggestions as to why and how I should debug? I have checked by default |
Looks like this PR passes the Travis CI tests. I could continue copying and pasting to relevant modules if everything is okay. |
Hi @kakirastern - thanks for taking a stab. From what I can tell, you have simply copy-pasted the code from the (I am on parental leave for the next week and responses will continue to be slow. Thanks for your patience) |
Hi @manodeep Thanks for the reply! Sorry I took the hint in the original issue to "copy and paste" a bit too literally. I will give it another try soon before the end of the coming weekend. |
Hello @kakirastern! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-04-13 01:43:27 UTC |
Hi @manodeep I have made the changes as suggested. It seemed to have worked, at least on the surface. I have been able to compile and install then test the code successfully. Though I am not sure it is 100% correct. Any feedback would be greatly appreciated. |
Fixed code to pass Codacy/PR Quality Review. |
Thanks - good work! :) I have a couple of suggestions - ideally, the Also, you should add your name to the "author" list in the file. |
Interesting, am seeing the |
Just added my name to the authors' list of the Corrfunc/mocks/DDtheta_mocks file as well, plus re-triggering the Travis CI checks. |
@kakirastern Could you please re-trigger that sub-build that failed? Must have been a transient issue |
Hi @manodeep Sure, have just re-triggered the build. |
I have checked the Travis CI checks are indeed all passing, but for some reason that fact has not been reflected on this page as of now... |
Make modifications as per reviewer suggestion Correct typo in L15 of DDtheta_mocks.py Resolve PEP 8 issues Resolve unused variable error Get rid of unused lines Make changes according to reviewer's suggestions Update in-code example Make changes to conform to PEP 8 standards Add new author name to author list in file Make changes to how three different (link_in_dec, link_in_ra) cases are handled Remove unnecessary continue as it was not properly in loop Modify code to show print statement in L555 where applicable
Just tested more thoroughly again and fixed the bug in the now L555 to print out some info statement for Case 2: if link_in_dec is True:
if link_in_ra is False:
msg3 = "Info: Gridding in the declination only, as link_in_dec " \
"is set to True while link_in_ra is set to False." \
"Thus looping is only needed over the range of " \
"(min, max) bin, with refinements in the declination."
print(msg3) The condition was able to be satisfied when met and the print statement was successfully outputted. For consistency's sake have changed |
Thanks @kakirastern. What I meant for the |
Hi @manodeep Understood. Currently for the |
I have tried for the ( I might have misunderstood something, if that's the case please let me know. In summary, I did something like the following: >>> from __future__ import print_function
>>> import numpy as np
>>> import time
>>> from math import pi
>>> from os.path import dirname, abspath, join as pjoin
>>> import Corrfunc
>>> from Corrfunc.mocks.DDtheta_mocks import find_fastest_DDtheta_mocks_bin_refs
>>> binfile = pjoin(dirname(abspath(Corrfunc.__file__)), "../mocks/tests/", "angular_bins")
>>> N = 100000
>>> nthreads = 4
>>> seed = 42
>>> np.random.seed(seed)
>>> RA1 = np.random.uniform(0.0, 2.0*pi, N)*180.0/pi
>>> cos_theta = np.random.uniform(-1.0, 1.0, N)
>>> DEC1 = 90.0 - np.arccos(cos_theta)*180.0/pi
>>> autocorr = 1
>>> find_fastest_DDtheta_mocks_bin_refs(autocorr, nthreads, binfile, RA1, DEC1, link_in_dec=True, link_in_ra=False, return_runtimes=False)
Info: Gridding in the declination only, as link_in_dec is set to True while link_in_ra is set to False. Thus looping is only needed over the range of (min, max) bin, with refinements in the declination.
Out: (1, 3) |
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.
Thanks again for all your work on this! I have made some comments and (hopefully) a way to reduce the number of repeated lines of code.
Thanks again!
@kakirastern Btw, since we dropped the |
Not a problem! I would like to continue my work on this PR until it is merged, since I am enjoying the process and am learning a lot from the experience. I will work on it a bit more according to your suggestions and get back to you soon. |
Thank you - your continued efforts on this PR are appreciated! |
Added changelog entry for PR. |
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.
@kakirastern I requested one final change, but I am approving the PR regardless. Thank you so much for all your efforts!
@lgarrison Did you want to check if I have missed anything?
@manodeep You are more than welcome! |
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.
Aside from one or two small tweaks, looks good to me! Thanks @kakirastern!
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.
Thanks!
@kakirastern Thank you for your updates. I have made a couple of changes, and once the tests pass, I will merge this PR in. @kakirastern Thanks again for all your efforts on this PR. You are very welcome to look at other sections of the code-base that you might want to contribute to. This PR highlighted that we need a proper contributing guideline. A related (but somewhat advanced) idea would be to create a decorator function that can be applied on individual pair-counters to automagically generates this helper routine to return the faster combination. This decorator would load the pair-counting function source, and create a nested triple loop over Regardless of your choice, thank you again for your contribution! |
@manodeep You are welcome! Yeah, I would be interested in helping out making such a decorator function, but may need some guidance. |
Addresses #97 partially. As the title would suggest, to add the find_fastest_wp_bin_refs() function from Corrfunc/theory/wp.py#L17 to Corrfunc/mocks/DDtheta_mocks.py.