Cs2star terminates with KeyError


I have issues converting a cryoSPARC job to .star file since one of the most recent cryoSPARC updates (I am currently running v4.4.1). I tried different job types, projects and workstations without any success.

The command I am using is ‘cs2star /data_path’

I always encounter the following error:

oading particle data… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Loading micrograph data… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:–:–
Traceback (most recent call last):
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/pandas/core/indexes/base.py”, line 3802, in get_loc
return self._engine.get_loc(casted_key)
File “index.pyx”, line 153, in pandas._libs.index.IndexEngine.get_loc
File “index.pyx”, line 177, in pandas._libs.index.IndexEngine.get_loc
File “index.pyx”, line 220, in pandas._libs.index.IndexEngine._get_loc_duplicates
File “index.pyx”, line 228, in pandas._libs.index.IndexEngine._maybe_get_bool_indexer
File “index.pyx”, line 120, in pandas._libs.index._unpack_bool_indexer
KeyError: ‘rlnMicrographOriginalPixelSize’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/hrishi/anaconda3/envs/cs2star/bin/cs2star”, line 8, in
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/cs2star/cs2star.py”, line 221, in main
df_mic_i = pyem.metadata.cryosparc_2_cs_movie_parameters(
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/pyem/metadata/cryosparc2.py”, line 224, in cryosparc_2_cs_movie_parameters
data_general[star.Relion.MICROGRAPHPIXELSIZE] / data_general[star.Relion.MICROGRAPHORIGINALPIXELSIZE]
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/pandas/core/frame.py”, line 4090, in getitem
indexer = self.columns.get_loc(key)
File “/home/hrishi/anaconda3/envs/cs2star/lib/python3.9/site-packages/pandas/core/indexes/base.py”, line 3809, in get_loc
raise KeyError(key) from err
KeyError: ‘rlnMicrographOriginalPixelSize’

I would be happy if anyone could help me out.


You more then likely need to add the pass through file into your command. Something along the lines of csparc2star /data/path/refinement.cs /data/path/JXXX_passthrough_particles.cs Name.star

This should also help in figuring out why that field is missing:

Thanks a lot! I figured out what went wrong.


Hi Ole,

I faced the same error as you. Could you tell me how to fix it? Thanks a lot.



Hey Feng,

Sorry for the late reply, I never ended up really fixing this issue. I reinstalled cs2star and then used it with the flags -f -c -p and it magically worked. I hope this will work for you too!