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.1.tar.gz (5.4 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.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cfstreamparser-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 61de9ae8742f103396cd358a05006969bde007ef7fc3470a6ea90e6eefd839d0
MD5 9ae47eeeb062b2538ad71267f547226f
BLAKE2b-256 b3b806edb4248d9ec60a3440c1ff82d554b3f8c987f391824e09ed1c572e12e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cfstreamparser-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8149bcb4ce9611f5d9955ed724f68faafac206bd91008cb36634d36b6cc42a36
MD5 abe810895ff479e363c459f1151f3b67
BLAKE2b-256 df25fe78c3dd946c3fb5f9fe0a3a47a4df59bee60d65ba90273268ddad7e404d

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