Skip to content

Problem converting CBF files to SFRM #401

@RufusTFirefly

Description

@RufusTFirefly

Hi Developers

I have a bunch of CBF files generated by a Dectris Pilatus200K detector and I want to convert them to SFRM
using the fabio library.
I used the tutorial script and changed "edf" (which works file) with "sfrm":

import glob
import fabio, os

files = glob.glob("*.cbf")
files.sort()
print("Number of files: %s" % len(files))

dest_format = "sfrm"
dest_dir = "sfrm_format"

if not os.path.exists(dest_dir):
    os.makedirs(dest_dir)
    
for onefile in files:
    dst_name = os.path.join(dest_dir, os.path.splitext(onefile)[0] + "." + dest_format)
    fabio.open(onefile).convert(dest_format).save(dst_name)

I used the cbf file appended.
When runnning the script I get an error message:

(base) C:\Users\xxxxx\Documents\Python Scripts>python testfabio.py
Number of files: 2
C:\Users\xxxxx\Anaconda3\lib\site-packages\fabio\bruker100image.py:288: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  if numpy.issubdtype(self.data.dtype, float):
Traceback (most recent call last):
  File "testfabio.py", line 23, in <module>
    fabio.open(onefile).convert(dest_format).save(dst_name)
  File "C:\Users\xxxxx\Anaconda3\lib\site-packages\fabio\fabioimage.py", line 676, in save
    self.write(fname)
  File "C:\Users\xxxxx\Anaconda3\lib\site-packages\fabio\bruker100image.py", line 309, in write
    if int(self.header["NOVERFL"].split()[0]) > 0:
KeyError: 'NOVERFL'

It appears to search in the header (which at this point is a CBF header) for a keywork "NOVERFL" that I have never seen in the miniCBF header written by Pilatus detectors.

Best regards

RTF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions