Skip to content

Commit

Permalink
resolves a TODO in utils
Browse files Browse the repository at this point in the history
Moved DIRNAME_PERFORMANCE_PLOTS = "performance" in config
  • Loading branch information
Krish Patel committed Jun 1, 2023
1 parent d5b303d commit f72de4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions openadapt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def getenv_fallback(var_name):
ROOT_DIRPATH = pathlib.Path(__file__).parent.parent.resolve()
DB_FPATH = ROOT_DIRPATH / DB_FNAME
DB_URL = f"sqlite:///{DB_FPATH}"
DIRNAME_PERFORMANCE_PLOTS = "performance"

if multiprocessing.current_process().name == "MainProcess":
for key, val in locals().items():
Expand Down
9 changes: 3 additions & 6 deletions openadapt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
import mss.base
import numpy as np

from openadapt import common
from openadapt import common, config


# TODO: move to config.py
DIRNAME_PERFORMANCE_PLOTS = "performance"

EMPTY = (None, [], {}, "")


Expand Down Expand Up @@ -450,8 +447,8 @@ def plot_performance(recording_timestamp: float = None) -> None:
# TODO: add PROC_WRITE_BY_EVENT_TYPE
fname_parts = ["performance", f"{recording_timestamp}"]
fname = "-".join(fname_parts) + ".png"
os.makedirs(DIRNAME_PERFORMANCE_PLOTS, exist_ok=True)
fpath = os.path.join(DIRNAME_PERFORMANCE_PLOTS, fname)
os.makedirs(config.DIRNAME_PERFORMANCE_PLOTS, exist_ok=True)
fpath = os.path.join(config.DIRNAME_PERFORMANCE_PLOTS, fname)
logger.info(f"{fpath=}")
plt.savefig(fpath)
os.system(f"open {fpath}")
Expand Down

0 comments on commit f72de4c

Please sign in to comment.