Skip to content

[Hotfix 25.2]: Exclude pseudo/time step related columns when computing the average of forces #1121

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
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
20 changes: 12 additions & 8 deletions flow360/component/results/case_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,20 +511,19 @@ def include_time(self):
)

params = self._get_params_method()
if isinstance(params, Flow360Params):
if isinstance(params, SimulationParams):
try:
step_size = params.time_stepping.time_step_size
step_size = params.time_stepping.step_size
except KeyError:
raise ValueError(
"Cannot find time step size for this simulation. Check flow360.json file."
"Cannot find time step size for this simulation. Check simulation.json."
)

elif isinstance(params, SimulationParams):
elif isinstance(params, Flow360Params):
try:
step_size = params.time_stepping.step_size
step_size = params.time_stepping.time_step_size
except KeyError:
raise ValueError(
"Cannot find time step size for this simulation. Check simulation.json."
"Cannot find time step size for this simulation. Check flow360.json file."
)
else:
raise ValueError(
Expand Down Expand Up @@ -563,7 +562,12 @@ def _pseudo_step_masks(cls, df):

@classmethod
def _average_last_fraction(cls, df, average_fraction):
selected_fraction = df.tail(int(len(df) * average_fraction))
columns_filtered = [
col
for col in df.columns
if col not in [_PSEUDO_STEP, _PHYSICAL_STEP, _TIME, _TIME_UNITS]
]
selected_fraction = df[columns_filtered].tail(int(len(df) * average_fraction))
return selected_fraction.mean()

def get_averages(self, average_fraction):
Expand Down
Loading