From 580b09a562ebba6edf83d3602cecef7bc8967925 Mon Sep 17 00:00:00 2001 From: "L.A. Perez" Date: Tue, 5 Jan 2021 16:54:41 -0500 Subject: [PATCH] Removed independent volume check in vpf.py (#238) * Removed independent volume check in vpf.py Following the discussion in issue #237 and after conversations with LGarrison, I've completely removed the check that confirmed that the volume inhabited by the dropped spheres was less than the volume of the sample. This check was unnecessary for the VPF to run, and actively discouraged the oversampling of the sample volume with test spheres that one needs to precisely measure the VPF at a given radius. * Update vpf.py Without the check of independent volumes, there's no need to overtly calculate the volume the samples inhabit. * Update CHANGES.rst Updated 2.4.0 with this new enhancement to theory.vpf * Update CHANGES.rst I promise I can type! * Tweaked wording @laperezNYC Tweaked the wording a bit. If this looks acceptable to you, then I will merge in the PR Co-authored-by: Manodeep Sinha --- CHANGES.rst | 4 ++++ Corrfunc/theory/vpf.py | 16 ---------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1b2f128a..0b98413b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,10 @@ New features 2.4.0 (upcoming) ================== +Enhancements +------------ +- In the theoretical VPF calculation (``theory.vpf``), the total volume of the random spheres can now exceed the volume of the sample [#238] + Bug fixes --------- - Fix Python reference leak to results struct [#229] diff --git a/Corrfunc/theory/vpf.py b/Corrfunc/theory/vpf.py index e5cda955..ce659756 100644 --- a/Corrfunc/theory/vpf.py +++ b/Corrfunc/theory/vpf.py @@ -196,22 +196,6 @@ def vpf(rmax, nbins, nspheres, numpN, seed, msg = "Number of counts-in-cells wanted must be at least 1" raise ValueError(msg) - if boxsize > 0.0: - volume = boxsize * boxsize * boxsize - else: - volume = (max(X) - min(X)) * \ - (max(Y) - min(Y)) * \ - (max(Z) - min(Z)) - - volume_sphere = 4. / 3. * pi * rmax * rmax * rmax - if nspheres * volume_sphere > volume: - msg = "There are not as many independent volumes in the "\ - "requested particle distribution. Num. spheres = {0} "\ - "rmax = {1} => effective volume = {2}.\nVolume of particles ="\ - "{3}. Reduce rmax or Nspheres"\ - .format(nspheres, rmax, nspheres * volume_sphere, volume) - raise ValueError(msg) - # Ensure all input arrays are native endian X, Y, Z = [convert_to_native_endian(arr, warn=True) for arr in [X, Y, Z]]