coveralls: 
[![Coverage Status](https://coveralls.io/builds/29001198/badge)](https://coveralls.io/builds/29001198)

Coverage increased (+0.3%) to 89.315% when pulling **f9c6295914a42dd2d0292e9fde985120f1c75354 on fix-cross-power-bug** into **09809f3fe9e2b25dfb2f956ca4c2d4d40a0ac693 on master**.

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 428d540..d3bd2f9 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,8 +1,14 @@
 Changelog
 =========
 
-dev
----
+0.6.1
+-----
+**Bugfixes**
+
+- Fix error when doing cross-power [Issue #5].
+
+0.6.0
+-----
 **Features**
 
 - New ``left_edge`` argument in fft/ifft which gives the ability to specify where
diff --git a/powerbox/__init__.py b/powerbox/__init__.py
index 074d33d..81a6073 100644
--- a/powerbox/__init__.py
+++ b/powerbox/__init__.py
@@ -1,4 +1,4 @@
-__version__ = "0.6.0"
+__version__ = "0.6.1"
 
 from .powerbox import PowerBox, LogNormalPowerBox
 from .tools import get_power, angular_average, angular_average_nd
diff --git a/powerbox/tools.py b/powerbox/tools.py
index 2b087fd..b78d7e3 100644
--- a/powerbox/tools.py
+++ b/powerbox/tools.py
@@ -460,7 +460,7 @@ def get_power(deltax, boxlength, deltax2=None, N=None, a=1., b=1., remove_shotno
         if not np.iterable(boxlength):
             boxlength = [boxlength] * dim
 
-        if deltax2 is not None and deltax.shape != len(deltax2.shape):
+        if deltax2 is not None and deltax.shape != deltax2.shape:
             raise ValueError("deltax and deltax2 must have the same shape!")
 
         N = deltax.shape

Errot with get_power
I tried to compute the cross-correlated power spectrum of two fields using get_power, including as an argument another field deltax2. I obtained an error message, even if deltax2 was the same than deltax1 (which should give the standard power spectrum). I noticed that there is an error in tools.py/get_power, line 463, which reads:

    if deltax2 is not None and deltax.shape != len(deltax2.shape):

but it should be:

    if deltax2 is not None and deltax.shape != deltax2.shape:

which works without problem. I checked it recovering the power spectrum when deltax2=deltax1.
diff --git a/tests/test_tools.py b/tests/test_tools.py
index aa71767..4270f8f 100644
--- a/tests/test_tools.py
+++ b/tests/test_tools.py
@@ -1,5 +1,6 @@
 import numpy as np
-from powerbox.tools import angular_average_nd, angular_average
+from powerbox.tools import angular_average_nd, angular_average, get_power
+from powerbox.powerbox import PowerBox
 import pytest
 
 def test_angular_avg_nd_3():
@@ -109,6 +110,13 @@ def test_logbins():
     assert np.all(np.isclose(np.diff(coord[1:]/coord[:-1]), 0))
 
 
+def test_cross_power_identity():
+    pb = PowerBox(200, dim=2, pk=lambda k: 1.0 * k ** -2., boxlength=1.0, b=1)
+    dx = pb.delta_x()
+    p, k = get_power(dx, pb.boxlength, b=1)
+    p_cross, k = get_power(dx, pb.boxlength, b=1, deltax2=dx)
+    assert np.all(np.isclose(p, p_cross))
+
 
 @pytest.mark.skip()
 def test_against_multirealisation():

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-runner tox coverage coveralls
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
coveralls==3.3.1
distlib==0.3.9
docopt==0.6.2
filelock==3.4.1
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
numpy==1.19.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
-e git+https://github.com/steven-murray/powerbox.git@09809f3fe9e2b25dfb2f956ca4c2d4d40a0ac693#egg=powerbox
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-runner==5.3.2
requests==2.27.1
six==1.17.0
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.17.1
zipp==3.6.0

name: powerbox
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - coveralls==3.3.1
      - distlib==0.3.9
      - docopt==0.6.2
      - filelock==3.4.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - numpy==1.19.5
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pytest-runner==5.3.2
      - requests==2.27.1
      - six==1.17.0
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.17.1
      - zipp==3.6.0
prefix: /opt/conda/envs/powerbox

tests/test_tools.py::test_cross_power_identity
tests/test_tools.py::test_angular_avg_nd_3 tests/test_tools.py::test_angular_avg_nd_4_2 tests/test_tools.py::test_angular_avg_nd_2_1_varnull tests/test_tools.py::test_null_variance_2d tests/test_tools.py::test_variance_2d tests/test_tools.py::test_complex_variance tests/test_tools.py::test_bin_edges tests/test_tools.py::test_sum tests/test_tools.py::test_var_trivial_weights tests/test_tools.py::test_logbins
CHANGELOG.rst powerbox/tools.py powerbox/__init__.py
CHANGELOG.rst powerbox/tools.py powerbox/__init__.py