From 36e98eeca00f52fc32c01685c6847064913602de Mon Sep 17 00:00:00 2001 From: Luthaf Date: Tue, 26 Mar 2024 12:17:48 +0100 Subject: [PATCH 1/2] Add authors to the different examples --- examples/batch-cp2k/reference-trajectory.py | 3 ++- examples/gaas-map/gaas-map.py | 3 +++ examples/lode-linear/lode-linear.py | 3 +++ examples/roy-gch/roy-gch.py | 2 ++ examples/sample-selection/sample-selection.py | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/batch-cp2k/reference-trajectory.py b/examples/batch-cp2k/reference-trajectory.py index 84fa6cc7..4fb6e77c 100644 --- a/examples/batch-cp2k/reference-trajectory.py +++ b/examples/batch-cp2k/reference-trajectory.py @@ -2,7 +2,8 @@ Batch run of CP2K calculations ============================== -.. start-body +:Authors: Matthias Kellner `@bananenpampe `_, + Philip Loche `@PicoCentauri `_ This is an example how to perform single point calculations based on list of structures using `CP2K `_ using its `reftraj functionality diff --git a/examples/gaas-map/gaas-map.py b/examples/gaas-map/gaas-map.py index 00d181b7..c0175812 100644 --- a/examples/gaas-map/gaas-map.py +++ b/examples/gaas-map/gaas-map.py @@ -2,6 +2,9 @@ PCA/PCovR Visualization for the rattled GaAs training dataset ============================================================= +:Authors: Michele Ceriotti `@ceriottm `_, + Giulio Imbalzano + This example uses ``rascaline`` and ``metatensor`` to compute structural properties for the structures in a training for a ML model. These are then used with simple dimensionality reduction algorithms diff --git a/examples/lode-linear/lode-linear.py b/examples/lode-linear/lode-linear.py index d8d5c551..23ac620b 100644 --- a/examples/lode-linear/lode-linear.py +++ b/examples/lode-linear/lode-linear.py @@ -2,6 +2,9 @@ LODE Tutorial ============= +:Authors: Philip Loche `@PicoCentauri `_, + Kevin Huguenin-Dumittan `@kvhuguenin `_ + This tutorial explains how Long range equivariant descriptors can be constructed using rascaline and the resulting descriptors be used to construct a linear model with equisolve diff --git a/examples/roy-gch/roy-gch.py b/examples/roy-gch/roy-gch.py index 5b59ae97..13ba591b 100644 --- a/examples/roy-gch/roy-gch.py +++ b/examples/roy-gch/roy-gch.py @@ -2,6 +2,8 @@ Generalized Convex Hull construction for the polymorphs of ROY ============================================================== +:Authors: Michele Ceriotti `@ceriottm `_ + This notebook analyzes the structures of 264 polymorphs of ROY, from `Beran et Al, Chemical Science (2022) `__, comparing the diff --git a/examples/sample-selection/sample-selection.py b/examples/sample-selection/sample-selection.py index 34030c64..1cb03d50 100644 --- a/examples/sample-selection/sample-selection.py +++ b/examples/sample-selection/sample-selection.py @@ -2,7 +2,7 @@ Sample and Feature Selection with FPS and CUR ============================================= -.. start-body +:Authors: Davide Tisi `@DavideTisi `_ In this tutorial we generate descriptors using rascaline, then select a subset of structures using both the farthest-point sampling (FPS) and CUR algorithms From b70b75903447d900ba9641524e27e1ca7e5a048f Mon Sep 17 00:00:00 2001 From: Luthaf Date: Tue, 26 Mar 2024 13:12:31 +0100 Subject: [PATCH 2/2] Add download links for environment --- docs/src/index.rst.in | 12 ++++++++++++ generate-gallery.py | 2 +- noxfile.py | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/src/index.rst.in b/docs/src/index.rst.in index a5137653..f7378cfe 100644 --- a/docs/src/index.rst.in +++ b/docs/src/index.rst.in @@ -6,6 +6,18 @@ COSMO Software Cookbook :end-before: marker-intro-end +All the examples provide an ``environment.yml`` file that you can download and +then use with conda to create a new environment with all the required +dependencies for this example. + +.. code-block:: bash + + # Pick a name for the environment and replace with it + conda env create --name --file environment.yml + + # when you want to use the environment + conda env activate --name + .. toctree:: :caption: Table of Contents :maxdepth: 1 diff --git a/generate-gallery.py b/generate-gallery.py index 9d27e630..239a50b9 100644 --- a/generate-gallery.py +++ b/generate-gallery.py @@ -38,7 +38,7 @@ def __init__(self, example): "examples_dirs": os.path.join(HERE, example), "gallery_dirs": gallery_dir, "min_reported_time": 60, - "copyfile_regex": r".*\.(sh|xyz|cp2k)", + "copyfile_regex": r".*\.(sh|xyz|cp2k|yml)", "matplotlib_animations": True, } diff --git a/noxfile.py b/noxfile.py index fac20ca2..83bff979 100644 --- a/noxfile.py +++ b/noxfile.py @@ -128,6 +128,30 @@ def build_docs(session): output.write(f" {path}\n") + # TODO: Explain + with open(file) as fd: + content = fd.read() + + if "Download Conda environment file" in content: + # do not add the download link twice + pass + else: + lines = content.split("\n") + with open(file, "w") as fd: + for line in lines: + if "sphx-glr-download-jupyter" in line: + # add the new download link before + fd.write( + """ + .. container:: sphx-glr-download + + :download:`Download Conda environment file: environment.yml ` +""" + ) + + fd.write(line) + fd.write("\n") + session.run("sphinx-build", "-W", "-b", "html", "docs/src", "docs/build/html")