High resolution image of 2D classification

Hi CS community

Is there a way to export 2D classification result at a higher resolution than the png or pdf files provided by 2D classification job? I would like to export a publication quality 2D classification result from Select 2D Classes job, however the images are lower resolution than the actual pixel size of the particles.

Thank you.

Hi @alburse,

You can use the plotting function used by the 2D Classification job itself. Check out the function parameters for more info (found in cryosparc2_worker/cryosparc2_compute/plotutils.py)

The .mrc file is from the “particles_selected” output of the Select 2D job:


Thank you, I will try this.

I tried this but could not get it to work. I guess CRYOSPARC_ROOT_DIR is not right, I tried the master folder and worker too. I found this link but not sure if this solution will effect other operations.

Thank you

import os
from cryosparc2_compute import plotutil
from cryosparc2_compute.blobio import mrc

KeyErrorTraceback (most recent call last)
in ()
1 import os
----> 2 os.chdir(os.environ[’/share/PI/yiorgo/alpay/modules/alpaysprograms/cryosparc/2.9’])
3 from cryosparc2_compute import plotutil
4 from cryosparc2_compute.blobio import mrc

/share/software/user/open/python/2.7.13/lib/python2.7/UserDict.pyc in getitem(self, key)
38 if hasattr(self.class, “missing”):
39 return self.class.missing(self, key)
—> 40 raise KeyError(key)
41 def setitem(self, key, item): self.data[key] = item
42 def delitem(self, key): del self.data[key]

KeyError: ‘/share/PI/yiorgo/alpay/modules/alpaysprograms/cryosparc/2.9’

Check your system environment that if “CRYOSPARC_ROOT_DIR” is set


You may set it by

echo “export CRYOSPARC_ROOT_DIR=/path/to/cryosparc/root/dir” >> ~/.bashrc && . ~/.bashrc

Thank you. I gave the directory (CRYOSPARC_RROT_DIR) directly to Jupyter notebook and it did not work. System environment worked. Thank you

Hi sarulthasan,

I’m also struggling with this. Unfortuantely, I don’t really understand what you meant. Where should I use this plotting function?

Also, is there a reason why this is relatively difficult, compared to a downloading or displaying a 3d map? It seems to me 2D classes are an important (intermediate) result?

Many thanks,

Hi Maarten

@stephan showed an example on Jupyter Notebook. You can start a Jupyter notebook and use it as a python environment. I believe cryosparc itself has the jupyter notebook setup and has all the necessary python libraries but I could not find how to start Jupyter notebook from cryosparc environment. Therefore I used my own Jupyter notebook. You will need at least the following python 2.7 libraries installed.
py-numpy py-scipy py-numba py-matplotlib pyFFTW
and CRYOSPARC_ROOT_DIR defined in your bashrc or bash_profile or equivalent file for other shells.
Below worked for me on my bash_profile file.
export CRYOSPARC_ROOT_DIR="/directory-to-cryosparc/cryosparc/2.11/cryosparc2_worker"

If @stephan tells us how to use the jupyter notebook from cryosparc that would be great.
More importantly, I could not really find what parameter to change on the plotutils.py to get the native resolution on the 2D-class averages. If you find it, please let me know.

1 Like

Hi @maarten.tuijtel,

You’re right- we’re planning on adding a “download images” button that will output a compressed folder of individual class images at full resolution. I’ll keep you updated on this!


Hi @alburse,

I believe the parameter is figsize_each.