diff --git a/.travis.yml b/.travis.yml index b75b6cc6..4503deef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,34 @@ -cache: apt -sudo: false language: python python: - - "2.7" + - "2.7" + +virtualenv: + system_site_packages: true before_install: - - travis_retry wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh - - chmod +x miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH=/home/travis/miniconda/bin:$PATH - - conda update --yes conda + - travis_retry wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh + - chmod +x miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH=/home/travis/miniconda/bin:$PATH + - conda update --yes conda install: - - conda create --yes -n test python=$TRAVIS_PYTHON_VERSION - - source activate test - - conda install --yes numpy scipy matplotlib pip nose - - pip install setuptools - - pip install enum34 - - pip install numpy-stl - - pip install coveralls - - pip install coverage - - python setup.py install + - conda create --yes -n test python=$TRAVIS_PYTHON_VERSION + - source activate test + - conda install --yes numpy scipy matplotlib pip nose vtk + - pip install setuptools + - pip install enum34 + - pip install numpy-stl + - pip install coveralls + - pip install coverage + - python setup.py install script: coverage run test.py after_success: - - coveralls + - coveralls branches: - only: - - master + only: + - master diff --git a/pygem/file_handler.py b/pygem/file_handler.py index 04161f6e..1a57e80c 100644 --- a/pygem/file_handler.py +++ b/pygem/file_handler.py @@ -182,10 +182,11 @@ def parse(self, filename): reader.Update() data = reader.GetOutput() - mesh_points = np.zeros([data.GetNumberOfPoints(),3]) + n_points = data.GetNumberOfPoints() + mesh_points = np.zeros([n_points, 3]) - for i in range(data.GetNumberOfPoints()): - mesh_points[i,0],mesh_points[i,1],mesh_points[i,2] = data.GetPoint(i) + for i in range(n_points): + mesh_points[i, 0], mesh_points[i, 1], mesh_points[i, 2] = data.GetPoint(i) return mesh_points @@ -224,8 +225,14 @@ def write(self, mesh_points, filename): writer = vtk.vtkDataSetWriter() writer.SetFileName(self.outfile) - writer.SetInput(data) - + + + if vtk.VTK_MAJOR_VERSION <= 5: + writer.SetInput(data) + else: + writer.SetInputData(data) + + #writer.SetInputData(data) writer.Write() diff --git a/setup.py b/setup.py index 67456e57..ddc459dc 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def readme(): description='Tools to apply FFD.', long_description=readme(), classifiers=[ - 'Development Status :: 2 - Pre-Alpha', + 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2.7', 'Intended Audience :: Science/Research', diff --git a/tests/test_datasets/test_red_blood_cell_out_true.vtk b/tests/test_datasets/test_red_blood_cell_out_true.vtk index 7797291e..b2fad88b 100644 --- a/tests/test_datasets/test_red_blood_cell_out_true.vtk +++ b/tests/test_datasets/test_red_blood_cell_out_true.vtk @@ -1,4 +1,4 @@ -# vtk DataFile Version 3.0 +# vtk DataFile Version 4.0 vtk output ASCII DATASET UNSTRUCTURED_GRID