steven-murray / powerbox

A python package for making arbitrarily structured, arbitrary-dimension boxes
Other
24 stars 11 forks source link

Unable to compute power spectra for non-uniform arrays #34

Closed JianrongTan closed 10 months ago

JianrongTan commented 1 year ago

Here is the example code

array_test = np.random.rand(50,40,40)
ps = powerbox.get_power(array_test, boxlength=(50,40,40), bin_ave=False, get_variance=False)

And I get the error message

--> 151 freq = np.array([fftfreq(n, d=d, b=b) for n, d in zip(N, dx)])
    153 # Adjust phases of the result to align with the left edge properly.
    154 ft = _adjust_phase(ft, left_edge, freq, axes, b)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

It seems np.array() in Line 151 causes the error.

steven-murray commented 1 year ago

Thanks @JianrongTan, this does indeed look like a bug.

JianrongTan commented 11 months ago

@steven-murray It looks like this commit only fix the bug in ifft while leaves fft untouched.

steven-murray commented 10 months ago

Ah, I see that, thanks @JianrongTan