tomodrgn.mrc.parse_mrc#

parse_mrc(fname: str, lazy: bool = False) tuple[ndarray | list[LazyImage], MRCHeader][source]#

Load an entire MRC file into memory as either a numpy array or a list of LazyImages

Parameters:
  • fname – path to MRC file on disk

  • lazy – whether to load particle images now in memory (False) or later on-the-fly (True)

Returns:

array: numpy array of MRC data in header-specified dtype and shape, or list of a LazyImage for each section along the nz axis in the MRC file header: an MRCHeader object containing the information encoded in the header and extended header of the MRC file