-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Javier Garcia Ordonez
committed
Jan 14, 2025
1 parent
0b076f1
commit 2e3b1d1
Showing
10 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ __pycache__/ | |
*.py[cod] | ||
*$py.class | ||
.pyenv | ||
.vscode/settings.json | ||
|
||
# C extensions | ||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,6 @@ | |
"seaborn", | ||
"scipy", | ||
"statsmodels", | ||
"itis-dakota", | ||
], | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.