rmjarvis / TreeCorr

Code for efficiently computing 2-point and 3-point correlation functions. For documentation, go to
http://rmjarvis.github.io/TreeCorr/
Other
99 stars 37 forks source link

Require npatch when patch is an integer. #150

Closed rmjarvis closed 2 years ago

rmjarvis commented 2 years ago

@myamamoto26 ran into an error, which was my fault because I failed to tell him the right syntax for setting a catalog to have a single patch number. (I.e. one of 200 files, each of which represents a different patch.) The problem is that for this to work correctly, TreeCorr (usually) needs to know the total number of patches that the given file is a part of. So you need to include npatch=200, which I had neglected.

This PR mostly just adds a better error message for whenever users try to set patch=i without including npatch, rather than the fairly cryptic error that Masa got. However, it is officially an API change, since there were use cases where TreeCorr could figure out npatch without it being provided explicitly. So now those uses require setting npatch, when they didn't used to require it.

That seems worth it to me, since it's a very small burden on the user in those cases. (They would necessarily know what npatch is in those use cases, so it would be easy to add to the Catalog construction.) But it means that this can't be considered a bugfix. It will have to wait until the next minor release series, 4.3.