Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pyproject.toml #22

Merged
merged 5 commits into from
Jan 5, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install fftw3 libs (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libfftw3-dev libfftw3-3
sudo apt-get install -y libfftw3-dev libfftw3-double3
- name: Install fftw3 libs (macOS)
if: runner.os == 'macOS'
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ target/
*.rst~

_version_save.py
_version.py

# extracted test files
tests/data/*__*.txt
Expand All @@ -75,3 +76,6 @@ tests/data/*__*.txt
*bib.sav

.idea

# used by pyenv-virtualenv:
.python-version
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.4.9
- fix: support numpy 2
- setup: bumpy scikit-image to 0.21.0 (API)
- setup: migrate to pyproject.toml
0.4.8
- fix: cut-off radius too small in fmap_2d algorithm (#19)
0.4.7
Expand Down
1 change: 0 additions & 1 deletion odtbrain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from ._prepare_sino import sinogram_as_radon, sinogram_as_rytov
from ._translate_ri import odt_to_ri, opt_to_ri
from ._version import version as __version__
from ._version import longversion as __version_full__

from . import apple
from . import util
Expand Down
2 changes: 1 addition & 1 deletion odtbrain/_alg3d_bpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def backpropagate_3d(uSin, angles, res, nm, lD=0, coords=None,

# setup dtype
if dtype is None:
dtype = np.float_
dtype = np.float64
dtype = np.dtype(dtype)
if dtype.name not in ["float32", "float64"]:
raise ValueError("dtype must be float32 or float64!")
Expand Down
2 changes: 1 addition & 1 deletion odtbrain/_alg3d_bppt.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def backpropagate_3d_tilted(uSin, angles, res, nm, lD=0,

# setup dtype
if dtype is None:
dtype = np.float_
dtype = np.float64
dtype = np.dtype(dtype)
if dtype.name not in ["float32", "float64"]:
raise ValueError("dtype must be float32 or float64!")
Expand Down
4 changes: 2 additions & 2 deletions odtbrain/_prepare_sino.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def sinogram_as_radon(uSin, align=True):
# slices one by one.
phiR = np.angle(uSin)
for ii in range(len(phiR)):
phiR[ii] = unwrap_phase(phiR[ii], seed=47)
phiR[ii] = unwrap_phase(phiR[ii], rng=47)

if align:
align_unwrapped(phiR)
Expand Down Expand Up @@ -169,7 +169,7 @@ def sinogram_as_rytov(uSin, u0=1, align=True):
# data. Since we have a sinogram, we need to pass it the
# slices one by one.
for ii in range(len(phiR)):
phiR[ii] = unwrap_phase(phiR[ii], seed=47)
phiR[ii] = unwrap_phase(phiR[ii], rng=47)

if align:
align_unwrapped(phiR)
Expand Down
197 changes: 0 additions & 197 deletions odtbrain/_version.py

This file was deleted.

51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
# Defined by PEP 518:
requires = [
# for version management
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
]
build-backend = "setuptools.build_meta"

[project]
name = "ODTbrain"
authors = [
# In alphabetical order.
{ name = "Paul Müller" },
]
maintainers = [
{ name = "Paul Müller", email = "[email protected]" },
]
description = "Algorithms for diffraction tomography"
readme = "README.rst"
requires-python = ">=3.5, <4"
keywords = ["odt", "opt", "diffraction", "born", "rytov", "radon",
"backprojection", "backpropagation", "inverse problem",
"Fourier diffraction theorem", "Fourier slice theorem"]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Visualization",
"Intended Audience :: Science/Research"
]
license = {file = "LICENSE"}
dependencies = [
"numexpr",
"numpy>=1.7.0",
"pyfftw>=0.9.2,<1",
"scikit-image>=0.21.0,<1",
"scipy>=1.4.0,<2"
]
dynamic = ["version"]

[project.urls]
source = "https://github.com/RI-imaging/ODTbrain"
tracker = "https://github.com/RI-imaging/ODTbrain/Issues"

[tool.setuptools_scm]
write_to = "odtbrain/_version.py"
version_scheme = "post-release"

[tool.setuptools.packages.find]
where = ["."]
include = ["odtbrain"]
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

46 changes: 0 additions & 46 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_correct_reproduce():
write_results(myframe, fo)

data = fo.flatten().view(float)
assert np.allclose(data, get_results(myframe))
assert np.allclose(data, get_results(myframe), atol=2.E-6)


def test_correct_values():
Expand Down
Loading