ccpem/mrcfile

failed to read FEI2 ext header with mrcfile 1.4.3

azazellochg opened this issue · 3 comments

I have an mrc movie file with 13 frames. NZ = 13, exttyp = fei2, nsymbt = 15360. In the mrcinterpreter code I can see the whole 15360 bytes are read into ext_header_arr.

When trying to read the header I get:

mrcinterpreter.py:295: RuntimeWarning: File has exttyp 'b'FEI2'' but the extended header cannot be interpreted as that type
warnings.warn("File has exttyp '{}' but the extended header "

Or more detailed:

self._extended_header.dtype = dtype
^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: When changing to a larger dtype, its size must be a divisor of the total size in bytes of the last axis of the array.

If I read the ext header myself I know that for a single block the metadata size = 888 bytes. I think the problem is that 15360 is not divisible by 888, hence there's probably an unused area after all 13 blocks.

This sounds like a duplicate of #50, which has been fixed in the mrcfile code here on github but hasn't made it into a PyPI release yet. Could you check and see if your issue still occurs in the latest master branch of mrcfile?

Hi @colinpalmer you are correct, I should have checked the other issues before posting. With the master branch I no longer get the warning but mrcfile-header does not print extended header, only the main one. Is that expected?

Great, good to know it is the same issue that you were seeing.

Yes, mrcfile-header has only ever printed the main header, not the extended one. I can see that it'd be useful to print the extended header too when we have a recognised type, so I've opened a separate issue for that: #55

It's unlikely I'll have time to implement that any time soon, but if you need it for your own work and want to submit a pull request so everyone can benefit, please feel free :-)