Convert a bunch of CBF files into EDF format

This simple tutorial explains how to convert a bunch of CBF files to EDF files.

In [1]:
import glob
files = glob.glob("*.cbf")
print("Number of files: %s" % len(files))
Number of files: 18
In [2]:
dest_format = "edf"
dest_dir = "edf_format"
In [3]:
import fabio, os
if not os.path.exists(dest_dir):
In [4]:
for onefile in files:
    dst_name = os.path.join(dest_dir, os.path.splitext(onefile)[0] + "." + dest_format)
CPU times: user 476 ms, sys: 576 ms, total: 1.05 s
Wall time: 1.06 s
In [5]:
print("The overall speed is %.1f frame/second"%(len(files)/5.64))
The overall speed is 3.2 frame/second


This simple tutorial explains how to perform simple file conversion. It is likely to be limited by the bandwidth available for the hard-drive of your computer or by the compression/decompression algorithm as it the case here for CBF decompression.

In [ ]: