rmjarvis / TreeCorr

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

Add angle_slop parameter #170

Closed rmjarvis closed 4 months ago

rmjarvis commented 4 months ago

One issue that has cropped up from time to time with shear correlations is that there can be some error in the projection directions when the bin size is rather large. This is because when a pair of cells fully fits into a single bin, or nearly does (according to the given bin_slop), there can still be some errors in the accumulated correlation because the shears are all projected to a slightly different direction than they would with the exact calculation.

Previously, there had been no way to reduce this error other than using smaller bins, which can sometimes be impractical. This PR adds a new option to set a maximum angular error that is allowed for any pair of cells being accumulated. The parameter angle_slop sets a maximum angular difference (in radians) between the direction that a pair of cells being accumulated has compared to any of is constituent object pairs.

For scalar correlations (e.g. NN, KK, NK), there is not really any reason to use this parameter. But for shear correlations or other non-spin-0 quantities, it can potentially improve the accuracy when the bin size is relatively large.

The default value for all non-spin-0 quantities is angle_slop = 0.1, which is probably reasonable for most use cases.

Additionally, this PR disconnects the angular splitting calculation from the angular one for the three-point multipole algorithm. With multipole, the bin_slop parameter turns out to be pretty important for accuracy, as the slop between bins seems to move power from the off-diagonal to the diagonal. So for high-accuracy use cases, one may want to lower the bin_slop to 0 or close to 0. Now, that doesn't affect the angular splitting decision, which seems to be less impactful to the final multipole accuracy.