diff --git a/neo/core/analogsignal.py b/neo/core/analogsignal.py index ac47834a3..70ad085c7 100644 --- a/neo/core/analogsignal.py +++ b/neo/core/analogsignal.py @@ -448,7 +448,7 @@ def _pp(line): def time_index(self, t): """Return the array index (or indices) corresponding to the time (or times) `t`""" i = (t - self.t_start) * self.sampling_rate - i = np.rint(i.simplified.magnitude).astype(np.int) + i = np.rint(i.simplified.magnitude).astype(np.int64) return i def time_slice(self, t_start, t_stop): diff --git a/neo/core/spiketrain.py b/neo/core/spiketrain.py index 58303d2af..f62104772 100644 --- a/neo/core/spiketrain.py +++ b/neo/core/spiketrain.py @@ -249,7 +249,7 @@ def __new__(cls, times, t_stop, units=None, dtype=None, copy=True, sampling_rate if dtype is None: if not hasattr(times, 'dtype'): - dtype = np.float + dtype = np.float_ elif hasattr(times, 'dtype') and times.dtype != dtype: if not copy: raise ValueError("cannot change dtype and return view") @@ -310,7 +310,7 @@ def __new__(cls, times, t_stop, units=None, dtype=None, copy=True, sampling_rate return obj - def __init__(self, times, t_stop, units=None, dtype=np.float, copy=True, + def __init__(self, times, t_stop, units=None, dtype=None, copy=True, sampling_rate=1.0 * pq.Hz, t_start=0.0 * pq.s, waveforms=None, left_sweep=None, name=None, file_origin=None, description=None, array_annotations=None, **annotations): diff --git a/neo/io/alphaomegaio.py b/neo/io/alphaomegaio.py index c6e0e26d1..c4aa0fbe4 100644 --- a/neo/io/alphaomegaio.py +++ b/neo/io/alphaomegaio.py @@ -261,7 +261,7 @@ def count_samples(m_length): list_data[ind_chan].append(ind_block) # step 4: compute the length (number of samples) of the channels - chan_len = np.zeros(len(list_data), dtype=np.int) + chan_len = np.zeros(len(list_data), dtype=np.int64) for ind_chan, list_blocks in enumerate(list_data): for ind_block in list_blocks: chan_len[ind_chan] += count_samples( diff --git a/neo/io/brainwaredamio.py b/neo/io/brainwaredamio.py index abc40c27c..5bd19fe7c 100644 --- a/neo/io/brainwaredamio.py +++ b/neo/io/brainwaredamio.py @@ -210,7 +210,7 @@ def _read_segment(self, fobject): # int16 * numpts -- the AnalogSignal itself signal = np.fromfile(fobject, dtype=np.int16, count=numpts) - sig = AnalogSignal(signal.astype(np.float) * pq.mV, + sig = AnalogSignal(signal.astype(np.float32) * pq.mV, t_start=t_start * pq.d, file_origin=self._filename, sampling_period=1. * pq.s, diff --git a/neo/io/klustakwikio.py b/neo/io/klustakwikio.py index fa7131b6a..096cc311c 100644 --- a/neo/io/klustakwikio.py +++ b/neo/io/klustakwikio.py @@ -294,7 +294,7 @@ def write_block(self, block): # Convert to samples spike_times_in_samples = np.rint( - np.array(st) * sr).astype(np.int) + np.array(st) * sr).astype(np.int64) # Try to get features from spiketrain try: diff --git a/neo/io/tiffio.py b/neo/io/tiffio.py index 1f46180ad..a9c39fe89 100644 --- a/neo/io/tiffio.py +++ b/neo/io/tiffio.py @@ -103,13 +103,13 @@ def natural_sort(l): list_data_image = [] for file_name in file_name_list: list_data_image.append( - np.array(Image.open(self.filename + "/" + file_name), dtype=np.float)) + np.array(Image.open(self.filename + "/" + file_name), dtype=np.float32)) list_data_image = np.array(list_data_image) if len(list_data_image.shape) == 4: list_data_image = [] for file_name in file_name_list: list_data_image.append( - np.array(Image.open(self.filename + "/" + file_name).convert('L'), dtype=np.float)) + np.array(Image.open(self.filename + "/" + file_name).convert('L'), dtype=np.float32)) print("read block") image_sequence = ImageSequence(np.stack(list_data_image), diff --git a/neo/test/coretest/test_base.py b/neo/test/coretest/test_base.py index 14d4325d2..42d4c86c0 100644 --- a/neo/test/coretest/test_base.py +++ b/neo/test/coretest/test_base.py @@ -853,7 +853,7 @@ def test_numpy_array_uint64(self): def test_numpy_array_float(self): '''test to make sure float type numpy arrays are accepted''' - value = np.array([1, 2, 3, 4, 5], dtype=np.float) + value = np.array([1, 2, 3, 4, 5], dtype=np.float_) self.base.annotate(data=value) result = {'data': value} self.assertDictEqual(result, self.base.annotations) @@ -1048,7 +1048,7 @@ def test_numpy_scalar_uint64(self): def test_numpy_scalar_float(self): '''test to make sure float type numpy scalars are accepted''' - value = np.array(99, dtype=np.float) + value = np.array(99, dtype=np.float_) self.base.annotate(data=value) result = {'data': value} self.assertDictEqual(result, self.base.annotations) diff --git a/neo/test/coretest/test_spiketrain.py b/neo/test/coretest/test_spiketrain.py index 9544e320e..5ec946823 100644 --- a/neo/test/coretest/test_spiketrain.py +++ b/neo/test/coretest/test_spiketrain.py @@ -679,8 +679,8 @@ def test_defaults(self): train2 = _new_spiketrain(SpikeTrain, [3, 4, 5], units='sec', t_stop=10.0) assert_neo_object_is_compliant(train1) assert_neo_object_is_compliant(train2) - self.assertEqual(train1.dtype, np.float) - self.assertEqual(train2.dtype, np.float) + self.assertEqual(train1.dtype, np.float_) + self.assertEqual(train2.dtype, np.float_) self.assertEqual(train1.sampling_rate, 1.0 * pq.Hz) self.assertEqual(train2.sampling_rate, 1.0 * pq.Hz) self.assertEqual(train1.waveforms, None) diff --git a/neo/test/iotest/test_nestio.py b/neo/test/iotest/test_nestio.py index de570e7e3..c788537cc 100644 --- a/neo/test/iotest/test_nestio.py +++ b/neo/test/iotest/test_nestio.py @@ -356,7 +356,7 @@ def test_read_float(self): t_stop=500. * pq.ms, lazy=False, id_column_gdf=0, time_column_gdf=1) sts = seg.spiketrains - self.assertTrue(all([s.magnitude.dtype == np.float for s in sts])) + self.assertTrue(all([s.magnitude.dtype == np.float_ for s in sts])) def test_values(self): """ diff --git a/neo/test/iotest/test_nixio.py b/neo/test/iotest/test_nixio.py index d823b6487..e798f02e0 100644 --- a/neo/test/iotest/test_nixio.py +++ b/neo/test/iotest/test_nixio.py @@ -878,7 +878,7 @@ def test_signals_write(self): IrregularlySampledSignal(times=np.sort(np.random.random(10)), signal=np.random.random((10, 13)), units="mV", time_units="s", - dtype=np.float, + dtype=np.float32, name="some sort of signal", description="the signal is described") )