From 7fffdedd1c33c4f91d91cc82ebbe3af391b406b9 Mon Sep 17 00:00:00 2001 From: gh-actions Date: Tue, 12 Nov 2024 08:15:08 +0000 Subject: [PATCH] auto commit from showyourwork tests --- README.md | 4 +++- Snakefile | 8 ++++++++ src/scripts/age_of_universe.py | 12 ++++++++++++ src/tex/ms.tex | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/scripts/age_of_universe.py diff --git a/README.md b/README.md index d2e2b42..16c5099 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,6 @@

-An open source scientific article created using the [showyourwork](https://github.com/showyourwork/showyourwork) workflow. +*This is an automatically generated test for [showyourwork](https://github.com/showyourwork/showyourwork) generated from the file [test_variable.py](https://github.com/showyourwork/showyourwork/blob/main/tests/integration/test_variable.py).* + +Test a workflow with dynamic quantities imported into the tex file. diff --git a/Snakefile b/Snakefile index e69de29..cb10c3e 100644 --- a/Snakefile +++ b/Snakefile @@ -0,0 +1,8 @@ + + + +rule age_of_universe: + output: + 'src/tex/output/age_of_universe.txt' + script: + 'src/scripts/age_of_universe.py' diff --git a/src/scripts/age_of_universe.py b/src/scripts/age_of_universe.py new file mode 100644 index 0000000..beb7f0e --- /dev/null +++ b/src/scripts/age_of_universe.py @@ -0,0 +1,12 @@ + +import paths +import numpy as np + +# Compute the age of the universe +np.random.seed(42) +age = np.random.normal(14.0, 1.0) + +# Write it to disk +with open(paths.output / "age_of_universe.txt", "w") as f: + f.write(f"{age:.3f}") + diff --git a/src/tex/ms.tex b/src/tex/ms.tex index 6ab8e9c..09f486b 100644 --- a/src/tex/ms.tex +++ b/src/tex/ms.tex @@ -54,4 +54,6 @@ \section{Introduction} \bibliography{bib} +Based on a detailed analysis of Planck observations of the cosmic microwave background, we have determined the age of the universe to be \variable{output/age_of_universe.txt} Gyr. \end{document} +