Skip to content

FIX: Improve robustness of field summary dictionary to DataFrame conversion #5986

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

Merged
merged 5 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/5986.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve robustness of field summary dictionary to DataFrame conversion
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/visualization/post/field_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
df = pd.DataFrame.from_dict(out_dict)
for col in ["Min", "Max", "Mean", "Stdev", "Total"]:
if col in df.columns:
df[col] = df[col].astype(float)
df[col] = pd.to_numeric(df[col], errors="coerce")

Check warning on line 235 in src/ansys/aedt/core/visualization/post/field_summary.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/visualization/post/field_summary.py#L235

Added line #L235 was not covered by tests
return df
return out_dict

Expand Down
Binary file modified tests/system/general/example_models/T98/TransientFS.aedtz
Binary file not shown.
7 changes: 6 additions & 1 deletion tests/system/general/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@ def test077__transient_fs(self, ipk):
df = fs.get_field_summary_data(pandas_output=True)
assert not df["Mean"].empty

fs2 = ipk.post.create_field_summary()
fs2.add_calculation("Boundary", "Surface", "Network1", "Temperature", time="4s")
df = fs2.get_field_summary_data(pandas_output=True)
assert not df["Mean"].empty

@pytest.mark.parametrize("ipk", [transient_fs], indirect=True)
def test078__folder_settings(self, ipk):
plot_object = ipk.post.create_fieldplot_surface(
Expand Down Expand Up @@ -1951,7 +1956,7 @@ def test080__get_object_material_properties(self, ipk):
@pytest.mark.parametrize("ipk", [transient_fs], indirect=True)
def test081__get_max_temp_location_transient(self, ipk):
with pytest.raises(ValueError):
ipk.post.get_temperature_extremum(assignment="Box2", max_min="Max", location="Surface")
ipk.post.get_temperature_extremum(assignment="Box3", max_min="Max", location="Surface")
max_temp = ipk.post.get_temperature_extremum(assignment="Box1", max_min="Max", location="Surface", time="1s")
assert isinstance(max_temp, tuple)
assert len(max_temp[0]) == 3
Expand Down