Skip to content
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
4 changes: 2 additions & 2 deletions conda_recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requirements:
- numpy
- scipy
- matplotlib
- cython >=0.26
- Cython >=0.26
- nose
- pygments

Expand All @@ -39,7 +39,7 @@ requirements:
- numpy
- scipy
- matplotlib
- cython >=0.26
- Cython >=0.26
- nose
- pygments

Expand Down
2 changes: 1 addition & 1 deletion doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ To install tofu as a developer, we recommend using the conda ecosystem (Minicond
(long) <https://www.atlassian.com/git/tutorials>`__ or `this short
one <https://rogerdudler.github.io/git-guide/>`__
- Run ``pip install -e .[dev]``. This will install dependencies, compile the
tofu Cython extensions and install it into your conda environment while you can still
tofu cython extensions and install it into your conda environment while you can still
modify the source files in the current repository.`
- Make sure tofu tests are running by typing ``nosetests``
4 changes: 2 additions & 2 deletions doc/source/release_notes/release_notes_141.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Code structure and format
Restructuring of the geometry modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Created Cython include files ``*.pxd`` and ``*.pyx`` for the following
Created cython include files ``*.pxd`` and ``*.pyx`` for the following
group of functions: - ``_basic_geom_tools.*``: global variables
definition (``_VSMALL`` and ``_SMALL``), and basic geometric tools
(vector calculus, path distance point-point, point-vector,...) -
Expand All @@ -244,7 +244,7 @@ Installation and portability
impossible
- git dependency is now optional (issue #67 )
- changes in ``setup.py`` for **Windows** portability
- Now only supporting ``Cython`` versions ``>=0.26``
- Now only supporting ``cython`` versions ``>=0.26``
- Removed all **pandas** dependencies
- Using ``-O3`` flag instead of ``-O0`` for faster execution time even
if compilation is slower
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ scipy
matplotlib

######## Requirements with Version Specifier ########
cython>=0.26
Cython>=0.26
43 changes: 29 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,31 @@
import platform
import subprocess
from codecs import open
import Cython as cth
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import numpy as np
try:
import numpy as np
import Cython as cth
from Cython.Distutils import build_ext
from Cython.Build import cythonize
from Cython.Build import build_ext as cthBext
# Why do we need two different build_ext command ?

def npgetinclude(): return np.get_include()
print("cython version =", cth.__version__)
print("numpy version =", np.__version__)
print("cython file =", cth.__file__)
print("numpy file =", np.__file__)
except ImportError:
def npgetinclude():
import numpy as np
return np.get_include()
def cythonize(*args, **kwargs):
from Cython.Build import cythonize
return cythonize(*args, **kwargs)
def cthBext(*args, **kwargs):
from Cython.Build import build_ext as cthBext
return cthBext(*args, **kwargs)
import _updateversion as up

from distutils.command.clean import clean as Clean


print("cython version =", cth.__version__)
print("numpy version =", np.__version__)
print("cython version =", cth.__file__)
print("numpy version =", np.__file__)

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("tofu.setup")
Expand All @@ -36,6 +48,9 @@
from distutils.core import setup
from distutils.extension import Extension

# Is there a clean command from setuptools instead of distutils ?
from distutils.command.clean import clean as Clean

is_platform_windows = False
if platform.system() == "Windows":
is_platform_windows = True
Expand Down Expand Up @@ -282,7 +297,7 @@ def get_version_tofu(path=_HERE):
# The version is stored only in the setup.py file and read from it (option
# 1 in https://packaging.python.org/en/latest/single_source_version.html)
use_scm_version=False,
# setup_requires=['setuptools_scm'],
setup_requires=['numpy', 'cython>=0.26'],
description="A python library for Tomography for Fusion",
long_description=long_description,
long_description_content_type=long_description_content_type,
Expand Down Expand Up @@ -384,7 +399,7 @@ def get_version_tofu(path=_HERE):
# ],
# },
ext_modules=extensions,
cmdclass={"build_ext": cth.Build.build_ext,
cmdclass={"build_ext": cthBext,
"clean": CleanCommand},
include_dirs=[np.get_include()],
include_dirs=[npgetinclude()],
)
20 changes: 10 additions & 10 deletions tofu/geom/_GG.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import numpy as np
import scipy.integrate as scpintg
from matplotlib.path import Path

# -- Cython libraries imports --------------------------------------------------
# -- cython libraries imports --------------------------------------------------
from cpython cimport bool
from cpython.array cimport array, clone
from cython.parallel import prange
Expand Down Expand Up @@ -3679,7 +3679,7 @@ def comp_dist_los_circle(np.ndarray[double,ndim=1,mode='c'] ray_vdir,
to the circle
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `dist_los_circle_core`
Python, if you need it from cython, use `dist_los_circle_core`
"""
cdef double[2] res
_dt.dist_los_circle_core(<double*>ray_vdir.data,
Expand Down Expand Up @@ -3714,7 +3714,7 @@ def comp_dist_los_circle_vec(int nlos, int ncircles,
with the distance between each LOS to each circle
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `dist_los_circle_core`
Python, if you need it from cython, use `dist_los_circle_core`
"""
cdef array kmin_tab = clone(array('d'), nlos*ncircles, True)
cdef array dist_tab = clone(array('d'), nlos*ncircles, True)
Expand Down Expand Up @@ -3748,7 +3748,7 @@ def is_close_los_circle(np.ndarray[double,ndim=1,mode='c'] ray_vdir,
The result is True when distance < epsilon
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `is_los_close_circle_core`
Python, if you need it from cython, use `is_los_close_circle_core`
"""
return _dt.is_close_los_circle_core(<double*>ray_vdir.data,
<double*>ray_orig.data,
Expand All @@ -3767,7 +3767,7 @@ def is_close_los_circle_vec(int nlos, int ncircles, double epsilon,
The result is True when distance < epsilon
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `is_los_close_circle_core`
Python, if you need it from cython, use `is_los_close_circle_core`
"""
cdef array res = clone(array('i'), nlos, True)

Expand Down Expand Up @@ -3824,7 +3824,7 @@ def comp_dist_los_vpoly(double[:, ::1] ray_orig,
`distance[i]` is the distance from P_i to the extruded polygon.
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `simple_dist_los_vpoly_core`
Python, if you need it from cython, use `simple_dist_los_vpoly_core`
"""
cdef int npts_poly = ves_poly.shape[1]
cdef int nlos = ray_orig.shape[1]
Expand Down Expand Up @@ -3929,7 +3929,7 @@ def comp_dist_los_vpoly_vec(int nvpoly, int nlos,
extruded poly.
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `comp_dist_los_vpoly_vec_core`
Python, if you need it from cython, use `comp_dist_los_vpoly_vec_core`
"""
if not algo_type.lower() == "simple" or not ves_type.lower() == "tor":
assert False, "The function is only implemented with the simple"\
Expand Down Expand Up @@ -4003,7 +4003,7 @@ def is_close_los_vpoly_vec(int nvpoly, int nlos,
and j-th poly are closer than epsilon. (True if distance<epsilon)
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `is_close_los_vpoly_vec_core`
Python, if you need it from cython, use `is_close_los_vpoly_vec_core`
"""
warn("This function supposes that the polys are nested from inner to outer",
Warning)
Expand Down Expand Up @@ -4069,7 +4069,7 @@ def which_los_closer_vpoly_vec(int nvpoly, int nlos,
among all other LOS without going over it.
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `which_los_closer_vpoly_vec_core`
Python, if you need it from cython, use `which_los_closer_vpoly_vec_core`
"""
warn("This function supposes that the polys are nested from inner to outer",
Warning)
Expand Down Expand Up @@ -4129,7 +4129,7 @@ def which_vpoly_closer_los_vec(int nvpoly, int nlos,
among all other poly without going over it.
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `which_vpoly_closer_los_vec_core`
Python, if you need it from cython, use `which_vpoly_closer_los_vec_core`
"""
warn("This function supposes that the polys are nested from inner to outer",
Warning)
Expand Down
14 changes: 7 additions & 7 deletions tofu/geom/_distance_tools.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ cdef inline void comp_dist_los_circle_vec_core(int num_los, int num_cir,
# res = [kmin(los1, cir1), kmin(los1, cir2),...]
# ---
# This is the PYTHON function, use only if you need this computation from
# Python, if you need it from Cython, use `dist_los_circle_core`
# Python, if you need it from cython, use `dist_los_circle_core`
"""
cdef int i, ind_los, ind_cir
cdef double* loc_res
Expand Down Expand Up @@ -550,7 +550,7 @@ cdef inline void is_close_los_circle_vec_core(int num_los, int num_cir,
res = [kmin(los1, cir1), kmin(los1, cir2),...]
---
This is the PYTHON function, use only if you need this computation from
Python, if you need it from Cython, use `dist_los_circle_core`
Python, if you need it from cython, use `dist_los_circle_core`
"""
cdef int i, ind_los, ind_cir
cdef double* dirv
Expand Down Expand Up @@ -632,7 +632,7 @@ cdef inline void comp_dist_los_vpoly_vec_core(int num_poly, int nlos,
`distance[j, i]` is the distance from P_i to the i-th extruded poly.
---
This is the CYTHON function, use only if you need this computation from
Cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
"""
cdef int i, ind_los, ind_pol, ind_pol2
cdef int npts_poly
Expand Down Expand Up @@ -771,7 +771,7 @@ cdef inline void simple_dist_los_vpoly_core(const double[3] ray_orig,
`distance[i]` is the distance from P_i to the extruded polygon.
if the i-th LOS intersects the poly, then distance[i] = Cnan
---
This is the Cython version, only accessible from cython. If you need
This is the cython version, only accessible from cython. If you need
to use it from Python please use: comp_dist_los_vpoly
"""
cdef int jj
Expand Down Expand Up @@ -1096,7 +1096,7 @@ cdef inline void is_close_los_vpoly_vec_core(int num_poly, int nlos,
and j-th poly are closer than epsilon. (True if distance<epsilon)
---
This is the CYTHON function, use only if you need this computation from
Cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
"""
cdef int i, ind_los, ind_pol, ind_pol2
cdef int npts_poly
Expand Down Expand Up @@ -1187,7 +1187,7 @@ cdef inline void which_los_closer_vpoly_vec_core(int num_poly, int nlos,
among all other LOS without going over it.
---
This is the CYTHON function, use only if you need this computation from
Cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
"""
cdef int i, ind_los, ind_pol, ind_pol2, indloc
cdef int npts_poly
Expand Down Expand Up @@ -1264,7 +1264,7 @@ cdef inline void which_vpoly_closer_los_vec_core(int num_poly, int nlos,
among all other poly without going over it.
---
This is the CYTHON function, use only if you need this computation from
Cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
cython, if you need it from Python, use `comp_dist_los_vpoly_vec`
"""
cdef int i, ind_los, ind_pol, ind_pol2, indloc
cdef int npts_poly
Expand Down
2 changes: 1 addition & 1 deletion tofu/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Do not edit, pipeline versioning governed by git tags!
__version__ = '1.4.2-alpha2'
__version__ = '1.4.2-alpha2-13-g7db6643'