Skip to content

Commit 33dd776

Browse files
authored
Fix return type in petab.v2.calculate (#464)
Annotation says float, but functions returned np.float64.
1 parent 5429412 commit 33dd776

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

petab/v2/calculate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ def calculate_chi2(
308308
chi2s = [
309309
calculate_chi2_for_table_from_residuals(df) for df in residual_dfs
310310
]
311-
return sum(chi2s)
311+
return float(sum(chi2s))
312312

313313

314314
def calculate_chi2_for_table_from_residuals(
315315
residual_df: pd.DataFrame,
316316
) -> float:
317317
"""Compute chi2 value for a single residual table."""
318-
return (np.array(residual_df[RESIDUAL]) ** 2).sum()
318+
return float((np.array(residual_df[RESIDUAL]) ** 2).sum())
319319

320320

321321
def calculate_llh(
@@ -362,7 +362,7 @@ def calculate_llh(
362362
measurement_df, simulation_df, observable_df, parameter_df
363363
)
364364
llhs.append(_llh)
365-
return sum(llhs)
365+
return float(sum(llhs))
366366

367367

368368
def calculate_llh_for_table(
@@ -423,7 +423,7 @@ def calculate_llh_for_table(
423423
measurement, simulation, obs_scale, noise_distr, noise_value
424424
)
425425
llhs.append(llh)
426-
return sum(llhs)
426+
return float(sum(llhs))
427427

428428

429429
def calculate_single_llh(

0 commit comments

Comments
 (0)