The crystfelparser application is an easy-to-use, open-source toolbox for parsing the output stream from indexamajig. Basically, using this tool you can transform a raw text file into series of dictionaries, where for each frame you havea kewyword and the corresponding value, e.g. the strong reflections found by the spot finder and the positions of the predicted Bragg's reflections where the frames are indexable.
This library can also be used to parse the outputs from XDS, i.e. XDS_ASCII.HKL and SPOT.XDS.
Linux and MacOS are fully supported. Windows too, through WSL.
git clone https://github.com/pgasparo/crystfelparser
cd crystfelparser && makeAlternatively, if you already have a workin python environment with all the necessary libraries:
git clone https://github.com/pgasparo/crystfelparser
cd crystfelparser && pip install . A Dockerfile for manual builds is provided:
docker build -t crystfelparser . Attach to the provided container with:
docker run -it crystfelparser bashYou are now inside the container and you can use the script.
Usage from the command line, as a script, is simple: just specify an input stream and (optional) an output file.
crystfelparser --stream ../tutorials/crystfel.streamTo import and use functions from the library in your code:
from crystfelparser.crystfelparser import streamfile_parser
# parse a stream file
tutorial_stream = streamfile_parser("tutorials/crystfel.stream")
len(tutorial_stream.parsed[25])
# Output: 13To load a previously saved h5 file:
from crystfelparser.utils import load_dict_from_hdf5
# parse a stream file
parsed=load_dict_from_hdf5("parsed_stream.h5")
len(parsed[25])
# Output: 13XDS outputs can be parsed using the command line tool xdsparser:
xdsparser --file XDS_ASCII.HKL --dt 3or if you want to read the ouput from colspot
xdsparser --file SPOT.XDS --dt 0 --colspotIn-depth tutorials can be found in the tutorials subfolder. These include:
- something.ipynb: This showcases...
- something_else.ipynb: This dives into...
