Skip to content

Commit

Permalink
Merge pull request #3 from hz-b/dev/feature/numpy-2-compat
Browse files Browse the repository at this point in the history
[FIX] dtype numpy 2. and 1.x compatible
  • Loading branch information
Sulimankhail authored Jul 9, 2024
2 parents 8e051ef + f7773a3 commit 2dcba20
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bact_math_utils/exp_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def scaled_exp_df(t, c0, tau, b=None, t0=None):
dfs = [df_c0, df_dtau]

if b is not None:
df_db = np.ones(df_c0.shape, dtype=np.float)
df_db = np.ones(df_c0.shape, dtype=float)
dfs.append(df_db)

if t0 is not None:
Expand Down
2 changes: 1 addition & 1 deletion bact_math_utils/life_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def beam_decay_fsdf(t, u, c0, tauG, b, c, offset):
ys = scaled_exp(t, 1, tau)

nu = len(u)
df = np.zeros((nu, 5), np.float_)
df = np.zeros((nu, 5), float)

# Derviatives with respect to calculate_lifetime
df_scale = -c0 * t / tau2 * ys
Expand Down
2 changes: 1 addition & 1 deletion bact_math_utils/linear_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def linear_fit_1d(x: np.ndarray, y: np.ndarray) -> (np.ndarray, np.ndarray):
"""
N = len(x)
X = np.ones((N, 2), np.float_)
X = np.ones((N, 2), float)
X[:, 0] = x

p, residues, rank, s = linalg.lstsq(X, y)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linear_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def compute_cov(x):
"""Compute covariance for linear fit with independent x"""
N = len(x)
X = np.ones((N, 2), np.float_)
X = np.ones((N, 2), float)
X[:, 0] = x

residues = 1
Expand Down

0 comments on commit 2dcba20

Please sign in to comment.