Skip to content

Commit

Permalink
reorganize
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Garcia Ordonez committed Jan 14, 2025
1 parent 0b076f1 commit 2e3b1d1
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
*$py.class
.pyenv
.vscode/settings.json

# C extensions
*.so
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"seaborn",
"scipy",
"statsmodels",
"itis-dakota",
],
)
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions src/mmux_utils/funs_evaluate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
### Allows to evaluate in different modes - batch, single set, ...
### also in OSPARC or local deployment
from typing import Callable, List
from pathlib import Path
import dakota.environment as dakenv


### Otherwise could create a class that I can instantiate and give a "model" at initialization time,
# which is given to "run dakota" as input parameter
def batch_evaluator(model: Callable, batch_input: List[dict]):
return map(model, batch_input) # FIXME not sure this will work


def single_evaluator(model: Callable, input: dict):
return model(input)


def run_dakota(dakota_conf_path: Path, batch_mode: bool = True):
print("Starting dakota")
dakota_conf = dakota_conf_path.read_text()
callbacks = (
{"batch_evaluator": batch_evaluator}
if batch_mode
else {"evaluator": single_evaluator} # not sure this will work
)
study = dakenv.study(
callbacks=callbacks,
input_string=dakota_conf,
)
study.execute()
## TODO access documentation of dakenv.study -- cannot, also cannot find in https://github.com/snl-dakota/dakota/tree/devel/packages
# would need to ask Werner


if __name__ == "__main__":
print("DONE")
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file removed src/mmux_utils/utils/__init__.py
Empty file.

0 comments on commit 2e3b1d1

Please sign in to comment.