Visualizing orientation distribution other than heatmap?

Is there a way to visualize the orientation distribution of particles contributing to a map other than the Elevation/Azimuth heatmap? Can I export the cryosparc metadata file to another program for visualization of this distribution?

In particular, I’d like to view as cylinders with height proportional to the number of particles in the orientation indicated (similar to Relion).


1 Like

Hi Aaron,

You could export to relion and run a “fake” 3D auto refine run - setting searches to 0.1 degree, lowpass to the global res from cryosparc, and offsets to 0 & 0 - that should more or less accomplish this I think.


If you convert to a star file, you can use the program in pyem to produce a XMIPP/Chimera style orientation plot like the ones made by Relion. This program works with any particle star file. I set the colors and cylinder sizes to mimic the ones made by Relion, and it uses the same HealPix angle bins as Relion.


Thanks so much for your response, Oli! I’ll try to get this going and report back on the final result in case anyone else is interested.

Thank you, Daniel! I will definitely be trying this out.

Hi Daniel,

I have had some trouble updating pyem on linux. I was previously on the version that could not handle cryosparc2 files. Perhaps you may have some insight to my problems. I tried just installing fresh after removing the old version and got this error. Then I tried to git pull in the old folder (after putting it back in its original location) and still had this error. After completing the " pip install -e ." command, it says installation was successful.

Sorry, this is my first time trying to update any program from github.

Thanks for any help,

Traceback (most recent call last):
File “/home/user/pyem/”, line 28, in
from pyem import metadata
File “/home/user/pyem/pyem/ init .py”, line 3, in
from . import metadata
File “/home/user/pyem/pyem/”, line 25, in
from . import star
File “/home/user/pyem/pyem/”, line 31, in
from pyem.util import rot2euler
File “/home/user/pyem/pyem/util/ init .py”, line 3, in
from .util import *
File “/home/user/pyem/pyem/util/”, line 25, in
from … import geom
File “/home/user/pyem/pyem/geom/ init .py”, line 4, in
from .geom import *
File “/home/user/pyem/pyem/geom/”, line 22, in
from .quat_numba import qslerp
File “/home/user/pyem/pyem/geom/”, line 153, in
“(m)->(m), (m), (m), (m)”, nopython=True, cache=False)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/”, line 179, in wrap
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/”, line 198, in add
self.nb_func, targetoptions, sig)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/”, line 129, in _compile_element_wise_function
cres = nb_func.compile(sig, **targetoptions)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/”, line 78, in compile
return self._compile_core(sig, flags, locals)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/”, line 113, in _compile_core
flags=flags, locals=locals)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/”, line 871, in compile_extra
return pipeline.compile_extra(func)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/”, line 365, in compile_extra
return self._compile_bytecode()
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/”, line 802, in _compile_bytecode
return self._compile_core()
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/”, line 789, in _compile_core
res =
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/”, line 251, in run
raise patched_exception
TypeError: Failed at nopython (analyzing bytecode)
Signature mismatch: 2 argument types given, but function takes 1 arguments

Thanks for trying out my stuff. I have been making some breaking changes in the master branch lately, which is why you’ve seen this error.

Try git checkout tags/v0.4 to switch to the latest release version. Since you installed with pip install -e it should be updated immediately and no new pip command should be required.

Really fantastic! Thank you so much, Daniel! This worked after performing git pull, followed by your command and installing healpy. The bild file looks nice.
Now, is there a way to customize the visualization of this file? For example, I have seen figures showing just half of this bild sphere.

you can just do that in Chimera, Aaron - e.g. use per model clipping

Thanks for pointing out the missing healpy requirement, I added it to the requirements.txt for future users.

Right now just uses the angles in the star file, so if Relion isn’t accounting for projection ambiguity (and it indeed does not) then you get the whole sphere covered.

It would be easy to force half the sphere, or a certain symmetry group, using my implementation (I take advantage of the order-preserving surjection between great circle arc length and secant distance, and use a kD-tree to rapidly histogram the Euler angles). If there’s interest, and in particular if there are good suggestions, I could revisit it.

Thanks for the info and all the help, Daniel. It’s working great for my needs at the moment. I know clipping is not perfect, but to achieve the 1/4 sphere, I use the per model clipping as suggested by Oli, with global clipping in the second plane.
Thanks to you both for the advice!

@user123 @olibclarke I implemented a --sym argument for which will apply the symmetry to the angles from cryoSPARC. It was trickier than I thought!

Great, I look forward to giving it a spin!

Hi Daniel, revisiting this topic and have reinstalled my pyem package just yesterday.
Hope this is the right place to ask my qn and seek your advice.
I cannot seem to convert the to .bild file. error message below:

/home/dlsw1/pyem/pyem/ FutureWarning: Columnar iteration over characters will be deprecated in future releases.
/home/dlsw1/pyem/pyem/ FutureWarning: Columnar iteration over characters will be deprecated in future releases.
Traceback (most recent call last):
File “/usr/bin/”, line 122, in
File “/usr/bin/”, line 71, in main"%.0f (%.2f%) +/- %.1f (%.2f%) particles per bin" %
ValueError: unsupported format character ‘)’ (0x29) at index 11

1 Like

Got the same error today!

This was my bad, I fixed it about 2 weeks ago.

1 Like

Got a question!

In a refinement with symmetry, rot, tilt, and psi are not restricted to the “symmetry unit” in the star file.

Is this because CS does not do that in the .cs (although I guess it is used for calculations) or is it more a pyem “feature” :wink:

that is a cryosparc thing: How does cryosparc treat symmetry? - #2 by apunjani

1 Like just shows you what’s in the .star file, but there is a --sym argument that will average all the symmetry equivalent angles so you get something more easily compared to Relion’s distributions.

to the point! Thanks!