Skip to content

Commit eb510b7

Browse files
author
gh-actions
committed
auto commit from showyourwork tests
1 parent dd5c650 commit eb510b7

File tree

4 files changed

+118
-81
lines changed

4 files changed

+118
-81
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818
</a>
1919
</p>
2020

21-
An open source scientific article created using the [showyourwork](https://github.com/showyourwork/showyourwork) workflow.
21+
*This is an automatically generated test for [showyourwork](https://github.com/showyourwork/showyourwork) generated from the file [test_zenodo.py](https://github.com/showyourwork/showyourwork/blob/main/tests/integration/test_zenodo.py).*
22+
23+
Test a repo that downloads data from Zenodo.

showyourwork.yml

Lines changed: 42 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,67 @@
1-
# Enable rule caching on Zenodo?
21
cache_on_zenodo: true
3-
4-
# Workflow graph (DAG) generation
52
dag:
6-
# Generate `dag.pdf` on each build?
7-
render: false
8-
# Graphviz layout engine
93
engine: sfdp
10-
# Group files by type into plates?
11-
group_by_type: false
12-
# Custom graph attributes
134
graph_attr:
14-
ranksep: "1"
15-
nodesep: "0.65"
16-
# Custom node attributes
5+
nodesep: '0.65'
6+
ranksep: '1'
7+
group_by_type: false
178
node_attr:
18-
shape: "box"
19-
penwidth: "2"
20-
width: "1"
21-
# Files and glob patterns to ignore
22-
# ignore_files:
23-
# - src/tex/orcid-ID.png
24-
25-
26-
# Externally-hosted datasets, e.g. on Zenodo
9+
penwidth: '2'
10+
shape: box
11+
width: '1'
12+
render: false
2713
datasets:
28-
# 10.5281/zenodo.6468327:
29-
# contents:
30-
# TOI640b.json: src/data/TOI640b.json
31-
32-
# Custom file dependencies
14+
10.5281/zenodo.6515864:
15+
contents:
16+
README.md: null
17+
TOI640b.json: src/data/TOI640/planet.json
18+
images.tar.gz:
19+
README.md: null
20+
S06:
21+
image.json: src/data/TOI640/S06.json
22+
S07:
23+
image.json: src/data/TOI640/S07.json
24+
lightcurves.zip:
25+
lightcurves:
26+
README.md: null
27+
S06:
28+
lc.txt: src/data/TOI640/S06.txt
29+
S07:
30+
lc.txt: src/data/TOI640/S07.txt
31+
destination: src/data/TOI640
3332
dependencies:
34-
# src/scripts/my_script.py:
35-
# - src/data/dataset_for_my_script.dat
36-
# src/tex/ms.tex:
37-
# - src/tex/stylesheet.tex
38-
39-
# Name of the `.tex` manuscript and corresponding `.pdf` article
33+
src/scripts/test_figure.py:
34+
- src/data/TOI640/planet.json
35+
- src/data/TOI640/S06.txt
36+
- src/data/TOI640/S06.json
37+
- src/data/TOI640/S07.txt
38+
- src/data/TOI640/S07.json
4039
ms_name: ms
41-
42-
# Optimize DAG by removing unnecessary jobs upstream of cache hits?
4340
optimize_caching: false
44-
45-
# Overleaf sync settings
4641
overleaf:
47-
# Overleaf project ID (blank = disabled)
48-
id:
49-
# Perform sync on GitHub Actions?
5042
gh_actions_sync: true
51-
# List of files to push to Overleaf
52-
push:
53-
- src/tex/figures
54-
- src/tex/output
55-
# List of files to pull from Overleaf
43+
id: null
5644
pull:
57-
- src/tex/ms.tex
58-
- src/tex/bib.bib
59-
60-
# Always require all input files to be present on disk for workflow to pass?
45+
- src/tex/ms.tex
46+
- src/tex/bib.bib
47+
push:
48+
- src/tex/figures
49+
- src/tex/output
6150
require_inputs: true
62-
63-
# Allow cacheable rules to run on GitHub Actions?
6451
run_cache_rules_on_ci: false
65-
66-
# Mapping of script file extensions to instructions for executing them
6752
scripts:
6853
py: python {script}
69-
70-
# Display of the `showyourwork` stamp on first page
7154
stamp:
72-
# Show the stamp?
73-
enabled: true
74-
# Stamp angle in degrees
7555
angle: -20.0
76-
# Stamp size in inches
56+
enabled: true
7757
size: 0.75
78-
# Horizontal position in inches from right edge of paper
79-
xpos: 0.50
80-
# Vertical position in inches from top edge of paper
81-
ypos: 0.50
82-
# Display of the repo URL in the stamp
8358
url:
84-
# Show the URL?
8559
enabled: true
86-
# Maximum URL length to display
8760
maxlen: 40
88-
89-
# Enable SyncTeX?
90-
synctex: True
91-
92-
# Command-line options to be passed to tectonic when building the manuscript
61+
xpos: 0.5
62+
ypos: 0.5
63+
synctex: true
9364
tectonic_args: []
94-
95-
# Preprocessing script for arXiv tarball
96-
# (such as to switch `minted` from `finalizecache` to `frozencache`)
97-
# The script will be passed a directory containing the manuscript source
98-
# as input, and should modify the contents of that directory in-place.
99-
# preprocess_arxiv_script: my_preprocess_script.sh
100-
101-
# Enable verbose output?
10265
verbose: false
103-
104-
# Version of `showyourwork` used to create this workflow
10566
version: 0.4.4.dev261+g098a369e9
67+

src/scripts/test_figure.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
import matplotlib.pyplot as plt
3+
import numpy as np
4+
import json
5+
import paths
6+
7+
# Set up the figure
8+
fig = plt.figure(figsize=(7, 6))
9+
ax = fig.subplot_mosaic(
10+
'''
11+
AB
12+
CC
13+
'''
14+
)
15+
fig.subplots_adjust(wspace=0.1, hspace=0.15)
16+
17+
# Images
18+
for n, dataset in zip(["A", "B"], ["S06", "S07"]):
19+
with open(paths.data / "TOI640" / f"{dataset}.json", "r") as f:
20+
image_data = json.load(f)
21+
aperture = np.array(image_data["aperture"])
22+
image = np.array(image_data["image"]) / 1e3
23+
im = ax[n].imshow(image, origin="lower", vmin=0, vmax=4)
24+
ax[n].set_xticks([])
25+
ax[n].set_yticks([])
26+
ax[n].set_title(dataset)
27+
ax[n].set_aspect("auto")
28+
fig.colorbar(im, ax=[ax["A"], ax["B"]], shrink=1, label="flux [ke$^-$/s]")
29+
30+
# Dummy colorbar to get the spacing right
31+
cbar = fig.colorbar(im, ax=ax["C"], shrink=1)
32+
cbar.ax.set_visible(False)
33+
34+
# Load planet data
35+
with open(paths.data / "TOI640" / "planet.json", "r") as f:
36+
planet_data = json.load(f)
37+
phase = planet_data["phase"]
38+
period = planet_data["period"]
39+
40+
# Photometry
41+
for dataset in ["S06", "S07"]:
42+
43+
# Load the data
44+
time, flux, *_ = np.loadtxt(paths.data / "TOI640" / f"{dataset}.txt").T
45+
46+
# Divide out the rolling 1-day median baseline
47+
dt = np.median(np.diff(time))
48+
w = int(1 / dt)
49+
baseline = [np.median(flux[a : a + w]) for a in range(len(flux))]
50+
flux /= baseline
51+
52+
# Fold the data
53+
time = (time % period) / period + phase
54+
55+
# Plot it
56+
ax["C"].plot(time, flux, ".", label=dataset)
57+
58+
# Format the figure
59+
ax["C"].legend()
60+
ax["C"].set_xlim(-0.1, 0.1)
61+
ax["C"].set_xlabel("orbital phase")
62+
ax["C"].set_ylabel("normalized flux")
63+
fig.savefig(paths.figures / "test_figure.pdf", bbox_inches="tight", dpi=300)
64+

src/tex/ms.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,13 @@ \section{Introduction}
5959

6060
\bibliography{bib}
6161

62+
\begin{figure}[ht!]
63+
\script{test_figure.py}
64+
\begin{centering}
65+
\includegraphics[width=\linewidth]{figures/test_figure.pdf}
66+
\caption{A test figure.}
67+
\label{fig:test_figure}
68+
\end{centering}
69+
\end{figure}
70+
6271
\end{document}

0 commit comments

Comments
 (0)