Skip to content

Airfoil history processing requires pyoptsparse #156

@ffelten

Description

@ffelten

I thought we fixed the issue by having our own pyoptsparse history but it was not--I had a pyoptsparse installed in my local venv.

It seems that when reading the opt.hst file, it tries to unpickle pyoptsparse classes, which will trigger a ModuleNotFound pyoptsparse. I can provide an opt.hst file, here is come code to test:

optisteps_history = []
history = History("opt.hst")
call_counters = history.getCallCounters()
iters = list(map(int, call_counters)) if call_counters is not None else []

for i in range(len(iters)):
    vals = history.read(int(iters[i]))
    if vals is not None and "funcs" in vals and "obj" in vals["funcs"] and not vals["fail"]:
        values = history.getValues(names=["obj"], callCounters=[i], allowSens=False, major=False, scale=True)
        if values is not None and "obj" in values:
            objective = values["obj"]
            optisteps_history.append(OptiStep(obj_values=np.array(objective), step=vals["iter"]))

history.close()
print(optisteps_history)

We bypassed it by installing pyoptsparse on the cluster but it might not work everywhere (requires native deps).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions