From dc9f107c19d7dec02a25ecec29d4322bf74d5699 Mon Sep 17 00:00:00 2001 From: Martijn van den Ende Date: Mon, 27 Jan 2020 13:22:23 +0100 Subject: [PATCH] Fixed NumPy issue with float/integer numbers --- src/pyqdyn.py | 3 +-- test/singleasperity.py | 4 ++-- test/tserice.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pyqdyn.py b/src/pyqdyn.py index 8cb151d9..c35cd5cb 100644 --- a/src/pyqdyn.py +++ b/src/pyqdyn.py @@ -177,7 +177,7 @@ def __init__(self): # Output control parameters set_dict["V_TH"] = 1e-2 # Threshold velocity for seismic event set_dict["NTOUT_OT"] = 1 # Temporal interval (number of time steps) for time series output - set_dict["NTOUT"] = 1 # Temporal interval (number of time steps) for snapshout output + set_dict["NTOUT"] = 1 # Temporal interval (number of time steps) for snapshot output set_dict["NXOUT"] = 1 # Spatial interval (number of elements) for snapshot output set_dict["OX_SEQ"] = 0 # Type of snapshot outputs (0: all snapshots in single file, 1: one file per snapshot) set_dict["OX_DYN"] = 0 # Output specific snapshots of dynamic events defined by thresholds on peak slip velocity DYN_TH_ON and DYN_TH_OFF @@ -196,7 +196,6 @@ def __init__(self): set_dict["NPROC"] = 1 # Number of processors, default 1 = serial (no MPI) - self.set_dict = set_dict pass diff --git a/test/singleasperity.py b/test/singleasperity.py index 08d0c2cf..4a6da4bf 100644 --- a/test/singleasperity.py +++ b/test/singleasperity.py @@ -44,7 +44,7 @@ def render_RSF_mesh(set_dict): Lasp *= Lc L *= Lasp - N = np.power(2, np.ceil(np.log2(resolution*L/Lb))) + N = int(np.power(2, np.ceil(np.log2(resolution*L/Lb)))) x = np.linspace(-L/2, L/2, N, dtype=float) a = b*(1 + cab_ratio*(1 - 2*np.exp(-(2*x/Lasp)**6))) @@ -53,7 +53,7 @@ def render_RSF_mesh(set_dict): V0 = V0 * V_pl / np.mean(V0) result = { - "N": int(N), + "N": N, "L": L, "a": a, "V0": V0, diff --git a/test/tserice.py b/test/tserice.py index 376bf43d..58ef3b14 100644 --- a/test/tserice.py +++ b/test/tserice.py @@ -29,7 +29,7 @@ def run_test(self): p = self.p set_dict = p.set_dict t_yr = 3600 * 24 * 365.0 - N = np.power(2, 11) + N = int(np.power(2, 11)) # Compute depth-dependent parameters @@ -60,7 +60,7 @@ def run_test(self): set_dict["FINITE"] = 3 set_dict["TMAX"] = 500*t_yr set_dict["NTOUT"] = 1000 - set_dict["NXOUT"] = np.power(2, 3) + set_dict["NXOUT"] = int(np.power(2, 3)) set_dict["V_PL"] = 35e-3 / t_yr set_dict["MU"] = 3e10 set_dict["SIGMA"] = 1e8