farhadnkm / Fringe.Py

A Python implementation of diffraction and coherent field propagation by angular spectrum method.
MIT License
28 stars 2 forks source link

More than 2-dimensional data structure is not supported without a batch dimension #1

Closed Sud11111 closed 2 years ago

Sud11111 commented 2 years ago

I ran the example given on https://pypi.org/project/fringe/ and I am getting the following error:-

ValueError Traceback (most recent call last) in () 2 from fringe.solvers.AngularSpectrum import AngularSpectrumSolver as AsSolver 3 ----> 4 solver = AsSolver(shape=obj.shape, dr=1, is_batched=False, padding="same", pad_fill_value=0, backend="Numpy") 5 rec = solver.solve(hologram, k=2*pi/500e-3, z=-1000) 6 amp, phase = abs(rec), angle(rec)

/usr/local/lib/python3.7/dist-packages/fringe/solvers/AngularSpectrum.py in init(self, shape, dr, is_batched, padding, pad_fill_value, backend) 46 47 if len(shape) > 2 and not is_batched: ---> 48 raise ValueError("More than 2-dimensional data structure is not supported without a batch dimension.") 49 elif len(shape) > 3: 50 raise ValueError("More than 3-dimensional data structure is not supported.")

ValueError: More than 2-dimensional data structure is not supported without a batch dimension.

farhadnkm commented 2 years ago

Looks like there was a little bug in IO pipeline which was missed in the last update. Fixed the issue now. Package is upgraded to 1.0.4. Missing addresses are also updated in the example files.