Skip to main content

A numba compatible wrapper of the xraylib library.

Project description

numba-xraylib

Ruff

Use xraylib in numba nopython functions.

Installation

pip install numba-xraylib

Usage

Simply install numba-xraylib 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 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.1.tar.gz (13.2 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: numba_xraylib-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 433f36411c4f9b085f50bcefa8d152a479f51e4be2dba88f2b9ea498d82dd01d
MD5 2bd00388e6a74001116e6cc589cef145
BLAKE2b-256 e262e1911b20055016e3cfe23e1a2da32811bc30f9d72c576b5f729d5e4ace3d

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