Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix convert endian bug #191

Merged
merged 3 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions Corrfunc/mocks/DDrppi_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,10 @@ def DDrppi_mocks(autocorr, cosmology, nthreads, pimax, binfile,

weights1, weights2 = process_weights(weights1, weights2, RA1, RA2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('RA1', 'DEC1', 'CZ1', 'weights1', 'RA2', 'DEC2', 'CZ2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
RA1, DEC1, CZ1, weights1, RA2, DEC2, CZ2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[RA1, DEC1, CZ1, weights1, RA2, DEC2, CZ2, weights2]]

fix_ra_dec(RA1, DEC1)
if autocorr == 0:
Expand All @@ -357,7 +355,7 @@ def DDrppi_mocks(autocorr, cosmology, nthreads, pimax, binfile,
# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'RA2', 'DEC2', 'CZ2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
10 changes: 4 additions & 6 deletions Corrfunc/mocks/DDsmu_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,10 @@ def DDsmu_mocks(autocorr, cosmology, nthreads, mu_max, nmu_bins, binfile,

weights1, weights2 = process_weights(weights1, weights2, RA1, RA2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('RA1', 'DEC1', 'CZ1', 'weights1', 'RA2', 'DEC2', 'CZ2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
RA1, DEC1, CZ1, weights1, RA2, DEC2, CZ2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[RA1, DEC1, CZ1, weights1, RA2, DEC2, CZ2, weights2]]


fix_ra_dec(RA1, DEC1)
Expand All @@ -291,7 +289,7 @@ def DDsmu_mocks(autocorr, cosmology, nthreads, mu_max, nmu_bins, binfile,
# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'RA2', 'DEC2', 'CZ2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
10 changes: 4 additions & 6 deletions Corrfunc/mocks/DDtheta_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,10 @@ def DDtheta_mocks(autocorr, nthreads, binfile,

weights1, weights2 = process_weights(weights1, weights2, RA1, RA2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('RA1', 'DEC1', 'weights1', 'RA2', 'DEC2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
RA1, DEC1, weights1, RA2, DEC2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[RA1, DEC1, weights1, RA2, DEC2, weights2]]

fix_ra_dec(RA1, DEC1)
if autocorr == 0:
Expand All @@ -309,7 +307,7 @@ def DDtheta_mocks(autocorr, nthreads, binfile,
# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'RA2', 'DEC2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
8 changes: 3 additions & 5 deletions Corrfunc/mocks/vpf_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,10 @@ def vpf_mocks(rmax, nbins, nspheres, numpN,
return_file_with_rbins, convert_to_native_endian,\
is_native_endian, sys_pipes, process_weights

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('RA', 'DEC', 'CZ', 'RAND_RA', 'RAND_DEC', 'RAND_CZ'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
RA, DEC, CZ, RAND_RA, RAND_DEC, RAND_CZ = [
convert_to_native_endian(arr, warn=True) for arr in
[RA, DEC, CZ, RAND_RA, RAND_DEC, RAND_CZ]]

integer_isa = translate_isa_string_to_enum(isa)
with sys_pipes():
Expand Down
10 changes: 4 additions & 6 deletions Corrfunc/theory/DD.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,15 @@ def DD(autocorr, nthreads, binfile, X1, Y1, Z1, weights1=None, periodic=True,

weights1, weights2 = process_weights(weights1, weights2, X1, X2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X1', 'Y1', 'Z1', 'weights1', 'X2', 'Y2', 'Z2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X1, Y1, Z1, weights1, X2, Y2, Z2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, weights1, X2, Y2, Z2, weights2]]

# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'X2', 'Y2', 'Z2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
10 changes: 4 additions & 6 deletions Corrfunc/theory/DDrppi.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,15 @@ def DDrppi(autocorr, nthreads, pimax, binfile, X1, Y1, Z1, weights1=None,

weights1, weights2 = process_weights(weights1, weights2, X1, X2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X1', 'Y1', 'Z1', 'weights1', 'X2', 'Y2', 'Z2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X1, Y1, Z1, weights1, X2, Y2, Z2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, weights1, X2, Y2, Z2, weights2]]

# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'X2', 'Y2', 'Z2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
10 changes: 4 additions & 6 deletions Corrfunc/theory/DDsmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,15 @@ def DDsmu(autocorr, nthreads, binfile, mu_max, nmu_bins,

weights1, weights2 = process_weights(weights1, weights2, X1, X2, weight_type, autocorr)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X1', 'Y1', 'Z1', 'weights1', 'X2', 'Y2', 'Z2', 'weights2'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X1, Y1, Z1, weights1, X2, Y2, Z2, weights2 = [
convert_to_native_endian(arr, warn=True) for arr in
[X1, Y1, Z1, weights1, X2, Y2, Z2, weights2]]

# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights1', 'weights2', 'weight_type', 'X2', 'Y2', 'Z2']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
7 changes: 2 additions & 5 deletions Corrfunc/theory/vpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,9 @@ def vpf(rmax, nbins, nspheres, numpN, seed,
.format(nspheres, rmax, nspheres * volume_sphere, volume)
raise ValueError(msg)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X', 'Y', 'Z'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X, Y, Z = [convert_to_native_endian(arr, warn=True)
for arr in [X, Y, Z]]

integer_isa = translate_isa_string_to_enum(isa)
with sys_pipes():
Expand Down
9 changes: 3 additions & 6 deletions Corrfunc/theory/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,14 @@ def wp(boxsize, pimax, nthreads, binfile, X, Y, Z,

weights, _ = process_weights(weights, None, X, None, weight_type, autocorr=True)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X', 'Y', 'Z', 'weights'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X, Y, Z, weights = [convert_to_native_endian(arr, warn=True)
for arr in [X, Y, Z, weights]]

# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights', 'weight_type']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down
9 changes: 3 additions & 6 deletions Corrfunc/theory/xi.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,14 @@ def xi(boxsize, nthreads, binfile, X, Y, Z,

weights, _ = process_weights(weights, None, X, None, weight_type, autocorr=True)

_locals = locals()

# Ensure all input arrays are native endian
for arrname in ('X', 'Y', 'Z', 'weights'):
arr = _locals[arrname]
_locals[arrname] = convert_to_native_endian(arr, warn=True)
X, Y, Z, weights = [convert_to_native_endian(arr, warn=True)
for arr in [X, Y, Z, weights]]

# Passing None parameters breaks the parsing code, so avoid this
kwargs = {}
for k in ['weights', 'weight_type']:
v = _locals[k]
v = locals()[k]
if v is not None:
kwargs[k] = v

Expand Down