Skip to main content

A numba compatible wrapper of the xraylib library.

Project description

numba-xraylib

Ruff

Use xraylib in numba nopython functions.

Installation

Clone the repository and submodules (with --recurse-submodules) then install with:

pip install .

Will be uploaded to PyPi shortly.

Usage

Simply install xraylib_numba in your environment to use xraylib and xraylib_np in nopython mode:

import xraylib
import xraylib_np
from numba import njit
import numpy as np

@njit
def AtomicWeight(Z):
    return xraylib.AtomicWeight(Z), xraylib_np.AtomicWeight(np.array([Z]))

print(AtomicWeight(1))  # (1.01, array([1.01]))

Currently, functions that have non-numeric arguments or returns are unsupported. If you know how to pass strings from numba to c please let me know.

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

numba_xraylib-0.2.0.tar.gz (13.2 MB view details)

Uploaded Source

File details

Details for the file numba_xraylib-0.2.0.tar.gz.

File metadata

  • Download URL: numba_xraylib-0.2.0.tar.gz
  • Upload date:
  • Size: 13.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for numba_xraylib-0.2.0.tar.gz
Algorithm Hash digest
SHA256 16f618ef46ed745325f019a2cbac53cbc3ee3251062586132a3c95386811cdc4
MD5 d30e0d6bccb44105da7aa8b176926d48
BLAKE2b-256 c0ca204ca55fb848f67e62b7992f510917b622ac51539c3a364d32222b1873db

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