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

Optimas exits if a history file is given, but not found #80

Closed
delaossa opened this issue Apr 17, 2023 · 4 comments
Closed

Optimas exits if a history file is given, but not found #80

delaossa opened this issue Apr 17, 2023 · 4 comments

Comments

@delaossa
Copy link
Collaborator

delaossa commented Apr 17, 2023

Optimas exits if a history file is given, but not found.

def _load_history(self, history: Union[str, np.ndarray, None]) -> None:
"""Load history file."""
if isinstance(history, str):
if os.path.exists(history):
# Load array.
history = np.load(history)
# Only include runs that completed
history = history[history['sim_ended']]
else:
raise ValueError(
'History file {} does not exist.'.format(history))
assert history is None or isinstance(history, np.ndarray), (
'Type {} not valid for `history`'.format(type(history))
)
return history

This current behaviour is problematic with my usual post processing scripts, as sometimes the optimas run script is accessed from a location that does not follow the relative path to the history file.
Previously in libE_opt, if the history file was not found, it would continue as if not given.

@AngelFP
Copy link
Member

AngelFP commented Apr 17, 2023

Hi @delaossa, thanks for reporting this. I think we could raise a warning instead of an error here.

@delaossa
Copy link
Collaborator Author

Ok, I would prefer it.. :)
Would be ok with just replacing ValueError by Warning?
By the way, why does the history argument in _load_history accept a np.darray?

@delaossa
Copy link
Collaborator Author

Raising Warning still exits the program.
#81 implements a solution using the warning package.

@AngelFP
Copy link
Member

AngelFP commented Jan 12, 2024

This should be solved now that #120 is merged. The recommended approach to analyze an optimas run is to use the new ExplorationDiagnostics class. (see https://optimas.readthedocs.io/en/latest/user_guide/basic_usage/exploration_diagnostics.html and https://optimas.readthedocs.io/en/latest/api/_autosummary/optimas.diagnostics.ExplorationDiagnostics.html#optimas.diagnostics.ExplorationDiagnostics)

@AngelFP AngelFP closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants