xray_data:convertfileseries
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| xray_data:convertfileseries [2019/01/18 14:19] – created smerkel | xray_data:convertfileseries [2026/08/10 10:37] (current) – smerkel | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Convert! | + | ====== |
| + | |||
| + | |||
| + | ===== Introduction ===== | ||
| + | |||
| + | Typical diamond anvil cell beamlines generate series of diffraction files in various formats, which are not the [[fileformat: | ||
| + | |||
| + | Data collected at step scans have a starting ω position, an end ω position, and a step size δω. Diffraction are collected at each ω and save in files such as '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | The scripts '' | ||
| + | |||
| + | Watch out! You can generate vast amount of data! You may want to include such scripts into larger scripts as you develop your data processing strategy. | ||
| + | |||
| + | ===== timelessTiff2edf ===== | ||
| + | |||
| + | < | ||
| + | timelessTiff2edf -h | ||
| + | |||
| + | usage: timelessTiff2edf -f from -t to -s step -n stem -i first image [OPTIONS] | ||
| + | |||
| + | Creates a list of EDF files based on a collection of TIFF files This is part | ||
| + | of the TIMEleSS project http:// | ||
| + | |||
| + | optional arguments: | ||
| + | -h, --help | ||
| + | -f FROM, --from FROM Start for omega scan (in degrees, required) | ||
| + | -t TO, --to TO End for omega scan (in degrees, required) | ||
| + | -s STEP, --step STEP Omega step (in degrees, required) | ||
| + | -n STEM, --stem STEM Stem for images files (required) | ||
| + | -i IMAGEFIRST, --imagefirst IMAGEFIRST | ||
| + | Number of first image file in series (required) | ||
| + | -p TIFFIMAGEPATH, | ||
| + | Path to tiff images. Default is ./ | ||
| + | -e EDFIMAGEPATH, | ||
| + | Path in which to save edf images. Default is ./ | ||
| + | -x EXTENSION, --extension EXTENSION | ||
| + | Extension for tiff files. Default is tif | ||
| + | -d NDIGITS, --ndigits NDIGITS | ||
| + | Number of digits for file number. Default is 4 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== timelessMccd2edf ===== | ||
| + | |||
| + | < | ||
| + | timelessMccd2edf -h | ||
| + | |||
| + | usage: timelessMccd2edf -f from -t to -s step -n stem -i first image [OPTIONS] | ||
| + | |||
| + | Creates a list of EDF files based on a collection of MarCCD files This is part | ||
| + | of the TIMEleSS project http:// | ||
| + | |||
| + | optional arguments: | ||
| + | -h, --help | ||
| + | -f FROM, --from FROM Start for omega scan (in degrees, required) | ||
| + | -t TO, --to TO End for omega scan (in degrees, required) | ||
| + | -s STEP, --step STEP Omega step (in degrees, required) | ||
| + | -n STEM, --stem STEM Stem for images file (required) | ||
| + | -i IMAGEFIRST, --imagefirst IMAGEFIRST | ||
| + | Number of first image file in series (required) | ||
| + | -p MCCDIMAGEPATH, | ||
| + | Path to MarCCD images. Default is ./ | ||
| + | -e EDFIMAGEPATH, | ||
| + | Path in which to save edf images. Default is ./ | ||
| + | -x EXTENSION, --extension EXTENSION | ||
| + | Extension for MarCCD files. Default is mccd | ||
| + | -d NDIGITS, --ndigits NDIGITS | ||
| + | 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.1547817589.txt.gz · Last modified: (external edit)
