Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example run changes directory to repository root #289

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions examples/example_end_to_end_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
A basic local covid example meant to show off the flow of running the mechanistic model

Expand All @@ -16,7 +16,12 @@
import matplotlib.pyplot as plt
import numpy as np

# the different segments of code responsible for runing the model
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
ROOT_PATH = os.path.join(SCRIPT_PATH, "..")

os.chdir(ROOT_PATH)

# the different segments of code responsible for running the model
# each will be explained as they are used below
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the file to fail pre-commit checks: E402 Module level import not at top of file. You have two solutions, either add the following command: # ruff: noqa: E402 to disable the particular pre-commit check. Or move the lines below the import. I suggest the latter unless you have a good reason to keep the current ordering

from resp_ode import (
CovidSeroInitializer,
Expand Down Expand Up @@ -44,18 +49,18 @@
os.mkdir("output")

# step 1: define your paths
config_path = "config/"
config_path = os.path.join(ROOT_PATH, "config")
# global_config include definitions such as age bin bounds and strain definitions
# Any value or data structure that needs context to be interpretted is here.
GLOBAL_CONFIG_PATH = config_path + "config_global.json"
GLOBAL_CONFIG_PATH = os.path.join(config_path, "config_global.json")
# defines the init conditions of the scenario: pop size, initial infections etc.
INITIALIZER_CONFIG_PATH = config_path + "config_initializer_covid.json"
INITIALIZER_CONFIG_PATH = os.path.join(config_path, "config_initializer_covid.json")
# defines the running variables, strain R0s, external strain introductions etc.
RUNNER_CONFIG_PATH = config_path + "config_runner_covid.json"
RUNNER_CONFIG_PATH = os.path.join(config_path, "config_runner_covid.json")
# defines prior distributions for inferring variables.
INFERER_CONFIG_PATH = config_path + "config_inferer_covid.json"
INFERER_CONFIG_PATH = os.path.join(config_path, "config_inferer_covid.json")
# defines how the solution should be viewed, what slices examined, how to save.
INTERPRETER_CONFIG_PATH = config_path + "config_interpreter_covid.json"
INTERPRETER_CONFIG_PATH = os.path.join(config_path, "config_interpreter_covid.json")

# step 2: Set up your initializer
# sets up the initial conditions, initializer.get_initial_state() passed to runner
Expand Down
Loading