Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--flip option causes error in analyze_landscape_full #409

Closed
cbeck22 opened this issue Oct 9, 2024 · 1 comment
Closed

--flip option causes error in analyze_landscape_full #409

cbeck22 opened this issue Oct 9, 2024 · 1 comment

Comments

@cbeck22
Copy link

cbeck22 commented Oct 9, 2024

Hi!

I'm running cryoDRGN v3.3.3, and I'm trying to use the analyze_landscape_full command. I'm running it in the results directory containing the weights and z .pkl files.

The command results in the following error if used with the --flip option:

cryodrgn analyze_landscape_full . 99 --flip > landscape_full.log
Traceback (most recent call last):
  File "/programs/x86_64-linux//cryodrgn/3.3.3/cryodrgn/bin/cryodrgn", line 8, in <module>
    sys.exit(main_commands())
  File "/programs/x86_64-linux/cryodrgn/3.3.3/miniconda/lib/python3.9/site-packages/cryodrgn/command_line.py", line 68, in main_commands
    _get_commands(
  File "/programs/x86_64-linux/cryodrgn/3.3.3/miniconda/lib/python3.9/site-packages/cryodrgn/command_line.py", line 63, in _get_commands
    args.func(args)
  File "/programs/x86_64-linux/cryodrgn/3.3.3/miniconda/lib/python3.9/site-packages/cryodrgn/commands/analyze_landscape_full.py", line 339, in main
    z, embeddings = generate_and_map_volumes(
  File "/programs/x86_64-linux/cryodrgn/3.3.3/miniconda/lib/python3.9/site-packages/cryodrgn/commands/analyze_landscape_full.py", line 231, in generate_and_map_volumes
    vol = vol[::-1]
ValueError: step must be greater than zero

However, the command runs properly when the --flip option is not used. Is this a bug? The --flip option worked successfully for the regular analyze_landscape command.

Best,
cbeck

@michal-g
Copy link
Collaborator

michal-g commented Oct 9, 2024

Hey, this is indeed a bug on our side — we had been assuming that PyTorch tensor objects support negative slices in the same manner as numpy arrays (e.g. vol[::-1]) but this is not the case, nor is it expected to be the case for the foreseeable future, as outlined here: pytorch/pytorch#59786

I've updated the vol = vol[::-1] line in analyze_landscape_full to be vol = vol.flip([0]) as in the code used by analyze_landscape for the same operation, which allows the command to run to completion with --flip. This fix will be part of the v3.4.2 release and has been made available in the meantime through our beta release channel:

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ 'cryodrgn<=3.4.2' --pre

Let us know if you find any other problems with the landscape analyses tools!

-Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants