Skip to content

[Bug]: .jpk-qi-data files not loading #173

Description

@bicarlsen

Describe the bug

Using AFMReader.jpk.load_jpk on a .jpk-qi-data is throwing the error TiffFileError: not a TIFF file b'PK\x03\x04'. In issue #154 @derollins states that this should be working now.

I tried with multiple images which open fine in Gwyddion.

Copy of the output

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
c:\Users\user\Downloads\.venv-afm-analysis\Lib\site-packages\tifffile\tifffile.py in ?(self, file, mode, name, offset, size, omexml, superres, _multifile, _useframes, _parent, **is_flags)
   4359         except Exception:
   4360             fh.close()
-> 4361             raise

KeyError: b'PK'

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

TiffFileError                             Traceback (most recent call last)
<ipython-input-12-f981e5507437> in ?()
      1 # %%
----> 2 jpk.load_jpk("qi_data.jpk-qi-data", "height")

c:\Users\user\Downloads\.venv-afm-analysis\Lib\site-packages\AFMReader\jpk.py in ?(file_path, channel, config_path, flip_image)
    215     filename = file_path.stem
    216     jpk_tags = _load_jpk_tags(config_path)
    217     try:
    218         tif = tifffile.TiffFile(file_path)
--> 219     except FileNotFoundError:
    220         logger.error(f"[{filename}] File not found : {file_path}")
    221         raise
    222     # Obtain channel list for all channels in file

c:\Users\user\Downloads\.venv-afm-analysis\Lib\site-packages\tifffile\tifffile.py in ?(self, file, mode, name, offset, size, omexml, superres, _multifile, _useframes, _parent, **is_flags)
   4357                 self.pages.useframes = True
   4358 
   4359         except Exception:
   4360             fh.close()
-> 4361             raise

TiffFileError: not a TIFF file b'PK\x03\x04'

To Reproduce

from AFMReader import jpk 

jpk.load_jpk("qi_data.jpk-qi-data", "height")

I also tried the height_trace and other channels as shown in #155 with the same result.

AFMReader Version

0.0.6

Python Version

3.13

Operating System

Windows

Python Packages

  • AFMReader: 0.0.6
  • Python: 3.13
    (These aren't listed in the available options.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions