From 58b0c231da7936b81b72db0b598c66769df3be6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?= <laura.kuehle@uni-duesseldorf.de> Date: Thu, 6 Oct 2022 00:38:13 +0200 Subject: [PATCH] Added function to select parameters for DG scheme. --- Snakefile | 4 +++- workflows/approximation.smk | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Snakefile b/Snakefile index 0f13017..3f30fb0 100644 --- a/Snakefile +++ b/Snakefile @@ -25,7 +25,8 @@ Urgent: TODO: Build package for DG scheme -> Done TODO: Move scripts into separate directory -> Done TODO: Move TODOs to Snakefile -> Done -TODO: Outsource run commands in SM rules into separate files +TODO: Outsource run commands in SM rules into separate files -> Done +TODO: Add function to select parameters for DG schemes -> Done TODO: Move plot_approximation_results() into plotting script TODO: Introduce env files for each SM rule @@ -53,6 +54,7 @@ TODO: Add a default model state TODO: Look into validators for variable checks Not feasible yet or doc-related: +TODO: Enforce SM conventions (no direct access to config, order in rule, etc.) TODO: Replace pop() with get() for dictionary access TODO: Induce shift in IC class TODO: Force input_size for each ANN model to be stencil length diff --git a/workflows/approximation.smk b/workflows/approximation.smk index b07ba24..d19038a 100644 --- a/workflows/approximation.smk +++ b/workflows/approximation.smk @@ -20,13 +20,17 @@ def get_ANN_model(wildcards): return [] +def get_DG_params(wildcards): + return config['schemes'][wildcards.scheme] + + rule approximate_solution: input: get_ANN_model output: DIR+'/fig/{scheme}.json' params: - dg_params = lambda wildcards: config['schemes'][wildcards.scheme], + dg_params = get_DG_params, plot_dir = DIR + '/fig' log: DIR+'/log/approximate_solution/{scheme}.log' @@ -40,8 +44,8 @@ rule plot_approximation_results: output: expand(DIR + '/fig/{plot}/{{scheme}}.pdf', plot=PLOTS) params: - dg_params=lambda wildcards: config['schemes'][wildcards.scheme], - plot_dir=DIR + '/fig', + dg_params = get_DG_params, + plot_dir = DIR + '/fig', directory = DIR log: DIR+'/log/plot_approximation_results/{scheme}.log' -- GitLab