Skip to content

Commit

Permalink
Change dist:precise to dist:trusty (#56)
Browse files Browse the repository at this point in the history
* Change dist:precise to dist:trusty

* Make shorter tests

* Remove incorrect part of the test

* Lower source number and spatial resolution to speed up tests

* Add docstrings

* Comment out build for ubuntu trusty because the build takes too long
  • Loading branch information
asiaszmek committed Oct 26, 2018
1 parent 00a1605 commit 34ae665
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 72 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dist: precise
dist: trusty
language: python
sudo: false
python:
- 2.7.13
- 2.7.14

branches:
only:
- master

install: travis_wait
env:
matrix:
# This environment tests the newest supported anaconda env
Expand All @@ -32,9 +32,9 @@ env:
COVERAGE="true"

# basic Ubuntu build environment
- DISTRIB="ubuntu" PYTHON_VERSION="2.7"
NUMPY_VERSION="1.8.0" SCIPY_VERSION="0.14.0" SIX_VERSION="1.10.0"
COVERAGE="true"
# - DISTRIB="ubuntu" PYTHON_VERSION="2.7"
# NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.16.1" SIX_VERSION="1.10.0"
# COVERAGE="true"

# - DISTRUB="ubuntu_extra" PYTHON_VERSION="2.7"
# SKMONACO_VERSION="0.2" NUMPY_VERSION="1.13.0" SCIPY_VERSION="1.0.0"
Expand Down
8 changes: 4 additions & 4 deletions kcsd/tests/kcsd_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setUp(self):
self.pots = np.reshape(pots, (-1, 1))
self.test_method = 'KCSD1D'
self.test_params = {'h': 1., 'sigma': 0.3, 'R_init': 0.2,
'n_src_init': 1000, 'xmin': 0., 'xmax': 1.,}
'n_src_init': 100, 'xmin': 0., 'xmax': 1.,}

def test_kcsd1d_estimate(self, cv_params={}):
self.test_params.update(cv_params)
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_kcsd2d_estimate(self, cv_params={}):
'between trueCSD and estimate > 0.5')

def test_moi_estimate(self):
result = MoIKCSD(self.ele_pos, self.pots, n_src_init=500,
result = MoIKCSD(self.ele_pos, self.pots, n_src_init=200,
MoI_iters=20, sigma_S=0.3, **self.test_params)
result.cross_validate(Rs=np.array((0.41, 0.42)))
vals = result.values()
Expand Down Expand Up @@ -118,11 +118,11 @@ def setUp(self):
h=50., sigma=1.)
self.pots = np.reshape(pots, (-1, 1))
self.test_method = 'KCSD3D'
self.test_params = {'gdx': 0.05, 'gdy': 0.05, 'gdz': 0.05,
self.test_params = {'gdx': 0.2, 'gdy': 0.2, 'gdz': 0.2,
'src_type': 'gauss',
'R_init': 0.31, 'xmin': 0., 'xmax': 1., 'ymin': 0.,
'ymax': 1., 'zmin': 0., 'zmax': 1.,
'n_src_init': 3000}
'n_src_init': 100}

def test_kcsd3d_estimate(self, cv_params={}):
self.test_params.update(cv_params)
Expand Down
34 changes: 0 additions & 34 deletions kcsd/tests/test_ball_and_stick_8.py

This file was deleted.

43 changes: 16 additions & 27 deletions kcsd/tests/test_sKCSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,28 @@
from kcsd.utility_functions import LoadData

try:
basestring
basestring
except NameError:
basestring = str
basestring = str


n_src = 1000
n_src = 5

class testsKCD(unittest.TestCase):
@classmethod
def setUpClass(cls,n_src=1000):
sc = 1e6
sKCSD.skmonaco_available = False
cls.data = LoadData(os.path.join(sample_data_path, "ball_and_stick_8"))
cls.data.morphology[:,2:6] = cls.data.morphology[:,2:6]/sc
cls.reco = sKCSD(cls.data.ele_pos/sc,cls.data.LFP[:100],cls.data.morphology,n_src_init=n_src)
cls.segments = cls.reco.values(transformation='segments')
cls.loops = cls.reco.values(transformation=None)
cls.cartesian = cls.reco.values(transformation='3D')

def test_values_segments_shape(self):
self.assertTrue(len(self.segments.shape) == 2)

def test_values_segments_length(self):
self.assertTrue(self.segments.shape[0] == len(self.data.morphology)-1)

def test_values_loops_shape(self):
self.assertTrue(len(self.loops.shape) == 2)

def test_values_loops_length(self):
self.assertTrue(self.loops.shape[0] == 2*(len(self.data.morphology)-1)+1) #plus 1, because we include 0
@classmethod
def setUpClass(cls, n_src=5):
"""
Check, if it is possible to read in data.
This test will be expanded and more neurons read-in.
"""

cls.data2 = LoadData(os.path.join(sample_data_path, "Simple_with_branches"))
cls.data2.morphology[:, 2:6] = cls.data2.morphology[:, 2:6]/sc
cls.data2.ele_pos = cls.data2.ele_pos/sc
cls.data2.LFP = cls.data2.LFP[:,:10]/1e3
cls.reco2 = sKCSD(cls.data2.ele_pos, cls.data2.LFP, cls.data2.morphology, n_src_init=n_src, dist_table_density=5)


def test_values_cartesian_shape(self):
self.assertTrue(len(self.cartesian.shape) == 4)

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion kcsd/validation/ValidateKCSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def integrate(self, csd_at, true_csd, ele_loc, h, csd_lims=None):
if self.dim == 1:
m = np.sqrt((csd_at - ele_loc)**2 + h**2) - abs(csd_at - ele_loc)
y = true_csd * m
Integral = simps(y, csd_at)
Integral = simps(y, x=csd_at)
elif self.dim == 2:
csd_x = csd_at[0]
csd_y = csd_at[1]
Expand Down

0 comments on commit 34ae665

Please sign in to comment.