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
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ env:
# This environment tests the newest supported anaconda env
- DISTRIB="conda" PYTHON_VERSION="2.7"
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1"
SIX_VERSION="1.10.0" COVERAGE="true"
SIX_VERSION="1.10.0" NUMBA_VERSION="0.38.0" COVERAGE="true"
- DISTRIB="conda" PYTHON_VERSION="3.5"
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1"
SIX_VERSION="1.10.0" COVERAGE="true"

SIX_VERSION="1.10.0" NUMBA_VERSION="0.38.0" COVERAGE="true"
# # This environment tests conda extras matplotlib
# - DISTRIB="conda_extra" PYTHON_VERSION="3.5"
# NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1"
Expand All @@ -26,10 +26,10 @@ env:
# This environment tests minimal dependency versions
- DISTRIB="conda_min" PYTHON_VERSION="2.7"
SIX_VERSION="1.10.0" NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1"
COVERAGE="true"
- DISTRIB="conda_min" PYTHON_VERSION="3.4"
NUMBA_VERSION="0.38.0" COVERAGE="true"
- DISTRIB="conda_min" PYTHON_VERSION="3.5"
SIX_VERSION="1.10.0" NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1"
COVERAGE="true"
NUMBA_VERSION="0.38.0" COVERAGE="true"

# basic Ubuntu build environment
# - DISTRIB="ubuntu" PYTHON_VERSION="2.7"
Expand Down
9 changes: 5 additions & 4 deletions continuous_integration/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [[ "$DISTRIB" == "conda_min" ]]; then
# Configure the conda environment and put it in the path using the
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage \
six=$SIX_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
six=$SIX_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION numba=$NUMBA_VERSION
source activate testenv
pip install matplotlib

Expand All @@ -49,7 +49,7 @@ elif [[ "$DISTRIB" == "conda" ]]; then
# Configure the conda environment and put it in the path using the
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage six=$SIX_VERSION \
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION numba=$NUMBA_VERSION
source activate testenv

if [[ "$COVERAGE" == "true" ]]; then
Expand All @@ -73,7 +73,7 @@ elif [[ "$DISTRIB" == "conda_extra" ]]; then
# Configure the conda environment and put it in the path using the
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip nose coverage six=$SIX_VERSION \
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION numba=$NUMBA_VERSION
source activate testenv

pip install scikit-monaco
Expand All @@ -94,6 +94,7 @@ elif [[ "$DISTRIB" == "ubuntu" ]]; then
pip install numpy==$NUMPY_VERSION
pip install scipy==$SCIPY_VERSION
pip install six==$SIX_VERSION
pip install numba==$NUMBA_VERSION
pip install matplotlib

elif [[ "$DISTRIB" == "ubuntu_extra" ]]; then
Expand All @@ -106,7 +107,7 @@ elif [[ "$DISTRIB" == "ubuntu_extra" ]]; then
pip install numpy==$NUMPY_VERSION
pip install scipy==$SCIPY_VERSION
pip install six==$SIX_VERSION
pip install scikit-monaco==$SKMONACO_VERSION
pip install numba===$NUMBA_VERSION
pip install matplotlib==$MATPLOTLIB_VERSION

fi
Expand Down
5 changes: 5 additions & 0 deletions kcsd/KCSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from __future__ import division, print_function, absolute_import

import numpy as np
from numba import jit
from numpy.linalg import LinAlgError, svd
from scipy import special, integrate, interpolate
from scipy.spatial import distance
Expand Down Expand Up @@ -570,6 +571,7 @@ def forward_model(self, x, R, h, sigma, src_type):
pot *= 1./(2.0*sigma)
return pot

@jit
def int_pot_1D(self, xp, x, R, h, basis_func):
"""FWD model function.
Returns contribution of a point xp,yp, belonging to a basis source
Expand Down Expand Up @@ -747,6 +749,7 @@ def forward_model(self, x, R, h, sigma, src_type):
pot *= 1./(2.0*np.pi*sigma) # Potential basis functions bi_x_y
return pot

@jit
def int_pot_2D(self, xp, yp, x, R, h, basis_func):
"""FWD model function.
Returns contribution of a point xp,yp, belonging to a basis source
Expand Down Expand Up @@ -869,6 +872,7 @@ def forward_model(self, x, R, h, sigma, src_type):
pot *= 1./(2.0*np.pi*sigma)
return pot

@jit
def int_pot_2D_moi(self, xp, yp, x, R, h, basis_func):
"""FWD model function. Incorporates the Method of Images.
Returns contribution of a point xp,yp, belonging to a basis source
Expand Down Expand Up @@ -1092,6 +1096,7 @@ def forward_model(self, x, R, h, sigma, src_type):
pot *= 1./(4.0*np.pi*sigma)
return pot

@jit
def int_pot_3D(self, xp, yp, zp, x, R, h, basis_func):
"""FWD model function.
Returns contribution of a point xp,yp, belonging to a basis source
Expand Down
19 changes: 11 additions & 8 deletions kcsd/basis_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numba import jit


@jit(nopython=True)
def gauss(d, stdev, dim):
"""Gaussian function
Parameters
Expand All @@ -33,7 +34,7 @@ def gauss(d, stdev, dim):
Z = np.exp(-(d**2) / (2*stdev**2)) / (np.sqrt(2*np.pi)*stdev)**dim
return Z


@jit(nopython=True)
def step_1D(d, R):
"""Returns normalized 1D step function.
Parameters
Expand All @@ -50,6 +51,7 @@ def step_1D(d, R):
s = s / R #normalize with width
return s

@jit(nopython=True)
def gauss_1D(d, three_stdev):
"""Returns normalized gaussian 2D scale function
Parameters
Expand All @@ -66,7 +68,7 @@ def gauss_1D(d, three_stdev):
Z = gauss(d, stdev, 1)
return Z


@jit(nopython=True)
def gauss_lim_1D(d, three_stdev):
"""Returns gausian 2D function cut off after 3 standard deviations.
Parameters
Expand All @@ -84,7 +86,7 @@ def gauss_lim_1D(d, three_stdev):
Z *= (d < three_stdev)
return Z


@jit(nopython=True)
def step_2D(d, R):
"""Returns normalized 2D step function.
Parameters
Expand All @@ -101,6 +103,7 @@ def step_2D(d, R):
s = (d <= R) / (np.pi*(R**2))
return s

@jit(nopython=True)
def gauss_2D(d, three_stdev):
"""Returns normalized gaussian 2D scale function
Parameters
Expand All @@ -118,7 +121,7 @@ def gauss_2D(d, three_stdev):
Z = gauss(d, stdev, 2)
return Z


@jit(nopython=True)
def gauss_lim_2D(d, three_stdev):
"""Returns gausian 2D function cut off after 3 standard deviations.
Parameters
Expand All @@ -135,7 +138,7 @@ def gauss_lim_2D(d, three_stdev):
Z = (d <= three_stdev)*gauss_2D(d, three_stdev)
return Z


@jit(nopython=True)
def gauss_3D(d, three_stdev):
"""Returns normalized gaussian 3D scale function
Parameters
Expand All @@ -153,7 +156,7 @@ def gauss_3D(d, three_stdev):
Z = gauss(d, stdev, 3)
return Z


@jit(nopython=True)
def gauss_lim_3D(d, three_stdev):
"""Returns normalized gaussian 3D scale function cut off after 3stdev
Parameters
Expand All @@ -171,7 +174,7 @@ def gauss_lim_3D(d, three_stdev):
Z = Z * (d < (three_stdev))
return Z


@jit(nopython=True)
def step_3D(d, R):
"""Returns normalized 3D step function.
Parameters
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def readme():
# ]},
include_package_data=True,
install_requires=['future>=0.16.0',
'numpy>=1.8.0',
'scipy>=0.14.0',
'numpy>=1.10.4',
'scipy>=0.16.1',
'numba>=0.38.0',
'matplotlib>=2.0'],
extras_require={'docs': ['numpydoc>=0.5',
'sphinx>=1.2.2']},
Expand Down