Stream-file parser for CrystFEL output
Project description
CFstreamparser
This is a simple Python library for parsing CrystFEL stream files, extracting global geometry, unit cell definitions, and per-frame indexing solutions.
Installation
pip install CFstreamparser
Usage Examples
from CFstreamparser import parse_stream_file
# 1. Parse a stream file
stream = parse_stream_file("path/to/your.stream")
# 2. Access global unit cell
print("Unit cell:", stream.uc)
# you can also query specfic parameters, e.g. like this:
print("Unit cell:", stream.uc.a) # to get length of a.
# 3. Access global geometry parameters
print("Detector center-to-lens distance (clen):", stream.geom.params["clen"])
# 4. Retrieve a specific frame by its event number (e.g., 215)
chunk = stream.get_chunk_by_event(215)
if chunk:
print(f"Frame {chunk.event} has {chunk.num_peaks} peaks")
# 5. Iterate through all indexing solutions for this frame
for sol_idx, sol in enumerate(chunk.crystals, start=1):
print(f"Solution {sol_idx}: {sol.num_reflections} reflections, final residual {sol.predict_refine.final_residual:.3f}")
# 6. Access the first solution's indexed reflections
first_solution = chunk.crystals[0]
print("First 5 indexed reflections:", first_solution.reflections[:5])
else:
print("No chunk found for event 215")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cfstreamparser-0.1.3.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cfstreamparser-0.1.3.tar.gz.
File metadata
- Download URL: cfstreamparser-0.1.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3bbe038110a8d58e131be1eb6d847aca133c0cc042f2a6ea81837668aa57df3
|
|
| MD5 |
1cd6dbfe9b03f297c8b03a62d385ecd5
|
|
| BLAKE2b-256 |
ea4491032b6dc0fa1c028f874f63d29fe95a8024a173143c86518683f1ccdd39
|
File details
Details for the file cfstreamparser-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cfstreamparser-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ada635577d2fc2e8fdb980c6caaaec9292253cfd2afc0443fec3763563133076
|
|
| MD5 |
4f3bfd44a5a2d1c90627dec398a5017c
|
|
| BLAKE2b-256 |
d5649cfbcafa0c9e1d0e131c7017d3c07253dc355780881acb6b68e2f65bd8f4
|