odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question on the Fourier transform

aringh opened this issue · comments

I have not used the Fourier transform in odl before, and now when I tried I bumped into the following:

import odl
space1 = odl.uniform_discr(0, 1, 11, dtype='complex128')
space2 = odl.uniform_discr(0, 1, 13, dtype='complex128')
fourier_trafo = odl.trafos.FourierTransform(space1, space2, halfcomplex='False')
fourier_trafo(space1.one())

gives the following error

Traceback (most recent call last):

  File "<ipython-input-1-a55ccd3e3345>", line 5, in <module>
    fourier_trafo(space1.one())

  File "[...]/odl/odl/operator/operator.py", line 686, in __call__
    out = self._call_out_of_place(x, **kwargs)

  File "[...]/odl/odl/operator/operator.py", line 50, in _default_call_out_of_place
    result = op._call_in_place(x, out, **kwargs)

  File "[...]/odl/odl/trafos/fourier.py", line 896, in _call
    out[:] = self._call_numpy(x.asarray())

  File "[...]/odl/odl/trafos/fourier.py", line 1321, in _call_numpy
    self._postprocess(out, out=out)

  File "[...]/odl/odl/trafos/fourier.py", line 1286, in _postprocess
    interp=self.domain.interp, op='multiply', out=out)

  File "[...]/odl/odl/trafos/util/ft_utils.py", line 546, in dft_postprocess_data
    fast_1d_tensor_mult(out, onedim_arrs, axes=axes, out=out)

  File "[...]/odl/odl/util/numerics.py", line 287, in fast_1d_tensor_mult
    out *= last_arr[slc]

ValueError: operands could not be broadcast together with shapes (11,) (13,) (11,) 

Is this a bug, or is there a reason why I need the same number of discretization points in the domain and the range?

Similar behavior occurs for 2D discretizations. Moreover, there seems to be no test of the FourierTransform operator where the range is given explicitly.

Looks like a bug to me.