Skip to content

Commit

Permalink
Fix #106
Browse files Browse the repository at this point in the history
We can now use newer scipy with its `simpson` integration method.
  • Loading branch information
JiriPavela committed Jul 4, 2024
1 parent 710f610 commit 75384ab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion perun/check/methods/integral_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def compute_nparam_integral(x_pts: list[float], y_pts: list[float]) -> float:
:param list y_pts: list of y-coordinates from non-parametric model
:return float: the value of integral computed using samples
"""
return integrate.simps(y_pts, x_pts, even="avg")
return integrate.simpson(y_pts, x=x_pts)


def execute_analysis(
Expand Down
2 changes: 1 addition & 1 deletion perun/check/methods/local_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def reshape_array(array: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
# compute the all statistical metrics on the specified intervals
return {
# integral
"int": np.atleast_1d(integrate.simps(y_array, x_array, axis=axis, even="avg")),
"int": np.atleast_1d(integrate.simpson(y_array, x=x_array, axis=axis)),
# average/mean
"avg": np.atleast_1d(np.nanmean(y_array, axis=axis)),
# median/2.percentile
Expand Down
21 changes: 3 additions & 18 deletions perun/testing/mock_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,6 @@

INTEGRAL_COMPARISON_RESULTS = [
DegradationInfo(res=pc.MaybeOptimization, loc="alloc", fb="constant", tt="constant", rd=-0.18),
DegradationInfo(
res=pc.MaybeDegradation,
loc="alloc",
fb="regressogram",
tt="regressogram",
rd=0.16,
),
DegradationInfo(res=pc.Degradation, loc="ga_grow", fb="constant", tt="constant", rd=1210.03),
DegradationInfo(res=pc.Degradation, loc="ga_init2", fb="quadratic", tt="quadratic", rd=2.33),
DegradationInfo(res=pc.Degradation, loc="skipwhite", fb="constant", tt="constant", rd=0.30),
Expand All @@ -243,14 +236,14 @@
loc="test_for_static",
fb="moving_average",
tt="moving_average",
rd=0.91,
rd=1.22,
),
DegradationInfo(
res=pc.MaybeDegradation,
loc="test_for_static",
fb="regressogram",
tt="regressogram",
rd=0.16,
rd=0.11,
),
DegradationInfo(
res=pc.MaybeDegradation,
Expand All @@ -264,7 +257,7 @@
loc="vim_regexec",
fb="regressogram",
tt="regressogram",
rd=0.42,
rd=0.27,
),
]

Expand All @@ -277,14 +270,6 @@
rd=-0.16,
pi=[(pc.MaybeOptimization, -0.16, 5.45, 5.45)],
),
DegradationInfo(
res=pc.MaybeDegradation,
loc="alloc",
fb="regressogram",
tt="regressogram",
rd=0.11,
pi=[(pc.MaybeDegradation, 0.11, 0.0, 275.0)],
),
DegradationInfo(
res=pc.Degradation,
loc="ga_grow",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies = [
"pandas>=2.0",
"statsmodels>=0.14",
"scikit-learn>=1.3",
"scipy>=1.10,<1.14", # 1.11+ dropped support for Python 3.8
"scipy>=1.13",
"networkx>=3.1",

# Plotting / visualization / output
Expand Down

0 comments on commit 75384ab

Please sign in to comment.