From a20fdcaf9bf23f88cba2a2c5906d515fd785dc8a Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 24 Jan 2020 12:15:14 +0100 Subject: Modern cmake for boost approach --- src/Alpha_complex/utilities/CMakeLists.txt | 4 ++-- src/Bottleneck_distance/example/CMakeLists.txt | 2 +- src/Cech_complex/benchmark/CMakeLists.txt | 2 +- src/Cech_complex/example/CMakeLists.txt | 2 +- src/Cech_complex/utilities/CMakeLists.txt | 2 +- src/Contraction/example/CMakeLists.txt | 2 +- src/Persistent_cohomology/benchmark/CMakeLists.txt | 2 +- src/Persistent_cohomology/example/CMakeLists.txt | 8 ++++---- src/Rips_complex/utilities/CMakeLists.txt | 8 ++++---- src/Simplex_tree/example/CMakeLists.txt | 2 +- src/Witness_complex/utilities/CMakeLists.txt | 4 ++-- src/cmake/modules/GUDHI_boost_test.cmake | 2 +- src/cmake/modules/GUDHI_third_party_libraries.cmake | 6 +++--- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index 57b92942..a3b0cc24 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -2,7 +2,7 @@ project(Alpha_complex_utilities) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_executable (alpha_complex_persistence alpha_complex_persistence.cpp) - target_link_libraries(alpha_complex_persistence ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries(alpha_complex_persistence ${CGAL_LIBRARY} Boost::program_options) if (TBB_FOUND) target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES}) @@ -23,7 +23,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) install(TARGETS alpha_complex_persistence DESTINATION bin) add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp) - target_link_libraries(alpha_complex_3d_persistence ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries(alpha_complex_3d_persistence ${CGAL_LIBRARY} Boost::program_options) if (TBB_FOUND) target_link_libraries(alpha_complex_3d_persistence ${TBB_LIBRARIES}) endif(TBB_FOUND) diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index 3d65963a..9839c59d 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -13,7 +13,7 @@ endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) - target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries(alpha_rips_persistence_bottleneck_distance Boost::program_options) if (TBB_FOUND) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) diff --git a/src/Cech_complex/benchmark/CMakeLists.txt b/src/Cech_complex/benchmark/CMakeLists.txt index b7697764..c04bca53 100644 --- a/src/Cech_complex/benchmark/CMakeLists.txt +++ b/src/Cech_complex/benchmark/CMakeLists.txt @@ -5,7 +5,7 @@ project(Cech_complex_benchmark) file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) add_executable(cech_complex_benchmark cech_complex_benchmark.cpp) -target_link_libraries(cech_complex_benchmark ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) +target_link_libraries(cech_complex_benchmark Boost::filesystem) if (TBB_FOUND) target_link_libraries(cech_complex_benchmark ${TBB_LIBRARIES}) diff --git a/src/Cech_complex/example/CMakeLists.txt b/src/Cech_complex/example/CMakeLists.txt index ab391215..98757988 100644 --- a/src/Cech_complex/example/CMakeLists.txt +++ b/src/Cech_complex/example/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(Cech_complex_examples) add_executable ( Cech_complex_example_step_by_step cech_complex_step_by_step.cpp ) -target_link_libraries(Cech_complex_example_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(Cech_complex_example_step_by_step Boost::program_options) if (TBB_FOUND) target_link_libraries(Cech_complex_example_step_by_step ${TBB_LIBRARIES}) endif() diff --git a/src/Cech_complex/utilities/CMakeLists.txt b/src/Cech_complex/utilities/CMakeLists.txt index 30b99729..253d7304 100644 --- a/src/Cech_complex/utilities/CMakeLists.txt +++ b/src/Cech_complex/utilities/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) project(Cech_complex_utilities) add_executable(cech_persistence cech_persistence.cpp) -target_link_libraries(cech_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(cech_persistence Boost::program_options) if (TBB_FOUND) target_link_libraries(cech_persistence ${TBB_LIBRARIES}) diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt index f0dc885d..4740a2d1 100644 --- a/src/Contraction/example/CMakeLists.txt +++ b/src/Contraction/example/CMakeLists.txt @@ -4,7 +4,7 @@ if (NOT CGAL_VERSION VERSION_LESS 4.11.0) add_executable(RipsContraction Rips_contraction.cpp) add_executable(GarlandHeckbert Garland_heckbert.cpp) - target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY}) + target_link_libraries(GarlandHeckbert Boost::timer) add_test(NAME Contraction_example_tore3D_0.2 COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2") diff --git a/src/Persistent_cohomology/benchmark/CMakeLists.txt b/src/Persistent_cohomology/benchmark/CMakeLists.txt index 2bb3b0c7..f38cc543 100644 --- a/src/Persistent_cohomology/benchmark/CMakeLists.txt +++ b/src/Persistent_cohomology/benchmark/CMakeLists.txt @@ -3,7 +3,7 @@ project(Persistent_cohomology_benchmark) if(GMP_FOUND) if(GMPXX_FOUND) add_executable ( performance_rips_persistence EXCLUDE_FROM_ALL performance_rips_persistence.cpp ) - target_link_libraries(performance_rips_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) + target_link_libraries(performance_rips_persistence Boost::program_options ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) if (TBB_FOUND) target_link_libraries(performance_rips_persistence ${TBB_LIBRARIES}) endif(TBB_FOUND) diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index 94ec13c5..4c08cd68 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -5,13 +5,13 @@ add_executable(plain_homology plain_homology.cpp) add_executable(persistence_from_simple_simplex_tree persistence_from_simple_simplex_tree.cpp) add_executable(rips_persistence_step_by_step rips_persistence_step_by_step.cpp) -target_link_libraries(rips_persistence_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(rips_persistence_step_by_step Boost::program_options) add_executable(rips_persistence_via_boundary_matrix rips_persistence_via_boundary_matrix.cpp) -target_link_libraries(rips_persistence_via_boundary_matrix ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(rips_persistence_via_boundary_matrix Boost::program_options) add_executable(persistence_from_file persistence_from_file.cpp) -target_link_libraries(persistence_from_file ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(persistence_from_file Boost::program_options) if (TBB_FOUND) target_link_libraries(plain_homology ${TBB_LIBRARIES}) @@ -43,7 +43,7 @@ if(GMP_FOUND) if(GMPXX_FOUND) add_executable(rips_multifield_persistence rips_multifield_persistence.cpp ) target_link_libraries(rips_multifield_persistence - ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) + Boost::program_options ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) if (TBB_FOUND) target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES}) endif(TBB_FOUND) diff --git a/src/Rips_complex/utilities/CMakeLists.txt b/src/Rips_complex/utilities/CMakeLists.txt index 4b565628..d2448d7b 100644 --- a/src/Rips_complex/utilities/CMakeLists.txt +++ b/src/Rips_complex/utilities/CMakeLists.txt @@ -1,16 +1,16 @@ project(Rips_complex_utilities) add_executable(rips_distance_matrix_persistence rips_distance_matrix_persistence.cpp) -target_link_libraries(rips_distance_matrix_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(rips_distance_matrix_persistence Boost::program_options) add_executable(rips_persistence rips_persistence.cpp) -target_link_libraries(rips_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(rips_persistence Boost::program_options) add_executable(rips_correlation_matrix_persistence rips_correlation_matrix_persistence.cpp) -target_link_libraries(rips_correlation_matrix_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(rips_correlation_matrix_persistence Boost::system Boost::program_options) add_executable(sparse_rips_persistence sparse_rips_persistence.cpp) -target_link_libraries(sparse_rips_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries(sparse_rips_persistence Boost::program_options) if (TBB_FOUND) target_link_libraries(rips_distance_matrix_persistence ${TBB_LIBRARIES}) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index f99b164c..6ba518fa 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -32,7 +32,7 @@ endif() if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_executable ( Simplex_tree_example_cech_complex_cgal_mini_sphere_3d cech_complex_cgal_mini_sphere_3d.cpp ) - target_link_libraries(Simplex_tree_example_cech_complex_cgal_mini_sphere_3d ${Boost_PROGRAM_OPTIONS_LIBRARY} ${CGAL_LIBRARY}) + target_link_libraries(Simplex_tree_example_cech_complex_cgal_mini_sphere_3d Boost::program_options ${CGAL_LIBRARY}) if (TBB_FOUND) target_link_libraries(Simplex_tree_example_cech_complex_cgal_mini_sphere_3d ${TBB_LIBRARIES}) endif() diff --git a/src/Witness_complex/utilities/CMakeLists.txt b/src/Witness_complex/utilities/CMakeLists.txt index 3ee0c2f6..d986d2d1 100644 --- a/src/Witness_complex/utilities/CMakeLists.txt +++ b/src/Witness_complex/utilities/CMakeLists.txt @@ -4,10 +4,10 @@ project(Witness_complex_utilities) if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_executable ( Witness_complex_strong_witness_persistence strong_witness_persistence.cpp ) - target_link_libraries(Witness_complex_strong_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries(Witness_complex_strong_witness_persistence Boost::program_options) add_executable ( Witness_complex_weak_witness_persistence weak_witness_persistence.cpp ) - target_link_libraries(Witness_complex_weak_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries(Witness_complex_weak_witness_persistence Boost::program_options) if (TBB_FOUND) target_link_libraries(Witness_complex_strong_witness_persistence ${TBB_LIBRARIES}) diff --git a/src/cmake/modules/GUDHI_boost_test.cmake b/src/cmake/modules/GUDHI_boost_test.cmake index c3b29883..3b9da78f 100644 --- a/src/cmake/modules/GUDHI_boost_test.cmake +++ b/src/cmake/modules/GUDHI_boost_test.cmake @@ -19,7 +19,7 @@ else (WITH_GUDHI_BOOST_TEST_COVERAGE) endif(WITH_GUDHI_BOOST_TEST_COVERAGE) function(gudhi_add_boost_test unitary_test) - target_link_libraries(${unitary_test} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + target_link_libraries(${unitary_test} Boost::unit_test_framework) add_test(NAME ${unitary_test} COMMAND $ ${GUDHI_UT_LOG_FORMAT} ${GUDHI_UT_LOG_SINK} ${GUDHI_UT_LOG_LEVEL} ${GUDHI_UT_REPORT_LEVEL}) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 24a34150..4d121eca 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,6 +1,6 @@ # This files manage third party libraries required by GUDHI -find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) +find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread timer) if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") @@ -82,8 +82,8 @@ add_definitions( -DBOOST_ALL_DYN_LINK ) # problem on Mac with boost_system and boost_thread add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED ) -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) +#INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +#LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) -- cgit v1.2.3 From a604e92c73d4f83281dd62e180a9ec6a70d3bd00 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 24 Jan 2020 14:26:40 +0100 Subject: Remove boost timer as not used --- src/Contraction/example/CMakeLists.txt | 1 - src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt index 4740a2d1..c5d31aca 100644 --- a/src/Contraction/example/CMakeLists.txt +++ b/src/Contraction/example/CMakeLists.txt @@ -4,7 +4,6 @@ if (NOT CGAL_VERSION VERSION_LESS 4.11.0) add_executable(RipsContraction Rips_contraction.cpp) add_executable(GarlandHeckbert Garland_heckbert.cpp) - target_link_libraries(GarlandHeckbert Boost::timer) add_test(NAME Contraction_example_tore3D_0.2 COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2") diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 4d121eca..10b2b56a 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,6 +1,6 @@ # This files manage third party libraries required by GUDHI -find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread timer) +find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") -- cgit v1.2.3 From 22c946ecc9594fc496d641b70a19643057295dcf Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 24 Jan 2020 15:48:16 +0100 Subject: Accordingly to the documentation, cmake 3.5 is required for modern boost finding --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dcc6803..a9f7f989 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(GUDHIdev) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 561aa049..0e799a3a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(GUDHI) -- cgit v1.2.3 From 91223f6158607dfbb94e38b69cc1ec9599a9cf19 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 11 Feb 2020 14:31:48 +0100 Subject: Add ressources: default copyright files (Python and C++ versions) and a github guide for GUDHI contributors --- for_dev/copyright_template.h | 14 +++ for_dev/copyright_template.py | 10 ++ .../how_to_use_github_to_contribute_to_gudhi.md | 102 +++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 for_dev/copyright_template.h create mode 100644 for_dev/copyright_template.py create mode 100644 for_dev/how_to_use_github_to_contribute_to_gudhi.md diff --git a/for_dev/copyright_template.h b/for_dev/copyright_template.h new file mode 100644 index 00000000..30034f1b --- /dev/null +++ b/for_dev/copyright_template.h @@ -0,0 +1,14 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): [AUTHOR NAME] + * + * Copyright (C) [YEAR] [COPYRIGHT] + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef [FILE_NAME]_H_ +#define [FILE_NAME]_H_ + +#endif // [FILE_NAME]_H_ \ No newline at end of file diff --git a/for_dev/copyright_template.py b/for_dev/copyright_template.py new file mode 100644 index 00000000..19de05e2 --- /dev/null +++ b/for_dev/copyright_template.py @@ -0,0 +1,10 @@ +# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - +# which is released under MIT. +# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license +# details. +# Author(s): [AUTHOR NAME] +# +# Copyright (C) [YEAR] [COPYRIGHT] +# +# Modification(s): +# - YYYY/MM Author: Description of the modification diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md new file mode 100644 index 00000000..86506602 --- /dev/null +++ b/for_dev/how_to_use_github_to_contribute_to_gudhi.md @@ -0,0 +1,102 @@ +# How to use github to contribute to gudhi + +Similar information is available in many places: +https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch) +https://help.github.com/en/github/getting-started-with-github/fork-a-repo +https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/ +https://gist.github.com/Chaser324/ce0505fbed06b947d962 +etc + +## Get a github account +I assume the account is called "LOGIN", please replace as appropriate below. Log in to github.com using this account. + +## Fork GUDHI/gudhi-devel project +Go to https://github.com/GUDHI/gudhi-devel and click on "fork" (top right). Feel free to also click on the star next to it to show you like the project! +You can see your fork at https://github.com/LOGIN/gudhi-devel + +## Create a local clone on your computer +```bash +git clone https://github.com/LOGIN/gudhi-devel.git +``` + +This creates a directory gudhi-devel, which you are free to move around or rename. For the following, change to that directory: +```bash +cd gudhi-devel +``` + +## Configuring a remote for a fork +```bash +git remote add upstream https://github.com/GUDHI/gudhi-devel.git +``` + +because you want to see the real gudhi, not just your clone. +(It is perfectly possible to do things in the reverse order, clone from GUDHI and add the one in LOGIN as extra remote, but the names of the remotes may not match the rest of this document. You can change the name of a remote with `git remote rename oldname newname`) + +## Optional remotes +Optional, if you are interested in one of the old branches +git remote add oldies https://github.com/GUDHI/branches.git + +Or if you want to spy on someone's work. I assume the someone's account is called "SOMEONE" +git remote add someone https://github.com/SOMEONE/gudhi-devel.git + +## Download +```bash +git fetch -p --all +``` +This is a command you can run quite regularly. +It tells git to check all that happened on github. +It is safe, it will not mess with your files. + +## Create a branch, based on the current master +git checkout -b some-fancy-name --no-track upstream/master +Your local branch "master" and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on. + +## The real coding is here! +Edit files, test, etc. + +## Commit your changes (locally) +The basic command is just `git commit`, but it will do nothing by default. +You need `git add my_new_file` for every new file you want to commit. +And usually you'll want to use `git commit -a` so that all files that git already knows about and that have been modified get committed. + +## Push your changes (remotely) +```bash +git push -u origin some-fancy-name +``` +This puts a copy of your branch on your online clone of gudhi-devel. +Because of `-u`, it will remember where you like to push this branch, and next time you can just use `git push`. + +## Play again! +Possibly iterate a few times, add more commits and push them. + +## Your pull request is ready +Get your web browser to https://github.com/LOGIN/gudhi-devel, click on the button that says **Branch: some-name** (below the number of commits, above the list of files) and select the branch you are so proud of. +Click on **New pull request** next to it. + +## Follow the instructions ;-) +Note that if your branch is not quite ready, you can make a **draft pull request** (see the arrow next to the confirmation button), and later you will have access to a button to say that the branch is ready for reviews now. +Draft pull requests can be a way to advertise that you are working on something, and possibly ask others for comments or help. + +## Code review +Make sure you follow the discussion on your pull request, answer questions, take comments into account. +You can keep pushing new commits on your branch to your fork of gudhi-devel, the pull request will automatically notice the new commits there. +There is no need to create a new pull request. +Once the branch is under review, fixing issues is good, but please refrain from adding extra features, that just makes the reviewers' job harder and thus slower. +You may want to look at https://github.com/settings/notifications (and other settings nearby) if you don't receive emails when people comment on your pull request. +Some bold reviewer might make changes to your branch. You will then need `git pull` for your local branch to reflect those. + +## Your work is merged! +Once your pull request has been closed (your branch merged), you can remove your branch, both locally +```bash +git checkout master # or any other branch, but you cannot remove the branch you are currently in +git branch -d some-fancy-name # local branch delete +git push origin --delete some-fancy-name # remote branch delete +``` +If you add @VincentRouvreau or @mglisse as collaborator (https://github.com/LOGIN/gudhi-devel/settings/collaboration), they may remove the branch on your clone at the same time as they merge the branch, so you only have the local one to remove (or keep if you are nostalgic). + +## Keep in touch +Create a new branch and keep contributing! +Do not try to reuse an old branch that has already been merged. +Make sure you run the fetch command just before creating any new branch, so you don't base it on some outdated version of master. +You can also work on several branches at the same time, using `git checkout some-fancy-name` and `git checkout name-of-other-branch` to switch between them (commit before switching or things may get complicated). + -- cgit v1.2.3 From 9a182406ff9a419931d7dc20d900515fda2c0ef0 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 11 Feb 2020 14:37:36 +0100 Subject: Fix some typos --- .../how_to_use_github_to_contribute_to_gudhi.md | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md index 86506602..b9a7f8f7 100644 --- a/for_dev/how_to_use_github_to_contribute_to_gudhi.md +++ b/for_dev/how_to_use_github_to_contribute_to_gudhi.md @@ -1,17 +1,18 @@ # How to use github to contribute to gudhi Similar information is available in many places: -https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch) -https://help.github.com/en/github/getting-started-with-github/fork-a-repo -https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/ -https://gist.github.com/Chaser324/ce0505fbed06b947d962 -etc +* https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch) +* https://help.github.com/en/github/getting-started-with-github/fork-a-repo +* https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/ +* https://gist.github.com/Chaser324/ce0505fbed06b947d962 +* etc ## Get a github account -I assume the account is called "LOGIN", please replace as appropriate below. Log in to github.com using this account. +I assume the account is called **LOGIN**, please replace as appropriate below. Log in to github.com using this account. ## Fork GUDHI/gudhi-devel project -Go to https://github.com/GUDHI/gudhi-devel and click on "fork" (top right). Feel free to also click on the star next to it to show you like the project! +Go to https://github.com/GUDHI/gudhi-devel and click on **fork** (top right). +Feel free to also click on the star next to it to show you like the project! You can see your fork at https://github.com/LOGIN/gudhi-devel ## Create a local clone on your computer @@ -36,10 +37,10 @@ because you want to see the real gudhi, not just your clone. Optional, if you are interested in one of the old branches git remote add oldies https://github.com/GUDHI/branches.git -Or if you want to spy on someone's work. I assume the someone's account is called "SOMEONE" +Or if you want to spy on someone's work. I assume the someone's account is called **SOMEONE** git remote add someone https://github.com/SOMEONE/gudhi-devel.git -## Download +## Stay up-to-date ```bash git fetch -p --all ``` @@ -48,8 +49,10 @@ It tells git to check all that happened on github. It is safe, it will not mess with your files. ## Create a branch, based on the current master +```bash git checkout -b some-fancy-name --no-track upstream/master -Your local branch "master" and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on. +``` +Your local branch `master` and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on. ## The real coding is here! Edit files, test, etc. -- cgit v1.2.3 From acdd28ebf3103c133c5a985219972bec2c7a3460 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 11 Feb 2020 14:41:35 +0100 Subject: Fix some typos --- for_dev/how_to_use_github_to_contribute_to_gudhi.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md index b9a7f8f7..1ca40386 100644 --- a/for_dev/how_to_use_github_to_contribute_to_gudhi.md +++ b/for_dev/how_to_use_github_to_contribute_to_gudhi.md @@ -35,10 +35,14 @@ because you want to see the real gudhi, not just your clone. ## Optional remotes Optional, if you are interested in one of the old branches +```bash git remote add oldies https://github.com/GUDHI/branches.git +``` Or if you want to spy on someone's work. I assume the someone's account is called **SOMEONE** +```bash git remote add someone https://github.com/SOMEONE/gudhi-devel.git +``` ## Stay up-to-date ```bash @@ -89,7 +93,7 @@ You may want to look at https://github.com/settings/notifications (and other set Some bold reviewer might make changes to your branch. You will then need `git pull` for your local branch to reflect those. ## Your work is merged! -Once your pull request has been closed (your branch merged), you can remove your branch, both locally +Once your pull request has been closed (your branch merged), you can remove your branch, both locally and also the branch on your github fork: ```bash git checkout master # or any other branch, but you cannot remove the branch you are currently in git branch -d some-fancy-name # local branch delete @@ -99,7 +103,7 @@ If you add @VincentRouvreau or @mglisse as collaborator (https://github.com/LOGI ## Keep in touch Create a new branch and keep contributing! + Do not try to reuse an old branch that has already been merged. Make sure you run the fetch command just before creating any new branch, so you don't base it on some outdated version of master. You can also work on several branches at the same time, using `git checkout some-fancy-name` and `git checkout name-of-other-branch` to switch between them (commit before switching or things may get complicated). - -- cgit v1.2.3 From b3bd147a06b013efca688ef5dafdfa732a036346 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 11 Feb 2020 17:50:50 +0100 Subject: Add code style tools and modify python copyright with 120 characters [skip ci] --- for_dev/code_conventions.md | 17 ++++++++++++++++- for_dev/copyright_template.py | 6 ++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/for_dev/code_conventions.md b/for_dev/code_conventions.md index 5882f78e..7f9f7471 100644 --- a/for_dev/code_conventions.md +++ b/for_dev/code_conventions.md @@ -21,6 +21,21 @@ * The name of the "project" should be in this form: `Package_[tests|examples|…]`. E.g. `project(Simplex_tree_examples)`. * The name if each "target" (first parameter of add_executable) should be in this form: `Package_{name of the cpp file without extension}`. E.g `add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp)`. +### Code style +We are using [google c++ style guide](https://google.github.io/styleguide/cppguide.html) recommendations with 120 characters per line of code. +[clang-format](https://clang.llvm.org/docs/ClangFormat.html) can be used to format automatically your code: +```bash +cd src # there is a .clang-format file with these specifications +clang-format -style=file -i Simplex_tree/include/gudhi/Simplex_tree.h # -i means in place, your file will be modified +``` + ## Python -In progress... \ No newline at end of file +In progress... + +### Code style +We are using [PEP8 Python style guide](https://www.python.org/dev/peps/pep-0008/) recommendations with 120 characters per line of code. +[black](https://black.readthedocs.io/en/stable/) can be used to format automatically your code: +```bash +black -l 120 src/python/example/bottleneck_basic_example.py +``` diff --git a/for_dev/copyright_template.py b/for_dev/copyright_template.py index 19de05e2..667f985d 100644 --- a/for_dev/copyright_template.py +++ b/for_dev/copyright_template.py @@ -1,7 +1,5 @@ -# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - -# which is released under MIT. -# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license -# details. +# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. +# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. # Author(s): [AUTHOR NAME] # # Copyright (C) [YEAR] [COPYRIGHT] -- cgit v1.2.3 From ab018a79b1d71b9db17056303785517934cd9157 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 12 Feb 2020 10:08:06 +0100 Subject: Fix code coverage generation --- src/cmake/modules/GUDHI_boost_test.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmake/modules/GUDHI_boost_test.cmake b/src/cmake/modules/GUDHI_boost_test.cmake index 3b9da78f..4a13404b 100644 --- a/src/cmake/modules/GUDHI_boost_test.cmake +++ b/src/cmake/modules/GUDHI_boost_test.cmake @@ -9,7 +9,6 @@ if (WITH_GUDHI_BOOST_TEST_COVERAGE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() set(GUDHI_UT_LOG_FORMAT "--log_format=XML") - set(GUDHI_UT_LOG_SINK "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml") set(GUDHI_UT_LOG_LEVEL "--log_level=test_suite") set(GUDHI_UT_REPORT_LEVEL "--report_level=no") else (WITH_GUDHI_BOOST_TEST_COVERAGE) @@ -19,6 +18,10 @@ else (WITH_GUDHI_BOOST_TEST_COVERAGE) endif(WITH_GUDHI_BOOST_TEST_COVERAGE) function(gudhi_add_boost_test unitary_test) + if (WITH_GUDHI_BOOST_TEST_COVERAGE) + set(GUDHI_UT_LOG_SINK "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml") + endif(WITH_GUDHI_BOOST_TEST_COVERAGE) + target_link_libraries(${unitary_test} Boost::unit_test_framework) add_test(NAME ${unitary_test} COMMAND $ ${GUDHI_UT_LOG_FORMAT} ${GUDHI_UT_LOG_SINK} -- cgit v1.2.3 From 89911f674b79c930a6f936a092748e4070d99e46 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 12 Feb 2020 10:08:45 +0100 Subject: Make boost available even if cmake is < 3.5 --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- .../modules/GUDHI_third_party_libraries.cmake | 35 ++++++++++++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 298e71ca..d9244dc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.1) project(GUDHIdev) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e799a3a..561aa049 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.1) project(GUDHI) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 10b2b56a..6f01dc85 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -6,6 +6,38 @@ if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") endif(NOT Boost_FOUND) +# cf. https://cliutils.gitlab.io/modern-cmake/chapters/packages/Boost.html +# This is needed if your Boost version is newer than your CMake version +# or if you have an old version of CMake (<3.5) +if(NOT TARGET Boost::program_options) + add_library(Boost::program_options IMPORTED INTERFACE) + set_property(TARGET Boost::program_options PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}) + set_property(TARGET Boost::program_options PROPERTY + INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES}) +endif() +if(NOT TARGET Boost::filesystem) + add_library(Boost::filesystem IMPORTED INTERFACE) + set_property(TARGET Boost::filesystem PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}) + set_property(TARGET Boost::filesystem PROPERTY + INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES}) +endif() +if(NOT TARGET Boost::unit_test_framework) + add_library(Boost::unit_test_framework IMPORTED INTERFACE) + set_property(TARGET Boost::unit_test_framework PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}) + set_property(TARGET Boost::unit_test_framework PROPERTY + INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES}) +endif() +if(NOT TARGET Boost::system) + add_library(Boost::system IMPORTED INTERFACE) + set_property(TARGET Boost::system PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}) + set_property(TARGET Boost::system PROPERTY + INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES}) +endif() + find_package(GMP) if(GMP_FOUND) INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) @@ -82,9 +114,6 @@ add_definitions( -DBOOST_ALL_DYN_LINK ) # problem on Mac with boost_system and boost_thread add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED ) -#INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -#LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) -- cgit v1.2.3 From 939b2a8bc88d9ed45fd2f01727498042ef137e04 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 16:45:19 +0100 Subject: [skip ci] link to templates --- for_dev/code_conventions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/for_dev/code_conventions.md b/for_dev/code_conventions.md index 7f9f7471..9724f722 100644 --- a/for_dev/code_conventions.md +++ b/for_dev/code_conventions.md @@ -29,6 +29,9 @@ cd src # there is a .clang-format file with these specifications clang-format -style=file -i Simplex_tree/include/gudhi/Simplex_tree.h # -i means in place, your file will be modified ``` +### Template +Please use the file [following template](copyright_template.h). + ## Python In progress... @@ -39,3 +42,6 @@ We are using [PEP8 Python style guide](https://www.python.org/dev/peps/pep-0008/ ```bash black -l 120 src/python/example/bottleneck_basic_example.py ``` + +### Template +Please use the file [following template](copyright_template.py). -- cgit v1.2.3 From 8b0a7fdfb917147d7263a89cdfa1bc785f62c139 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 16:49:10 +0100 Subject: [skip ci] add a section for submodule --- for_dev/how_to_use_github_to_contribute_to_gudhi.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md index 1ca40386..358825f3 100644 --- a/for_dev/how_to_use_github_to_contribute_to_gudhi.md +++ b/for_dev/how_to_use_github_to_contribute_to_gudhi.md @@ -25,6 +25,13 @@ This creates a directory gudhi-devel, which you are free to move around or renam cd gudhi-devel ``` +## Submodule +An interface to Hera for Wasserstein distanceis available on an external git repository. +Everytime you checkout master or merge from master, afterwards, you will need to run the command: +```bash +git submodule update --init +``` + ## Configuring a remote for a fork ```bash git remote add upstream https://github.com/GUDHI/gudhi-devel.git -- cgit v1.2.3 From 9e97c2b0cfeb5defc51b1358949d8a29adec8767 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 16:49:29 +0100 Subject: [skip ci] typo --- for_dev/how_to_use_github_to_contribute_to_gudhi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md index 358825f3..0e7d42ef 100644 --- a/for_dev/how_to_use_github_to_contribute_to_gudhi.md +++ b/for_dev/how_to_use_github_to_contribute_to_gudhi.md @@ -26,7 +26,7 @@ cd gudhi-devel ``` ## Submodule -An interface to Hera for Wasserstein distanceis available on an external git repository. +An interface to Hera for Wasserstein distance is available on an external git repository. Everytime you checkout master or merge from master, afterwards, you will need to run the command: ```bash git submodule update --init -- cgit v1.2.3 From 4b0c4bdf4ec3b8ddc7803eff3e08b7a792a9003d Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 16:50:56 +0100 Subject: [skip ci] Add .github folder --- .github/CONTRIBUTING.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 7afba92e26f9e3e78ce0c27b8b9ef29b2f9a8121 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 16:52:58 +0100 Subject: [skip ci] Move all in .github folder --- .github/code_conventions.md | 47 +++++++++ .github/copyright_template.h | 14 +++ .github/copyright_template.py | 8 ++ .../for_maintainers/new_gudhi_version_creation.md | 97 +++++++++++++++++ .github/for_maintainers/next_release_template.md | 28 +++++ .../how_to_use_github_to_contribute_to_gudhi.md | 116 +++++++++++++++++++++ .github/next_release.md | 28 +++++ for_dev/code_conventions.md | 47 --------- for_dev/copyright_template.h | 14 --- for_dev/copyright_template.py | 8 -- .../for_maintainers/new_gudhi_version_creation.md | 97 ----------------- for_dev/for_maintainers/next_release_template.md | 28 ----- .../how_to_use_github_to_contribute_to_gudhi.md | 116 --------------------- for_dev/next_release.md | 28 ----- 14 files changed, 338 insertions(+), 338 deletions(-) create mode 100644 .github/code_conventions.md create mode 100644 .github/copyright_template.h create mode 100644 .github/copyright_template.py create mode 100644 .github/for_maintainers/new_gudhi_version_creation.md create mode 100644 .github/for_maintainers/next_release_template.md create mode 100644 .github/how_to_use_github_to_contribute_to_gudhi.md create mode 100644 .github/next_release.md delete mode 100644 for_dev/code_conventions.md delete mode 100644 for_dev/copyright_template.h delete mode 100644 for_dev/copyright_template.py delete mode 100644 for_dev/for_maintainers/new_gudhi_version_creation.md delete mode 100644 for_dev/for_maintainers/next_release_template.md delete mode 100644 for_dev/how_to_use_github_to_contribute_to_gudhi.md delete mode 100644 for_dev/next_release.md diff --git a/.github/code_conventions.md b/.github/code_conventions.md new file mode 100644 index 00000000..9724f722 --- /dev/null +++ b/.github/code_conventions.md @@ -0,0 +1,47 @@ +# Naming conventions + +## C++ + +### In the code: +* The classes and functions of a package should be in a sub-namespace of the `Gudhi` namespace. The sub-namespace names are in lowercase and use underscore separators. E.g. `Gudhi::package_name::` +* Concepts are named with camel case starting with uppercase. E.g. `PersistentHomology` for the concept of Persitence homology. +* Classes start with an uppercase letter and use underscore separators. E.g. `Skeleton_blocker_contractor`. +* Member functions and free functions are in lowercase and use underscore separators. E.g. `int num_vertices()`. +* Constants and macros are in uppercase. +* Macros should begin with the prefix `GUDHI_`. + +### File names: +* All headers are named *.h and all sources are named *.cpp. +* If a single class or function is provided in a file, its name (with the same letter case) should be used for the file name. +* If a file does not contain a single class, its name should not begin with a capital letter. +* Test files should be called `test_[what_is_tested].cpp`. E.g. `test_sparsify_point_set.cpp` +* Example files should be called `example_[what_it_is].cpp`. E.g. `example_sparsify_point_set.cpp` + +### In CMakeLists.txt files: +* The name of the "project" should be in this form: `Package_[tests|examples|…]`. E.g. `project(Simplex_tree_examples)`. +* The name if each "target" (first parameter of add_executable) should be in this form: `Package_{name of the cpp file without extension}`. E.g `add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp)`. + +### Code style +We are using [google c++ style guide](https://google.github.io/styleguide/cppguide.html) recommendations with 120 characters per line of code. +[clang-format](https://clang.llvm.org/docs/ClangFormat.html) can be used to format automatically your code: +```bash +cd src # there is a .clang-format file with these specifications +clang-format -style=file -i Simplex_tree/include/gudhi/Simplex_tree.h # -i means in place, your file will be modified +``` + +### Template +Please use the file [following template](copyright_template.h). + +## Python + +In progress... + +### Code style +We are using [PEP8 Python style guide](https://www.python.org/dev/peps/pep-0008/) recommendations with 120 characters per line of code. +[black](https://black.readthedocs.io/en/stable/) can be used to format automatically your code: +```bash +black -l 120 src/python/example/bottleneck_basic_example.py +``` + +### Template +Please use the file [following template](copyright_template.py). diff --git a/.github/copyright_template.h b/.github/copyright_template.h new file mode 100644 index 00000000..30034f1b --- /dev/null +++ b/.github/copyright_template.h @@ -0,0 +1,14 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): [AUTHOR NAME] + * + * Copyright (C) [YEAR] [COPYRIGHT] + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#ifndef [FILE_NAME]_H_ +#define [FILE_NAME]_H_ + +#endif // [FILE_NAME]_H_ \ No newline at end of file diff --git a/.github/copyright_template.py b/.github/copyright_template.py new file mode 100644 index 00000000..667f985d --- /dev/null +++ b/.github/copyright_template.py @@ -0,0 +1,8 @@ +# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. +# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. +# Author(s): [AUTHOR NAME] +# +# Copyright (C) [YEAR] [COPYRIGHT] +# +# Modification(s): +# - YYYY/MM Author: Description of the modification diff --git a/.github/for_maintainers/new_gudhi_version_creation.md b/.github/for_maintainers/new_gudhi_version_creation.md new file mode 100644 index 00000000..4a40f373 --- /dev/null +++ b/.github/for_maintainers/new_gudhi_version_creation.md @@ -0,0 +1,97 @@ +# Create a new GUDHI version + +We will consider that all operations will be performed in a brand new clone of the main project: +```bash +git clone https://github.com/GUDHI/gudhi-devel.git +cd gudhi-devel +``` + +## Version file modification + +**Edit the file CMakeGUDHIVersion.txt**, and increment major, minor, or patch version number, in function of the version new delivery. +```bash +# cf. .gitignore - ignore this if it is a fresh clone version +rm -rf data/points/COIL_database/lucky_cat.off_dist data/points/COIL_database/lucky_cat.off_sc.dot data/points/KleinBottle5D.off_dist data/points/KleinBottle5D.off_sc.dot data/points/human.off_dist data/points/human.off_sc.off data/points/human.off_sc.txt +``` + +Checkin the modifications, build and test the version: +```bash +mkdir build +cd build +cmake -DCGAL_DIR=/your/path/to/CGAL -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_BENCHMARK=ON -DUSER_VERSION_DIR=gudhi.@GUDHI_VERSION@ -DPython_ADDITIONAL_VERSIONS=3 .. +make user_version +date +"%d-%m-%Y-%T" > gudhi.@GUDHI_VERSION@/timestamp.txt +tar -czvf gudhi.@GUDHI_VERSION@.tar.gz gudhi.@GUDHI_VERSION@ +md5sum gudhi.@GUDHI_VERSION@.tar.gz > md5sum.txt +sha256sum gudhi.@GUDHI_VERSION@.tar.gz > sha256sum.txt +sha512sum gudhi.@GUDHI_VERSION@.tar.gz > sha512sum.txt + +make -j all test +``` + +***[Check there are no error]*** + +## Create the documentation +```bash +mkdir gudhi.doc.@GUDHI_VERSION@ +make doxygen 2>&1 | tee dox.log && grep warning dox.log +``` + +***[Check there are no error and the warnings]*** + +```bash +cp -R gudhi.@GUDHI_VERSION@/doc/html gudhi.doc.@GUDHI_VERSION@/cpp +cd gudhi.@GUDHI_VERSION@ +rm -rf build; mkdir build; cd build; cmake -DCGAL_DIR=/your/path/to/CGAL -DWITH_GUDHI_EXAMPLE=ON -DPython_ADDITIONAL_VERSIONS=3 .. +export LC_ALL=en_US.UTF-8 # cf. bug +make sphinx +``` + +***[Check there are no error]*** + +```bash +cp -R python/sphinx ../../gudhi.doc.@GUDHI_VERSION@/python +cd ../.. +tar -czvf gudhi.doc.@GUDHI_VERSION@.tar.gz gudhi.doc.@GUDHI_VERSION@ + +cd gudhi.@GUDHI_VERSION@/build +make all test +``` + +***[Check there are no error]*** + +## Upload the documentation + +Upload by ftp the content of the directory gudhi.doc.@GUDHI_VERSION@/cpp in a new directory on ForgeLogin@scm.gforge.inria.fr:/home/groups/gudhi/htdocs/doc/@GUDHI_VERSION@ + +Upload by ftp the content of the directory gudhi.doc.@GUDHI_VERSION@/python in a new directory on ForgeLogin@scm.gforge.inria.fr:/home/groups/gudhi/htdocs/python/@GUDHI_VERSION@ + +Through ssh, make the **latest** link to your new version of the documentation: +```bash +ssh ForgeLogin@scm.gforge.inria.fr +cd /home/groups/gudhi/htdocs/doc +rm latest +ln -s @GUDHI_VERSION@ latest +cd /home/groups/gudhi/htdocs/python +rm latest +ln -s @GUDHI_VERSION@ latest +``` + +## Put a version label on files + +* Go on page https://github.com/GUDHI/gudhi-devel/releases/new +* Name the tag: tags/gudhi-release-@GUDHI_VERSION@ +* Name the release GUDHI @GUDHI_VERSION@ +* Write the release note +* Drag'n drop *gudhi.@GUDHI_VERSION@.tar.gz*, *md5sum.txt*, *sha256sum.txt*, *sha512sum.txt* files +* Tick the *This is a pre-release* check button if this is a release candidate (untick if this is an official version) +* Click the *Publish the release* button + +***[Where X, Y and Z corresponds respectively to the major, minor, and patch version number]*** + + +## Mail sending +Send version mail to the following lists : +* gudhi-devel@lists.gforge.inria.fr +* gudhi-users@lists.gforge.inria.fr (not for release candidate) + diff --git a/.github/for_maintainers/next_release_template.md b/.github/for_maintainers/next_release_template.md new file mode 100644 index 00000000..a2805a55 --- /dev/null +++ b/.github/for_maintainers/next_release_template.md @@ -0,0 +1,28 @@ +We are pleased to announce the release 3.X.X of the GUDHI library. + +As a major new feature, the GUDHI library now offers ... + +We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). + +Below is a list of changes made since GUDHI 3.X-1.X-1: + +- [Module](link) + - ... + +- [Module](link) + - ... + +- Miscellaneous + - The [list of bugs that were solved since GUDHI-3.X-1.X-1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.1.1+is%3Aclosed) is available on GitHub. + +All modules are distributed under the terms of the MIT license. +However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. + +We kindly ask users to cite the GUDHI library as appropriately as possible in their papers, and to mention the use of the GUDHI library on the web pages of their projects using GUDHI and provide us with links to these web pages. + +We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) for the modules of the User and Reference Manual, as well as for publications directly related to the GUDHI library. + +Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks. + +For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/latest/installation.html) or [Python](https://gudhi.inria.fr/python/latest/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/). + diff --git a/.github/how_to_use_github_to_contribute_to_gudhi.md b/.github/how_to_use_github_to_contribute_to_gudhi.md new file mode 100644 index 00000000..0e7d42ef --- /dev/null +++ b/.github/how_to_use_github_to_contribute_to_gudhi.md @@ -0,0 +1,116 @@ +# How to use github to contribute to gudhi + +Similar information is available in many places: +* https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch) +* https://help.github.com/en/github/getting-started-with-github/fork-a-repo +* https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/ +* https://gist.github.com/Chaser324/ce0505fbed06b947d962 +* etc + +## Get a github account +I assume the account is called **LOGIN**, please replace as appropriate below. Log in to github.com using this account. + +## Fork GUDHI/gudhi-devel project +Go to https://github.com/GUDHI/gudhi-devel and click on **fork** (top right). +Feel free to also click on the star next to it to show you like the project! +You can see your fork at https://github.com/LOGIN/gudhi-devel + +## Create a local clone on your computer +```bash +git clone https://github.com/LOGIN/gudhi-devel.git +``` + +This creates a directory gudhi-devel, which you are free to move around or rename. For the following, change to that directory: +```bash +cd gudhi-devel +``` + +## Submodule +An interface to Hera for Wasserstein distance is available on an external git repository. +Everytime you checkout master or merge from master, afterwards, you will need to run the command: +```bash +git submodule update --init +``` + +## Configuring a remote for a fork +```bash +git remote add upstream https://github.com/GUDHI/gudhi-devel.git +``` + +because you want to see the real gudhi, not just your clone. +(It is perfectly possible to do things in the reverse order, clone from GUDHI and add the one in LOGIN as extra remote, but the names of the remotes may not match the rest of this document. You can change the name of a remote with `git remote rename oldname newname`) + +## Optional remotes +Optional, if you are interested in one of the old branches +```bash +git remote add oldies https://github.com/GUDHI/branches.git +``` + +Or if you want to spy on someone's work. I assume the someone's account is called **SOMEONE** +```bash +git remote add someone https://github.com/SOMEONE/gudhi-devel.git +``` + +## Stay up-to-date +```bash +git fetch -p --all +``` +This is a command you can run quite regularly. +It tells git to check all that happened on github. +It is safe, it will not mess with your files. + +## Create a branch, based on the current master +```bash +git checkout -b some-fancy-name --no-track upstream/master +``` +Your local branch `master` and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on. + +## The real coding is here! +Edit files, test, etc. + +## Commit your changes (locally) +The basic command is just `git commit`, but it will do nothing by default. +You need `git add my_new_file` for every new file you want to commit. +And usually you'll want to use `git commit -a` so that all files that git already knows about and that have been modified get committed. + +## Push your changes (remotely) +```bash +git push -u origin some-fancy-name +``` +This puts a copy of your branch on your online clone of gudhi-devel. +Because of `-u`, it will remember where you like to push this branch, and next time you can just use `git push`. + +## Play again! +Possibly iterate a few times, add more commits and push them. + +## Your pull request is ready +Get your web browser to https://github.com/LOGIN/gudhi-devel, click on the button that says **Branch: some-name** (below the number of commits, above the list of files) and select the branch you are so proud of. +Click on **New pull request** next to it. + +## Follow the instructions ;-) +Note that if your branch is not quite ready, you can make a **draft pull request** (see the arrow next to the confirmation button), and later you will have access to a button to say that the branch is ready for reviews now. +Draft pull requests can be a way to advertise that you are working on something, and possibly ask others for comments or help. + +## Code review +Make sure you follow the discussion on your pull request, answer questions, take comments into account. +You can keep pushing new commits on your branch to your fork of gudhi-devel, the pull request will automatically notice the new commits there. +There is no need to create a new pull request. +Once the branch is under review, fixing issues is good, but please refrain from adding extra features, that just makes the reviewers' job harder and thus slower. +You may want to look at https://github.com/settings/notifications (and other settings nearby) if you don't receive emails when people comment on your pull request. +Some bold reviewer might make changes to your branch. You will then need `git pull` for your local branch to reflect those. + +## Your work is merged! +Once your pull request has been closed (your branch merged), you can remove your branch, both locally and also the branch on your github fork: +```bash +git checkout master # or any other branch, but you cannot remove the branch you are currently in +git branch -d some-fancy-name # local branch delete +git push origin --delete some-fancy-name # remote branch delete +``` +If you add @VincentRouvreau or @mglisse as collaborator (https://github.com/LOGIN/gudhi-devel/settings/collaboration), they may remove the branch on your clone at the same time as they merge the branch, so you only have the local one to remove (or keep if you are nostalgic). + +## Keep in touch +Create a new branch and keep contributing! + +Do not try to reuse an old branch that has already been merged. +Make sure you run the fetch command just before creating any new branch, so you don't base it on some outdated version of master. +You can also work on several branches at the same time, using `git checkout some-fancy-name` and `git checkout name-of-other-branch` to switch between them (commit before switching or things may get complicated). diff --git a/.github/next_release.md b/.github/next_release.md new file mode 100644 index 00000000..a2805a55 --- /dev/null +++ b/.github/next_release.md @@ -0,0 +1,28 @@ +We are pleased to announce the release 3.X.X of the GUDHI library. + +As a major new feature, the GUDHI library now offers ... + +We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). + +Below is a list of changes made since GUDHI 3.X-1.X-1: + +- [Module](link) + - ... + +- [Module](link) + - ... + +- Miscellaneous + - The [list of bugs that were solved since GUDHI-3.X-1.X-1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.1.1+is%3Aclosed) is available on GitHub. + +All modules are distributed under the terms of the MIT license. +However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. + +We kindly ask users to cite the GUDHI library as appropriately as possible in their papers, and to mention the use of the GUDHI library on the web pages of their projects using GUDHI and provide us with links to these web pages. + +We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) for the modules of the User and Reference Manual, as well as for publications directly related to the GUDHI library. + +Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks. + +For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/latest/installation.html) or [Python](https://gudhi.inria.fr/python/latest/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/). + diff --git a/for_dev/code_conventions.md b/for_dev/code_conventions.md deleted file mode 100644 index 9724f722..00000000 --- a/for_dev/code_conventions.md +++ /dev/null @@ -1,47 +0,0 @@ -# Naming conventions - -## C++ - -### In the code: -* The classes and functions of a package should be in a sub-namespace of the `Gudhi` namespace. The sub-namespace names are in lowercase and use underscore separators. E.g. `Gudhi::package_name::` -* Concepts are named with camel case starting with uppercase. E.g. `PersistentHomology` for the concept of Persitence homology. -* Classes start with an uppercase letter and use underscore separators. E.g. `Skeleton_blocker_contractor`. -* Member functions and free functions are in lowercase and use underscore separators. E.g. `int num_vertices()`. -* Constants and macros are in uppercase. -* Macros should begin with the prefix `GUDHI_`. - -### File names: -* All headers are named *.h and all sources are named *.cpp. -* If a single class or function is provided in a file, its name (with the same letter case) should be used for the file name. -* If a file does not contain a single class, its name should not begin with a capital letter. -* Test files should be called `test_[what_is_tested].cpp`. E.g. `test_sparsify_point_set.cpp` -* Example files should be called `example_[what_it_is].cpp`. E.g. `example_sparsify_point_set.cpp` - -### In CMakeLists.txt files: -* The name of the "project" should be in this form: `Package_[tests|examples|…]`. E.g. `project(Simplex_tree_examples)`. -* The name if each "target" (first parameter of add_executable) should be in this form: `Package_{name of the cpp file without extension}`. E.g `add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp)`. - -### Code style -We are using [google c++ style guide](https://google.github.io/styleguide/cppguide.html) recommendations with 120 characters per line of code. -[clang-format](https://clang.llvm.org/docs/ClangFormat.html) can be used to format automatically your code: -```bash -cd src # there is a .clang-format file with these specifications -clang-format -style=file -i Simplex_tree/include/gudhi/Simplex_tree.h # -i means in place, your file will be modified -``` - -### Template -Please use the file [following template](copyright_template.h). - -## Python - -In progress... - -### Code style -We are using [PEP8 Python style guide](https://www.python.org/dev/peps/pep-0008/) recommendations with 120 characters per line of code. -[black](https://black.readthedocs.io/en/stable/) can be used to format automatically your code: -```bash -black -l 120 src/python/example/bottleneck_basic_example.py -``` - -### Template -Please use the file [following template](copyright_template.py). diff --git a/for_dev/copyright_template.h b/for_dev/copyright_template.h deleted file mode 100644 index 30034f1b..00000000 --- a/for_dev/copyright_template.h +++ /dev/null @@ -1,14 +0,0 @@ -/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - * Author(s): [AUTHOR NAME] - * - * Copyright (C) [YEAR] [COPYRIGHT] - * - * Modification(s): - * - YYYY/MM Author: Description of the modification - */ - -#ifndef [FILE_NAME]_H_ -#define [FILE_NAME]_H_ - -#endif // [FILE_NAME]_H_ \ No newline at end of file diff --git a/for_dev/copyright_template.py b/for_dev/copyright_template.py deleted file mode 100644 index 667f985d..00000000 --- a/for_dev/copyright_template.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. -# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. -# Author(s): [AUTHOR NAME] -# -# Copyright (C) [YEAR] [COPYRIGHT] -# -# Modification(s): -# - YYYY/MM Author: Description of the modification diff --git a/for_dev/for_maintainers/new_gudhi_version_creation.md b/for_dev/for_maintainers/new_gudhi_version_creation.md deleted file mode 100644 index 4a40f373..00000000 --- a/for_dev/for_maintainers/new_gudhi_version_creation.md +++ /dev/null @@ -1,97 +0,0 @@ -# Create a new GUDHI version - -We will consider that all operations will be performed in a brand new clone of the main project: -```bash -git clone https://github.com/GUDHI/gudhi-devel.git -cd gudhi-devel -``` - -## Version file modification - -**Edit the file CMakeGUDHIVersion.txt**, and increment major, minor, or patch version number, in function of the version new delivery. -```bash -# cf. .gitignore - ignore this if it is a fresh clone version -rm -rf data/points/COIL_database/lucky_cat.off_dist data/points/COIL_database/lucky_cat.off_sc.dot data/points/KleinBottle5D.off_dist data/points/KleinBottle5D.off_sc.dot data/points/human.off_dist data/points/human.off_sc.off data/points/human.off_sc.txt -``` - -Checkin the modifications, build and test the version: -```bash -mkdir build -cd build -cmake -DCGAL_DIR=/your/path/to/CGAL -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_BENCHMARK=ON -DUSER_VERSION_DIR=gudhi.@GUDHI_VERSION@ -DPython_ADDITIONAL_VERSIONS=3 .. -make user_version -date +"%d-%m-%Y-%T" > gudhi.@GUDHI_VERSION@/timestamp.txt -tar -czvf gudhi.@GUDHI_VERSION@.tar.gz gudhi.@GUDHI_VERSION@ -md5sum gudhi.@GUDHI_VERSION@.tar.gz > md5sum.txt -sha256sum gudhi.@GUDHI_VERSION@.tar.gz > sha256sum.txt -sha512sum gudhi.@GUDHI_VERSION@.tar.gz > sha512sum.txt - -make -j all test -``` - -***[Check there are no error]*** - -## Create the documentation -```bash -mkdir gudhi.doc.@GUDHI_VERSION@ -make doxygen 2>&1 | tee dox.log && grep warning dox.log -``` - -***[Check there are no error and the warnings]*** - -```bash -cp -R gudhi.@GUDHI_VERSION@/doc/html gudhi.doc.@GUDHI_VERSION@/cpp -cd gudhi.@GUDHI_VERSION@ -rm -rf build; mkdir build; cd build; cmake -DCGAL_DIR=/your/path/to/CGAL -DWITH_GUDHI_EXAMPLE=ON -DPython_ADDITIONAL_VERSIONS=3 .. -export LC_ALL=en_US.UTF-8 # cf. bug -make sphinx -``` - -***[Check there are no error]*** - -```bash -cp -R python/sphinx ../../gudhi.doc.@GUDHI_VERSION@/python -cd ../.. -tar -czvf gudhi.doc.@GUDHI_VERSION@.tar.gz gudhi.doc.@GUDHI_VERSION@ - -cd gudhi.@GUDHI_VERSION@/build -make all test -``` - -***[Check there are no error]*** - -## Upload the documentation - -Upload by ftp the content of the directory gudhi.doc.@GUDHI_VERSION@/cpp in a new directory on ForgeLogin@scm.gforge.inria.fr:/home/groups/gudhi/htdocs/doc/@GUDHI_VERSION@ - -Upload by ftp the content of the directory gudhi.doc.@GUDHI_VERSION@/python in a new directory on ForgeLogin@scm.gforge.inria.fr:/home/groups/gudhi/htdocs/python/@GUDHI_VERSION@ - -Through ssh, make the **latest** link to your new version of the documentation: -```bash -ssh ForgeLogin@scm.gforge.inria.fr -cd /home/groups/gudhi/htdocs/doc -rm latest -ln -s @GUDHI_VERSION@ latest -cd /home/groups/gudhi/htdocs/python -rm latest -ln -s @GUDHI_VERSION@ latest -``` - -## Put a version label on files - -* Go on page https://github.com/GUDHI/gudhi-devel/releases/new -* Name the tag: tags/gudhi-release-@GUDHI_VERSION@ -* Name the release GUDHI @GUDHI_VERSION@ -* Write the release note -* Drag'n drop *gudhi.@GUDHI_VERSION@.tar.gz*, *md5sum.txt*, *sha256sum.txt*, *sha512sum.txt* files -* Tick the *This is a pre-release* check button if this is a release candidate (untick if this is an official version) -* Click the *Publish the release* button - -***[Where X, Y and Z corresponds respectively to the major, minor, and patch version number]*** - - -## Mail sending -Send version mail to the following lists : -* gudhi-devel@lists.gforge.inria.fr -* gudhi-users@lists.gforge.inria.fr (not for release candidate) - diff --git a/for_dev/for_maintainers/next_release_template.md b/for_dev/for_maintainers/next_release_template.md deleted file mode 100644 index a2805a55..00000000 --- a/for_dev/for_maintainers/next_release_template.md +++ /dev/null @@ -1,28 +0,0 @@ -We are pleased to announce the release 3.X.X of the GUDHI library. - -As a major new feature, the GUDHI library now offers ... - -We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). - -Below is a list of changes made since GUDHI 3.X-1.X-1: - -- [Module](link) - - ... - -- [Module](link) - - ... - -- Miscellaneous - - The [list of bugs that were solved since GUDHI-3.X-1.X-1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.1.1+is%3Aclosed) is available on GitHub. - -All modules are distributed under the terms of the MIT license. -However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. - -We kindly ask users to cite the GUDHI library as appropriately as possible in their papers, and to mention the use of the GUDHI library on the web pages of their projects using GUDHI and provide us with links to these web pages. - -We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) for the modules of the User and Reference Manual, as well as for publications directly related to the GUDHI library. - -Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks. - -For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/latest/installation.html) or [Python](https://gudhi.inria.fr/python/latest/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/). - diff --git a/for_dev/how_to_use_github_to_contribute_to_gudhi.md b/for_dev/how_to_use_github_to_contribute_to_gudhi.md deleted file mode 100644 index 0e7d42ef..00000000 --- a/for_dev/how_to_use_github_to_contribute_to_gudhi.md +++ /dev/null @@ -1,116 +0,0 @@ -# How to use github to contribute to gudhi - -Similar information is available in many places: -* https://jarv.is/notes/how-to-pull-request-fork-github/ (this one is using `upstream/master` when creating a new branch) -* https://help.github.com/en/github/getting-started-with-github/fork-a-repo -* https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/ -* https://gist.github.com/Chaser324/ce0505fbed06b947d962 -* etc - -## Get a github account -I assume the account is called **LOGIN**, please replace as appropriate below. Log in to github.com using this account. - -## Fork GUDHI/gudhi-devel project -Go to https://github.com/GUDHI/gudhi-devel and click on **fork** (top right). -Feel free to also click on the star next to it to show you like the project! -You can see your fork at https://github.com/LOGIN/gudhi-devel - -## Create a local clone on your computer -```bash -git clone https://github.com/LOGIN/gudhi-devel.git -``` - -This creates a directory gudhi-devel, which you are free to move around or rename. For the following, change to that directory: -```bash -cd gudhi-devel -``` - -## Submodule -An interface to Hera for Wasserstein distance is available on an external git repository. -Everytime you checkout master or merge from master, afterwards, you will need to run the command: -```bash -git submodule update --init -``` - -## Configuring a remote for a fork -```bash -git remote add upstream https://github.com/GUDHI/gudhi-devel.git -``` - -because you want to see the real gudhi, not just your clone. -(It is perfectly possible to do things in the reverse order, clone from GUDHI and add the one in LOGIN as extra remote, but the names of the remotes may not match the rest of this document. You can change the name of a remote with `git remote rename oldname newname`) - -## Optional remotes -Optional, if you are interested in one of the old branches -```bash -git remote add oldies https://github.com/GUDHI/branches.git -``` - -Or if you want to spy on someone's work. I assume the someone's account is called **SOMEONE** -```bash -git remote add someone https://github.com/SOMEONE/gudhi-devel.git -``` - -## Stay up-to-date -```bash -git fetch -p --all -``` -This is a command you can run quite regularly. -It tells git to check all that happened on github. -It is safe, it will not mess with your files. - -## Create a branch, based on the current master -```bash -git checkout -b some-fancy-name --no-track upstream/master -``` -Your local branch `master` and the one on your github clone are useless and often outdated, but for technical reasons there has to exist at least one branch at all times, it might as well be that one. upstream/master is the real deal, that's what you want to base your new branch on. - -## The real coding is here! -Edit files, test, etc. - -## Commit your changes (locally) -The basic command is just `git commit`, but it will do nothing by default. -You need `git add my_new_file` for every new file you want to commit. -And usually you'll want to use `git commit -a` so that all files that git already knows about and that have been modified get committed. - -## Push your changes (remotely) -```bash -git push -u origin some-fancy-name -``` -This puts a copy of your branch on your online clone of gudhi-devel. -Because of `-u`, it will remember where you like to push this branch, and next time you can just use `git push`. - -## Play again! -Possibly iterate a few times, add more commits and push them. - -## Your pull request is ready -Get your web browser to https://github.com/LOGIN/gudhi-devel, click on the button that says **Branch: some-name** (below the number of commits, above the list of files) and select the branch you are so proud of. -Click on **New pull request** next to it. - -## Follow the instructions ;-) -Note that if your branch is not quite ready, you can make a **draft pull request** (see the arrow next to the confirmation button), and later you will have access to a button to say that the branch is ready for reviews now. -Draft pull requests can be a way to advertise that you are working on something, and possibly ask others for comments or help. - -## Code review -Make sure you follow the discussion on your pull request, answer questions, take comments into account. -You can keep pushing new commits on your branch to your fork of gudhi-devel, the pull request will automatically notice the new commits there. -There is no need to create a new pull request. -Once the branch is under review, fixing issues is good, but please refrain from adding extra features, that just makes the reviewers' job harder and thus slower. -You may want to look at https://github.com/settings/notifications (and other settings nearby) if you don't receive emails when people comment on your pull request. -Some bold reviewer might make changes to your branch. You will then need `git pull` for your local branch to reflect those. - -## Your work is merged! -Once your pull request has been closed (your branch merged), you can remove your branch, both locally and also the branch on your github fork: -```bash -git checkout master # or any other branch, but you cannot remove the branch you are currently in -git branch -d some-fancy-name # local branch delete -git push origin --delete some-fancy-name # remote branch delete -``` -If you add @VincentRouvreau or @mglisse as collaborator (https://github.com/LOGIN/gudhi-devel/settings/collaboration), they may remove the branch on your clone at the same time as they merge the branch, so you only have the local one to remove (or keep if you are nostalgic). - -## Keep in touch -Create a new branch and keep contributing! - -Do not try to reuse an old branch that has already been merged. -Make sure you run the fetch command just before creating any new branch, so you don't base it on some outdated version of master. -You can also work on several branches at the same time, using `git checkout some-fancy-name` and `git checkout name-of-other-branch` to switch between them (commit before switching or things may get complicated). diff --git a/for_dev/next_release.md b/for_dev/next_release.md deleted file mode 100644 index a2805a55..00000000 --- a/for_dev/next_release.md +++ /dev/null @@ -1,28 +0,0 @@ -We are pleased to announce the release 3.X.X of the GUDHI library. - -As a major new feature, the GUDHI library now offers ... - -We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). - -Below is a list of changes made since GUDHI 3.X-1.X-1: - -- [Module](link) - - ... - -- [Module](link) - - ... - -- Miscellaneous - - The [list of bugs that were solved since GUDHI-3.X-1.X-1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.1.1+is%3Aclosed) is available on GitHub. - -All modules are distributed under the terms of the MIT license. -However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. - -We kindly ask users to cite the GUDHI library as appropriately as possible in their papers, and to mention the use of the GUDHI library on the web pages of their projects using GUDHI and provide us with links to these web pages. - -We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) for the modules of the User and Reference Manual, as well as for publications directly related to the GUDHI library. - -Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks. - -For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/latest/installation.html) or [Python](https://gudhi.inria.fr/python/latest/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/). - -- cgit v1.2.3 From e98d18182076ef5f66361a6ef404e55ff13567e4 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 17:18:14 +0100 Subject: [skip ci] Add some contributing content --- .github/CONTRIBUTING.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e69de29b..eacf32f8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Contributing to GUDHI + +First of all, thank you for the time you may take to contribute to GUDHI ! + +# In case you have a question + +Please, check our [contact web page](https://gudhi.inria.fr/contact/). + +# In case you found an issue + +Please, first check [opened issues on GUDHI](https://github.com/GUDHI/gudhi-devel/issues). + +If the problem you are facing is not referenced, do not hesitate to open a [new issue](https://github.com/GUDHI/gudhi-devel/issues/new). + +This place is also a good place if you have some enhancement you want to propose for the GUDHI library. +There is a label **enhancement** in the [new issue](https://github.com/GUDHI/gudhi-devel/issues/new) page. + +# In case you want to contribute to GUDHI + +## You are not familiar with GitHub ? + +Please take some time to read our [how to use GitHub to contribute to GUDHI](/home/vincent/workspace/gudhi/gudhi-devel/for_dev/how_to_use_github_to_contribute_to_gudhi.md). + +## Something you want to improve in the documentation + +For C++ documentation, you can find it in the directories: +* *src/common/doc* for the main page and installation instructions +* *src/NAME_OF_THE_MODULE/doc* for the main page of a module +* *src/NAME_OF_THE_MODULE/include/gudhi* for the documentation generated from the code. +We use Doxygen to generate the code and you will be able to verify the result in CircleCI Doxygen target in the artifacts. + +For Python documentation, you can find it in the directories: +* *src/python/doc* for the main page, installation instructionsand for the main pages of the modules +* *src/python/gudhi/NAME_OF_THE_MODULE.pyx* for the documentation generated from the code. +We use Sphinx to generate the code and you will be able to verify the result in CircleCI Sphinx target in the artifacts. + +## Something you want to improve in the code + +Please first take some time to read our [code conventions](code_conventions.md) + -- cgit v1.2.3 From 8dc47a277c50744812a6e65e8e817fed479b301d Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 13 Feb 2020 17:25:55 +0100 Subject: [skip ci] contributing --- .github/CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index eacf32f8..29fe0aaa 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,7 +12,7 @@ Please, first check [opened issues on GUDHI](https://github.com/GUDHI/gudhi-deve If the problem you are facing is not referenced, do not hesitate to open a [new issue](https://github.com/GUDHI/gudhi-devel/issues/new). -This place is also a good place if you have some enhancement you want to propose for the GUDHI library. +This place is also a good place if you have some enhancement you want to propose. There is a label **enhancement** in the [new issue](https://github.com/GUDHI/gudhi-devel/issues/new) page. # In case you want to contribute to GUDHI @@ -38,3 +38,6 @@ We use Sphinx to generate the code and you will be able to verify the result in Please first take some time to read our [code conventions](code_conventions.md) +As a convention, we set a Pull Request as a **Draft Pull Request** when we work on something we want the other contributors to see. + +We click on **Ready for review** to ask for a peer review of the contribution. \ No newline at end of file -- cgit v1.2.3 From 34e1ae726e27fdd7c41f6d80d8ed7f6504dc3a0d Mon Sep 17 00:00:00 2001 From: tlacombe Date: Fri, 14 Feb 2020 18:16:27 +0100 Subject: Global improvement of rendering with Python tools --- src/python/gudhi/persistence_graphical_tools.py | 92 +++++++++++++++++++++---- 1 file changed, 77 insertions(+), 15 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 246280de..4a690241 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -5,6 +5,7 @@ # Copyright (C) 2016 Inria # # Modification(s): +# - 2020/02 Theo Lacombe: Added more options for improved rendering and more flexibility. # - YYYY/MM Author: Description of the modification from os import path @@ -43,6 +44,7 @@ def __min_birth_max_death(persistence, band=0.0): max_death += band return (min_birth, max_death) + def plot_persistence_barcode( persistence=[], persistence_file="", @@ -52,7 +54,9 @@ def plot_persistence_barcode( inf_delta=0.1, legend=False, colormap=None, - axes=None + axes=None, + fontsize=16, + title="Persistence barcode" ): """This function plots the persistence bar code from persistence values list or from a :doc:`persistence file `. @@ -81,11 +85,18 @@ def plot_persistence_barcode( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param fontsize: Fontsize to use in axis. + :type fontsize: int + :param title: title for the plot. + :type title: string :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') if persistence_file != "": if path.isfile(persistence_file): @@ -163,7 +174,7 @@ def plot_persistence_barcode( loc="lower right", ) - axes.set_title("Persistence barcode") + axes.set_title(title) # Ends plot on infinity value and starts a little bit before min_birth axes.axis([axis_start, infinity, 0, ind]) @@ -183,7 +194,11 @@ def plot_persistence_diagram( inf_delta=0.1, legend=False, colormap=None, - axes=None + axes=None, + aspect_equal=False, + fontsize=16, + title="Persistence diagram", + greyblock=True ): """This function plots the persistence diagram from persistence values list or from a :doc:`persistence file `. @@ -214,11 +229,23 @@ def plot_persistence_diagram( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param aspect_equal: if True, force plot to be square shaped. + :type aspect_equal: boolean + :param fontsize: Fontsize to use in axis. + :type fontsize: int + :param title: title for the plot. + :type title: string + :param greyblock: if we want to plot a grey patch on the lower half plane for nicer rendering. Default True. + :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') + if persistence_file != "": if path.isfile(persistence_file): @@ -256,18 +283,27 @@ def plot_persistence_diagram( # Replace infinity values with max_death + delta for diagram to be more # readable infinity = max_death + delta + axis_end = max_death + delta / 2 axis_start = min_birth - delta # line display of equation : birth = death x = np.linspace(axis_start, infinity, 1000) # infinity line and text - axes.plot(x, x, color="k", linewidth=1.0) - axes.plot(x, [infinity] * len(x), linewidth=1.0, color="k", alpha=alpha) - axes.text(axis_start, infinity, r"$\infty$", color="k", alpha=alpha) + axes.plot([axis_start, axis_end], [axis_start, axis_end], linewidth=1.0, color="k") + axes.plot([axis_start, axis_end], [infinity, infinity], linewidth=1.0, color="k", alpha=alpha) + # Infinity label + yt = axes.get_yticks() + yt = np.append(yt, infinity) + ytl = yt.tolist() + ytl[-1] = r'$+\infty$' + axes.set_yticks(yt) + axes.set_yticklabels(ytl) # bootstrap band if band > 0.0: axes.fill_between(x, x, x + band, alpha=alpha, facecolor="red") - + # lower diag patch + if greyblock: + axes.add_patch(mpatches.Polygon([[axis_start, axis_start], [axis_end, axis_start], [axis_end, axis_end]], fill=True, color='lightgrey')) # Draw points in loop for interval in reversed(persistence): if float(interval[1][1]) != float("inf"): @@ -293,11 +329,13 @@ def plot_persistence_diagram( ] ) - axes.set_xlabel("Birth") - axes.set_ylabel("Death") + axes.set_xlabel("Birth", fontsize=fontsize) + axes.set_ylabel("Death", fontsize=fontsize) # Ends plot on infinity value and starts a little bit before min_birth - axes.axis([axis_start, infinity, axis_start, infinity + delta]) - axes.set_title("Persistence diagram") + axes.axis([axis_start, axis_end, axis_start, infinity + delta]) + axes.set_title(title, fontsize=fontsize) # a different fontsize for the title? + if aspect_equal: + axes.set_aspect("equal") return axes except ImportError: @@ -313,7 +351,11 @@ def plot_persistence_density( dimension=None, cmap=None, legend=False, - axes=None + axes=None, + aspect_equal=False, + fontsize=16, + title="Persistence density", + greyblock=True ): """This function plots the persistence density from persistence values list or from a :doc:`persistence file `. Be @@ -355,11 +397,25 @@ def plot_persistence_density( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param aspect_equal: if True, force plot to be square shaped. + :type aspect_equal: boolean + :param fontsize: Fontsize to use in axis. + :type fontsize: int + :param title: title for the plot. + :type title: string + :param greyblock: if we want to plot a grey patch on the lower half plane + for nicer rendering. Default True. + :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt + import matplotlib.patches as mpatches from scipy.stats import kde + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') + if persistence_file != "": if dimension is None: @@ -418,12 +474,18 @@ def plot_persistence_density( # Make the plot img = axes.pcolormesh(xi, yi, zi.reshape(xi.shape), cmap=cmap) + if greyblock: + axes.add_patch(mpatches.Polygon([[birth.min(), birth.min()], [death.max(), birth.min()], [death.max(), death.max()]], fill=True, color='lightgrey')) + if legend: plt.colorbar(img, ax=axes) - axes.set_xlabel("Birth") - axes.set_ylabel("Death") - axes.set_title("Persistence density") + axes.set_xlabel("Birth", fontsize=fontsize) + axes.set_ylabel("Death", fontsize=fontsize) + axes.set_title(title, fontsize=fontsize) + if aspect_equal: + axes.set_aspect("equal") + return axes except ImportError: -- cgit v1.2.3 From 9af4d25790b0ccc19cfba90f8ab492823fde4623 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 18 Feb 2020 21:10:14 -0400 Subject: Update hera --- ext/hera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/hera b/ext/hera index 9a899718..cb1838e6 160000 --- a/ext/hera +++ b/ext/hera @@ -1 +1 @@ -Subproject commit 9a89971855acefe39dce0e2adadf53b88ca8f683 +Subproject commit cb1838e682ec07f80720241cf9098400caeb83c7 -- cgit v1.2.3 From 9b4258e4f5abb355670afb69d60f3002cb9c27b0 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Wed, 19 Feb 2020 08:29:27 +0100 Subject: Doc review: submodule rephrase [skip ci] --- .github/how_to_use_github_to_contribute_to_gudhi.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/how_to_use_github_to_contribute_to_gudhi.md b/.github/how_to_use_github_to_contribute_to_gudhi.md index 0e7d42ef..0a6133b7 100644 --- a/.github/how_to_use_github_to_contribute_to_gudhi.md +++ b/.github/how_to_use_github_to_contribute_to_gudhi.md @@ -25,9 +25,10 @@ This creates a directory gudhi-devel, which you are free to move around or renam cd gudhi-devel ``` -## Submodule -An interface to Hera for Wasserstein distance is available on an external git repository. -Everytime you checkout master or merge from master, afterwards, you will need to run the command: +Everytime you clone the repository, you will have to download the *submodules*. + +## Submodules +An interface to Hera for Wasserstein distance is available on an external git repository. To download it: ```bash git submodule update --init ``` @@ -59,6 +60,11 @@ This is a command you can run quite regularly. It tells git to check all that happened on github. It is safe, it will not mess with your files. +**Reminder:** Everytime you checkout master or merge from master, afterwards, if the version of one the submodule has changed, or if a submodule was added, you will have to: +```bash +git submodule update --init +``` + ## Create a branch, based on the current master ```bash git checkout -b some-fancy-name --no-track upstream/master -- cgit v1.2.3 From f9e77bbeabf307dbc4e6f1521c1567fe9bf1123f Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Wed, 19 Feb 2020 08:49:15 +0100 Subject: Doc review: precaution on contribution [skip ci] --- .github/CONTRIBUTING.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 29fe0aaa..13d6cad7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -36,8 +36,13 @@ We use Sphinx to generate the code and you will be able to verify the result in ## Something you want to improve in the code -Please first take some time to read our [code conventions](code_conventions.md) +We don't ask for any paperwork but we expect you don't submit anything you are not allowed to: +* check that your work contract and your employer allow you to contribute to this open source project. +* insure you do not violate someone's intellectual property. +* ... + +Please, take some time to read our [code conventions](code_conventions.md) As a convention, we set a Pull Request as a **Draft Pull Request** when we work on something we want the other contributors to see. -We click on **Ready for review** to ask for a peer review of the contribution. \ No newline at end of file +We click on **Ready for review** to ask for a peer review of the contribution. -- cgit v1.2.3 From 63e4222e528317b7e0385bf5881393ff2f97fa80 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 24 Feb 2020 16:08:19 +0100 Subject: Fix CI - bad use of skip continuous integration --- .github/for_maintainers/new_gudhi_version_creation.md | 3 --- CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/for_maintainers/new_gudhi_version_creation.md b/.github/for_maintainers/new_gudhi_version_creation.md index 4a40f373..f176d392 100644 --- a/.github/for_maintainers/new_gudhi_version_creation.md +++ b/.github/for_maintainers/new_gudhi_version_creation.md @@ -87,9 +87,6 @@ ln -s @GUDHI_VERSION@ latest * Tick the *This is a pre-release* check button if this is a release candidate (untick if this is an official version) * Click the *Publish the release* button -***[Where X, Y and Z corresponds respectively to the major, minor, and patch version number]*** - - ## Mail sending Send version mail to the following lists : * gudhi-devel@lists.gforge.inria.fr diff --git a/CMakeLists.txt b/CMakeLists.txt index d9244dc0..0b5f5144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ include(GUDHI_user_version_target) # For "make doxygen" - Requires GUDHI_USER_VERSION_DIR to be set - Done in GUDHI_user_version_target for dev version include(GUDHI_doxygen_target) -configure_file(${CMAKE_SOURCE_DIR}/for_dev/for_maintainers/new_gudhi_version_creation.md "${CMAKE_CURRENT_BINARY_DIR}/" @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/.github/for_maintainers/new_gudhi_version_creation.md "${CMAKE_CURRENT_BINARY_DIR}/" @ONLY) message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") message("++ GUDHI_MISSING_MODULES list is:\"${GUDHI_MISSING_MODULES}\"") -- cgit v1.2.3 From 835a831007196a4d93e57659ab8d3cdb28a4ef92 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Tue, 25 Feb 2020 18:14:06 +0100 Subject: Revert "Global improvement of rendering with Python tools" This reverts commit 34e1ae726e27fdd7c41f6d80d8ed7f6504dc3a0d. --- src/python/gudhi/persistence_graphical_tools.py | 92 ++++--------------------- 1 file changed, 15 insertions(+), 77 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 4a690241..246280de 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -5,7 +5,6 @@ # Copyright (C) 2016 Inria # # Modification(s): -# - 2020/02 Theo Lacombe: Added more options for improved rendering and more flexibility. # - YYYY/MM Author: Description of the modification from os import path @@ -44,7 +43,6 @@ def __min_birth_max_death(persistence, band=0.0): max_death += band return (min_birth, max_death) - def plot_persistence_barcode( persistence=[], persistence_file="", @@ -54,9 +52,7 @@ def plot_persistence_barcode( inf_delta=0.1, legend=False, colormap=None, - axes=None, - fontsize=16, - title="Persistence barcode" + axes=None ): """This function plots the persistence bar code from persistence values list or from a :doc:`persistence file `. @@ -85,18 +81,11 @@ def plot_persistence_barcode( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` - :param fontsize: Fontsize to use in axis. - :type fontsize: int - :param title: title for the plot. - :type title: string :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches - from matplotlib import rc - plt.rc('text', usetex=True) - plt.rc('font', family='serif') if persistence_file != "": if path.isfile(persistence_file): @@ -174,7 +163,7 @@ def plot_persistence_barcode( loc="lower right", ) - axes.set_title(title) + axes.set_title("Persistence barcode") # Ends plot on infinity value and starts a little bit before min_birth axes.axis([axis_start, infinity, 0, ind]) @@ -194,11 +183,7 @@ def plot_persistence_diagram( inf_delta=0.1, legend=False, colormap=None, - axes=None, - aspect_equal=False, - fontsize=16, - title="Persistence diagram", - greyblock=True + axes=None ): """This function plots the persistence diagram from persistence values list or from a :doc:`persistence file `. @@ -229,23 +214,11 @@ def plot_persistence_diagram( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` - :param aspect_equal: if True, force plot to be square shaped. - :type aspect_equal: boolean - :param fontsize: Fontsize to use in axis. - :type fontsize: int - :param title: title for the plot. - :type title: string - :param greyblock: if we want to plot a grey patch on the lower half plane for nicer rendering. Default True. - :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches - from matplotlib import rc - plt.rc('text', usetex=True) - plt.rc('font', family='serif') - if persistence_file != "": if path.isfile(persistence_file): @@ -283,27 +256,18 @@ def plot_persistence_diagram( # Replace infinity values with max_death + delta for diagram to be more # readable infinity = max_death + delta - axis_end = max_death + delta / 2 axis_start = min_birth - delta # line display of equation : birth = death x = np.linspace(axis_start, infinity, 1000) # infinity line and text - axes.plot([axis_start, axis_end], [axis_start, axis_end], linewidth=1.0, color="k") - axes.plot([axis_start, axis_end], [infinity, infinity], linewidth=1.0, color="k", alpha=alpha) - # Infinity label - yt = axes.get_yticks() - yt = np.append(yt, infinity) - ytl = yt.tolist() - ytl[-1] = r'$+\infty$' - axes.set_yticks(yt) - axes.set_yticklabels(ytl) + axes.plot(x, x, color="k", linewidth=1.0) + axes.plot(x, [infinity] * len(x), linewidth=1.0, color="k", alpha=alpha) + axes.text(axis_start, infinity, r"$\infty$", color="k", alpha=alpha) # bootstrap band if band > 0.0: axes.fill_between(x, x, x + band, alpha=alpha, facecolor="red") - # lower diag patch - if greyblock: - axes.add_patch(mpatches.Polygon([[axis_start, axis_start], [axis_end, axis_start], [axis_end, axis_end]], fill=True, color='lightgrey')) + # Draw points in loop for interval in reversed(persistence): if float(interval[1][1]) != float("inf"): @@ -329,13 +293,11 @@ def plot_persistence_diagram( ] ) - axes.set_xlabel("Birth", fontsize=fontsize) - axes.set_ylabel("Death", fontsize=fontsize) + axes.set_xlabel("Birth") + axes.set_ylabel("Death") # Ends plot on infinity value and starts a little bit before min_birth - axes.axis([axis_start, axis_end, axis_start, infinity + delta]) - axes.set_title(title, fontsize=fontsize) # a different fontsize for the title? - if aspect_equal: - axes.set_aspect("equal") + axes.axis([axis_start, infinity, axis_start, infinity + delta]) + axes.set_title("Persistence diagram") return axes except ImportError: @@ -351,11 +313,7 @@ def plot_persistence_density( dimension=None, cmap=None, legend=False, - axes=None, - aspect_equal=False, - fontsize=16, - title="Persistence density", - greyblock=True + axes=None ): """This function plots the persistence density from persistence values list or from a :doc:`persistence file `. Be @@ -397,25 +355,11 @@ def plot_persistence_density( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` - :param aspect_equal: if True, force plot to be square shaped. - :type aspect_equal: boolean - :param fontsize: Fontsize to use in axis. - :type fontsize: int - :param title: title for the plot. - :type title: string - :param greyblock: if we want to plot a grey patch on the lower half plane - for nicer rendering. Default True. - :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt - import matplotlib.patches as mpatches from scipy.stats import kde - from matplotlib import rc - plt.rc('text', usetex=True) - plt.rc('font', family='serif') - if persistence_file != "": if dimension is None: @@ -474,18 +418,12 @@ def plot_persistence_density( # Make the plot img = axes.pcolormesh(xi, yi, zi.reshape(xi.shape), cmap=cmap) - if greyblock: - axes.add_patch(mpatches.Polygon([[birth.min(), birth.min()], [death.max(), birth.min()], [death.max(), death.max()]], fill=True, color='lightgrey')) - if legend: plt.colorbar(img, ax=axes) - axes.set_xlabel("Birth", fontsize=fontsize) - axes.set_ylabel("Death", fontsize=fontsize) - axes.set_title(title, fontsize=fontsize) - if aspect_equal: - axes.set_aspect("equal") - + axes.set_xlabel("Birth") + axes.set_ylabel("Death") + axes.set_title("Persistence density") return axes except ImportError: -- cgit v1.2.3 From cdcd2904a1c682625670a62608fd781bfd571516 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Tue, 25 Feb 2020 18:19:24 +0100 Subject: solved scale issue and removed title/aspect as functions return ax --- src/python/gudhi/persistence_graphical_tools.py | 77 +++++++++++++++++++------ 1 file changed, 60 insertions(+), 17 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 246280de..8ddfdba8 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -5,6 +5,7 @@ # Copyright (C) 2016 Inria # # Modification(s): +# - 2020/02 Theo Lacombe: Added more options for improved rendering and more flexibility. # - YYYY/MM Author: Description of the modification from os import path @@ -43,6 +44,7 @@ def __min_birth_max_death(persistence, band=0.0): max_death += band return (min_birth, max_death) + def plot_persistence_barcode( persistence=[], persistence_file="", @@ -52,7 +54,8 @@ def plot_persistence_barcode( inf_delta=0.1, legend=False, colormap=None, - axes=None + axes=None, + fontsize=16, ): """This function plots the persistence bar code from persistence values list or from a :doc:`persistence file `. @@ -81,11 +84,16 @@ def plot_persistence_barcode( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param fontsize: Fontsize to use in axis. + :type fontsize: int :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') if persistence_file != "": if path.isfile(persistence_file): @@ -163,7 +171,7 @@ def plot_persistence_barcode( loc="lower right", ) - axes.set_title("Persistence barcode") + axes.set_title("Persistence barcode", fontsize=fontsize) # Ends plot on infinity value and starts a little bit before min_birth axes.axis([axis_start, infinity, 0, ind]) @@ -183,7 +191,9 @@ def plot_persistence_diagram( inf_delta=0.1, legend=False, colormap=None, - axes=None + axes=None, + fontsize=16, + greyblock=True ): """This function plots the persistence diagram from persistence values list or from a :doc:`persistence file `. @@ -214,11 +224,19 @@ def plot_persistence_diagram( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param fontsize: Fontsize to use in axis. + :type fontsize: int + :param greyblock: if we want to plot a grey patch on the lower half plane for nicer rendering. Default True. + :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt import matplotlib.patches as mpatches + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') + if persistence_file != "": if path.isfile(persistence_file): @@ -256,18 +274,27 @@ def plot_persistence_diagram( # Replace infinity values with max_death + delta for diagram to be more # readable infinity = max_death + delta + axis_end = max_death + delta / 2 axis_start = min_birth - delta - # line display of equation : birth = death - x = np.linspace(axis_start, infinity, 1000) # infinity line and text - axes.plot(x, x, color="k", linewidth=1.0) - axes.plot(x, [infinity] * len(x), linewidth=1.0, color="k", alpha=alpha) - axes.text(axis_start, infinity, r"$\infty$", color="k", alpha=alpha) + axes.plot([axis_start, axis_end], [axis_start, axis_end], linewidth=1.0, color="k") + axes.plot([axis_start, axis_end], [infinity, infinity], linewidth=1.0, color="k", alpha=alpha) + # Infinity label + yt = axes.get_yticks() + yt = yt[np.where(yt < axis_end)] # to avoid ploting ticklabel higher than infinity + yt = np.append(yt, infinity) + ytl = ["%.3f" % e for e in yt] # to avoid float precision error + ytl[-1] = r'$+\infty$' + axes.set_yticks(yt) + axes.set_yticklabels(ytl) # bootstrap band if band > 0.0: + x = np.linspace(axis_start, infinity, 1000) axes.fill_between(x, x, x + band, alpha=alpha, facecolor="red") - + # lower diag patch + if greyblock: + axes.add_patch(mpatches.Polygon([[axis_start, axis_start], [axis_end, axis_start], [axis_end, axis_end]], fill=True, color='lightgrey')) # Draw points in loop for interval in reversed(persistence): if float(interval[1][1]) != float("inf"): @@ -293,11 +320,11 @@ def plot_persistence_diagram( ] ) - axes.set_xlabel("Birth") - axes.set_ylabel("Death") + axes.set_xlabel("Birth", fontsize=fontsize) + axes.set_ylabel("Death", fontsize=fontsize) + axes.set_title("Persistence diagram", fontsize=fontsize) # Ends plot on infinity value and starts a little bit before min_birth - axes.axis([axis_start, infinity, axis_start, infinity + delta]) - axes.set_title("Persistence diagram") + axes.axis([axis_start, axis_end, axis_start, infinity + delta/2]) return axes except ImportError: @@ -313,7 +340,9 @@ def plot_persistence_density( dimension=None, cmap=None, legend=False, - axes=None + axes=None, + fontsize=16, + greyblock=True ): """This function plots the persistence density from persistence values list or from a :doc:`persistence file `. Be @@ -355,11 +384,21 @@ def plot_persistence_density( :param axes: A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes. :type axes: `matplotlib.axes.Axes` + :param fontsize: Fontsize to use in axis. + :type fontsize: int + :param greyblock: if we want to plot a grey patch on the lower half plane + for nicer rendering. Default True. + :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ try: import matplotlib.pyplot as plt + import matplotlib.patches as mpatches from scipy.stats import kde + from matplotlib import rc + plt.rc('text', usetex=True) + plt.rc('font', family='serif') + if persistence_file != "": if dimension is None: @@ -418,12 +457,16 @@ def plot_persistence_density( # Make the plot img = axes.pcolormesh(xi, yi, zi.reshape(xi.shape), cmap=cmap) + if greyblock: + axes.add_patch(mpatches.Polygon([[birth.min(), birth.min()], [death.max(), birth.min()], [death.max(), death.max()]], fill=True, color='lightgrey')) + if legend: plt.colorbar(img, ax=axes) - axes.set_xlabel("Birth") - axes.set_ylabel("Death") - axes.set_title("Persistence density") + axes.set_xlabel("Birth", fontsize=fontsize) + axes.set_ylabel("Death", fontsize=fontsize) + axes.set_title("Persistence density", fontsize=fontsize) + return axes except ImportError: -- cgit v1.2.3 From 3ecf0caf4efbea0fabf4af0df490900374abda8b Mon Sep 17 00:00:00 2001 From: tlacombe Date: Tue, 25 Feb 2020 18:20:30 +0100 Subject: say in doc that functions return ax --- src/python/doc/persistence_graphical_tools_sum.inc | 6 +++--- src/python/doc/persistence_graphical_tools_user.rst | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/python/doc/persistence_graphical_tools_sum.inc b/src/python/doc/persistence_graphical_tools_sum.inc index 0cdf8072..2ddaccfc 100644 --- a/src/python/doc/persistence_graphical_tools_sum.inc +++ b/src/python/doc/persistence_graphical_tools_sum.inc @@ -3,10 +3,10 @@ +-----------------------------------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------+ | .. figure:: | These graphical tools comes on top of persistence results and allows | :Author: Vincent Rouvreau | - | img/graphical_tools_representation.png | the user to build easily persistence barcode, diagram or density. | | + | img/graphical_tools_representation.png | the user to display easily persistence barcode, diagram or density. | | | | | :Introduced in: GUDHI 2.0.0 | - | | | | - | | | :Copyright: MIT | + | | Note that these functions return the matplotlib axis, allowing | | + | | for further modifications (title, aspect, etc.) | :Copyright: MIT | | | | | | | | :Requires: matplotlib, numpy and scipy | +-----------------------------------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------+ diff --git a/src/python/doc/persistence_graphical_tools_user.rst b/src/python/doc/persistence_graphical_tools_user.rst index 80002db6..ff51604e 100644 --- a/src/python/doc/persistence_graphical_tools_user.rst +++ b/src/python/doc/persistence_graphical_tools_user.rst @@ -20,7 +20,7 @@ This function can display the persistence result as a barcode: .. plot:: :include-source: - import matplotlib.pyplot as plot + import matplotlib.pyplot as plt import gudhi off_file = gudhi.__root_source_dir__ + '/data/points/tore3D_300.off' @@ -31,7 +31,7 @@ This function can display the persistence result as a barcode: diag = simplex_tree.persistence(min_persistence=0.4) gudhi.plot_persistence_barcode(diag) - plot.show() + plt.show() Show persistence as a diagram ----------------------------- @@ -44,15 +44,19 @@ This function can display the persistence result as a diagram: .. plot:: :include-source: - import matplotlib.pyplot as plot + import matplotlib.pyplot as plt import gudhi # rips_on_tore3D_1307.pers obtained from write_persistence_diagram method persistence_file=gudhi.__root_source_dir__ + \ '/data/persistence_diagram/rips_on_tore3D_1307.pers' - gudhi.plot_persistence_diagram(persistence_file=persistence_file, + ax = gudhi.plot_persistence_diagram(persistence_file=persistence_file, legend=True) - plot.show() + # We can modify the title, aspect, etc. + ax.set_title("Persistence diagram of a torus") + ax.set_aspect("equal") # forces to be square shaped + plt.show() + Persistence density ------------------- @@ -65,7 +69,7 @@ If you want more information on a specific dimension, for instance: .. plot:: :include-source: - import matplotlib.pyplot as plot + import matplotlib.pyplot as plt import gudhi # rips_on_tore3D_1307.pers obtained from write_persistence_diagram method persistence_file=gudhi.__root_source_dir__ + \ @@ -75,9 +79,9 @@ If you want more information on a specific dimension, for instance: only_this_dim=1) pers_diag = [(1, elt) for elt in birth_death] # Use subplots to display diagram and density side by side - fig, axes = plot.subplots(nrows=1, ncols=2, figsize=(12, 5)) + fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) gudhi.plot_persistence_diagram(persistence=pers_diag, axes=axes[0]) gudhi.plot_persistence_density(persistence=pers_diag, dimension=1, legend=True, axes=axes[1]) - plot.show() + plt.show() -- cgit v1.2.3 From b2c1cf839080efa43835d7b0fdcd6a38f6808255 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 26 Feb 2020 10:20:00 +0100 Subject: Fix #229 incomplete citation in nerve_GIC python documentation --- src/python/gudhi/nerve_gic.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/gudhi/nerve_gic.pyx b/src/python/gudhi/nerve_gic.pyx index 382e71c5..45cc8eba 100644 --- a/src/python/gudhi/nerve_gic.pyx +++ b/src/python/gudhi/nerve_gic.pyx @@ -187,7 +187,7 @@ cdef class CoverComplex: def set_automatic_resolution(self): """Computes the optimal length of intervals (i.e. the smallest interval - length avoiding discretization artifacts—see :cite:`Carriere17c`) for a + length avoiding discretization artifacts - see :cite:`Carriere17c`) for a functional cover. :rtype: double @@ -288,7 +288,7 @@ cdef class CoverComplex: def set_graph_from_automatic_rips(self, N=100): """Creates a graph G from a Rips complex whose threshold value is - automatically tuned with subsampling—see. + automatically tuned with subsampling - see :cite:`Carriere17c`. :param N: Number of subsampling iteration (the default reasonable value is 100, but there is no guarantee on how to choose it). -- cgit v1.2.3 From f8c251b1c1b7a1c8c36e77f56cda1fd41245adb7 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Mon, 2 Mar 2020 13:44:38 +0100 Subject: [skip ci] update next release with hera integration --- .github/next_release.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/next_release.md b/.github/next_release.md index a2805a55..3166b0a8 100644 --- a/.github/next_release.md +++ b/.github/next_release.md @@ -1,19 +1,20 @@ We are pleased to announce the release 3.X.X of the GUDHI library. -As a major new feature, the GUDHI library now offers ... +As a major new feature, the GUDHI library now offers a Python interface to [Hera](https://bitbucket.org/grey_narn/hera/src/master/) to compute the Wasserstein distance. +[PyBind11](https://github.com/pybind/pybind11) is now required to build the Python module. We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). -Below is a list of changes made since GUDHI 3.X-1.X-1: +Below is a list of changes made since GUDHI 3.1.1: -- [Module](link) - - ... +- [Wassertein distance](https://gudhi.inria.fr/python/latest/wasserstein_distance_user.html) + - An another implementation comes from Hera (BSD-3-Clause) which is based on [Geometry Helps to Compare Persistence Diagrams](http://doi.acm.org/10.1145/3064175) by Michael Kerber, Dmitriy Morozov, and Arnur Nigmetov. - [Module](link) - ... - Miscellaneous - - The [list of bugs that were solved since GUDHI-3.X-1.X-1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.1.1+is%3Aclosed) is available on GitHub. + - The [list of bugs that were solved since GUDHI-3.1.1](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.2.0+is%3Aclosed) is available on GitHub. All modules are distributed under the terms of the MIT license. However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. -- cgit v1.2.3 From d2943b9e7311c8a3d8a4fb379c39b15497481b9c Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Mon, 2 Mar 2020 13:50:35 +0100 Subject: [skip ci] add a note on next_release.md file --- .github/how_to_use_github_to_contribute_to_gudhi.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/how_to_use_github_to_contribute_to_gudhi.md b/.github/how_to_use_github_to_contribute_to_gudhi.md index 0a6133b7..6ab05e36 100644 --- a/.github/how_to_use_github_to_contribute_to_gudhi.md +++ b/.github/how_to_use_github_to_contribute_to_gudhi.md @@ -90,6 +90,8 @@ Because of `-u`, it will remember where you like to push this branch, and next t Possibly iterate a few times, add more commits and push them. ## Your pull request is ready +Do not forget to update `.github/next_release.md` to announce your development in the next release note. + Get your web browser to https://github.com/LOGIN/gudhi-devel, click on the button that says **Branch: some-name** (below the number of commits, above the list of files) and select the branch you are so proud of. Click on **New pull request** next to it. -- cgit v1.2.3 From efae8ff48c6b6e4d29afea753b7a1ddee0925ad4 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Tue, 3 Mar 2020 16:44:58 +0100 Subject: handle numpy array, should now adapt the doc --- src/python/gudhi/persistence_graphical_tools.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 8ddfdba8..43776fc6 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -45,6 +45,13 @@ def __min_birth_max_death(persistence, band=0.0): return (min_birth, max_death) +def _array_handler(a): + if isinstance(a, np.ndarray): + return [[0, x] for x in a] + else: + return a + + def plot_persistence_barcode( persistence=[], persistence_file="", @@ -95,6 +102,9 @@ def plot_persistence_barcode( plt.rc('text', usetex=True) plt.rc('font', family='serif') + + persistence = _array_handler(persistence) + if persistence_file != "": if path.isfile(persistence_file): # Reset persistence @@ -237,6 +247,7 @@ def plot_persistence_diagram( plt.rc('text', usetex=True) plt.rc('font', family='serif') + persistence = _array_handler(persistence) if persistence_file != "": if path.isfile(persistence_file): @@ -399,6 +410,7 @@ def plot_persistence_density( plt.rc('text', usetex=True) plt.rc('font', family='serif') + persistence = _array_handler(persistence) if persistence_file != "": if dimension is None: -- cgit v1.2.3 From 4f4030e9f9e0215c2d1f2431c02cd9270bba2699 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Tue, 3 Mar 2020 16:57:56 +0100 Subject: updated doc and example handling Nx2 numpy arrays --- src/python/doc/persistence_graphical_tools_sum.inc | 2 +- .../doc/persistence_graphical_tools_user.rst | 12 +++++++++++ src/python/gudhi/persistence_graphical_tools.py | 25 ++++++++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/python/doc/persistence_graphical_tools_sum.inc b/src/python/doc/persistence_graphical_tools_sum.inc index 2ddaccfc..ef376802 100644 --- a/src/python/doc/persistence_graphical_tools_sum.inc +++ b/src/python/doc/persistence_graphical_tools_sum.inc @@ -2,7 +2,7 @@ :widths: 30 50 20 +-----------------------------------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------+ - | .. figure:: | These graphical tools comes on top of persistence results and allows | :Author: Vincent Rouvreau | + | .. figure:: | These graphical tools comes on top of persistence results and allows | :Author: Vincent Rouvreau, Theo Lacombe | | img/graphical_tools_representation.png | the user to display easily persistence barcode, diagram or density. | | | | | :Introduced in: GUDHI 2.0.0 | | | Note that these functions return the matplotlib axis, allowing | | diff --git a/src/python/doc/persistence_graphical_tools_user.rst b/src/python/doc/persistence_graphical_tools_user.rst index ff51604e..91e52703 100644 --- a/src/python/doc/persistence_graphical_tools_user.rst +++ b/src/python/doc/persistence_graphical_tools_user.rst @@ -57,6 +57,18 @@ This function can display the persistence result as a diagram: ax.set_aspect("equal") # forces to be square shaped plt.show() +Note that (as barcode and density) it can also take a simple `np.array` +of shape (N x 2) encoding a persistence diagram (in a given dimension). + +.. plot:: + :include-source: + + import matplotlib.pyplot as plt + import gudhi + import numpy as np + d = np.array([[0, 1], [1, 2], [1, np.inf]]) + gudhi.plot_persistence_diagram(d) + plt.show() Persistence density ------------------- diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 43776fc6..48e26432 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -15,7 +15,7 @@ import numpy as np from gudhi.reader_utils import read_persistence_intervals_in_dimension from gudhi.reader_utils import read_persistence_intervals_grouped_by_dimension -__author__ = "Vincent Rouvreau, Bertrand Michel" +__author__ = "Vincent Rouvreau, Bertrand Michel, Theo Lacombe" __copyright__ = "Copyright (C) 2016 Inria" __license__ = "MIT" @@ -46,6 +46,11 @@ def __min_birth_max_death(persistence, band=0.0): def _array_handler(a): + ''' + :param a: if array, assumes it is a (n x 2) np.array and return a + persistence-compatible list (padding with 0), so that the + plot can be performed seamlessly. + ''' if isinstance(a, np.ndarray): return [[0, x] for x in a] else: @@ -65,9 +70,12 @@ def plot_persistence_barcode( fontsize=16, ): """This function plots the persistence bar code from persistence values list + , a np.array of shape (N x 2) (representing a diagram + in a single homology dimension), or from a :doc:`persistence file `. - :param persistence: Persistence intervals values list grouped by dimension. + :param persistence: Persistence intervals values list grouped by dimension, + or np.array of shape (N x 2). :type persistence: list of tuples(dimension, tuple(birth, death)). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). @@ -206,9 +214,11 @@ def plot_persistence_diagram( greyblock=True ): """This function plots the persistence diagram from persistence values - list or from a :doc:`persistence file `. + list, a np.array of shape (N x 2) representing a diagram in a single + homology dimension, or from a :doc:`persistence file `. - :param persistence: Persistence intervals values list grouped by dimension. + :param persistence: Persistence intervals values list grouped by dimension, + or np.array of shape (N x 2). :type persistence: list of tuples(dimension, tuple(birth, death)). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). @@ -356,12 +366,15 @@ def plot_persistence_density( greyblock=True ): """This function plots the persistence density from persistence - values list or from a :doc:`persistence file `. Be + values list, np.array of shape (N x 2) representing a diagram + in a single homology dimension, + or from a :doc:`persistence file `. Be aware that this function does not distinguish the dimension, it is up to you to select the required one. This function also does not handle degenerate data set (scipy correlation matrix inversion can fail). - :param persistence: Persistence intervals values list grouped by dimension. + :param persistence: Persistence intervals values list grouped by dimension, + or np.array of shape (N x 2). :type persistence: list of tuples(dimension, tuple(birth, death)). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). -- cgit v1.2.3 From e1dbf6da118615e20d2b642df98b7d3df7cfd8c7 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 5 Mar 2020 10:16:51 +0100 Subject: Remove travis and use appveyor for OSx. Fix parallel test by setting tests dependencies --- .github/build-requirements.txt | 5 ++ .github/test-requirements.txt | 8 +++ .travis.yml | 78 ---------------------- Dockerfile_for_circleci_image | 22 ++---- azure-pipelines.yml | 44 ++++++++++++ src/Alpha_complex/example/CMakeLists.txt | 6 +- src/Alpha_complex/utilities/CMakeLists.txt | 12 +++- .../utilities/CMakeLists.txt | 10 ++- .../utilities/persistence_heat_maps/CMakeLists.txt | 19 ++++-- .../utilities/persistence_intervals/CMakeLists.txt | 7 +- .../persistence_landscapes/CMakeLists.txt | 8 +-- .../persistence_landscapes_on_grid/CMakeLists.txt | 8 +-- .../utilities/persistence_vectors/CMakeLists.txt | 8 +-- src/Rips_complex/example/CMakeLists.txt | 8 +++ src/common/example/CMakeLists.txt | 1 + src/python/CMakeLists.txt | 2 +- 16 files changed, 128 insertions(+), 118 deletions(-) create mode 100644 .github/build-requirements.txt create mode 100644 .github/test-requirements.txt delete mode 100644 .travis.yml create mode 100644 azure-pipelines.yml diff --git a/.github/build-requirements.txt b/.github/build-requirements.txt new file mode 100644 index 00000000..7de60d23 --- /dev/null +++ b/.github/build-requirements.txt @@ -0,0 +1,5 @@ +setuptools +wheel +numpy +Cython +pybind11 \ No newline at end of file diff --git a/.github/test-requirements.txt b/.github/test-requirements.txt new file mode 100644 index 00000000..bd03f98e --- /dev/null +++ b/.github/test-requirements.txt @@ -0,0 +1,8 @@ +pytest +sphinx +sphinxcontrib-bibtex +sphinx-paramlinks +matplotlib +scipy +scikit-learn +POT \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8980be10..00000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -language: cpp - -sudo: required - -git: - depth: 3 - -os: osx -osx_image: xcode10.2 -compiler: clang - -matrix: - include: - - env: - # 1. Only examples and associated tests - - CMAKE_EXAMPLE='ON' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 2. Only unitary tests - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='ON' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 3. Only utilities and associated tests - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='ON' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 4. Only doxygen documentation - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='doxygen' CTEST_COMMAND='echo No tests for doxygen target' - - env: - # 5. Only Python, associated tests and sphinx documentation - # $ which python3 => /usr/local/bin/python3 - # cmake => -- Found PythonInterp: /usr/local/bin/python3 (found version "3.7.5") - # In python3-sphinx-build.py, print(sys.executable) => /usr/local/opt/python/bin/python3.7 ??? - # should be : MAKE_TARGET='all sphinx' CTEST_COMMAND='ctest --output-on-failure' - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='ON' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure -E sphinx' - -cache: - directories: - - $HOME/.cache/pip - - $HOME/Library/Caches/Homebrew - -before_install: - - brew update && brew unlink python@2 && brew upgrade python - -addons: - homebrew: - packages: - - python3 - - cmake - - graphviz - - doxygen - - boost - - eigen - - gmp - - mpfr - - tbb - - cgal - -before_cache: - - rm -f $HOME/.cache/pip/log/debug.log - - brew cleanup - -# When installing through libcgal-dev apt, CMake Error at CGAL Exports.cmake The imported target "CGAL::CGAL Qt5" references the file -install: - - python3 -m pip install --upgrade pip setuptools wheel - - python3 -m pip install --user pytest Cython sphinx sphinxcontrib-bibtex sphinx-paramlinks matplotlib numpy scipy scikit-learn - - python3 -m pip install --user POT pybind11 - -script: - - rm -rf build - - mkdir -p build - - cd build - - cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUDHI_EXAMPLE=${CMAKE_EXAMPLE} -DWITH_GUDHI_TEST=${CMAKE_TEST} -DWITH_GUDHI_UTILITIES=${CMAKE_UTILITIES} -DWITH_GUDHI_PYTHON=${CMAKE_PYTHON} -DUSER_VERSION_DIR=version -DPython_ADDITIONAL_VERSIONS=3 .. - - make ${MAKE_TARGET} - - ${CTEST_COMMAND} - - cd .. - -notifications: - email: - on_success: change # default: always - on_failure: always # default: always diff --git a/Dockerfile_for_circleci_image b/Dockerfile_for_circleci_image index ebd2f366..cca93f0c 100644 --- a/Dockerfile_for_circleci_image +++ b/Dockerfile_for_circleci_image @@ -42,24 +42,16 @@ RUN apt-get install -y make \ locales \ python3 \ python3-pip \ - python3-pytest \ python3-tk \ - python3-pybind11 \ libfreetype6-dev \ - pkg-config + pkg-config \ + curl -RUN pip3 install \ - setuptools \ - numpy \ - matplotlib \ - scipy \ - Cython \ - POT \ - scikit-learn \ - sphinx \ - sphinx-paramlinks \ - sphinxcontrib-bibtex \ - tensorflow +ADD .github/build-requirements.txt / +ADD .github/test-requirements.txt / + +RUN pip3 install -r build-requirements.txt +RUN pip3 install -r test-requirements.txt # apt clean up RUN apt autoremove && rm -rf /var/lib/apt/lists/* diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..77e0ac88 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,44 @@ +trigger: + batch: true + branches: + include: + - '*' # All branches + +jobs: + + - job: 'Test' + displayName: "Build and test" + timeoutInMinutes: 0 + cancelTimeoutInMinutes: 60 + + strategy: + matrix: + macOSrelease: + imageName: 'macos-10.14' + CMakeBuildType: Release + customInstallation: 'brew update && brew install graphviz doxygen boost eigen gmp mpfr tbb cgal' + + pool: + vmImage: $(imageName) + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + $(customInstallation) + git submodule update --init + python -m pip install --upgrade pip + python -m pip install --user -r .github/build-requirements.txt + python -m pip install --user -r .github/test-requirements.txt + displayName: 'Install build dependencies' + - script: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE:STRING=$(CMakeBuildType) -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON -DPython_ADDITIONAL_VERSIONS=3 .. + make + make doxygen + ctest -j 8 --output-on-failure -E sphinx # remove sphinx build as it fails + displayName: 'Build, test and documentation generation' diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index b0337934..2eecd50c 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -32,14 +32,18 @@ if (DIFF_PATH) add_test(Alpha_complex_example_from_off_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) + set_tests_properties(Alpha_complex_example_from_off_60_diff_files PROPERTIES DEPENDS Alpha_complex_example_from_off_60) add_test(Alpha_complex_example_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) + set_tests_properties(Alpha_complex_example_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_from_off_32) add_test(Alpha_complex_example_fast_from_off_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) + set_tests_properties(Alpha_complex_example_fast_from_off_60_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_60) add_test(Alpha_complex_example_fast_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) - endif() + set_tests_properties(Alpha_complex_example_fast_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_32) +endif() add_executable ( Alpha_complex_example_weighted_3d_from_points Weighted_alpha_complex_3d_from_points.cpp ) target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${CGAL_LIBRARY}) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index a3b0cc24..2ffbdde0 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -16,8 +16,14 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) if (DIFF_PATH) add_test(Alpha_complex_utilities_diff_exact_alpha_complex ${DIFF_PATH} "exact.pers" "safe.pers") + set_tests_properties(Alpha_complex_utilities_diff_exact_alpha_complex PROPERTIES DEPENDS + "Alpha_complex_utilities_exact_alpha_complex_persistence;Alpha_complex_utilities_safe_alpha_complex_persistence") + add_test(Alpha_complex_utilities_diff_fast_alpha_complex ${DIFF_PATH} "fast.pers" "safe.pers") + set_tests_properties(Alpha_complex_utilities_diff_fast_alpha_complex PROPERTIES DEPENDS + "Alpha_complex_utilities_fast_alpha_complex_persistence;Alpha_complex_utilities_safe_alpha_complex_persistence") + endif() install(TARGETS alpha_complex_persistence DESTINATION bin) @@ -36,15 +42,19 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-p" "2" "-m" "0.45" "-o" "exact_3d.pers" "-e") - add_test(NAME Alpha_complex_utilities_safe_alpha_complex_3d COMMAND $ + add_test(NAME Alpha_complex_utilities_fast_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-p" "2" "-m" "0.45" "-o" "fast_3d.pers" "-f") if (DIFF_PATH) add_test(Alpha_complex_utilities_diff_exact_alpha_complex_3d ${DIFF_PATH} "exact_3d.pers" "safe_3d.pers") + set_tests_properties(Alpha_complex_utilities_diff_exact_alpha_complex_3d PROPERTIES DEPENDS + "Alpha_complex_utilities_exact_alpha_complex_3d;Alpha_complex_utilities_alpha_complex_3d") add_test(Alpha_complex_utilities_diff_fast_alpha_complex_3d ${DIFF_PATH} "fast_3d.pers" "safe_3d.pers") + set_tests_properties(Alpha_complex_utilities_diff_fast_alpha_complex_3d PROPERTIES DEPENDS + "Alpha_complex_utilities_fast_alpha_complex_3d;Alpha_complex_utilities_alpha_complex_3d") endif() add_test(NAME Alpha_complex_utilities_periodic_alpha_complex_3d_persistence COMMAND $ diff --git a/src/Persistence_representations/utilities/CMakeLists.txt b/src/Persistence_representations/utilities/CMakeLists.txt index fc51b1d6..85633b7b 100644 --- a/src/Persistence_representations/utilities/CMakeLists.txt +++ b/src/Persistence_representations/utilities/CMakeLists.txt @@ -14,7 +14,7 @@ function(add_persistence_representation_creation_utility creation_utility) install(TARGETS ${creation_utility} DESTINATION bin) endfunction(add_persistence_representation_creation_utility) -function(add_persistence_representation_plot_utility plot_utility tool_extension) +function(add_persistence_representation_plot_utility creation_utility plot_utility tool_extension) add_executable ( ${plot_utility} ${plot_utility}.cpp ) # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files @@ -22,17 +22,21 @@ function(add_persistence_representation_plot_utility plot_utility tool_extension "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}") #add_test(NAME Persistence_representation_utilities_${plot_utility}_second COMMAND $ # "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") + set_tests_properties(Persistence_representation_utilities_${plot_utility}_first PROPERTIES DEPENDS + Persistence_representation_utilities_${creation_utility}) if(GNUPLOT_PATH) add_test(NAME Persistence_representation_utilities_${plot_utility}_first_gnuplot COMMAND ${GNUPLOT_PATH} "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}_GnuplotScript'") #add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH} # "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'") + set_tests_properties(Persistence_representation_utilities_${plot_utility}_first_gnuplot PROPERTIES DEPENDS + Persistence_representation_utilities_${plot_utility}_first) endif() install(TARGETS ${plot_utility} DESTINATION bin) endfunction(add_persistence_representation_plot_utility) -function(add_persistence_representation_function_utility function_utility tool_extension) +function(add_persistence_representation_function_utility creation_utility function_utility tool_extension) add_executable ( ${function_utility} ${function_utility}.cpp ) # ARGV2 is an optional argument @@ -48,6 +52,8 @@ function(add_persistence_representation_function_utility function_utility tool_e "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}" "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") endif() + set_tests_properties(Persistence_representation_utilities_${function_utility} PROPERTIES DEPENDS + Persistence_representation_utilities_${creation_utility}) install(TARGETS ${function_utility} DESTINATION bin) endfunction(add_persistence_representation_function_utility) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index 89ef232f..e4c471c2 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -2,13 +2,24 @@ project(Persistence_representations_heat_maps_utilities) add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1") add_persistence_representation_creation_utility(create_p_h_m_weighted_by_arctan_of_their_persistence "10" "-1" "-1" "4" "-1") + add_persistence_representation_creation_utility(create_p_h_m_weighted_by_distance_from_diagonal "10" "-1" "-1" "4" "-1") +# Tests output the same file +set_tests_properties(Persistence_representation_utilities_create_p_h_m_weighted_by_distance_from_diagonal PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_arctan_of_their_persistence) + add_persistence_representation_creation_utility(create_p_h_m_weighted_by_squared_diag_distance "10" "-1" "-1" "4" "-1") +# Tests output the same file +set_tests_properties(Persistence_representation_utilities_create_p_h_m_weighted_by_squared_diag_distance PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_distance_from_diagonal) + # Need to set grid min and max for further average, distance and scalar_product add_persistence_representation_creation_utility(create_persistence_heat_maps "10" "0" "35" "10" "-1") +set_tests_properties(Persistence_representation_utilities_create_persistence_heat_maps PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_squared_diag_distance) -add_persistence_representation_plot_utility(plot_persistence_heat_map ".mps") +add_persistence_representation_plot_utility(create_persistence_heat_maps plot_persistence_heat_map ".mps") -add_persistence_representation_function_utility(average_persistence_heat_maps ".mps") -add_persistence_representation_function_utility(compute_distance_of_persistence_heat_maps ".mps" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_persistence_heat_maps ".mps") +add_persistence_representation_function_utility(create_persistence_heat_maps average_persistence_heat_maps ".mps") +add_persistence_representation_function_utility(create_persistence_heat_maps compute_distance_of_persistence_heat_maps ".mps" "1") +add_persistence_representation_function_utility(create_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps ".mps") diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index a025183e..118c1e9b 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -3,17 +3,16 @@ project(Persistence_representations_intervals_utilities) add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp ) -add_test(NAME plot_histogram_of_intervals_lengths COMMAND $ +add_test(NAME Persistence_representation_utilities_plot_histogram_of_intervals_lengths COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "-1") install(TARGETS plot_histogram_of_intervals_lengths DESTINATION bin) -add_persistence_representation_plot_utility(plot_persistence_intervals "") -add_persistence_representation_plot_utility(plot_persistence_Betti_numbers "") +add_persistence_representation_plot_utility(plot_histogram_of_intervals_lengths plot_persistence_intervals "") +add_persistence_representation_plot_utility(plot_histogram_of_intervals_lengths plot_persistence_Betti_numbers "") add_persistence_representation_creation_utility(compute_birth_death_range_in_persistence_diagram "-1") - add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp ) add_test(NAME Persistence_representation_utilities_compute_number_of_dominant_intervals COMMAND $ diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt index 6b24d032..4df84d36 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt @@ -2,8 +2,8 @@ project(Persistence_representations_landscapes_utilities) add_persistence_representation_creation_utility(create_landscapes "-1") -add_persistence_representation_plot_utility(plot_landscapes ".land") +add_persistence_representation_plot_utility(create_landscapes plot_landscapes ".land") -add_persistence_representation_function_utility(average_landscapes ".land") -add_persistence_representation_function_utility(compute_distance_of_landscapes ".land" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_landscapes ".land") +add_persistence_representation_function_utility(create_landscapes average_landscapes ".land") +add_persistence_representation_function_utility(create_landscapes compute_distance_of_landscapes ".land" "1") +add_persistence_representation_function_utility(create_landscapes compute_scalar_product_of_landscapes ".land") diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt index 36f3196b..8cd965f1 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -3,8 +3,8 @@ project(Persistence_representations_lanscapes_on_grid_utilities) # Need to set grid min and max for further average, distance and scalar_product add_persistence_representation_creation_utility(create_landscapes_on_grid "100" "0" "35" "-1") -add_persistence_representation_plot_utility(plot_landscapes_on_grid ".g_land") +add_persistence_representation_plot_utility(create_landscapes_on_grid plot_landscapes_on_grid ".g_land") -add_persistence_representation_function_utility(average_landscapes_on_grid ".g_land") -add_persistence_representation_function_utility(compute_distance_of_landscapes_on_grid ".g_land" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_landscapes_on_grid ".g_land") +add_persistence_representation_function_utility(create_landscapes_on_grid average_landscapes_on_grid ".g_land") +add_persistence_representation_function_utility(create_landscapes_on_grid compute_distance_of_landscapes_on_grid ".g_land" "1") +add_persistence_representation_function_utility(create_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid ".g_land") diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt index bc982094..5b22ca84 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -2,8 +2,8 @@ project(Persistence_vectors_utilities) add_persistence_representation_creation_utility(create_persistence_vectors "-1") -add_persistence_representation_plot_utility(plot_persistence_vectors ".vect") +add_persistence_representation_plot_utility(create_persistence_vectors plot_persistence_vectors ".vect") -add_persistence_representation_function_utility(average_persistence_vectors ".vect") -add_persistence_representation_function_utility(compute_distance_of_persistence_vectors ".vect" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_persistence_vectors ".vect") +add_persistence_representation_function_utility(create_persistence_vectors average_persistence_vectors ".vect") +add_persistence_representation_function_utility(create_persistence_vectors compute_distance_of_persistence_vectors ".vect" "1") +add_persistence_representation_function_utility(create_persistence_vectors compute_scalar_product_of_persistence_vectors ".vect") diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt index e7772bdb..244a93ec 100644 --- a/src/Rips_complex/example/CMakeLists.txt +++ b/src/Rips_complex/example/CMakeLists.txt @@ -53,15 +53,23 @@ if (DIFF_PATH) add_test(Rips_complex_example_from_off_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_off_doc_12_1_diff_files PROPERTIES DEPENDS Rips_complex_example_from_off_doc_12_1) + add_test(Rips_complex_example_from_off_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_off_doc_12_3_diff_files PROPERTIES DEPENDS Rips_complex_example_from_off_doc_12_3) + add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_csv_distance_matrix_doc_12_1_diff_files PROPERTIES DEPENDS Rips_complex_example_from_csv_distance_matrix_doc_12_1) + add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_csv_distance_matrix_doc_12_3_diff_files PROPERTIES DEPENDS Rips_complex_example_from_csv_distance_matrix_doc_12_3) + endif() install(TARGETS Rips_complex_example_from_off DESTINATION bin) diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index 583a0027..fa8eb98c 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -12,6 +12,7 @@ if (DIFF_PATH) add_test(Common_example_vector_double_off_reader_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/vectordoubleoffreader_result.txt ${CMAKE_CURRENT_BINARY_DIR}/alphacomplexdoc.off.txt) + set_tests_properties(Common_example_vector_double_off_reader_diff_files PROPERTIES DEPENDS Common_example_vector_double_off_reader) endif() if(NOT CGAL_VERSION VERSION_LESS 4.11.0) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 090a7446..20e72a5f 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -181,7 +181,7 @@ if(PYTHONINTERP_FOUND) set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${MPFR_LIBRARIES_DIR}', ") message("** Add mpfr ${MPFR_LIBRARIES}") endif(MPFR_FOUND) -endif(CGAL_FOUND) + endif(CGAL_FOUND) # Specific for Mac if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -- cgit v1.2.3 From a9d2eae3139d291a3d66e71174b22a851bd797ba Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 5 Mar 2020 10:36:19 +0100 Subject: remove ext (submodule directory) from doxygen parsing --- src/Doxyfile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Doxyfile.in b/src/Doxyfile.in index ec551882..49e781bd 100644 --- a/src/Doxyfile.in +++ b/src/Doxyfile.in @@ -785,6 +785,7 @@ EXCLUDE = data/ \ GudhUI/ \ cmake/ \ python/ \ + ext/ \ README.md # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -- cgit v1.2.3 From 05985743182a5e7d462a6a8b872b92c9b8a90404 Mon Sep 17 00:00:00 2001 From: Théo Lacombe Date: Thu, 5 Mar 2020 11:31:47 +0100 Subject: Update src/python/gudhi/persistence_graphical_tools.py Co-Authored-By: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> --- src/python/gudhi/persistence_graphical_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 48e26432..c9af88f5 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -51,7 +51,7 @@ def _array_handler(a): persistence-compatible list (padding with 0), so that the plot can be performed seamlessly. ''' - if isinstance(a, np.ndarray): + if isinstance(a[0][1], np.float64) or isinstance(a[0][1], float): return [[0, x] for x in a] else: return a -- cgit v1.2.3 From c1ce28b8e8021097825a893564aed97757f2ac8e Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Thu, 5 Mar 2020 14:27:43 +0100 Subject: Fix bad link --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 13d6cad7..a18ff8bd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,7 +19,7 @@ There is a label **enhancement** in the [new issue](https://github.com/GUDHI/gud ## You are not familiar with GitHub ? -Please take some time to read our [how to use GitHub to contribute to GUDHI](/home/vincent/workspace/gudhi/gudhi-devel/for_dev/how_to_use_github_to_contribute_to_gudhi.md). +Please take some time to read our [how to use GitHub to contribute to GUDHI](how_to_use_github_to_contribute_to_gudhi.md). ## Something you want to improve in the documentation -- cgit v1.2.3 From eccfa153efe660662be945134115f7634c27335d Mon Sep 17 00:00:00 2001 From: tlacombe Date: Thu, 5 Mar 2020 15:32:09 +0100 Subject: updated doc --- src/python/gudhi/persistence_graphical_tools.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index c9af88f5..6fd854ff 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -74,9 +74,8 @@ def plot_persistence_barcode( in a single homology dimension), or from a :doc:`persistence file `. - :param persistence: Persistence intervals values list grouped by dimension, - or np.array of shape (N x 2). - :type persistence: list of tuples(dimension, tuple(birth, death)). + :param persistence: Persistence intervals values list. Can be grouped by dimension or not. + :type persistence: an array of (dimension, array of (birth, death)) or an array of (birth, death). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). :type persistence_file: string @@ -217,9 +216,8 @@ def plot_persistence_diagram( list, a np.array of shape (N x 2) representing a diagram in a single homology dimension, or from a :doc:`persistence file `. - :param persistence: Persistence intervals values list grouped by dimension, - or np.array of shape (N x 2). - :type persistence: list of tuples(dimension, tuple(birth, death)). + :param persistence: Persistence intervals values list. Can be grouped by dimension or not. + :type persistence: an array of (dimension, array of (birth, death)) or an array of (birth, death). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). :type persistence_file: string @@ -373,9 +371,10 @@ def plot_persistence_density( up to you to select the required one. This function also does not handle degenerate data set (scipy correlation matrix inversion can fail). - :param persistence: Persistence intervals values list grouped by dimension, - or np.array of shape (N x 2). - :type persistence: list of tuples(dimension, tuple(birth, death)). + :param persistence: Persistence intervals values list. + Can be grouped by dimension or not. + :type persistence: an array of (dimension, array of (birth, death)) + or an array of (birth, death). :param persistence_file: A :doc:`persistence file ` style name (reset persistence if both are set). :type persistence_file: string -- cgit v1.2.3 From 27d5a1dfdaeb2bc1840e9c39be4c58570d948d56 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:27:30 +0100 Subject: [skip ci] Replace travis badge with azure one --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7e3d70c..279953e1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -[![Build Status](https://travis-ci.org/GUDHI/gudhi-devel.svg?branch=master)](https://travis-ci.org/GUDHI/gudhi-devel) -[![CircleCI](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master.svg?style=svg)](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master) -[![Build status](https://ci.appveyor.com/api/projects/status/976j2uut8xgalvx2/branch/master?svg=true)](https://ci.appveyor.com/project/GUDHI/gudhi-devel/branch/master) +[![OSx on Azure](https://dev.azure.com/GUDHI/gudhi-devel/_apis/build/status/GUDHI.gudhi-devel?branchName=master)](https://dev.azure.com/GUDHI/gudhi-devel/_build/latest?definitionId=1&branchName=master) +[![Linux on CircleCI](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master.svg?style=svg)](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master) +[![Win on Appveyor](https://ci.appveyor.com/api/projects/status/976j2uut8xgalvx2/branch/master?svg=true)](https://ci.appveyor.com/project/GUDHI/gudhi-devel/branch/master) [![Anaconda Cloud](https://anaconda.org/conda-forge/gudhi/badges/version.svg)](https://anaconda.org/conda-forge/gudhi) [![Anaconda downloads](https://anaconda.org/conda-forge/gudhi/badges/downloads.svg)](https://anaconda.org/conda-forge/gudhi) -- cgit v1.2.3 From ae8c34ad96f421d480cbe6bff9c04ec6f0eff920 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:55:16 +0100 Subject: [skip ci] Install full LaTex matplotlib seems to fail to produce LaTeX-like plots --- Dockerfile_for_circleci_image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_for_circleci_image b/Dockerfile_for_circleci_image index cca93f0c..1eededb5 100644 --- a/Dockerfile_for_circleci_image +++ b/Dockerfile_for_circleci_image @@ -30,7 +30,7 @@ RUN apt-get install -y make \ cmake \ graphviz \ perl \ - texlive-bibtex-extra \ + texlive-full \ biber \ doxygen \ libboost-all-dev \ -- cgit v1.2.3 From 7789744d5d5972ef2d6218296a7b8a0a05337679 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Fri, 6 Mar 2020 13:31:05 +0100 Subject: set greyblock to False by default in density --- src/python/gudhi/persistence_graphical_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 6fd854ff..8c38b684 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -361,7 +361,7 @@ def plot_persistence_density( legend=False, axes=None, fontsize=16, - greyblock=True + greyblock=False ): """This function plots the persistence density from persistence values list, np.array of shape (N x 2) representing a diagram @@ -410,7 +410,7 @@ def plot_persistence_density( :param fontsize: Fontsize to use in axis. :type fontsize: int :param greyblock: if we want to plot a grey patch on the lower half plane - for nicer rendering. Default True. + for nicer rendering. Default False. :type greyblock: boolean :returns: (`matplotlib.axes.Axes`): The axes on which the plot was drawn. """ -- cgit v1.2.3 From 5bc96fdf837e4acb80b1333b9db63ddf5802edc8 Mon Sep 17 00:00:00 2001 From: tlacombe Date: Mon, 9 Mar 2020 12:12:13 +0100 Subject: removed infty line plot in plot_diagram if no pts at infty --- src/python/gudhi/persistence_graphical_tools.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 8c38b684..cc3db467 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -296,17 +296,6 @@ def plot_persistence_diagram( axis_end = max_death + delta / 2 axis_start = min_birth - delta - # infinity line and text - axes.plot([axis_start, axis_end], [axis_start, axis_end], linewidth=1.0, color="k") - axes.plot([axis_start, axis_end], [infinity, infinity], linewidth=1.0, color="k", alpha=alpha) - # Infinity label - yt = axes.get_yticks() - yt = yt[np.where(yt < axis_end)] # to avoid ploting ticklabel higher than infinity - yt = np.append(yt, infinity) - ytl = ["%.3f" % e for e in yt] # to avoid float precision error - ytl[-1] = r'$+\infty$' - axes.set_yticks(yt) - axes.set_yticklabels(ytl) # bootstrap band if band > 0.0: x = np.linspace(axis_start, infinity, 1000) @@ -315,6 +304,7 @@ def plot_persistence_diagram( if greyblock: axes.add_patch(mpatches.Polygon([[axis_start, axis_start], [axis_end, axis_start], [axis_end, axis_end]], fill=True, color='lightgrey')) # Draw points in loop + pts_at_infty = False # Records presence of pts at infty for interval in reversed(persistence): if float(interval[1][1]) != float("inf"): # Finite death case @@ -325,10 +315,23 @@ def plot_persistence_diagram( color=colormap[interval[0]], ) else: + pts_at_infty = True # Infinite death case for diagram to be nicer axes.scatter( interval[1][0], infinity, alpha=alpha, color=colormap[interval[0]] ) + if pts_at_infty: + # infinity line and text + axes.plot([axis_start, axis_end], [axis_start, axis_end], linewidth=1.0, color="k") + axes.plot([axis_start, axis_end], [infinity, infinity], linewidth=1.0, color="k", alpha=alpha) + # Infinity label + yt = axes.get_yticks() + yt = yt[np.where(yt < axis_end)] # to avoid ploting ticklabel higher than infinity + yt = np.append(yt, infinity) + ytl = ["%.3f" % e for e in yt] # to avoid float precision error + ytl[-1] = r'$+\infty$' + axes.set_yticks(yt) + axes.set_yticklabels(ytl) if legend: dimensions = list(set(item[0] for item in persistence)) -- cgit v1.2.3 From 7a5b614aa3bd06897e0135f0cda4e61f16951b20 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Tue, 10 Mar 2020 16:46:11 +0100 Subject: Try without trigger --- azure-pipelines.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 77e0ac88..95b15db2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,9 +1,3 @@ -trigger: - batch: true - branches: - include: - - '*' # All branches - jobs: - job: 'Test' -- cgit v1.2.3