xray_data:convertfileseries
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| xray_data:convertfileseries [2019/01/21 16:32] – matthias | xray_data:convertfileseries [2026/08/10 10:37] (current) – smerkel | ||
|---|---|---|---|
| Line 71: | Line 71: | ||
| -d NDIGITS, --ndigits NDIGITS | -d NDIGITS, --ndigits NDIGITS | ||
| Number of digits for file number. Default is 4 | Number of digits for file number. Default is 4 | ||
| + | </ | ||
| + | |||
| + | ===== Other formats ===== | ||
| + | |||
| + | The ESRF fabio library, which you must have installed by now, can open and read many formats. Below is an example python program that will convert a series '' | ||
| + | |||
| + | As you can see, the code is not specific to CBF, as long as Fabio can read it, it will work... | ||
| + | |||
| + | < | ||
| + | import glob | ||
| + | import fabio, os | ||
| + | |||
| + | cbf_dir = "/ | ||
| + | edf_dir = "/ | ||
| + | dest_format = " | ||
| + | |||
| + | # Starting value of omega | ||
| + | omegastart = -23.5 | ||
| + | # Omega step | ||
| + | omegastep = 0.5 | ||
| + | # The first file will be assigne a value of omega = omegastart+omegastep/ | ||
| + | |||
| + | |||
| + | files = glob.glob(" | ||
| + | files.sort() | ||
| + | print(" | ||
| + | |||
| + | if not os.path.exists(edf_dir): | ||
| + | os.makedirs(edf_dir) | ||
| + | |||
| + | omega = omegastart + omegastep / 2. | ||
| + | for onefile in files: | ||
| + | dst_name = os.path.join(edf_dir, | ||
| + | print(" | ||
| + | im = fabio.open(onefile) | ||
| + | im.header[" | ||
| + | im.convert(dest_format).save(dst_name) | ||
| + | omega += omegastep | ||
| + | |||
| + | print ("Read %d file in %s" % (len(files), | ||
| + | print (" | ||
| + | print (" | ||
| </ | </ | ||
xray_data/convertfileseries.1548084768.txt.gz · Last modified: (external edit)
