Skip to main content

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.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cfstreamparser-0.1.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file cfstreamparser-0.1.2.tar.gz.

File metadata

  • Download URL: cfstreamparser-0.1.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for cfstreamparser-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b20f785ee5eec1ee82a9e9646e6b4feb55f25028c4a24915acc0d432edcdf3f8
MD5 9ada9b177f29b72e2623ac84703ffbf7
BLAKE2b-256 0eb1c521b4e9e9cef9c174ad48978e5e0a85defa26a1234e61cc7e5fe8eca6a0

See more details on using hashes here.

File details

Details for the file cfstreamparser-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cfstreamparser-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for cfstreamparser-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa83b66225e13b43e54ec2055a89d3073c5122e4b7b9148f9d00c2ee66fde4ca
MD5 0fb000d800740bbea35a4587004b99e0
BLAKE2b-256 953dcd594e580785b13d3206591b6371f6acc8c06953f51ef913e2562920cb71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page