Skip to content
Snippets Groups Projects
Commit 352242ae authored by Jan Caron's avatar Jan Caron
Browse files

Got rid of nose in all tests. Finished environment.yml.

parent 618b728d
No related branches found
No related tags found
No related merge requests found
Showing with 78 additions and 82 deletions
...@@ -4,6 +4,8 @@ desktop.ini ...@@ -4,6 +4,8 @@ desktop.ini
.idea .idea
.coverage
*.egg-info *.egg-info
.DS_Store .DS_Store
# Create environment with "conda env create", update with "conda env update"!
name: pyramid name: pyramid
channels:
- defaults
- conda-forge # Used for hyperspy, pyFFTW (linux-64/osx-64) and more!
- ccpi # Used for pyFFTW on win-64!
dependencies: dependencies:
- python=3.5 # Basic:
- numpy - python=3.5 # TODO: upgrade to 3.6!
- pip - numpy=1.11
- pip: - scipy=0.19
- pypi-package-name - tqdm=4.14
- scikit-image=0.13
# Fast computation:
- pyFFTW=0.10
# File IO:
- hyperspy=1.3
- hyperspy-gui-ipywidgets=1.0
- hyperspy-gui-traitsui=1.0 # TODO: Optional! Delete when mayavi is gone!
- h5py=2.7
# Plotting and colors: # TODO: Shift to plotting package?
- matplotlib=2.0
- Pillow=4.1
- cmocean=1.1
- qt=4.8 # Necessary because of traits in mayavi...
- mayavi=4.5 # TODO: Get rid of!
#- colorspacious # TODO: NOT USED?
#- visvis # TODO: NOT USED?
# Testing:
- pytest=3.1
- pytest-cov=2.5
- pytest-flake8=0.8
- pytest-runner=2.11
- coverage=4.4
# IPython and notebooks:
- ipython=5.3
- jupyter=1.0
# TODO: Add back GUI dependencies!
# TODO: Get Jutil from gitlab (currently doesn't work, git and cygwin don't play nice,...
# TODO: ...because one is Unix, ond is Windows).
# - pip=9.0
# - pip:
# # ALSO NEEDS JUTIL!
# - "git+ssh://gitlab@iffgit.fz-juelich.de/unger/jutil.git"
#
# # FOLLOWING NOT USED ANYMORE, CONDA WORKS, TOO (with appropriate channels):
# # Install pyFFTW=0.10 from wheel:
# - http://www.lfd.uci.edu/~gohlke/pythonlibs/pyFFTW‑0.10.4‑cp35‑cp35m‑win_amd64.whl
# # Install mayavi=4.5 and VTK from wheel:
# - http://www.lfd.uci.edu/~gohlke/pythonlibs/mayavi‑4.5.0+vtk71‑cp35‑cp35m‑win_amd64.whl
...@@ -10,7 +10,7 @@ pack will be used. FFTW objects are saved in a cache after creation which speeds ...@@ -10,7 +10,7 @@ pack will be used. FFTW objects are saved in a cache after creation which speeds
FFT operations. FFT operations.
""" """
# TODO: is this still in use or deprecated by jutil???
import pickle import pickle
import logging import logging
......
...@@ -54,8 +54,3 @@ class TestCaseAnalytic(unittest.TestCase): ...@@ -54,8 +54,3 @@ class TestCaseAnalytic(unittest.TestCase):
reference = np.load(os.path.join(self.path, 'ref_phase_vort.npy')) reference = np.load(os.path.join(self.path, 'ref_phase_vort.npy'))
assert_allclose(phase, reference, atol=1E-10, assert_allclose(phase, reference, atol=1E-10,
err_msg='Unexpected behavior in phase_mag_vortex()') err_msg='Unexpected behavior in phase_mag_vortex()')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -74,8 +74,3 @@ class TestCaseCostfunction(unittest.TestCase): ...@@ -74,8 +74,3 @@ class TestCaseCostfunction(unittest.TestCase):
def test_hess_diag(self): def test_hess_diag(self):
assert_allclose(self.cost.hess_diag(None), np.ones(self.cost.n), assert_allclose(self.cost.hess_diag(None), np.ones(self.cost.n),
err_msg='Unexpected behaviour in hess_diag()!') err_msg='Unexpected behaviour in hess_diag()!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -88,8 +88,3 @@ class TestCaseDataSet(unittest.TestCase): ...@@ -88,8 +88,3 @@ class TestCaseDataSet(unittest.TestCase):
mask_ref[1:-1, 1:-1, 1:-1] = True mask_ref[1:-1, 1:-1, 1:-1] = True
np.testing.assert_equal(self.data.mask, mask_ref, np.testing.assert_equal(self.data.mask, mask_ref,
err_msg='Unexpected behaviour in set_3d_mask') err_msg='Unexpected behaviour in set_3d_mask')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -116,8 +116,3 @@ class TestCaseVectorData(unittest.TestCase): ...@@ -116,8 +116,3 @@ class TestCaseVectorData(unittest.TestCase):
err_msg='Unexpected behavior in load_from_hdf5()!') err_msg='Unexpected behavior in load_from_hdf5()!')
assert_allclose(magdata.a, self.magdata.a, assert_allclose(magdata.a, self.magdata.a,
err_msg='Unexpected behavior in load_from_hdf5()!') err_msg='Unexpected behavior in load_from_hdf5()!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -67,8 +67,3 @@ class TestCaseForwardModel(unittest.TestCase): ...@@ -67,8 +67,3 @@ class TestCaseForwardModel(unittest.TestCase):
jac_T_ref = np.load(os.path.join(self.path, 'jac.npy')).T jac_T_ref = np.load(os.path.join(self.path, 'jac.npy')).T
assert_allclose(jac_T, jac_T_ref, atol=1E-7, assert_allclose(jac_T, jac_T_ref, atol=1E-7,
err_msg='Unexpected behaviour in the the transposed jacobi matrix!') err_msg='Unexpected behaviour in the the transposed jacobi matrix!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -30,8 +30,3 @@ class TestCaseKernel(unittest.TestCase): ...@@ -30,8 +30,3 @@ class TestCaseKernel(unittest.TestCase):
err_msg='Unexpected behavior in u_fft') err_msg='Unexpected behavior in u_fft')
assert_allclose(self.kernel.v_fft, ref_v_fft, atol=1E-7, assert_allclose(self.kernel.v_fft, ref_v_fft, atol=1E-7,
err_msg='Unexpected behavior in v_fft') err_msg='Unexpected behavior in v_fft')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -78,8 +78,3 @@ class TestCaseMagCreator(unittest.TestCase): ...@@ -78,8 +78,3 @@ class TestCaseMagCreator(unittest.TestCase):
magnitude = mc.create_mag_dist_vortex(mag_shape) magnitude = mc.create_mag_dist_vortex(mag_shape)
assert_allclose(magnitude, np.load(os.path.join(self.path, 'ref_mag_vort.npy')), assert_allclose(magnitude, np.load(os.path.join(self.path, 'ref_mag_vort.npy')),
err_msg='Created vortex magnetic distribution does not match expectation') err_msg='Created vortex magnetic distribution does not match expectation')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -72,8 +72,3 @@ class TestCasePhaseMap(unittest.TestCase): ...@@ -72,8 +72,3 @@ class TestCasePhaseMap(unittest.TestCase):
err_msg='Unexpected behavior in load_from_netcdf4()!') err_msg='Unexpected behavior in load_from_netcdf4()!')
assert_allclose(phasemap.a, self.phasemap.a, assert_allclose(phasemap.a, self.phasemap.a,
err_msg='Unexpected behavior in load_from_netcdf4()!') err_msg='Unexpected behavior in load_from_netcdf4()!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -201,8 +201,3 @@ class TestCasePhaseMapperCharge(unittest.TestCase): ...@@ -201,8 +201,3 @@ class TestCasePhaseMapperCharge(unittest.TestCase):
def test_jac_T_dot(self): def test_jac_T_dot(self):
self.assertRaises(NotImplementedError, self.mapper.jac_T_dot, None) self.assertRaises(NotImplementedError, self.mapper.jac_T_dot, None)
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -26,8 +26,3 @@ class TestCasePM(unittest.TestCase): ...@@ -26,8 +26,3 @@ class TestCasePM(unittest.TestCase):
assert_allclose(phasemap.phase, phase_ref.phase, atol=1E-7, assert_allclose(phasemap.phase, phase_ref.phase, atol=1E-7,
err_msg='Unexpected behavior in pm()!') err_msg='Unexpected behavior in pm()!')
assert_allclose(phasemap.a, phase_ref.a, err_msg='Unexpected behavior in pm()!') assert_allclose(phasemap.a, phase_ref.a, err_msg='Unexpected behavior in pm()!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -256,7 +256,3 @@ class TestCaseYTiltProjector(unittest.TestCase): ...@@ -256,7 +256,3 @@ class TestCaseYTiltProjector(unittest.TestCase):
# TODO: Test RotTiltProjector!!! # TODO: Test RotTiltProjector!!!
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
...@@ -128,8 +128,3 @@ class TestCaseFirstOrderRegularisator(unittest.TestCase): ...@@ -128,8 +128,3 @@ class TestCaseFirstOrderRegularisator(unittest.TestCase):
hess_diag_ref = np.diag(np.load(os.path.join(self.path, 'first_order_jac_ref.npy'))) hess_diag_ref = np.diag(np.load(os.path.join(self.path, 'first_order_jac_ref.npy')))
assert_allclose(hess_diag, hess_diag_ref, atol=1E-7, assert_allclose(hess_diag, hess_diag_ref, atol=1E-7,
err_msg='Unexpected behaviour in hess_diag()!') err_msg='Unexpected behaviour in hess_diag()!')
if __name__ == '__main__':
import nose
nose.run(defaultTest=__name__)
-e . -e .['all']
...@@ -6,6 +6,7 @@ import os ...@@ -6,6 +6,7 @@ import os
import re import re
import subprocess import subprocess
import sys import sys
import itertools
from distutils.command.build import build from distutils.command.build import build
#import numpy #import numpy
...@@ -17,12 +18,13 @@ DESCRIPTION = 'PYthon based Reconstruction Algorithm for MagnetIc Distributions' ...@@ -17,12 +18,13 @@ DESCRIPTION = 'PYthon based Reconstruction Algorithm for MagnetIc Distributions'
MAINTAINER = 'Jan Caron' MAINTAINER = 'Jan Caron'
MAINTAINER_EMAIL = 'j.caron@fz-juelich.de' MAINTAINER_EMAIL = 'j.caron@fz-juelich.de'
URL = '' URL = ''
VERSION = '0.1.0-dev' VERSION = '0.1.0.dev0' # TODO: Better way?
PYTHON_VERSION = (2, 7) PYTHON_VERSION = (2, 7) # TODO: get rid of!!!
DEPENDENCIES = {'numpy': (1, 10)} # TODO: get rid off!!! DEPENDENCIES = {'numpy': (1, 10)} # TODO: get rid of!!!
LONG_DESCRIPTION = 'long description (TODO!)' # TODO: Long description! put in (Readme?) file! LONG_DESCRIPTION = 'long description (TODO!)' # TODO: Long description! put in (Readme?) file!
# TODO: get rid of superfluous functions!
def get_package_version(package): def get_package_version(package):
"""Return the package version of the specified package. """Return the package version of the specified package.
...@@ -70,7 +72,7 @@ def check_requirements(): ...@@ -70,7 +72,7 @@ def check_requirements():
% ((package_name,) + min_version)) % ((package_name,) + min_version))
def hg_version(): # TODO: Replace with GIT! Also check build output on GitLab! def hg_version(): # TODO: Replace with GIT! Also check build output on GitLab! See numpy setup.py!
"""Get the Mercurial reference identifier. """Get the Mercurial reference identifier.
Returns Returns
...@@ -126,13 +128,24 @@ def get_files(rootdir): ...@@ -126,13 +128,24 @@ def get_files(rootdir):
return filepaths return filepaths
# TODO: Use requirements.txt? extras_require for optional stuff (hyperspy, plotting)?
# TODO: After split of Pyramid, comment out and see what really is used (is e.g. scipy?)!
install_requires = ['numpy>=1.6', 'tqdm', 'scipy', 'matplotlib', 'Pillow', 'h5py',
'hyperspy', 'jutil', 'cmocean']
# TODO: extend extras_require for plotting and IO: # TODO: extend extras_require for plotting and IO:
# TODO: extra: 'pyfftw', 'mayavi' (not easy to install... find a way!)
# TODO: See https://stackoverflow.com/a/28842733 for extras_require...
# TODO: ...replace [dev] with [IO] (hyperspy) and [plotting] (separate plotting library)!
extras_require = { extras_require = {
# TODO: Test all if really needed! don't use nose, if possible (pure pytest)! # TODO: Test all if really needed! don't use nose, if possible (pure pytest)!
"tests": ['pytest', 'pytest-runner', 'pytest-cov', 'pytest-flake8', 'coverage', 'nose'] 'tests': ['pytest', 'pytest-runner', 'pytest-cov', 'pytest-flake8', 'coverage'],
'3Dplot': ['qt==4.8', 'mayavi==4.5']
# TODO: more for mayavi (plotting in general) and hyperspy, etc (see below)... # TODO: more for mayavi (plotting in general) and hyperspy, etc (see below)...
} }
extras_require["all"] = list(itertools.chain(*list(extras_require.values())))
print('\n-------------------------------------------------------------------------------') print('\n-------------------------------------------------------------------------------')
...@@ -148,18 +161,12 @@ setup(name=DISTNAME, ...@@ -148,18 +161,12 @@ setup(name=DISTNAME,
url=URL, url=URL,
download_url=URL, download_url=URL,
version=VERSION, version=VERSION,
packages=find_packages(exclude=['tests', 'doc']), packages=find_packages(exclude=['tests', 'doc']), # TODO: necessary?
#include_dirs=[numpy.get_include()], #include_dirs=[numpy.get_include()], # TODO: Maybe used for sphinx?!
# TODO: Use requirements.txt? extras_require for optional stuff (hyperspy, plotting)?
# TODO: After split of Pyramid, comment out and see what really is used (is e.g. scipy?)!
#setup_requires=['numpy>=1.6', 'pytest', 'pytest-runner'], #setup_requires=['numpy>=1.6', 'pytest', 'pytest-runner'],
#tests_require=['pytest', 'pytest-cov', 'pytest-flake8'], #tests_require=['pytest', 'pytest-cov', 'pytest-flake8'],
install_requires=['numpy>=1.6', 'tqdm', 'scipy', 'matplotlib', 'Pillow', 'h5py', install_requires=install_requires,
'hyperspy', 'jutil', 'cmocean'],
extras_require=extras_require, extras_require=extras_require,
# TODO: extra: 'pyfftw', 'mayavi' (not easy to install... find a way!) cmdclass={'build': build} # TODO: necessary?
# TODO: See https://stackoverflow.com/a/28842733 for extras_require... )
# TODO: ...replace [dev] with [IO] (hyperspy) and [plotting] (separate plotting library)!
#test_suite='nose.collector', # TODO: don't use nose!
cmdclass={'build': build})
print('-------------------------------------------------------------------------------\n') print('-------------------------------------------------------------------------------\n')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment