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

NumPy 2.0 compatibility #540

Merged
merged 4 commits into from
Jul 3, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `SECURITY.md`
### Changed
- Bug report template modified
- `thresholds_calc` function updated
- `__midpoint_numeric_integral__` function updated
- `__trapezoidal_numeric_integral__` function updated
- Diagrams updated
- Document modified
- `AUTHORS.md` updated
Expand Down
4 changes: 2 additions & 2 deletions Otherfiles/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# PyCM Release Instructions

#### Last Update: 2023-11-25
**Last Update: 2024-07-02**

1. Create the `release` branch under `dev`
2. Update all version tags
Expand Down Expand Up @@ -54,5 +54,5 @@
1. `index.html`
4. Update size of files
1. `index.html`
5. Update `doc` folder (Step **12.2**)
5. Update `doc` folder (Step **13.2**)
6. Copy `doc/Document_files/cm1.html` to `test.html`
4 changes: 2 additions & 2 deletions pycm/pycm_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def __trapezoidal_numeric_integral__(x, y):
area = numpy.trapz(y, x)
if isinstance(area, numpy.memmap):
area = area.dtype.type(area)
return abs(area)
return abs(float(area))


def __midpoint_numeric_integral__(x, y):
Expand All @@ -413,4 +413,4 @@ def __midpoint_numeric_integral__(x, y):
dx = numpy.diff(x)
y_midpoints = 0.5 * (y[:-1] + y[1:])
area = numpy.sum(dx * y_midpoints)
return abs(area)
return abs(float(area))
2 changes: 1 addition & 1 deletion pycm/pycm_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def thresholds_calc(probs):
:return: thresholds as list
"""
thresholds = numpy.ravel(probs)
thresholds = sorted(set(thresholds))
thresholds = sorted(set(thresholds.tolist()))
return thresholds


Expand Down
Loading