From 8028f8daa6fa7ae361cf43eb67c5696436f33101 Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 15:08:58 +0200 Subject: [PATCH 1/6] travis fix for vtk --- .travis.yml | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index b75b6cc..bb60875 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,29 +5,34 @@ language: python python: - "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 + - sudo apt-get update -qq + - sudo apt-get install -qq python-vtk + - 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 + - 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 From 7eed00b10a3f8cd3c18d699220fd776b5a94b2ff Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 15:15:59 +0200 Subject: [PATCH 2/6] travis fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bb60875..f038fc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: python python: - - "2.7" + - "2.7" virtualenv: system_site_packages: true From 41c377f03ec327ecfa3c84757917f0477b49c269 Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 15:19:05 +0200 Subject: [PATCH 3/6] travis -sudo --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f038fc0..89b5c18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -cache: apt -sudo: false language: python python: From 10feb10bc47928e41fd326c70f733c37cfe32c7d Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 15:30:11 +0200 Subject: [PATCH 4/6] spaces in yml --- .travis.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 89b5c18..a1681ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,36 @@ language: python python: - - "2.7" + - "2.7" virtualenv: system_site_packages: true before_install: - - sudo apt-get update -qq - - sudo apt-get install -qq python-vtk - - 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 + - sudo apt-get update -qq + - sudo apt-get install -qq python-vtk + - 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 + - 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 From 3c0a4da32675ad5de57ce65a7b05ffe41ec97dc9 Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 15:41:12 +0200 Subject: [PATCH 5/6] vtk of conda --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1681ca..4503dee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,6 @@ virtualenv: system_site_packages: true before_install: - - sudo apt-get update -qq - - sudo apt-get install -qq python-vtk - 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 @@ -18,7 +16,7 @@ before_install: install: - conda create --yes -n test python=$TRAVIS_PYTHON_VERSION - source activate test - - conda install --yes numpy scipy matplotlib pip nose + - conda install --yes numpy scipy matplotlib pip nose vtk - pip install setuptools - pip install enum34 - pip install numpy-stl From 9d219407bc66787f5025d0ebfeee20becd093e6a Mon Sep 17 00:00:00 2001 From: Marco Tezzele Date: Thu, 31 Mar 2016 16:42:56 +0200 Subject: [PATCH 6/6] fixed write method in vtk --- pygem/file_handler.py | 17 ++++++++++++----- setup.py | 2 +- .../test_red_blood_cell_out_true.vtk | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pygem/file_handler.py b/pygem/file_handler.py index 04161f6..1a57e80 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 67456e5..ddc459d 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 7797291..b2fad88 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