diff --git a/CMakeLists.txt b/CMakeLists.txt index b9c716aee..56a1b55d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # start configuration cmake_minimum_required(VERSION 2.8) -project(triqs_som CXX) +project(som CXX) set(CMAKE_BUILD_TYPE Release) # Version number of the application diff --git a/TODO.md b/TODO.md index bda0f9ad9..7163ce6fe 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ * Test all kernels and close #3 accordingly * Add automatic Python tests chi_* and chi_auto_* -* Place Python module into pytriqs.applications package * Make adding new kernels more straightforward diff --git a/benchmark/chi/som.py b/benchmark/chi/som.py index c2b5d211f..4d9e69893 100644 --- a/benchmark/chi/som.py +++ b/benchmark/chi/som.py @@ -1,7 +1,7 @@ from pytriqs.gf.local import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som from sys import argv from params import * diff --git a/benchmark/microgap/microgap.py b/benchmark/microgap/microgap.py index 46698e85d..3bc6db4fc 100644 --- a/benchmark/microgap/microgap.py +++ b/benchmark/microgap/microgap.py @@ -2,7 +2,7 @@ from pytriqs.gf.local.descriptors import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som import numpy as np import time diff --git a/benchmark/semicircle/semicircle.py b/benchmark/semicircle/semicircle.py index 2c3c38b80..ce5a59901 100644 --- a/benchmark/semicircle/semicircle.py +++ b/benchmark/semicircle/semicircle.py @@ -2,7 +2,7 @@ from pytriqs.gf.local.descriptors import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som import numpy as np import time diff --git a/benchmark/triangles/triangles.py b/benchmark/triangles/triangles.py index 377593d1c..1d1260f88 100644 --- a/benchmark/triangles/triangles.py +++ b/benchmark/triangles/triangles.py @@ -2,7 +2,7 @@ from pytriqs.gf.local.descriptors import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som import numpy as np import time diff --git a/cmake/sitecustomize.py b/cmake/sitecustomize.py new file mode 100644 index 000000000..0f31ba93d --- /dev/null +++ b/cmake/sitecustomize.py @@ -0,0 +1,8 @@ +def application_pytriqs_import(name,*args,**kwargs): + if name.startswith('@package_name@'): + name = name[len('@package_name@')+1:] + return builtin_import(name,*args,**kwargs) + +import __builtin__ +__builtin__.__import__, builtin_import = application_pytriqs_import, __builtin__.__import__ + diff --git a/doc/documentation.rst b/doc/documentation.rst index 24553d16e..33318798e 100644 --- a/doc/documentation.rst +++ b/doc/documentation.rst @@ -1,4 +1,4 @@ -.. module:: triqs_som.som +.. module:: pytriqs.applications.analytical_continuation.som .. _documentation: diff --git a/doc/example.py b/doc/example.py index 70fe5fd62..25f76bb46 100644 --- a/doc/example.py +++ b/doc/example.py @@ -4,7 +4,7 @@ import pytriqs.utility.mpi as mpi # Import main SOM class -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som n_tau = 500 # Number of tau-slices for the input GF diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index f8ed4312d..afa9fe8dd 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,16 +1,24 @@ +# where will the python end up in triqs? +set(python_destination pytriqs/applications/analytical_continuation/som) + +# site_customize for build +set(package_name "pytriqs.applications.analytical_continuation") +configure_file(${CMAKE_SOURCE_DIR}/cmake/sitecustomize.py ${CMAKE_CURRENT_BINARY_DIR}/sitecustomize.py @ONLY) + # make a local pytriqs copy -triqs_prepare_local_pytriqs(${CMAKE_PROJECT_NAME}) +triqs_prepare_local_pytriqs(${python_destination}) # Build the python modules -triqs_python_extension_and_install(core) +triqs_python_extension(core ${python_destination}) target_link_libraries(core som_c ${TRIQS_LIBRARY_ALL}) triqs_set_rpath_for_target(core) file(COPY parameters.rst DESTINATION .) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include ${TRIQS_INCLUDE_ALL}) -install(FILES som.py __init__.py DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${CMAKE_PROJECT_NAME}) +install(TARGETS core DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${python_destination}) +install(FILES som.py __init__.py DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${python_destination}) # add version file configure_file(version.py.in version.py) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${CMAKE_PROJECT_NAME}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${python_destination}) diff --git a/python/converters.hxx b/python/converters.hxx index 075e3d2dd..5bcc806f5 100644 --- a/python/converters.hxx +++ b/python/converters.hxx @@ -1,6 +1,6 @@ // DO NOT EDIT // Generated automatically using libclang using the command : -// c++2py.py ../c++/som_core.hpp --only_converters --compiler_options=-DCACHE_SIZE=0x10000 -p -m som -o som --appname triqs_som --moduledoc "The Stochastic Optimization Method" +// c++2py.py ../c++/som_core.hpp --only_converters --compiler_options=-DCACHE_SIZE=0x10000 -p -mpytriqs.applications.analytical_continuation.som.core -o core --moduledoc "The Stochastic Optimization Method" // --- C++ Python converter for run_parameters_t diff --git a/python/core_desc.py b/python/core_desc.py index e420b595a..60f30d541 100644 --- a/python/core_desc.py +++ b/python/core_desc.py @@ -1,9 +1,10 @@ # Generated automatically using the command : -# c++2py.py ../c++/som_core.hpp --compiler_options=-DCACHE_SIZE=0x10000 -p -m som -o som --appname triqs_som --moduledoc "The Stochastic Optimization Method" +# c++2py.py ../c++/som_core.hpp --compiler_options=-DCACHE_SIZE=0x10000 -p -mpytriqs.applications.analytical_continuation.som.core -o core --moduledoc "The Stochastic Optimization Method" from wrap_generator import * # The module -module = module_(full_name = "core", doc = "The Stochastic Optimization Method", app_name = "triqs_som") +module = module_(full_name = "pytriqs.applications.analytical_continuation.som.core", + doc = "The Stochastic Optimization Method") # All the triqs C++/Python modules module.use_module('gf', 'triqs') diff --git a/test/python/gf_imfreq.py b/test/python/gf_imfreq.py index 695149b4f..651fed8e9 100644 --- a/test/python/gf_imfreq.py +++ b/test/python/gf_imfreq.py @@ -22,7 +22,7 @@ from pytriqs.gf.local import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som from pytriqs.utility.comparison_tests import * arch = HDFArchive('gf_imfreq.ref.h5', 'r') diff --git a/test/python/gf_imtime.py b/test/python/gf_imtime.py index 53a69ed31..f203b3f0f 100644 --- a/test/python/gf_imtime.py +++ b/test/python/gf_imtime.py @@ -22,7 +22,7 @@ from pytriqs.gf.local import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som from pytriqs.utility.comparison_tests import * arch = HDFArchive('gf_imtime.ref.h5', 'r') diff --git a/test/python/gf_legendre.py b/test/python/gf_legendre.py index f20c2c315..b4d1ac076 100644 --- a/test/python/gf_legendre.py +++ b/test/python/gf_legendre.py @@ -22,7 +22,7 @@ from pytriqs.gf.local import * from pytriqs.archive import HDFArchive import pytriqs.utility.mpi as mpi -from triqs_som.som import Som +from pytriqs.applications.analytical_continuation.som import Som from pytriqs.utility.comparison_tests import * arch = HDFArchive('gf_legendre.ref.h5', 'r')