ccpem/mrcfile

imod file with unrecognized machine stamp

jdeschamps opened this issue · 2 comments

Hi,

Using mrcfile==1.4.3 and attempting to read a file exported from imod, i get the following warning:

with mrcfile.open('21.mrc', 'r', header_only=True, permissive=True) as mrc:
     print(mrc.header)

/home/user/miniconda3/envs/blik/lib/python3.9/site-packages/mrcfile/mrcinterpreter.py:219: 
RuntimeWarning: Unrecognised machine stamp: 0x44 0x20 0x20 0x20
  warnings.warn(str(err), RuntimeWarning)
(1024, 1024, 512, 2, 0, 0, 0, 1024, 1024, 512, (1024., 1024., 512.), (90., 90., 90.), 1, 2, 3, -995.9688, 480.2282, -2.2351742e-07,
 0, 0, b'\x00\x00\x00\x00\x00\x00\x00\x00', b'', 0, b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', (0., 0., 0.), b'MAP ', [68, 32, 32, 32], -1., 0, [b'', b'', b'', b'', b'', b'', b'', b'', 
b'', b''])

Without permissive=True this would lead to an error.

The file is from a collaborator, so I don't know whether some export options are responsible for this behaviour. If that's of any interest to the project, I can investigate!

edit: I must warn that I never worked with mrc files before, so I might just not be aware of obvious things to do when saving files in imod. :)

Hi, thanks for the report, but I think this is an issue for IMOD rather than mrcfile. It looks like the file genuinely does have an incorrect machine stamp (which is a code written to the file header to tell other software how it should read the data in the file). This is definitely a mistake, sometimes the machine stamp can vary but this one is invalid. Normally files from IMOD are fine so this is unusual, but beyond that I can't say why it might have happened. I'd suggest reporting the problem to the IMOD developers.

Alright! Thanks for the swift answer!