cryodrgn icon indicating copy to clipboard operation
cryodrgn copied to clipboard

ERROR:Calculating masked map-map CCs at representative latent encodings for epochs

Open siayouyang opened this issue 2 years ago • 1 comments

Describe the bug (INFO) (analyze_convergence.py) (10-Jan-24 13:15:04) Calculating masked map-map CCs at representative latent encodings for epochs [ 4 9 14 19 24 29 34 39 40] ... Traceback (most recent call last): File "/data2/xyy/cryodrgn_test/cryodrgn/utils/analyze_convergence.py", line 1251, in main(parser.parse_args()) File "/data2/xyy/cryodrgn_test/cryodrgn/utils/analyze_convergence.py", line 1232, in main calculate_CCs(outdir, epochs, labels, chimerax_colors) File "/data2/xyy/cryodrgn_test/cryodrgn/utils/analyze_convergence.py", line 894, in calculate_CCs cc_masked[cluster, i] = calc_cc(vol1, vol2) File "/data2/xyy/cryodrgn_test/cryodrgn/utils/analyze_convergence.py", line 874, in calc_cc zmean1 = vol1 - np.mean(vol1) File "<array_function internals>", line 180, in mean File "/home/user/anaconda3/envs/cryodrgn/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 3472, in mean return mean(axis=axis, dtype=dtype, out=out, **kwargs) TypeError: mean() received an invalid combination of arguments - got (dtype=NoneType, out=NoneType, axis=NoneType, ), but expected one of:

  • (*, torch.dtype dtype)
  • (tuple of ints dim, bool keepdim, *, torch.dtype dtype)
  • (tuple of names dim, bool keepdim, *, torch.dtype dtype)

To Reproduce following Nature Protocols step7: python /path/to/cryodrgn/utils/analyze_convergence.py 01_128_8D_256 40

Additional context the plots generated under ./cryodrgn_test/01_128_8D_256/convergence.40/plots: -rw-rw-r--. 1 user user 60757 Jan 10 13:03 00_total_loss.png -rw-rw-r--. 1 user user 854221 Jan 10 13:10 01_encoder_umaps.png -rw-rw-r--. 1 user user 116268 Jan 10 13:10 02_encoder_latent_vector_shifts.png -rw-rw-r--. 1 user user 440947 Jan 10 13:10 03_decoder_UMAP-sketching.png -rw-rw-r--. 1 user user 891581 Jan 10 13:10 04_decoder_maxima-sketch-consistency.png

siayouyang avatar Jan 10 '24 05:01 siayouyang

I had the same issue. I have fixed it by adding code to change torch tensor to numpy array before zmean1 = vol1 - np.mean(vol1). The code I added is vol1= vol1.detach().numpy() vol2 = vol2.detach().numpy()

Huang-XN avatar Nov 28 '24 03:11 Huang-XN