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

Some fixes for running Olympus on Windows #34

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/olympus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

# ===============================================================================

from .campaigns import Campaign, Observations, ParameterSpace
from .analyzer import Analyzer
from .baseline import Baseline
from .campaigns import Campaign, Observations, ParameterSpace
from .databases import Database
from .datasets import Dataset, list_datasets
from .emulators import Emulator, list_trained_emulators
Expand Down
4 changes: 2 additions & 2 deletions src/olympus/databases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

db_types = []
databases = {}
for dir_name in glob.glob("{}/database_*".format(__home__)):
dir_name = dir_name.split("/")[-1][9:]
for dir_name in glob.glob(os.path.join(__home__, "database_*")):
dir_name = os.path.basename(dir_name)[9:]
db = Database(kind=dir_name)
db_types.extend(db.file_types)
databases[dir_name.lower()] = db
Expand Down
4 changes: 2 additions & 2 deletions src/olympus/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import glob

datasets_list = []
for dir_name in glob.glob(f"{__home__}/dataset_*"):
dir_name = dir_name.split("/")[-1][8:]
for dir_name in glob.glob(os.path.join(__home__, "dataset_*")):
dir_name = os.path.basename(dir_name)[8:]
datasets_list.append(dir_name)


Expand Down
3 changes: 2 additions & 1 deletion src/olympus/emulators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def list_trained_emulators():
import glob

emulators = []
for dir_name in glob.glob("{}/emulator_*".format(__home__)):
for dir_name in glob.glob(os.path.join(__home__, "emulator_*")):
if os.path.isfile(dir_name):
continue
dir_name = os.path.basename(dir_name)
dataset_name = dir_name.split("_")[-2]
model_name = dir_name.split("_")[-1]
emulators.append(f"{dataset_name}_{model_name}")
Expand Down
4 changes: 2 additions & 2 deletions src/olympus/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def _find_models(self):
self.model_files = []
self.model_names = []
self.model_map = {}
for dir_name in glob.glob(f"{__home__}/model_*"):
model_name = dir_name.split("/")[-1][6:]
for dir_name in glob.glob(os.path.join(__home__, "model_*")):
model_name = os.path.basename(dir_name)[6:]
self.model_files.append(model_name)
self.model_names.append(ModelLoader.file_to_class(model_name))

Expand Down
4 changes: 2 additions & 2 deletions src/olympus/noises/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def _find_noise(self):
self.noise_files = []
self.noise_names = []
self.noise_map = {}
for dir_name in glob.glob(f"{__home__}/noise_*"):
noise_name = dir_name.split("/")[-1][6:]
for dir_name in glob.glob(os.path.join(__home__, "noise_*")):
noise_name = os.path.basename(dir_name)[6:]
self.noise_files.append(noise_name)
self.noise_names.append(NoiseLoader.file_to_class(noise_name))

Expand Down
9 changes: 2 additions & 7 deletions src/olympus/planners/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ def _find_planners(self):
self.planner_names = []
self.planner_param_types = []
self.planners_map = {}
for dir_name in glob.glob(f"{__home__}/planner_*"):

if "/" in dir_name:
planner_name = dir_name.split("/")[-1][8:]
elif "\\" in dir_name:
planner_name = dir_name.split("/")[-1][8:]

for dir_name in glob.glob(os.path.join(__home__, "planner_*")):
planner_name = os.path.basename(dir_name)[8:]
self.planner_files.append(planner_name)
self.planner_names.append(
PlannerLoader.file_to_class(planner_name)
Expand Down
4 changes: 2 additions & 2 deletions src/olympus/scalarizers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def _find_scalarizers(self):
self.scalarizer_files = []
self.scalarizer_names = []
self.scalarizer_map = {}
for dir_name in glob.glob(f"{__home__}/scalarizer_*"):
scalarizer_name = dir_name.split("/")[-1][11:]
for dir_name in glob.glob(os.path.join(__home__, "scalarizer_*")):
scalarizer_name = os.path.basename(dir_name)[11:]
self.scalarizer_files.append(scalarizer_name)
self.scalarizer_names.append(
ScalarizerLoader.file_to_class(scalarizer_name)
Expand Down
4 changes: 2 additions & 2 deletions src/olympus/surfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def _find_surfaces(self):
self.surface_files = []
self.surface_names = []
self.surfaces_map = {}
for dir_name in glob.glob(f"{__home__}/surface_*"):
surface_name = dir_name.split("/")[-1][8:]
for dir_name in glob.glob(os.path.join(__home__, "surface_*")):
surface_name = os.path.basename(dir_name)[8:]
self.surface_files.append(surface_name)
self.surface_names.append(
SurfaceLoader.file_to_class(surface_name)
Expand Down