manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
165 stars 50 forks source link

Require boxsize if periodic=True #199

Closed lgarrison closed 3 years ago

lgarrison commented 5 years ago

From #198, require the user to specify boxsize if using periodic=True. I can't imagine a situation where the user would want automatic detection of the particle extent, because that will nearly always be off by a small amount.

If the user still wants that behavior for some reason, boxsize=0. will still trigger it. That was the old Python default value.

pep8speaks commented 5 years ago

Hello @lgarrison! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2021-06-09 17:57:16 UTC
manodeep commented 4 years ago

@lgarrison A check will need to be added to the API as well so that boxsize is required even when using the static library interface.

Since this is a functional change, should we milestone it for v2.4 instead of v2.3.2?

lgarrison commented 4 years ago

Okay, I'll take a look at the static interfaces. I actually think some of them don't even accept a boxsize at all right now! Versioning it as 2.4 is fine with me.

manodeep commented 4 years ago

That's true -- there is no option to pass the boxsize at the command-line. However, any external C code could set the options->boxsize and that value would be used within the API. Perhaps, we could instantiate boxsize to be negative within defs.h and that would force the user/us to set the value correctly.

On a related note, what do you think about renaming defs.h to corrfunc.h (or corrfunc/core.h), and then splitting off the contents within defs.h into separate header files?

manodeep commented 4 years ago

@lgarrison The checks might need to be tweaked a little. Within the main functions, there needs to be a check for #ifdef PERIODIC, and then boxsize will become a required parameter. The PrintHelp() function will need to be updated accordingly as well. Rest of the implementation looks good.

lgarrison commented 4 years ago

We could add #ifdef PERIODIC for boxsize, but that complicates the argument parsing, since we have 4 scenarios instead of 2 (periodic & not, and parallel & not). I am in favor of always requiring boxsize and having it be a no-op in the case of no periodicity. That makes the command line interface not change when recompiling with different options, which I think is desirable. And it mirrors the Python interface, where boxsize can be specified but only has an effect with periodic=True.

manodeep commented 4 years ago

Sounds good - agree with your logic about keeping it simple. We are milestoning this for v2.4 with a (minor) change in calling convention - so the versioning is also fine.

manodeep commented 4 years ago

Oooo I actually did a review!

lgarrison commented 4 years ago

Now that 2.3.2 is out, I think this can be merged.

lgarrison commented 3 years ago

@manodeep, the GitHub CI errors seem to be an error in the environment setup, rather than the code itself. Following the instructions here, I am updating the CI file. We'll see if that helps!

lgarrison commented 3 years ago

I think this is just about ready to merge. Want to do one last review? The student who originally asked me about the VPF is going to make a PR for that change, then we can get the ball rolling on the 2.4.0 release.

manodeep commented 3 years ago

Took another look at the code and added one comment about the version. Plus, there is the previous comment about the boxsize=0.0/None/boxsize - should we have two sets of tests to make sure that the documented boxsize behaviour works? We can check to reproduce the old correct results with boxsize=0.0, and the new results with boxsize=boxsize. What do you think?

lgarrison commented 3 years ago

Hmm... I think I'm in favor of saying the boxsize=0. behavior is deprecated; I believe it is essentially always wrong to use! So probably not worth testing, unless we want to be very complete.

Also, I am looking for your new review comment, but I cannot find it! Which line was it at?

manodeep commented 3 years ago

Heh - I don't think I had submitted the review! Oops

manodeep commented 3 years ago

If we are thinking of merging this in, perhaps would be good to have a think on how to accommodate #247

lgarrison commented 3 years ago

Everything look okay with this PR? I think I am not going to tackle #247 right now, but will probably revisit it in a few months.

manodeep commented 3 years ago

Sorry, it's taking me a while - I am currently swamped! I will do the review as soon as I have a second but will likely be next week at the earliest

lgarrison commented 3 years ago

Thanks for the comments; I agree moving boxsize next to periodic is an improvement.

What do you think, ready to merge?

manodeep commented 3 years ago

Thanks for the changes. Yup - ready to merge