Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(xrayphysics)
project(xrayphysics CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ The x-ray source models are at least as accurate as TASMICS and much more flexib

## Installation and Usage

A python *wheel* package can be built and installed as follows.

```commandline
python -m pip install --upgrade pip build
python -m build .
pip install dist/xrayphysics*whl
```

The wildcard `*` is used in the above example because the exact package file name may vary.

If the build system cannot find all dependencies, they can be provided with CMake variables.
For example,

```commandline
python -m build . \
-Ccmake.define.CMAKE_PREFIX_PATH=/opt/homebrew \
-Ccmake.define.OpenMP_ROOT=/opt/homebrew/opt/libomp
```

Documentation is available [here](https://xrayphysics.readthedocs.io/)

Installation and usage information is posted on the [wiki page](https://github.com/kylechampley/XrayPhysics/wiki)
Expand All @@ -40,4 +59,3 @@ Champley, Kyle M., Stephen G. Azevedo, Isaac M. Seetho, Steven M. Glenn, Larry D
Kyle Champley and Timo Bremer. ”Efficient and Accurate Correction of
Beam Hardening Artifacts.”, 3rd International Congress on Image Formation
in X-ray CT, 2014.

40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[project]
name = "xrayphysics"
authors = [
{ name = "Kyle Champley", email = "champley@gmail.com" },
]
description = "x-ray cross section tables, x-ray tube source simulation, beam hardening correction, and dual energy decompositon"
readme = "README.md"
requires-python = ">=3.6"
#license = { text = "internal use only" }
dependencies = [
"numpy",
]
version = "1.2"

[project.optional-dependencies]

[tool.scikit-build]

# Extra args to pass directly to the builder in the build step.
build.tool-args = []

# The build targets to use when building the project. Empty builds the default
# target.
build.targets = []

# The components to install. If empty, all default components are installed.
install.components = []

sdist.cmake = true
sdist.include = [
"LICENSE",
]

wheel.packages = ["src/xrayphysics"]
wheel.license-files = ["LICENSE.txt"]
wheel.py-api = "py3"
13 changes: 3 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(xrayphysics CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenMP REQUIRED)

if (WIN32)
Expand Down Expand Up @@ -62,7 +55,7 @@ target_link_libraries(${PROJECT_NAME}

install(TARGETS ${PROJECT_NAME}
PUBLIC_HEADER DESTINATION include
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION xrayphysics
ARCHIVE DESTINATION xrayphysics
LIBRARY DESTINATION xrayphysics
)
2 changes: 1 addition & 1 deletion src/xrayphysics.py → src/xrayphysics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def resample(self, gammas, s, gammas_out):
Args:
gammas (numpy array): the energy samples (keV) of the given spectra
s (numpy array): the given spectra to resample
gammmas_out (numpy array): the energy samples (keV) to rebin to
gammas_out (numpy array): the energy samples (keV) to rebin to

Returns:
resampled spectra
Expand Down