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 patch_method=local option #169

Closed rmjarvis closed 5 months ago

rmjarvis commented 5 months ago

The Multipole binning requires that all the objects from cat2 and cat3 are present when finishing the calculation for each object (or cell) in cat1. This means that the usual algorithm we use for doing patches doesn't work. You can't add on additional triangles from cross-patch combinations.

So this PR adds a new option to the process functions called patch_method. There are currently two options, 'global' and 'local'. The first one is the current method of doing all possible combinations of 2 or 3 patches separately. This is appropriate for all two-point functions and non-multipole three-point functions.

The new local method is required for LogMultipole, but allowed for all bintypes. It does only a single process_cross call for each patch in cat1, correlating with a slightly larger patch from cat2 and (if 3pt cross) cat3. These expanded patches are larger by the max_sep value for the binning, so the cross calculation will include all pairs or triangles with the first point in cat1.

For two-point correlations, the default is still global, since that tends to produce slightly better results for covariance matrices than the local algorithm. For three-point, the default is also global, unless the binning is LogMultipole, in which case it automatically switches to local, since that's the only valid method.