Skip to content

Commit

Permalink
Change relative paths, to make it compatible with running outside sco…
Browse files Browse the repository at this point in the history
…pe (Git Actions)
  • Loading branch information
manuelgloeckler committed Feb 4, 2024
1 parent c652b62 commit 44e7057
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions labproject/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import os

# Load matplotlibrc file
STYLE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "matplotlibrc")) # Necessary for GitHub Actions
STYLE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "matplotlibrc")) # Necessary for GitHub Actions/ Calling from other directories
plt.style.use(STYLE_PATH)

PLOT_PATH = "../plots/"
PLOT_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "plots"))


def plot_scaling_metric_dimensionality(dimensionality, distances, metric_name, dataset_name):
Expand Down
4 changes: 3 additions & 1 deletion labproject/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import numpy as np
import random
import inspect
import os

from omegaconf import OmegaConf

CONF_PATH = STYLE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "configs"))

def set_seed(seed: int) -> None:
"""Set seed for reproducibility
Expand Down Expand Up @@ -34,7 +36,7 @@ def get_cfg() -> OmegaConf:
filename = caller_frame.f_code.co_filename
name = filename.split("/")[-1].split(".")[0].split("_")[-1]
try:
config = OmegaConf.load(f"../configs/conf_{name}.yaml")
config = OmegaConf.load(CONF_PATH + f"/conf_{name}.yaml")
except FileNotFoundError:
msg = f"Config file not found for {name}. Please create a config file at ../configs/conf_{name}.yaml"
raise FileNotFoundError(msg)
Expand Down

0 comments on commit 44e7057

Please sign in to comment.