Skip to content

Inconsistent number of pairs between theory.wp and theory.DDrppi #345

@Hoptune

Description

@Hoptune

General information

  • Corrfunc version: 2.5.3
  • platform: Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-215-generic x86_64)
  • installation method (pip/source/other?): pip

Issue description

The number of pairs ("npairs") return by theory.wp and theory.DDrppi is slightly different on large-scales.

Expected behavior

Should be exactly the same.

Actual behavior

They are different on the order of 1e-7 on large-scales.

What have you tried so far?

Tried performing the same calculation but using float32 rather than float64, the inconsistency would be even larger. So I suspect it's due to precision loss during the calculation.

Minimal failing example

import numpy as np
from Corrfunc.theory import DDrppi, wp, DD, xi

testpos = np.load("testpos.npy")

rp_bins = np.logspace(-2, np.log10(30), 16)

boxsize=400
ncpu = 100
pimax = 40

testpos = testpos.astype(np.float64)

wp_res = wp(boxsize, pimax, ncpu, rp_bins, X=testpos[0], Y=testpos[1], Z=testpos[2])

ddrppi_res = DDrppi(1, ncpu, pimax, rp_bins, X1=testpos[0], Y1=testpos[1], Z1=testpos[2], boxsize=boxsize, periodic=True)
ddrppi_in_rpbins = ddrppi_res['npairs'].reshape(rp_bins.size-1, 40).sum(axis=1)

print(wp_res['npairs']), print(ddrppi_in_rpbins), print(wp_res['npairs'] - ddrppi_in_rpbins)

testpos.npy.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions