Giter Club home page Giter Club logo

Comments (9)

jdeschamps avatar jdeschamps commented on July 30, 2024 1

The joy of open source dependencies :D

ccpem/mrcfile#47

from blik.

brisvag avatar brisvag commented on July 30, 2024

Hi! This seems to be unrelated to #130. The issue is deeper (with mrcfile):

ValueError: Unrecognised machine stamp: 0x44 0x20 0x20 0x20

Something seems to be off with the header of your mrc file, which is not recognized by mrcfile. Can you try to manually open the file by doing this in ipython?:

with mrcfile.open('/path/to/file.mrc', 'r', header_only=True) as mrc:
    print(mrc.header)

If this fails again, try:

with mrcfile.open('/path/to/file.mrc', 'r', header_only=True, permissive=True) as mrc:
    print(mrc.header)

I didn't add any machinery to allow permissive=True for now; if that solves it, maybe I should consider setting it to True by default.

from blik.

jdeschamps avatar jdeschamps commented on July 30, 2024

It fails without permissive=True, but loads with it:

/home/joran.deschamps/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''])

from blik.

brisvag avatar brisvag commented on July 30, 2024

Yeah, this happens if the header is a bit messed up for some reason. Corrupted file, or maybe it was written by a software that wasn't very careful about writing correct information in the header. If you want a quick fix, you can edit the code in naaf for the mrc reader function and add the permissive=True argument to the mrcfile.mmap call. I will try to release a half update to naaf and blik to fix both this issue and the other you raised.

from blik.

jdeschamps avatar jdeschamps commented on July 30, 2024

Thanks a lot! I will let you be the judge of whether to keep this issue open!

FYI the file was saved using imod, and there is no issue opening it there.

from blik.

brisvag avatar brisvag commented on July 30, 2024

You might want to bring this issue up to the mrcfile repo then, since this can only be solved there.

In my experience, imod is super resilient to broken headers, but because of this it might be less careful in writing correct ones :P

from blik.

brisvag avatar brisvag commented on July 30, 2024

@jdeschamps I just released v0.3.2 as an intermediate version before napari 0.4.17. Feel free to try it out and let me know if things work :)

from blik.

brisvag avatar brisvag commented on July 30, 2024

@jdeschamps update: v0.3.3 is actually fixed, sorry :P

from blik.

jdeschamps avatar jdeschamps commented on July 30, 2024

Awesome thanks, I'll let you know if anything arises!

from blik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.