summaryrefslogtreecommitdiffstats
path: root/src/Python
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2017-10-23 17:04:41 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2017-10-23 17:04:41 +0100
commitece0bfc45cf2e339fc517a4f2c078f0b8fe274ad (patch)
treeb52304b950304fe58200d5e5f6744ded852122a6 /src/Python
parent44ec01fa2e8d8da2dce4950ea3d822fe7c8cd8d5 (diff)
downloadregularization-ece0bfc45cf2e339fc517a4f2c078f0b8fe274ad.tar.gz
regularization-ece0bfc45cf2e339fc517a4f2c078f0b8fe274ad.tar.bz2
regularization-ece0bfc45cf2e339fc517a4f2c078f0b8fe274ad.tar.xz
regularization-ece0bfc45cf2e339fc517a4f2c078f0b8fe274ad.zip
add fista-recipe and stuff
Diffstat (limited to 'src/Python')
-rw-r--r--src/Python/CMakeLists.txt16
-rw-r--r--src/Python/fista-recipe/build.sh10
-rw-r--r--src/Python/fista-recipe/meta.yaml28
-rw-r--r--src/Python/setup-fista.py.in27
-rw-r--r--src/Python/setup.py.in4
5 files changed, 83 insertions, 2 deletions
diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt
index fd74ee7..33ebc08 100644
--- a/src/Python/CMakeLists.txt
+++ b/src/Python/CMakeLists.txt
@@ -63,12 +63,19 @@ message("Python found Minor " ${PYTHON_VERSION_MINOR})
findPythonPackagesPath()
message("PYTHON_PACKAGES_FOUND " ${PYTHON_PACKAGES_PATH})
-# copy the Pyhon files of the package
+######### CONFIGURE REGULARIZER #############
+
+# copy the Pyhon files of the package regularizer
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ccpi/imaging/)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ccpi/__init__.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ccpi)
+# regularizers
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ccpi/imaging/__init__.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ccpi/imaging)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ccpi/imaging/Regularizer.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ccpi/imaging)
+# fista reconstructor
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ccpi/reconstruction/FISTAReconstructor.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ccpi/reconstruction)
+#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ccpi/reconstruction/__init__.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ccpi/reconstruction)
+
if (WIN32)
#set (CONDA_ENVIRONMENT_PATH "C:\\Apps\\Miniconda2\\envs\\${CONDA_ENVIRONMENT}" CACHE PATH "Main environment directory")
set (CONDA_ENVIRONMENT_PREFIX "${CONDA_ENVIRONMENT_PATH}\\Library" CACHE PATH "env dir")
@@ -84,9 +91,16 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DI
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/conda-recipe)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/conda-recipe/meta.yaml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/conda-recipe)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup-fista.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup-fista.py)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fista-recipe)
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fista-recipe/meta.yaml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/fista-recipe)
+
if (WIN32)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/conda-recipe/bld.bat DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/conda-recipe/)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile.bat.in ${CMAKE_CURRENT_BINARY_DIR}/compile.bat)
+
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fista-recipe/bld.bat DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/fista-recipe/)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile.bat.in ${CMAKE_CURRENT_BINARY_DIR}/compile.bat)
elseif(UNIX)
message ("We are on UNIX")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/conda-recipe/build.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/conda-recipe/)
diff --git a/src/Python/fista-recipe/build.sh b/src/Python/fista-recipe/build.sh
new file mode 100644
index 0000000..e3f3552
--- /dev/null
+++ b/src/Python/fista-recipe/build.sh
@@ -0,0 +1,10 @@
+if [ -z "$CIL_VERSION" ]; then
+ echo "Need to set CIL_VERSION"
+ exit 1
+fi
+mkdir "$SRC_DIR/ccpifista"
+cp -r "$RECIPE_DIR/.." "$SRC_DIR/ccpifista"
+
+cd $SRC_DIR/ccpifista
+
+$PYTHON setup-fista.py install
diff --git a/src/Python/fista-recipe/meta.yaml b/src/Python/fista-recipe/meta.yaml
new file mode 100644
index 0000000..64c9b5d
--- /dev/null
+++ b/src/Python/fista-recipe/meta.yaml
@@ -0,0 +1,28 @@
+package:
+ name: ccpi-fista
+ version: {{ environ['CIL_VERSION'] }}
+
+
+build:
+ preserve_egg_dir: False
+ script_env:
+ - CIL_VERSION
+# number: 0
+
+requirements:
+ build:
+ - python
+ - numpy
+ - setuptools
+
+ run:
+ - python
+ - numpy
+ - astra
+
+
+
+about:
+ home: http://www.ccpi.ac.uk
+ license: Apache v.2.0 license
+ summary: 'CCPi Core Imaging Library (Viewer)'
diff --git a/src/Python/setup-fista.py.in b/src/Python/setup-fista.py.in
new file mode 100644
index 0000000..c5c9f4d
--- /dev/null
+++ b/src/Python/setup-fista.py.in
@@ -0,0 +1,27 @@
+from distutils.core import setup
+#from setuptools import setup, find_packages
+import os
+
+cil_version=os.environ['CIL_VERSION']
+if cil_version == '':
+ print("Please set the environmental variable CIL_VERSION")
+ sys.exit(1)
+
+setup(
+ name="ccpi-fista",
+ version=cil_version,
+ packages=['ccpi','ccpi.reconstruction'],
+ install_requires=['numpy'],
+
+ zip_safe = False,
+
+ # metadata for upload to PyPI
+ author="Edoardo Pasca",
+ author_email="edo.paskino@gmail.com",
+ description='CCPi Core Imaging Library - FISTA Reconstructor module',
+ license="Apache v2.0",
+ keywords="tomography interative reconstruction",
+ url="http://www.ccpi.ac.uk", # project home page, if any
+
+ # could also include long_description, download_url, classifiers, etc.
+)
diff --git a/src/Python/setup.py.in b/src/Python/setup.py.in
index 0a1f4ad..12e8af1 100644
--- a/src/Python/setup.py.in
+++ b/src/Python/setup.py.in
@@ -44,7 +44,7 @@ else:
setup(
name='ccpi',
- description='CCPi Core Imaging Library - FISTA Reconstruction Module',
+ description='CCPi Core Imaging Library - Image Regularizers',
version=cil_version,
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("ccpi.imaging.cpu_regularizers",
@@ -65,3 +65,5 @@ setup(
zip_safe = False,
packages = {'ccpi','ccpi.imaging'},
)
+
+