jcouto / wfield

Tools to process widefield data
GNU General Public License v3.0
13 stars 14 forks source link

Stack reconstruction errors with current pypi deployment #12

Closed mayofaulkner closed 2 months ago

mayofaulkner commented 3 months ago

Hello,

It seems that with the current pypi deployment of the wfield package (0.4.1) the stack reconstruction doesn't work

e.g this code results in the following error

import wfield
import matplotlib.pyplot as plt
U = np.load('widefieldU.images.npy')
SVT = np.load('widefieldSVT.haemoCorrected.npy')
stack = wfield.SVDStack(U, SVT)

plt.imshow(stack[100])
File /opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/wfield/utils.py:388, in SVDStack.__getitem__(self, *args)
    386 else:
    387     idxz = args[0]        
--> 388 return reconstruct(self.U,self.SVT[:,idxz],dims=self.shape[1:])

File /opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/wfield/utils.py:265, in reconstruct(u, svt, dims)
    262     if dims is None:
    263         dims = u.shape[:2]
--> 265 return u@svt.reshape((*dims,-1)).transpose(-1,0,1).squeeze()

ValueError: cannot reshape array of size 200 into shape (540,640,newaxis)

When I install the latest code from the repo (pip install git+https://github.com/jcouto/wfield.git), this error goes away so I think it is just in the version that is currently released to pypi.

jcouto commented 2 months ago

Thanks for finding this, I'll update pypi asap!

jcouto commented 2 months ago

Done, thanks again Mayo!

mayofaulkner commented 2 months ago

Thank you!