avoid deprecation warnings about use of numpy.float etc

snuffler-improvements
Sebastian Heimann 2 years ago
parent e5a2daeab7
commit 6fccf607c1

@ -21,7 +21,7 @@ for distance in distances:
for ray in rays[:1]:
data.append((distance, ray.t))
phase_distances, phase_time = num.array(data, dtype=num.float).T
phase_distances, phase_time = num.array(data, dtype=float).T
# Plot the arrival times
mpl_init(fontsize=fontsize)

@ -16,9 +16,9 @@ class CombiSource(gf.Source):
if subsources:
lats = num.array(
[subsource.lat for subsource in subsources], dtype=num.float)
[subsource.lat for subsource in subsources], dtype=float)
lons = num.array(
[subsource.lon for subsource in subsources], dtype=num.float)
[subsource.lon for subsource in subsources], dtype=float)
assert num.all(lats == lats[0]) and num.all(lons == lons[0])
lat, lon = lats[0], lons[0]

@ -23,9 +23,9 @@ def make_seismogram(
if stf is None:
stf = Impulse()
x = num.asarray(x, num.float)
f = num.asarray(f, num.float)
m6 = num.asarray(m6, num.float)
x = num.asarray(x, float)
f = num.asarray(f, float)
m6 = num.asarray(m6, float)
r = math.sqrt(num.sum(x**2))
@ -48,7 +48,7 @@ def make_seismogram(
specs = []
for component in 'ned':
if component in wanted_components:
specs.append(num.zeros(nspec, dtype=num.complex))
specs.append(num.zeros(nspec, dtype=complex))
else:
specs.append(None)
@ -61,7 +61,7 @@ def make_seismogram(
out_spec_offset = 0.0
omega = out_spec_offset + out_spec_delta * num.arange(nspec)
coeffs_stf = stf(omega/(2.*math.pi)).astype(num.complex)
coeffs_stf = stf(omega/(2.*math.pi)).astype(complex)
coeffs_stf *= num.exp(1.0j * omega * tstart)
omega_max = 2.0 * math.pi * 0.5 / deltat
@ -166,7 +166,7 @@ class Impulse(object):
return None
def __call__(self, f):
return num.ones(f.size, dtype=num.complex)
return num.ones(f.size, dtype=complex)
class Gauss(object):

@ -394,7 +394,7 @@ as in --phases.''')
else:
distances = num.array(
list(map(
float, options.sdist.split(','))), dtype=num.float)
float, options.sdist.split(','))), dtype=float)
if not as_degrees:
distances *= r2d * cake.km / cake.earthradius
@ -415,7 +415,7 @@ as in --phases.''')
if distances is not None:
distances = num.concatenate((distances, [distance_sr]))
else:
distances = num.array([distance_sr], dtype=num.float)
distances = num.array([distance_sr], dtype=float)
if distances is not None:
d['distances'] = distances

@ -1171,7 +1171,7 @@ def psv_surface(material, p, energy=False):
scatter = num.array([
[- vsp_term**2 + pcc_term, 4.0*p*coslam/vp*vsp_term],
[4.0*p*cosphi/vs*vsp_term, vsp_term**2 - pcc_term]],
dtype=num.complex) / denom
dtype=complex) / denom
if not energy:
return scatter
@ -1234,7 +1234,7 @@ def psv_solid(material1, material2, p, energy=False):
2.0*rho2*vs2**2*p*cosphi2, rho2*vs2*(1.0-2.0*vs2**2*p**2)],
[-rho1*vp1*(1.0-2.0*vs1**2*p**2), 2.0*rho1*vs1**2*p*coslam1,
rho2*vp2*(1.0-2.0*vs2**2*p**2), -2.0*rho2*vs2**2*p*coslam2]],
dtype=num.complex)
dtype=complex)
N = M.copy()
N[0] *= -1.0
N[3] *= -1.0
@ -1251,7 +1251,7 @@ def psv_solid(material1, material2, p, energy=False):
vs2 = vp2*1e-16
normvec = num.array([
vp1*rho1*(cosphi1+eps), vs1*rho1*(coslam1+eps),
vp2*rho2*(cosphi2+eps), vs2*rho2*(coslam2+eps)], dtype=num.complex)
vp2*rho2*(cosphi2+eps), vs2*rho2*(coslam2+eps)], dtype=complex)
escatter = scatter*num.conj(scatter) * num.real(
normvec[:, num.newaxis] / normvec[num.newaxis, :])
@ -2547,7 +2547,7 @@ class RayPath(object):
t_ = t[i]
indices = num.where(num.logical_and(0. <= t_, t_ <= tmax[i]))[0]
n = indices.size + 2
zs_, xs_, ts_ = [num.empty(n, dtype=num.float) for j in range(3)]
zs_, xs_, ts_ = [num.empty(n, dtype=float) for j in range(3)]
zs_[1:-1] = z[i, indices]
xs_[1:-1] = x[i, indices]
ts_[1:-1] = t[i, indices]
@ -2581,7 +2581,7 @@ class RayPath(object):
self.critical_pstop(endgaps))
if pcrit < self._pmin:
empty = num.array([], dtype=num.float)
empty = num.array([], dtype=float)
return empty, empty, empty
elif pcrit >= self._pmax:
@ -2590,7 +2590,7 @@ class RayPath(object):
else:
n = num.searchsorted(cp, pcrit) + 1
rp, rx, rt = num.empty((3, n), dtype=num.float)
rp, rx, rt = num.empty((3, n), dtype=float)
rp[:-1] = cp[:n-1]
rx[:-1] = cx[:n-1]
rt[:-1] = ct[:n-1]
@ -3387,7 +3387,7 @@ class LayeredModel(object):
(distance, arrival time)
'''
distances = num.asarray(distances, dtype=num.float)
distances = num.asarray(distances, dtype=float)
arrivals = []
for path in self.gather_paths(phases, zstart=zstart, zstop=zstop):
@ -3543,7 +3543,7 @@ class LayeredModel(object):
mat = self.material(z, direction)
data.append(mat.astuple())
data = num.array(data, dtype=num.float)
data = num.array(data, dtype=float)
data_means = num.mean(data, axis=0)
nmax = len(layers) // 2
accept = False

@ -117,7 +117,7 @@ class GlobalCMT(EarthquakeCatalog):
[data.mrr, data.mrt, data.mrp,
data.mrt, data.mtt, data.mtp,
data.mrp, data.mtp, data.mpp],
dtype=num.float).reshape(3, 3)
dtype=float).reshape(3, 3)
m *= 10.0**(data.exponent-7)
mt = MomentTensor(m_up_south_east=m)

@ -204,7 +204,7 @@ mantle ave. vp, vs, rho: %15.5g %15.5g %15.5g
def _sa2arr(sa):
return num.array([float(x) for x in sa], dtype=num.float)
return num.array([float(x) for x in sa], dtype=float)
def _wrap(x, mi, ma):
@ -411,7 +411,7 @@ def plot(func, filename, **kwargs):
lats = num.linspace(-90., 90., nlats)
lons = num.linspace(-180., 180., nlons)
vecfunc = num.vectorize(func, [num.float])
vecfunc = num.vectorize(func, [float])
latss, lonss = num.meshgrid(lats, lons)
thickness = vecfunc(latss, lonss)

@ -25,7 +25,7 @@ class Plate(Object):
name = String.T(
help='Name of the tectonic plate.')
points = Array.T(
dtype=num.float, shape=(None, 2),
dtype=float, shape=(None, 2),
help='Points on the plate.')
def max_interpoint_distance(self):
@ -45,9 +45,9 @@ class Boundary(Object):
name1 = String.T()
name2 = String.T()
kind = String.T()
points = Array.T(dtype=num.float, shape=(None, 2))
cpoints = Array.T(dtype=num.float, shape=(None, 2))
itypes = Array.T(dtype=num.int, shape=(None))
points = Array.T(dtype=float, shape=(None, 2))
cpoints = Array.T(dtype=float, shape=(None, 2))
itypes = Array.T(dtype=int, shape=(None))
def split_types(self, groups=None):
xyz = od.latlon_to_xyz(self.points)
@ -67,7 +67,7 @@ class Boundary(Object):
groupmap = num.array(
[d[name] for name in self._index_to_type],
dtype=num.int)
dtype=int)
iswitch = num.concatenate(
([0],
@ -196,8 +196,8 @@ class PeterBird2003(PlatesDataset):
d2 = {}
for k in d:
d2[k] = (
num.array([x[:2] for x in d[k]], dtype=num.float),
num.array([x[2] for x in d[k]], dtype=num.int))
num.array([x[:2] for x in d[k]], dtype=float),
num.array([x[2] for x in d[k]], dtype=int))
fpath = self.fpath('PB2002_boundaries.dig.txt')
boundaries = []
@ -213,7 +213,7 @@ class PeterBird2003(PlatesDataset):
name1=name1,
name2=name2,
kind=kind,
points=num.array(data, dtype=num.float),
points=num.array(data, dtype=float),
cpoints=cpoints,
itypes=itypes))
@ -242,7 +242,7 @@ class PeterBird2003(PlatesDataset):
if line.startswith(b'***'):
plates.append(Plate(
name=name,
points=num.array(data, dtype=num.float)))
points=num.array(data, dtype=float)))
data = []
elif line.startswith(b' '):
@ -335,7 +335,7 @@ class GSRM1(StrainRateDataset):
t = line.split()
data.append(list(map(float, t)))
arr = num.array(data, dtype=num.float)
arr = num.array(data, dtype=float)
if region is not None:
points = arr[:, 1::-1]

@ -41,7 +41,7 @@ class Tile(object):
kernel = num.ones((ndeci+1, ndeci+1))
kernel /= num.sum(kernel)
data = scipy.signal.convolve2d(
self.data.astype(num.float), kernel, mode='valid')
self.data.astype(float), kernel, mode='valid')
self.data = data[::ndeci, ::ndeci].astype(self.data.dtype)
self.xmin += ndeci/2

@ -60,7 +60,7 @@ def str_complex_vals(vals):
class PoelSourceFunction(Object):
data = Array.T(shape=(None, 2), dtype=num.float)
data = Array.T(shape=(None, 2), dtype=float)
def string_for_config(self):
return '\n'.join([
@ -69,7 +69,7 @@ class PoelSourceFunction(Object):
class PoelModel(Object):
data = Array.T(shape=(None, 6), dtype=num.float)
data = Array.T(shape=(None, 6), dtype=float)
def string_for_config(self):
srows = []
@ -88,14 +88,14 @@ class PoelConfig(Object):
source_function_p = Float.T(default=1.0)
source_function_i = PoelSourceFunction.T(
default=PoelSourceFunction.D(
data=num.array([[0., 0.], [10., 1.]], dtype=num.float)))
data=num.array([[0., 0.], [10., 1.]], dtype=float)))
t_window = Float.T(default=500.)
accuracy = Float.T(default=0.025)
isurfcon = Int.T(default=1)
model = PoelModel.T(
default=PoelModel(data=num.array([[
0.00, 0.4E+09, 0.2, 0.4, 0.75, 5.00]], dtype=num.float)))
0.00, 0.4E+09, 0.2, 0.4, 0.75, 5.00]], dtype=float)))
def items(self):
return dict(self.T.inamevals(self))
@ -109,13 +109,13 @@ class PoelConfigFull(PoelConfig):
no_depths = Int.T(default=10)
depths = Array.T(
shape=(None,),
dtype=num.float,
default=num.array([10.0, 100.0], dtype=num.float))
dtype=float,
default=num.array([10.0, 100.0], dtype=float))
sw_equidistant_x = Int.T(default=1)
no_distances = Int.T(default=10)
distances = Array.T(
shape=(None,),
dtype=num.float,
dtype=float,
default=num.array([10., 100.]))
no_t_samples = Int.T(default=51)
@ -459,7 +459,7 @@ poel has been invoked as "%s"''' % (
fns = self.config.get_output_filenames(self.tempdir)
traces = []
for comp, fn in zip(poel_components, fns):
data = num.loadtxt(fn, skiprows=1, dtype=num.float)
data = num.loadtxt(fn, skiprows=1, dtype=float)
nsamples, ntraces = data.shape
ntraces -= 1
tmin = data[0, 0]

@ -1353,7 +1353,7 @@ in the directory {dir}'''.format(
if not os.path.exists(fn):
continue
data = num.loadtxt(fn, skiprows=1, dtype=num.float)
data = num.loadtxt(fn, skiprows=1, dtype=float)
try:
_, idxs = pscmp_component_mapping[component]

@ -712,7 +712,7 @@ in the directory %s'''.lstrip() % (
if not os.path.exists(fn):
continue
data = num.loadtxt(fn, skiprows=1, dtype=num.float)
data = num.loadtxt(fn, skiprows=1, dtype=float)
nsamples, ntraces = data.shape
ntraces -= 1
vred = self.config.time_reduction_velocity

@ -738,7 +738,7 @@ in the directory %s'''.lstrip() % (
def get_traces(self):
fn = self.config.get_output_filename(self.tempdir)
data = num.loadtxt(fn, skiprows=1, dtype=num.float)
data = num.loadtxt(fn, skiprows=1, dtype=float)
nsamples, ntraces = data.shape
deltat = (data[-1, 0] - data[0, 0]) / (nsamples - 1)
toffset = data[0, 0]

@ -738,7 +738,7 @@ qssp has been invoked as "%s"'''.lstrip() % (
fns = self.config.get_output_filenames(self.tempdir)
traces = {}
for comp, fn in zip(self.config.components, fns):
data = num.loadtxt(fn, skiprows=1, dtype=num.float)
data = num.loadtxt(fn, skiprows=1, dtype=float)
nsamples, ntraces = data.shape
ntraces -= 1
deltat = (data[-1, 0] - data[0, 0])/(nsamples-1)

@ -17,7 +17,7 @@ from . import store
def int_arr(*args):
return num.array(args, dtype=num.int)
return num.array(args, dtype=int)
class Interrupted(store.StoreError):

@ -102,7 +102,7 @@ class Result(SeismosizerResult):
class StaticResult(SeismosizerResult):
result = Dict.T(
String.T(),
Array.T(shape=(None,), dtype=num.float, serialize_as='base64'))
Array.T(shape=(None,), dtype=float, serialize_as='base64'))
class GNSSCampaignResult(StaticResult):
@ -114,11 +114,11 @@ class SatelliteResult(StaticResult):
theta = Array.T(
optional=True,
shape=(None,), dtype=num.float, serialize_as='base64')
shape=(None,), dtype=float, serialize_as='base64')
phi = Array.T(
optional=True,
shape=(None,), dtype=num.float, serialize_as='base64')
shape=(None,), dtype=float, serialize_as='base64')
class KiteSceneResult(SatelliteResult):
@ -640,19 +640,19 @@ class OutOfBounds(Exception):
class MultiLocation(Object):
lats = Array.T(
optional=True, shape=(None,), dtype=num.float,
optional=True, shape=(None,), dtype=float,
help='Latitudes of targets.')
lons = Array.T(
optional=True, shape=(None,), dtype=num.float,
optional=True, shape=(None,), dtype=float,
help='Longitude of targets.')
north_shifts = Array.T(
optional=True, shape=(None,), dtype=num.float,
optional=True, shape=(None,), dtype=float,
help='North shifts of targets.')
east_shifts = Array.T(
optional=True, shape=(None,), dtype=num.float,
optional=True, shape=(None,), dtype=float,
help='East shifts of targets.')
elevation = Array.T(
optional=True, shape=(None,), dtype=num.float,
optional=True, shape=(None,), dtype=float,
help='Elevations of targets.')
def __init__(self, *args, **kwargs):
@ -763,14 +763,14 @@ class DiscretizedSource(Object):
specified directly (:py:attr:`lats`, :py:attr:`lons`).
'''
times = Array.T(shape=(None,), dtype=num.float)
lats = Array.T(shape=(None,), dtype=num.float, optional=True)
lons = Array.T(shape=(None,), dtype=num.float, optional=True)
times = Array.T(shape=(None,), dtype=float)
lats = Array.T(shape=(None,), dtype=float, optional=True)
lons = Array.T(shape=(None,), dtype=float, optional=True)
lat = Float.T(optional=True)
lon = Float.T(optional=True)
north_shifts = Array.T(shape=(None,), dtype=num.float, optional=True)
east_shifts = Array.T(shape=(None,), dtype=num.float, optional=True)
depths = Array.T(shape=(None,), dtype=num.float)
north_shifts = Array.T(shape=(None,), dtype=float, optional=True)
east_shifts = Array.T(shape=(None,), dtype=float, optional=True)
depths = Array.T(shape=(None,), dtype=float)
@classmethod
def check_scheme(cls, scheme):
@ -944,8 +944,8 @@ class DiscretizedSource(Object):
lats, lons = num.hstack(latlons)
if all((s.lats is None and s.lons is None) for s in sources):
rlats = num.array([s.lat for s in sources], dtype=num.float)
rlons = num.array([s.lon for s in sources], dtype=num.float)
rlats = num.array([s.lat for s in sources], dtype=float)
rlons = num.array([s.lon for s in sources], dtype=float)
same_ref = num.all(
rlats == rlats[0]) and num.all(rlons == rlons[0])
else:
@ -1011,7 +1011,7 @@ class DiscretizedSource(Object):
class DiscretizedExplosionSource(DiscretizedSource):
m0s = Array.T(shape=(None,), dtype=num.float)
m0s = Array.T(shape=(None,), dtype=float)
provided_schemes = (
'elastic2',
@ -1131,7 +1131,7 @@ class DiscretizedExplosionSource(DiscretizedSource):
class DiscretizedSFSource(DiscretizedSource):
forces = Array.T(shape=(None, 3), dtype=num.float)
forces = Array.T(shape=(None, 3), dtype=float)
provided_schemes = (
'elastic5',
@ -1221,7 +1221,7 @@ class DiscretizedSFSource(DiscretizedSource):
class DiscretizedMTSource(DiscretizedSource):
m6s = Array.T(
shape=(None, 6), dtype=num.float,
shape=(None, 6), dtype=float,
help='rows with (m_nn, m_ee, m_dd, m_ne, m_nd, m_ed)')
provided_schemes = (
@ -1354,7 +1354,7 @@ class DiscretizedMTSource(DiscretizedSource):
class DiscretizedPorePressureSource(DiscretizedSource):
pp = Array.T(shape=(None,), dtype=num.float)
pp = Array.T(shape=(None,), dtype=float)
provided_schemes = (
'poroelastic10',
@ -2000,14 +2000,14 @@ class ConfigTypeA(Config):
def _update(self):
self.mins = num.array(
[self.source_depth_min, self.distance_min], dtype=num.float)
[self.source_depth_min, self.distance_min], dtype=float)
self.maxs = num.array(
[self.source_depth_max, self.distance_max], dtype=num.float)
[self.source_depth_max, self.distance_max], dtype=float)
self.deltas = num.array(
[self.source_depth_delta, self.distance_delta],
dtype=num.float)
dtype=float)
self.ns = num.floor((self.maxs - self.mins) / self.deltas +
vicinity_eps).astype(num.int) + 1
vicinity_eps).astype(int) + 1
self.effective_maxs = self.mins + self.deltas * (self.ns - 1)
self.deltat = 1.0/self.sample_rate
self.nrecords = num.product(self.ns) * self.ncomponents
@ -2081,10 +2081,10 @@ class ConfigTypeA(Config):
vb_fl = 1.0 - (xb - xb_fl)
vb_ce = (1.0 - (xb_ce - xb)) * (xb_ce - xb_fl)
ia_fl = xa_fl.astype(num.int)
ia_ce = xa_ce.astype(num.int)
ib_fl = xb_fl.astype(num.int)
ib_ce = xb_ce.astype(num.int)
ia_fl = xa_fl.astype(int)
ia_ce = xa_ce.astype(int)
ib_fl = xb_fl.astype(int)
ib_ce = xb_ce.astype(int)
if num.any(ia_fl < 0) or num.any(ia_fl >= na):
raise OutOfBounds()
@ -2098,13 +2098,13 @@ class ConfigTypeA(Config):
if num.any(ib_ce < 0) or num.any(ib_ce >= nb):
raise OutOfBounds()
irecords = num.empty(a.size*4, dtype=num.int)
irecords = num.empty(a.size*4, dtype=int)
irecords[0::4] = ia_fl*nb*ng + ib_fl*ng + ig
irecords[1::4] = ia_ce*nb*ng + ib_fl*ng + ig
irecords[2::4] = ia_fl*nb*ng + ib_ce*ng + ig
irecords[3::4] = ia_ce*nb*ng + ib_ce*ng + ig
weights = num.empty(a.size*4, dtype=num.float)
weights = num.empty(a.size*4, dtype=float)
weights[0::4] = va_fl * vb_fl
weights[1::4] = va_ce * vb_fl
weights[2::4] = va_fl * vb_ce
@ -2257,22 +2257,22 @@ class ConfigTypeB(Config):
self.receiver_depth_min,
self.source_depth_min,
self.distance_min],
dtype=num.float)
dtype=float)
self.maxs = num.array([
self.receiver_depth_max,
self.source_depth_max,
self.distance_max],
dtype=num.float)
dtype=float)
self.deltas = num.array([
self.receiver_depth_delta,
self.source_depth_delta,
self.distance_delta],
dtype=num.float)
dtype=float)
self.ns = num.floor((self.maxs - self.mins) / self.deltas +
vicinity_eps).astype(num.int) + 1
vicinity_eps).astype(int) + 1
self.effective_maxs = self.mins + self.deltas * (self.ns - 1)
self.deltat = 1.0/self.sample_rate
self.nrecords = num.product(self.ns) * self.ncomponents
@ -2352,12 +2352,12 @@ class ConfigTypeB(Config):
vc_fl = 1.0 - (xc - xc_fl)
vc_ce = (1.0 - (xc_ce - xc)) * (xc_ce - xc_fl)
ia_fl = xa_fl.astype(num.int)
ia_ce = xa_ce.astype(num.int)
ib_fl = xb_fl.astype(num.int)
ib_ce = xb_ce.astype(num.int)
ic_fl = xc_fl.astype(num.int)
ic_ce = xc_ce.astype(num.int)
ia_fl = xa_fl.astype(int)
ia_ce = xa_ce.astype(int)
ib_fl = xb_fl.astype(int)
ib_ce = xb_ce.astype(int)
ic_fl = xc_fl.astype(int)
ic_ce = xc_ce.astype(int)
if num.any(ia_fl < 0) or num.any(ia_fl >= na):
raise OutOfBounds()
@ -2377,7 +2377,7 @@ class ConfigTypeB(Config):
if num.any(ic_ce < 0) or num.any(ic_ce >= nc):
raise OutOfBounds()
irecords = num.empty(a.size*8, dtype=num.int)
irecords = num.empty(a.size*8, dtype=int)
irecords[0::8] = ia_fl*nb*nc*ng + ib_fl*nc*ng + ic_fl*ng + ig
irecords[1::8] = ia_ce*nb*nc*ng + ib_fl*nc*ng + ic_fl*ng + ig
irecords[2::8] = ia_fl*nb*nc*ng + ib_ce*nc*ng + ic_fl*ng + ig
@ -2387,7 +2387,7 @@ class ConfigTypeB(Config):
irecords[6::8] = ia_fl*nb*nc*ng + ib_ce*nc*ng + ic_ce*ng + ig
irecords[7::8] = ia_ce*nb*nc*ng + ib_ce*nc*ng + ic_ce*ng + ig
weights = num.empty(a.size*8, dtype=num.float)
weights = num.empty(a.size*8, dtype=float)
weights[0::8] = va_fl * vb_fl * vc_fl
weights[1::8] = va_ce * vb_fl * vc_fl
weights[2::8] = va_fl * vb_ce * vc_fl
@ -2588,22 +2588,22 @@ class ConfigTypeC(Config):
self.source_depth_min,
self.source_east_shift_min,
self.source_north_shift_min],
dtype=num.float)
dtype=float)
self.maxs = num.array([
self.source_depth_max,
self.source_east_shift_max,
self.source_north_shift_max],
dtype=num.float)
dtype=float)
self.deltas = num.array([
self.source_depth_delta,
self.source_east_shift_delta,
self.source_north_shift_delta],
dtype=num.float)
dtype=float)
self.ns = num.floor((self.maxs - self.mins) / self.deltas +
vicinity_eps).astype(num.int) + 1
vicinity_eps).astype(int) + 1
self.effective_maxs = self.mins + self.deltas * (self.ns - 1)
self.deltat = 1.0/self.sample_rate
self.nreceivers = len(self.receivers)
@ -2690,12 +2690,12 @@ class ConfigTypeC(Config):
vc_fl = 1.0 - (xc - xc_fl)
vc_ce = (1.0 - (xc_ce - xc)) * (xc_ce - xc_fl)
ia_fl = xa_fl.astype(num.int)
ia_ce = xa_ce.astype(num.int)
ib_fl = xb_fl.astype(num.int)
ib_ce = xb_ce.astype(num.int)
ic_fl = xc_fl.astype(num.int)
ic_ce = xc_ce.astype(num.int)
ia_fl = xa_fl.astype(int)
ia_ce = xa_ce.astype(int)
ib_fl = xb_fl.astype(int)
ib_ce = xb_ce.astype(int)
ic_fl = xc_fl.astype(int)
ic_ce = xc_ce.astype(int)
if num.any(ia_fl < 0) or num.any(ia_fl >= na):
raise OutOfBounds()
@ -2717,7 +2717,7 @@ class ConfigTypeC(Config):
irig = ir*na*nb*nc*ng + ig
irecords = num.empty(a.size*8, dtype=num.int)
irecords = num.empty(a.size*8, dtype=int)
irecords[0::8] = ia_fl*nb*nc*ng + ib_fl*nc*ng + ic_fl*ng + irig
irecords[1::8] = ia_ce*nb*nc*ng + ib_fl*nc*ng + ic_fl*ng + irig
irecords[2::8] = ia_fl*nb*nc*ng + ib_ce*nc*ng + ic_fl*ng + irig
@ -2727,7 +2727,7 @@ class ConfigTypeC(Config):
irecords[6::8] = ia_fl*nb*nc*ng + ib_ce*nc*ng + ic_ce*ng + irig
irecords[7::8] = ia_ce*nb*nc*ng + ib_ce*nc*ng + ic_ce*ng + irig
weights = num.empty(a.size*8, dtype=num.float)
weights = num.empty(a.size*8, dtype=float)
weights[0::8] = va_fl * vb_fl * vc_fl
weights[1::8] = va_ce * vb_fl * vc_fl
weights[2::8] = va_fl * vb_ce * vc_fl
@ -2774,7 +2774,7 @@ class ConfigTypeC(Config):
source_depths = source.depths - self.source_origin.depth
n = dists.size
ireceivers = num.empty(nc, dtype=num.int)
ireceivers = num.empty(nc, dtype=int)
ireceivers.fill(self.lookup_ireceiver(receiver))
return (ireceivers,
@ -2992,7 +2992,7 @@ def start_stop_num(start, stop, step, num, mi, ma, inc, eps=1e-5):
def nditer_outer(x):
return num.nditer(
x, op_axes=(num.identity(len(x), dtype=num.int)-1).tolist())
x, op_axes=(num.identity(len(x), dtype=int)-1).tolist())
def nodes(xs):
@ -3002,15 +3002,15 @@ def nodes(xs):
nodes = num.empty((nnodes, ndim), dtype=xs[0].dtype)
for idim in range(ndim-1, -1, -1):
x = xs[idim]
nrepeat = num.prod(ns[idim+1:], dtype=num.int)
ntile = num.prod(ns[:idim], dtype=num.int)
nrepeat = num.prod(ns[idim+1:], dtype=int)
ntile = num.prod(ns[:idim], dtype=int)
nodes[:, idim] = num.repeat(num.tile(x, ntile), nrepeat)
return nodes
def filledi(x, n):
a = num.empty(n, dtype=num.int)
a = num.empty(n, dtype=int)
a.fill(x)
return a

@ -184,7 +184,7 @@ def discretize_rect_source(deltas, deltat, time, north, east, depth,
xl = num.linspace(-0.5 * (ln - dl), 0.5 * (ln - dl), nl)
xw = num.linspace(-0.5 * (wd - dw), 0.5 * (wd - dw), nw)
points = num.empty((n, 3), dtype=num.float)
points = num.empty((n, 3), dtype=float)
points[:, 0] = num.tile(xl, nw)
points[:, 1] = num.repeat(xw, nl)
points[:, 2] = 0.0
@ -364,7 +364,7 @@ class Range(SObject):
stop = Float.T(optional=True)
step = Float.T(optional=True)
n = Int.T(optional=True)
values = Array.T(optional=True, dtype=num.float, shape=(None,))
values = Array.T(optional=True, dtype=float, shape=(None,))
spacing = StringChoice.T(
choices=['lin', 'log', 'symlog'],
@ -443,7 +443,7 @@ class Range(SObject):
raise InvalidGridDef(
'"%s" is not a valid range specification' % s)
return dict(values=num.array(vals, dtype=num.float))
return dict(values=num.array(vals, dtype=float))
d = m.groupdict()
try:
@ -672,11 +672,11 @@ class STF(Object, Cloneable):
tl = math.floor(tref / deltat) * deltat
th = math.ceil(tref / deltat) * deltat
if tl == th:
return num.array([tl], dtype=num.float), num.ones(1)
return num.array([tl], dtype=float), num.ones(1)
else:
return (
num.array([tl, th], dtype=num.float),
num.array([th - tref, tref - tl], dtype=num.float) / deltat)
num.array([tl, th], dtype=float),
num.array([th - tref, tref - tl], dtype=float) / deltat)
def base_key(self):
return (type(self).__name__,)
@ -692,12 +692,12 @@ def sshift(times, amplitudes, tshift, deltat):
if t0 == t1:
return times, amplitudes
amplitudes2 = num.zeros(amplitudes.size + 1, dtype=num.float)
amplitudes2 = num.zeros(amplitudes.size + 1, dtype=float)
amplitudes2[:-1] += (t1 - tshift) / deltat * amplitudes
amplitudes2[1:] += (tshift - t0) / deltat * amplitudes
times2 = num.arange(times.size + 1, dtype=num.float) * \
times2 = num.arange(times.size + 1, dtype=float) * \
deltat + times[0] + t0
return times2, amplitudes2
@ -744,8 +744,8 @@ class BoxcarSTF(STF):
t_edges = num.linspace(
tmin - 0.5 * deltat, tmax + 0.5 * deltat, nt + 1)
t = tmin_stf + self.duration * num.array(
[0.0, 0.0, 1.0, 1.0], dtype=num.float)
f = num.array([0., 1., 1., 0.], dtype=num.float)
[0.0, 0.0, 1.0, 1.0], dtype=float)
f = num.array([0., 1., 1., 0.], dtype=float)
amplitudes = util.plf_integrate_piecewise(t_edges, t, f)
amplitudes /= num.sum(amplitudes)
@ -840,8 +840,8 @@ class TriangularSTF(STF):
t_edges = num.linspace(
tmin - 0.5 * deltat, tmax + 0.5 * deltat, nt + 1)
t = tmin_stf + self.duration * num.array(
[0.0, self.peak_ratio, 1.0], dtype=num.float)
f = num.array([0., 1., 0.], dtype=num.float)
[0.0, self.peak_ratio, 1.0], dtype=float)
f = num.array([0., 1., 0.], dtype=float)
amplitudes = util.plf_integrate_piecewise(t_edges, t, f)
amplitudes /= num.sum(amplitudes)
else:
@ -1416,7 +1416,7 @@ class ExplosionSource(SourceWithDerivedMagnitude):
'magnitude.')
points = num.array(
[[self.north_shift, self.east_shift, self.depth]], dtype=num.float)
[[self.north_shift, self.east_shift, self.depth]], dtype=float)
interpolation = target.interpolation if target else 'multilinear'
try:
@ -1742,7 +1742,7 @@ class VLVDSource(SourceWithDerivedMagnitude):
'magnitude.')
points = num.array(
[[self.north_shift, self.east_shift, self.depth]], dtype=num.float)
[[self.north_shift, self.east_shift, self.depth]], dtype=float)
try:
shear_moduli = store.config.get_shear_moduli(
@ -2542,9 +2542,9 @@ class CombiSource(Source):
'Need at least one sub-source to create a CombiSource object.')
lats = num.array(
[subsource.lat for subsource in subsources], dtype=num.float)
[subsource.lat for subsource in subsources], dtype=float)
lons = num.array(
[subsource.lon for subsource in subsources], dtype=num.float)
[subsource.lon for subsource in subsources], dtype=float)
lat, lon = lats[0], lons[0]
if not num.all(lats == lat) and num.all(lons == lon):
@ -2611,7 +2611,7 @@ class SFSource(Source):
times, amplitudes = self.effective_stf_pre().discretize_t(
store.config.deltat, self.time)
forces = amplitudes[:, num.newaxis] * num.array(
[[self.fn, self.fe, self.fd]], dtype=num.float)
[[self.fn, self.fe, self.fd]], dtype=float)
return meta.DiscretizedSFSource(forces=forces,
**self._dparams_base_repeated(times))
@ -3449,9 +3449,9 @@ class LocalEngine(Engine):
rate = store_.config.sample_rate
tmin = num.fromiter(
(t.tmin for t in targets), dtype=num.float, count=len(targets))
(t.tmin for t in targets), dtype=float, count=len(targets))
tmax = num.fromiter(
(t.tmax for t in targets), dtype=num.float, count=len(targets))
(t.tmax for t in targets), dtype=float, count=len(targets))
itmin = num.floor(tmin * rate).astype(num.int64)
itmax = num.ceil(tmax * rate).astype(num.int64)
@ -3566,7 +3566,7 @@ class LocalEngine(Engine):
deltat, 0.0)
# repeat end point to prevent boundary effects
padded_data = num.empty(data.size + amplitudes.size, dtype=num.float)
padded_data = num.empty(data.size + amplitudes.size, dtype=float)
padded_data[:data.size] = data
padded_data[data.size:] = data[-1]
data = num.convolve(amplitudes, padded_data)
@ -3803,7 +3803,7 @@ class SourceGroup(Object):
def __getattr__(self, k):
return num.fromiter((getattr(s, k) for s in self),
dtype=num.float)
dtype=float)
def __iter__(self):
raise NotImplementedError(

@ -817,7 +817,7 @@ class BaseStore(object):
delays = delays / deltat
irecords2 = num.repeat(irecords, 2)
delays2 = num.empty(irecords2.size, dtype=num.float)
delays2 = num.empty(irecords2.size, dtype=float)
delays2[0::2] = num.floor(delays)
delays2[1::2] = num.ceil(delays)
weights2 = num.repeat(weights, 2)
@ -1720,7 +1720,7 @@ use `fomosto tttlsd` to fix holes.''' % w
else:
raise MakeTimingParamsFailed(msg)
xs, tmins, tmaxs = num.array(data, dtype=num.float).T
xs, tmins, tmaxs = num.array(data, dtype=float).T
tlens = tmaxs - tmins

@ -283,7 +283,7 @@ class SatelliteTarget(StaticTarget):
'''
theta = Array.T(
shape=(None,),
dtype=num.float,
dtype=float,
serialize_as='base64-compat',
help='Horizontal angle towards satellite\'s line of sight in radians.'
'\n\n .. important::\n\n'
@ -292,7 +292,7 @@ class SatelliteTarget(StaticTarget):
phi = Array.T(
shape=(None,),
dtype=num.float,
dtype=float,
serialize_as='base64-compat',
help='Theta is look vector elevation angle towards satellite from'
' horizon in radians. Matrix of theta towards satellite\'s'

@ -212,7 +212,7 @@ syear = 60*60*24*365. # /
acceptable_tincs = num.array([
1, 2, 5, 10, 20, 30, 60, 60*5, 60*10, 60*20, 60*30, 60*60, 60*60*3,
60*60*6, 60*60*12, sday, smonth, syear], dtype=num.float)
60*60*6, 60*60*12, sday, smonth, syear], dtype=float)
working_system_time_range = \
@ -3357,7 +3357,7 @@ def MakePileViewerMainClass(base):
or self.highpass is not None:
it = num.arange(
trace.data_len(), dtype=num.float)
trace.data_len(), dtype=float)
detr_data, m, b = detrend(
it, trace.get_ydata())

@ -80,7 +80,7 @@ class AmpSpec(Snuffling):
val = i_tr/maxval*100.
pb.set_status(pblabel, val)
tr.ydata = tr.ydata.astype(num.float)
tr.ydata = tr.ydata.astype(float)
tr.ydata -= tr.ydata.mean()
f, a = tr.spectrum()
minf = min([f.min(), minf])

@ -58,13 +58,13 @@ class RootMeanSquareSnuffling(Snuffling):
channel=tr.channel+'-RMS',
tmin=tmin + 0.5*tinc,
deltat=tinc,
ydata=num.zeros(n, dtype=num.float),
ydata=num.zeros(n, dtype=float),
meta={'tabu': True})
# create and insert the current sample
i = int(round((tr.tmin - tmin)/tinc))
if 0 <= i and i < n:
tr.ydata = num.asarray(tr.ydata, num.float)
tr.ydata = num.asarray(tr.ydata, float)
tr.ydata -= num.mean(tr.ydata)
value = num.sqrt(num.sum(tr.ydata**2)/tr.ydata.size)

@ -182,7 +182,7 @@ class Array(Object):
data = val.astype(self.serialize_dtype).tostring()
return literal(b64encode(data).decode('utf-8'))
elif self.serialize_as == 'list':
if self.dtype == num.complex:
if self.dtype == complex:
return [repr(x) for x in val]
else:
return val.tolist()

@ -145,7 +145,7 @@ def analyse_gps_tags(header, gps_tags, offset, nsamples):
icontrol = num.array(
[x[0] for x in control_points], dtype=num.int64)
tcontrol = num.array(
[x[1] for x in control_points], dtype=num.float)
[x[1] for x in control_points], dtype=float)
# robust against steps:
slope = num.median(
(tcontrol[1:] - tcontrol[:-1])
@ -161,7 +161,7 @@ def analyse_gps_tags(header, gps_tags, offset, nsamples):
control_points.append((offset + nsamples - 1, tmax))
icontrol = num.array([x[0] for x in control_points], dtype=num.int64)
tcontrol = num.array([x[1] for x in control_points], dtype=num.float)
tcontrol = num.array([x[1] for x in control_points], dtype=float)
return tmin, tmax, icontrol, tcontrol, ok
@ -497,7 +497,7 @@ def iload(fn, load_data=True, interpolation='sinc'):
leaps = num.array(
[x[0] + util.gps_utc_offset(x[0]) for x in util.read_leap_seconds2()],
dtype=num.float)
dtype=float)
if load_data and icontrol is not None:
ncontrol_this = num.sum(
@ -515,11 +515,11 @@ def iload(fn, load_data=True, interpolation='sinc'):
if interpolation == 'sinc' and icontrol is not None:
ydata = num.empty(nsamples_ip, dtype=num.float)
ydata = num.empty(nsamples_ip, dtype=float)
try:
signal_ext.antidrift(
icontrol, tcontrol,
arr.astype(num.float), tmin_ip, deltat, ydata)
arr.astype(float), tmin_ip, deltat, ydata)
except signal_ext.Error as e:
e = DataCubeError(str(e))

@ -64,7 +64,7 @@ def read_dat1_chk1(f, data_format, diff_flag, nsamples):
while len(samples) < nsamples:
samples.extend(map(float, f.readline().split()))
data = num.array(samples[:nsamples], dtype=num.int)
data = num.array(samples[:nsamples], dtype=int)
else:
raise GSE1LoadError(

@ -302,7 +302,7 @@ iqb1 iqb2 iqbx iqmt ieq ieq1 ieq2 ime iex inu inc io_ il ir it iu
self.data.append(num.array(num.fromstring(
filedata[nbh+iblock*nbb:nbh+(iblock+1)*nbb],
dtype=dtype),
dtype=num.float))
dtype=float))
if len(filedata) > nbh+nblocks*nbb:
logger.warning(

@ -32,7 +32,7 @@ def unpack_ibm_f4(data):
exponent = (ibm >> 24) & 0x7f
mantissa = (ibm & 0x00ffffff) / float(pow(2, 24))
xxx = (1 - 2 * sign) * mantissa * (16.0 ** (exponent - 64))\
.astype(num.float)
.astype(float)
# for i in range(len(data)/4):
# yyy = ibm2ieee(struct.unpack('>L', data[i*4:(i+1)*4])[0])
# print('y', sign[i], exponent[i] - 64, mantissa[i])

@ -95,7 +95,7 @@ class SeisanResponseFile(object):
data[ix].extend(unpack_fixed(
'f8,f8,f8,f8,f8,f8,f8,f8,f8,f8', line))
response_table = num.array(data, dtype=num.float)
response_table = num.array(data, dtype=float)
if filetype == 'poles-and-zeros':
assert False, 'poles-and-zeros file type not implemented yet ' \
@ -188,7 +188,7 @@ class SeisanResponseFile(object):
return s**2/(omega0**2 + s**2 + 2.0*s*omega0*self.damping)
def _response_prototype_and_filters(self, freqs):
freqs = num.asarray(freqs, dtype=num.float)
freqs = num.asarray(freqs, dtype=float)
iomega = 1.0j * 2. * num.pi * freqs
trans = iomega