From fcd2817e62668cdbe30afd38ba2ff459c57c2852 Mon Sep 17 00:00:00 2001
From: Duncan Macleod <duncan.macleod@ligo.org>
Date: Fri, 21 May 2021 02:20:45 +0000
Subject: [PATCH] Replace deprecated numpy aliases of builtins

---
 bilby/core/prior/joint.py        |  4 ++--
 bilby/gw/detector/strain_data.py |  2 +-
 bilby/gw/likelihood.py           | 12 ++++++------
 bilby/gw/prior.py                |  2 +-
 bilby/gw/source.py               |  4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/bilby/core/prior/joint.py b/bilby/core/prior/joint.py
index a10a0add..1eb6a460 100644
--- a/bilby/core/prior/joint.py
+++ b/bilby/core/prior/joint.py
@@ -172,7 +172,7 @@ class BaseJointPriorDist(object):
             raise ValueError("Array is the wrong shape")
 
         # check sample(s) is within bounds
-        outbounds = np.ones(samp.shape[0], dtype=np.bool)
+        outbounds = np.ones(samp.shape[0], dtype=bool)
         for s, bound in zip(samp.T, self.bounds.values()):
             outbounds = (s < bound[0]) | (s > bound[1])
             if np.any(outbounds):
@@ -630,7 +630,7 @@ class MultivariateGaussianDist(BaseJointPriorDist):
             elif isinstance(self.__dict__[key], (np.ndarray, list)):
                 thisarr = np.asarray(self.__dict__[key])
                 otherarr = np.asarray(other.__dict__[key])
-                if thisarr.dtype == np.float and otherarr.dtype == np.float:
+                if thisarr.dtype == float and otherarr.dtype == float:
                     fin1 = np.isfinite(np.asarray(self.__dict__[key]))
                     fin2 = np.isfinite(np.asarray(other.__dict__[key]))
                     if not np.array_equal(fin1, fin2):
diff --git a/bilby/gw/detector/strain_data.py b/bilby/gw/detector/strain_data.py
index 11c3e8b3..ab04f07c 100644
--- a/bilby/gw/detector/strain_data.py
+++ b/bilby/gw/detector/strain_data.py
@@ -658,7 +658,7 @@ class InterferometerStrainData(object):
                                                                     start_time=start_time)
         logger.debug('Setting zero noise data')
         self._frequency_domain_strain = np.zeros_like(self.frequency_array,
-                                                      dtype=np.complex)
+                                                      dtype=complex)
 
     def set_from_frame_file(
             self, frame_file, sampling_frequency, duration, start_time=0,
diff --git a/bilby/gw/likelihood.py b/bilby/gw/likelihood.py
index fa004479..44604c37 100644
--- a/bilby/gw/likelihood.py
+++ b/bilby/gw/likelihood.py
@@ -553,10 +553,10 @@ class GravitationalWaveTransient(Likelihood):
         times = times[in_prior]
 
         n_time_steps = int(self.waveform_generator.duration * 16384)
-        d_inner_h = np.zeros(len(times), dtype=np.complex)
+        d_inner_h = np.zeros(len(times), dtype=complex)
         psd = np.ones(n_time_steps)
-        signal_long = np.zeros(n_time_steps, dtype=np.complex)
-        data = np.zeros(n_time_steps, dtype=np.complex)
+        signal_long = np.zeros(n_time_steps, dtype=complex)
+        data = np.zeros(n_time_steps, dtype=complex)
         h_inner_h = np.zeros(1)
         for ifo in self.interferometers:
             ifo_length = len(ifo.frequency_domain_strain)
@@ -1492,9 +1492,9 @@ class ROQGravitationalWaveTransient(GravitationalWaveTransient):
             ifft = np.fft.ifft
         # Maximum delay time to geocentre + 5 steps
         earth_light_crossing_time = radius_of_earth / speed_of_light + 5 * time_space
-        start_idx = max(0, np.int(np.floor((self.priors['{}_time'.format(self.time_reference)].minimum -
+        start_idx = max(0, int(np.floor((self.priors['{}_time'.format(self.time_reference)].minimum -
                         earth_light_crossing_time - self.interferometers.start_time) / time_space)))
-        end_idx = min(number_of_time_samples - 1, np.int(np.ceil((
+        end_idx = min(number_of_time_samples - 1, int(np.ceil((
                       self.priors['{}_time'.format(self.time_reference)].maximum + earth_light_crossing_time -
                       self.interferometers.start_time) / time_space)))
         self.weights['time_samples'] = np.arange(start_idx, end_idx + 1) * time_space
@@ -1640,7 +1640,7 @@ class ROQGravitationalWaveTransient(GravitationalWaveTransient):
         number_of_time_samples = max(
             self.interferometers.duration / delta_t,
             self.interferometers.frequency_array[-1] * self.interferometers.duration + 1)
-        number_of_time_samples = np.int(2**np.ceil(np.log2(number_of_time_samples)))
+        number_of_time_samples = int(2**np.ceil(np.log2(number_of_time_samples)))
         delta_t = self.interferometers.duration / number_of_time_samples
         logger.info("ROQ time-step = {}".format(delta_t))
         return delta_t
diff --git a/bilby/gw/prior.py b/bilby/gw/prior.py
index 739cbf6a..d31dea06 100644
--- a/bilby/gw/prior.py
+++ b/bilby/gw/prior.py
@@ -1438,7 +1438,7 @@ class HealPixMapPriorDist(BaseJointPriorDist):
             elif isinstance(self.__dict__[key], (np.ndarray, list)):
                 thisarr = np.asarray(self.__dict__[key])
                 otherarr = np.asarray(other.__dict__[key])
-                if thisarr.dtype == np.float and otherarr.dtype == np.float:
+                if thisarr.dtype == float and otherarr.dtype == float:
                     fin1 = np.isfinite(np.asarray(self.__dict__[key]))
                     fin2 = np.isfinite(np.asarray(other.__dict__[key]))
                     if not np.array_equal(fin1, fin2):
diff --git a/bilby/gw/source.py b/bilby/gw/source.py
index 6fab1510..bbffa2c8 100644
--- a/bilby/gw/source.py
+++ b/bilby/gw/source.py
@@ -387,8 +387,8 @@ def _base_lal_cbc_fd_waveform(
             else:
                 raise
 
-    h_plus = np.zeros_like(frequency_array, dtype=np.complex)
-    h_cross = np.zeros_like(frequency_array, dtype=np.complex)
+    h_plus = np.zeros_like(frequency_array, dtype=complex)
+    h_cross = np.zeros_like(frequency_array, dtype=complex)
 
     if len(hplus.data.data) > len(frequency_array):
         logger.debug("LALsim waveform longer than bilby's `frequency_array`" +
-- 
GitLab