Skip to content

Commit

Permalink
update for zenodo caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Reep committed Jul 6, 2024
1 parent d26e045 commit 91b8c38
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 19 deletions.
27 changes: 27 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
rule figure1:
output:
directory("src/data/Figure1")
conda:
"environment.yml"
cache:
True
script:
"src/scripts/run_ebtel_figure1.py"
rule figure2:
output:
directory("src/data/Figure2")
conda:
"environment.yml"
cache:
True
script:
"src/scripts/run_ebtel_figure2.py"
rule figure3:
output:
directory("src/data/Figure3")
conda:
"environment.yml"
cache:
True
script:
"src/scripts/run_ebtel_figure3.py"
6 changes: 6 additions & 0 deletions showyourwork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ datasets:

# Custom file dependencies
dependencies:
src/scripts/render_figure1.py:
- src/data/Figure1/
src/scripts/render_figure2.py:
- src/data/Figure2/
src/scripts/render_figure3.py:
- src/data/Figure3/
# src/scripts/my_script.py:
# - src/data/dataset_for_my_script.dat
# src/tex/ms.tex:
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

# Absolute path to the `src/data` folder (contains datasets)
data = src / "data"
figure1 = data / "Figure1"
figure2 = data / "Figure2"
figure3 = data / "Figure3"

# Absolute path to the `src/static` folder (contains static images)
static = src / "static"
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/render_figure1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
pfile = 'pho_L'+L+'_H'+H+'_t'+t+'.txt'
cfile = 'cor_L'+L+'_H'+H+'_t'+t+'.txt'

t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.data / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.data / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.data / cfile)
t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.figure1 / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.figure1 / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.figure1 / cfile)

time = [t_v, t_p, t_c]
temperature = [T_e_v, T_e_p, T_e_c]
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/render_figure2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
pfile = 'pho_L'+L+'_H'+H+'_t'+t+'.txt'
cfile = 'cor_L'+L+'_H'+H+'_t'+t+'.txt'

t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.data / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.data / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.data / cfile)
t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.figure2 / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.figure2 / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.figure2 / cfile)

time = [t_v, t_p, t_c]
temperature = [T_e_v, T_e_p, T_e_c]
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/render_figure3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
pfile = 'pho_train_L'+L+'_H'+H+'_t'+t+'.txt'
cfile = 'cor_train_L'+L+'_H'+H+'_t'+t+'.txt'

t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.data / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.data / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.data / cfile)
t_v, T_e_v, T_i_v, n_v, P_e_v, P_i_v, v_v, Q_v = read_ebtel_file(filename=paths.figure3 / vfile)
t_p, T_e_p, T_i_p, n_p, P_e_p, P_i_p, v_p, Q_p = read_ebtel_file(filename=paths.figure3 / pfile)
t_c, T_e_c, T_i_c, n_c, P_e_c, P_i_c, v_c, Q_c = read_ebtel_file(filename=paths.figure3 / cfile)

time = [t_v, t_p, t_c]
temperature = [T_e_v, T_e_p, T_e_c]
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/run_ebtel_figure1.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@
os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'variable',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / vfile)
output_filename = paths.figure1 / vfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'photospheric',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / pfile)
output_filename = paths.figure1 / pfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'coronal',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / cfile)
output_filename = paths.figure1 / cfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

6 changes: 3 additions & 3 deletions src/scripts/run_ebtel_figure2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'variable',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / vfile)
output_filename = paths.figure2 / vfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'photospheric',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / pfile)
output_filename = paths.figure2 / pfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

os.chdir(paths.data)
write_new_configuration(initial_lines, length = L, radiation = 'coronal',
heating_rate = [H], heating_duration = [t],
output_filename = paths.data / cfile)
output_filename = paths.figure2 / cfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])
6 changes: 3 additions & 3 deletions src/scripts/run_ebtel_figure3.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
heating_rate = [H, H, H, H, H],
heating_duration = [t, t, t, t, t],
heating_start = ['0','300','600','900','1200'],
output_filename = paths.data / vfile)
output_filename = paths.figure3 / vfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

Expand All @@ -36,7 +36,7 @@
heating_rate = [H, H, H, H, H],
heating_duration = [t, t, t, t, t],
heating_start = ['0','300','600','900','1200'],
output_filename = paths.data / pfile)
output_filename = paths.figure3 / pfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])

Expand All @@ -45,6 +45,6 @@
heating_rate = [H, H, H, H, H],
heating_duration = [t, t, t, t, t],
heating_start = ['0','300','600','900','1200'],
output_filename = paths.data / cfile)
output_filename = paths.figure3 / cfile)
os.chdir(paths.ebtel_root)
subprocess.run(["bin/ebtel++.run"])
3 changes: 2 additions & 1 deletion zenodo.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cache:
main:
sandbox:
sandbox: 10.5072/zenodo.80336

0 comments on commit 91b8c38

Please sign in to comment.