Skip to content

Commit

Permalink
allow None weights when angular upweighting
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud De-Mattia committed Oct 26, 2021
1 parent 8a25b9b commit d27b322
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Corrfunc/mocks/DDrppi_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def DDrppi_mocks(autocorr, cosmology, nthreads, pimax, binfile,
if autocorr == 0:
fix_ra_dec(RA2, DEC2)

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
6 changes: 3 additions & 3 deletions Corrfunc/mocks/DDsmu_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ def DDsmu_mocks(autocorr, cosmology, nthreads, mu_max, nmu_bins, binfile,
if autocorr == 0:
fix_ra_dec(RA2, DEC2)

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
6 changes: 3 additions & 3 deletions Corrfunc/mocks/DDtheta_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ def DDtheta_mocks(autocorr, nthreads, binfile,
if autocorr == 0:
fix_ra_dec(RA2, DEC2)

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
6 changes: 3 additions & 3 deletions Corrfunc/theory/DD.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ def DD(autocorr, nthreads, binfile, X1, Y1, Z1, weights1=None, periodic=True,
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, X2, Y2, Z2]]

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
6 changes: 3 additions & 3 deletions Corrfunc/theory/DDrppi.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ def DDrppi(autocorr, nthreads, pimax, binfile, X1, Y1, Z1, weights1=None,
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, X2, Y2, Z2]]

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
6 changes: 3 additions & 3 deletions Corrfunc/theory/DDsmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ def DDsmu(autocorr, nthreads, binfile, mu_max, nmu_bins,
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, X2, Y2, Z2]]

if weight_type is not None:
if weights1 is not None:
weights1 = [convert_to_native_endian(arr, warn=True) for arr in weights1]
if not autocorr:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]
if weights2 is not None:
weights2 = [convert_to_native_endian(arr, warn=True) for arr in weights2]

if pair_weights is not None:
pair_weights = convert_to_native_endian(pair_weights, warn=True)
Expand Down
2 changes: 1 addition & 1 deletion Corrfunc/theory/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def wp(boxsize, pimax, nthreads, binfile, X, Y, Z,
X, Y, Z = [convert_to_native_endian(arr, warn=True)
for arr in [X, Y, Z]]

if weight_type is not None:
if weights is not None:
weights = [convert_to_native_endian(arr, warn=True) for arr in weights]

if pair_weights is not None:
Expand Down
2 changes: 1 addition & 1 deletion Corrfunc/theory/xi.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def xi(boxsize, nthreads, binfile, X, Y, Z,
X, Y, Z = [convert_to_native_endian(arr, warn=True)
for arr in [X, Y, Z]]

if weight_type is not None:
if weight is not None:
weights = [convert_to_native_endian(arr, warn=True) for arr in weights]

if pair_weights is not None:
Expand Down
2 changes: 1 addition & 1 deletion utils/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static inline int set_weight_struct(weight_struct* weight_st, const weight_metho
weight_st->num_weights = 1;
break;
case INVERSE_BITWISE:
weight_st->num_weights = 1;
weight_st->num_weights = 0; // we can e.g. have only angular upweighting
break;
default:
weight_st->num_weights = 0;
Expand Down

0 comments on commit d27b322

Please sign in to comment.