subworkflow banana_workflow:
    snakefile: "banana.smk"

subworkflow circle_workflow:
    snakefile: "circle.smk"

subworkflow clipping_workflow:
    snakefile: "clipping.smk"

rule all:
    input:
        circle = circle_workflow("../Thesis/figures/circle.pdf"),
        banana = banana_workflow("../Thesis/figures/banana_mmd.pdf"),
        clipping = clipping_workflow("../Thesis/figures/clipping.pdf"),
        posterior_plots = "../Thesis/figures/posterior_plots.pdf",
        model_params_table = "../Thesis/model_params_table.tex",
        accountant_comparison = "../Thesis/figures/accountant_comparison.pdf",
        hmc_trajectory = "../Thesis/figures/hmc_trajectory.pdf",
        grad_clip_fig = "../Thesis/figures/grad_clipping.pdf"

rule posterior_density_plots:
    input: "plot_posteriors.py"
    output: "../Thesis/figures/posterior_plots.pdf"
    shell: "python {input}"

rule model_params_table:
    input: "experiments.py"
    output: "../Thesis/model_params_table.tex"
    shell: "python {input}"

rule accountant_comparison_figure:
    input: "plot_iterations.py"
    output: "../Thesis/figures/accountant_comparison.pdf"
    shell: "python {input}"

rule hmc_trajectory_figure:
    input: "plot_hmc_trajectory.py"
    output: "../Thesis/figures/hmc_trajectory.pdf"
    shell: "python {input}"

rule grad_clipping_figure:
    input:
        py = "plot_grad_clipping.py",
        circle = circle_workflow("results/circle/results.csv"),
        banana = banana_workflow("results/banana/results.csv")
    output: "../Thesis/figures/grad_clipping.pdf"
    shell: "python {input.py} {input.banana} {input.circle}"
