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

Allow NumPy v2.0+ #391

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"numpy>=1.20, <2.0",
"numpy>=1.20",
"scipy",
"xarray",
"autograd",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def test_p_controller_resonant_wave(self,
scale_x_opt=1e-3,
scale_obj=1e-1,
optim_options={'ftol': 1e-10},
bounds_opt=((-1*np.infty, 0),),
bounds_opt=((-1*np.inf, 0),),
)

power_sol = -1*res[0]['fun']
Expand Down
10 changes: 5 additions & 5 deletions wecopttool/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from typing import Iterable, Callable, Any, Optional, Mapping, TypeVar, Union
from pathlib import Path
import warnings
from datetime import datetime
import datetime

from numpy.typing import ArrayLike
import autograd.numpy as np
Expand All @@ -80,7 +80,7 @@
warnings.filterwarnings("ignore", message=filter_msg)

# default values
_default_parameters = {'rho': 1025.0, 'g': 9.81, 'depth': np.infty}
_default_parameters = {'rho': 1025.0, 'g': 9.81, 'depth': np.inf}
_default_min_damping = 1e-6

# type aliases
Expand Down Expand Up @@ -895,7 +895,7 @@ def post_process(self,
"post-process and be passed as an input.")

def _postproc(res, waves, nsubsteps):
create_time = f"{datetime.utcnow()}"
create_time = f"{datetime.datetime.now(datetime.UTC)}"

omega_vals = np.concatenate([[0], waves.omega.values])
freq_vals = np.concatenate([[0], waves.freq.values])
Expand Down Expand Up @@ -1060,7 +1060,7 @@ def omega(self) -> ndarray:
@property
def period(self) -> ndarray:
"""Period vector [s]."""
return np.concatenate([[np.Infinity], 1/self._freq[1:]])
return np.concatenate([[np.inf], 1/self._freq[1:]])

@property
def w1(self) -> float:
Expand Down Expand Up @@ -2109,7 +2109,7 @@ def standard_forces(hydro_data: Dataset) -> TForceDict:

def run_bem(
fb: cpy.FloatingBody,
freq: Iterable[float] = [np.infty],
freq: Iterable[float] = [np.inf],
wave_dirs: Iterable[float] = [0],
rho: float = _default_parameters['rho'],
g: float = _default_parameters['g'],
Expand Down
4 changes: 2 additions & 2 deletions wecopttool/pto.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from scipy.linalg import block_diag
from scipy.optimize import OptimizeResult
from xarray import DataArray, Dataset
from datetime import datetime
import datetime
from scipy.optimize import OptimizeResult

from wecopttool.core import complex_to_real, td_to_fd
Expand Down Expand Up @@ -707,7 +707,7 @@ def post_process(self,
"""
def _postproc(wec, res, waves, nsubsteps):

create_time = f"{datetime.utcnow()}"
create_time = f"{datetime.datetime.now(datetime.UTC)}"

x_wec, x_opt = wec.decompose_state(res.x)

Expand Down
Loading