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

AttributeError: 'Variables' object has no attribute 'create_output_dict' #586

Open
wd15 opened this issue Dec 20, 2022 · 1 comment
Open
Labels
Milestone

Comments

@wd15
Copy link
Contributor

wd15 commented Dec 20, 2022

It looks like Sfepy has changed its API between version 2022.1 and 2022.3. Need to fix.

@btthorn1
Copy link

Can work around in colab to restore functional solve_fe() if you copy the elastic_fe.py class from github into your notebook and change get_displacement(vec,shape) to the following (the attribute create_output_dict() needed to be changed to create_output() to be compatible with the new SfePy API):
def get_displacement(vec, shape):
"""Extract the displacement data
Args:
#vec: the output from problem.solve()
#shape: the grid shape
Returns:
#displacement field
"""
as_dict = (
lambda x: x.create_output()
if hasattr(x, "create_output()")
else x.create_output()
)
return pipe(
vec,
as_dict,
lambda x: x['u'].data,
lambda x: np.reshape(x, (tuple(x + 1 for x in shape) + x.shape[-1:])),
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants