Skip to content

Nin17/xraylib_numba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xraylib_numba

Ruff

Use xraylib in numba nopython functions.

Installation

pip install xraylib_numba

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

# %pip install xraylib_numba

@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.

About

A numba wrapper xraylib.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages