Skip to content

Commit

Permalink
Added the bin refine factors into the theory modules
Browse files Browse the repository at this point in the history
  • Loading branch information
manodeep committed Oct 11, 2016
1 parent bb01aa5 commit 8451c06
Show file tree
Hide file tree
Showing 24 changed files with 718 additions and 183 deletions.
42 changes: 22 additions & 20 deletions Corrfunc/theory/DD.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

def DD(autocorr, nthreads, binfile, X1, Y1, Z1, periodic=True,
X2=None, Y2=None, Z2=None, verbose=False, boxsize=0.0,
output_ravg=False, c_api_timer=False, isa='fastest'):
output_ravg=False, xbin_refine_factor=2, ybin_refine_factor=2,
zbin_refine_factor=1, c_api_timer=False, isa='fastest'):
"""
Calculate the 3-D pair-counts corresponding to the real-space correlation
function, :math:`\\xi(r)`.
Expand Down Expand Up @@ -71,6 +72,10 @@ def DD(autocorr, nthreads, binfile, X1, Y1, Z1, periodic=True,
precision and can not be trusted. If you need accurate ``ravg``
values, then pass in double precision arrays for the particle positions.
(xyz)bin_refine_factor: integer, default is (2,2,1); typically within [1-3]
Controls the refinement on the cell sizes. Can have up to a 20% impact
on runtime.
c_api_timer: boolean (default false)
Boolean flag to measure actual time spent in the C libraries. Here
to allow for benchmarking and scaling studies.
Expand Down Expand Up @@ -159,28 +164,25 @@ def DD(autocorr, nthreads, binfile, X1, Y1, Z1, periodic=True,
msg = "Must pass valid arrays for X2/Y2/Z2 for "\
"computing cross-correlation"
raise ValueError(msg)
else:
X2 = np.empty(1)
Y2 = np.empty(1)
Z2 = np.empty(1)

integer_isa = translate_isa_string_to_enum(isa)
rbinfile, delete_after_use = return_file_with_rbins(binfile)
if autocorr == 1:
extn_results, api_time = DD_extn(autocorr, nthreads, rbinfile,
X1, Y1, Z1,
periodic=periodic,
output_ravg=output_ravg,
verbose=verbose,
boxsize=boxsize,
c_api_timer=c_api_timer,
isa=integer_isa)
else:
extn_results, api_time = DD_extn(autocorr, nthreads, rbinfile,
X1, Y1, Z1,
X2, Y2, Z2,
periodic=periodic,
verbose=verbose,
boxsize=boxsize,
output_ravg=output_ravg,
c_api_timer=c_api_timer,
isa=integer_isa)
extn_results, api_time = DD_extn(autocorr, nthreads, rbinfile,
X1, Y1, Z1,
X2, Y2, Z2,
periodic=periodic,
verbose=verbose,
boxsize=boxsize,
output_ravg=output_ravg,
xbin_refine_factor=xbin_refine_factor,
ybin_refine_factor=ybin_refine_factor,
zbin_refine_factor=zbin_refine_factor,
c_api_timer=c_api_timer,
isa=integer_isa)
if extn_results is None:
msg = "RuntimeError occurred"
raise RuntimeError(msg)
Expand Down
46 changes: 24 additions & 22 deletions Corrfunc/theory/DDrppi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

def DDrppi(autocorr, nthreads, pimax, binfile, X1, Y1, Z1,
periodic=True, X2=None, Y2=None, Z2=None, verbose=False,
boxsize=0.0, output_rpavg=False, c_api_timer=False, isa='fastest'):
boxsize=0.0, output_rpavg=False, xbin_refine_factor=2,
ybin_refine_factor=2, zbin_refine_factor=1,
c_api_timer=False, isa='fastest'):
"""
Calculate the 3-D pair-counts corresponding to the real-space correlation
function, :math:`\\xi(r_p, \pi)` or :math:`\\wp(r_p)`. Pairs which are
Expand Down Expand Up @@ -87,6 +89,10 @@ def DDrppi(autocorr, nthreads, pimax, binfile, X1, Y1, Z1,
precision and can not be trusted. If you need accurate ``rpavg``
values, then pass in double precision arrays for the particle positions.
(xyz)bin_refine_factor: integer, default is (2,2,1); typically within [1-3]
Controls the refinement on the cell sizes. Can have up to a 20% impact
on runtime.
c_api_timer: boolean (default false)
Boolean flag to measure actual time spent in the C libraries. Here
to allow for benchmarking and scaling studies.
Expand Down Expand Up @@ -206,30 +212,26 @@ def DDrppi(autocorr, nthreads, pimax, binfile, X1, Y1, Z1,
msg = "Must pass valid arrays for X2/Y2/Z2 for "\
"computing cross-correlation"
raise ValueError(msg)
else:
X2 = np.empty(1)
Y2 = np.empty(1)
Z2 = np.empty(1)

integer_isa = translate_isa_string_to_enum(isa)
rbinfile, delete_after_use = return_file_with_rbins(binfile)
if autocorr == 1:
extn_results, api_time = DDrppi_extn(autocorr, nthreads,
pimax, rbinfile,
X1, Y1, Z1,
periodic=periodic,
output_rpavg=output_rpavg,
verbose=verbose,
boxsize=boxsize,
c_api_timer=c_api_timer,
isa=integer_isa)
else:
extn_results, api_time = DDrppi_extn(autocorr, nthreads,
pimax, rbinfile,
X1, Y1, Z1,
X2, Y2, Z2,
periodic=periodic,
verbose=verbose,
boxsize=boxsize,
output_rpavg=output_rpavg,
c_api_timer=c_api_timer,
isa=integer_isa)
extn_results, api_time = DDrppi_extn(autocorr, nthreads,
pimax, rbinfile,
X1, Y1, Z1,
X2, Y2, Z2,
periodic=periodic,
verbose=verbose,
boxsize=boxsize,
output_rpavg=output_rpavg,
xbin_refine_factor=xbin_refine_factor,
ybin_refine_factor=ybin_refine_factor,
zbin_refine_factor=zbin_refine_factor,
c_api_timer=c_api_timer,
isa=integer_isa)
if extn_results is None:
msg = "RuntimeError occurred"
raise RuntimeError(msg)
Expand Down
12 changes: 11 additions & 1 deletion Corrfunc/theory/vpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
def vpf(rmax, nbins, nspheres, numpN, seed,
X, Y, Z,
verbose=False, periodic=True, boxsize=0.0,
c_api_timer=False, isa='fastest'):
xbin_refine_factor=1, ybin_refine_factor=1,
zbin_refine_factor=1, c_api_timer=False, isa='fastest'):
"""
Function to compute the counts-in-cells on 3-D real-space points.
Expand Down Expand Up @@ -83,6 +84,12 @@ def vpf(rmax, nbins, nspheres, numpN, seed,
If boxsize is not supplied, then the wrapping is done based on
the maximum difference within each dimension of the X/Y/Z arrays.
(xyz)bin_refine_factor: integer, default is (1,1,1); typically within [1-3]
Controls the refinement on the cell sizes. Can have up to a 20% impact
on runtime. Note, since the counts in spheres calculation is symmetric
in all 3 dimensions, the defaults are different from the clustering
routines.
c_api_timer: boolean (default false)
Boolean flag to measure actual time spent in the C libraries. Here
to allow for benchmarking and scaling studies.
Expand Down Expand Up @@ -198,6 +205,9 @@ def vpf(rmax, nbins, nspheres, numpN, seed,
verbose=verbose,
periodic=periodic,
boxsize=boxsize,
xbin_refine_factor=xbin_refine_factor,
ybin_refine_factor=ybin_refine_factor,
zbin_refine_factor=zbin_refine_factor,
c_api_timer=c_api_timer,
isa=integer_isa)

Expand Down
10 changes: 9 additions & 1 deletion Corrfunc/theory/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@


def wp(boxsize, pimax, nthreads, binfile, X, Y, Z, verbose=False,
output_rpavg=False, c_api_timer=False, isa='fastest'):
output_rpavg=False, xbin_refine_factor=2, ybin_refine_factor=2,
zbin_refine_factor=1, c_api_timer=False, isa='fastest'):
"""
Function to compute the projected correlation function in a
periodic cosmological box. Pairs which are separated by less
Expand Down Expand Up @@ -75,6 +76,10 @@ def wp(boxsize, pimax, nthreads, binfile, X, Y, Z, verbose=False,
precision and can not be trusted. If you need accurate ``rpavg``
values, then pass in double precision arrays for ``XYZ``.
(xyz)bin_refine_factor: integer, default is (2,2,1); typically within [1-3]
Controls the refinement on the cell sizes. Can have up to a 20% impact
on runtime.
c_api_timer: boolean (default false)
Boolean flag to measure actual time spent in the C libraries. Here
to allow for benchmarking and scaling studies.
Expand Down Expand Up @@ -167,6 +172,9 @@ def wp(boxsize, pimax, nthreads, binfile, X, Y, Z, verbose=False,
X, Y, Z,
verbose=verbose,
output_rpavg=output_rpavg,
xbin_refine_factor=xbin_refine_factor,
ybin_refine_factor=ybin_refine_factor,
zbin_refine_factor=zbin_refine_factor,
c_api_timer=c_api_timer,
isa=integer_isa)
if extn_results is None:
Expand Down
10 changes: 9 additions & 1 deletion Corrfunc/theory/xi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


def xi(boxsize, nthreads, binfile, X, Y, Z, verbose=False,
output_ravg=False, c_api_timer=False, isa='fastest'):
output_ravg=False, xbin_refine_factor=2, ybin_refine_factor=2,
zbin_refine_factor=1, c_api_timer=False, isa='fastest'):
"""
Function to compute the projected correlation function in a
periodic cosmological box. Pairs which are separated by less
Expand Down Expand Up @@ -69,6 +70,10 @@ def xi(boxsize, nthreads, binfile, X, Y, Z, verbose=False,
precision and can not be trusted. If you need accurate ``ravg``
values, then pass in double precision arrays for ``XYZ``.
(xyz)bin_refine_factor: integer, default is (2,2,1); typically within [1-3]
Controls the refinement on the cell sizes. Can have up to a 20% impact
on runtime.
c_api_timer: boolean (default false)
Boolean flag to measure actual time spent in the C libraries. Here
to allow for benchmarking and scaling studies.
Expand Down Expand Up @@ -160,6 +165,9 @@ def xi(boxsize, nthreads, binfile, X, Y, Z, verbose=False,
X, Y, Z,
verbose=verbose,
output_ravg=output_ravg,
xbin_refine_factor=xbin_refine_factor,
ybin_refine_factor=ybin_refine_factor,
zbin_refine_factor=zbin_refine_factor,
c_api_timer=c_api_timer,
isa=integer_isa)
if extn_results is None:
Expand Down
Loading

0 comments on commit 8451c06

Please sign in to comment.