@@ -1542,33 +1542,6 @@ def test__dtype_change(self):
15421542 data = np .array ([3 , 4 , 5 ])
15431543 self .assertRaises (ValueError , SpikeTrain , data , units = "sec" , t_stop = 101 , dtype = np .float64 )
15441544
1545- # need to remove for numpy 2.0 and quantities
1546- #def test_change_with_copy_true_and_data_not_quantity(self):
1547- # Changing spike train does not change data
1548- # Data source is array
1549- # Array and quantity are tested separately because copy default
1550- # is different for these two.
1551- # data = [3, 4, 5]
1552- # train = SpikeTrain(data, units="sec", copy=True, t_stop=123.4)
1553- # train[0] = 99 * pq.s
1554- # assert_neo_object_is_compliant(train)
1555- # self.assertEqual(train[0], 99 * pq.s)
1556- # self.assertEqual(data[0], 3)
1557-
1558- #def test_changing_slice_changes_original_spiketrain(self):
1559- # If we slice a spiketrain and then change the slice, the
1560- # original spiketrain should change.
1561- # Whether the original data source changes is dependent on the
1562- # copy parameter.
1563- # This is compatible with both np and quantity default behavior.
1564- # data = [3, 4, 5] * pq.s
1565- # train = SpikeTrain(data, copy=True, t_stop=99.9)
1566- # result = train[1:3]
1567- # result[0] = 99 * pq.s
1568- # assert_neo_object_is_compliant(train)
1569- # self.assertEqual(train[1], 99 * pq.s)
1570- # self.assertEqual(result[0], 99 * pq.s)
1571- # self.assertEqual(data[1], 4 * pq.s)
15721545
15731546 def test_changing_slice_changes_original_spiketrain (self ):
15741547 # If we slice a spiketrain and then change the slice, the
@@ -1875,137 +1848,7 @@ def test__pretty(self):
18751848
18761849
18771850class TestMiscellaneous (unittest .TestCase ):
1878- # we can't do any of this construction since we lose copy = True
1879- """
1880- def test__different_dtype_for_t_start_and_array(self):
1881- data = np.array([0, 9.9999999], dtype=np.float64) * pq.s
1882- data16 = data.astype(np.float16)
1883- data32 = data.astype(np.float32)
1884- data64 = data.astype(np.float64)
1885- t_start = data[0]
1886- t_stop = data[1]
1887- t_start16 = data[0].astype(dtype=np.float16)
1888- t_stop16 = data[1].astype(dtype=np.float16)
1889- t_start32 = data[0].astype(dtype=np.float32)
1890- t_stop32 = data[1].astype(dtype=np.float32)
1891- t_start64 = data[0].astype(dtype=np.float64)
1892- t_stop64 = data[1].astype(dtype=np.float64)
1893- t_start_custom = 0.0
1894- t_stop_custom = 10.0
1895- t_start_custom16 = np.array(t_start_custom, dtype=np.float16)
1896- t_stop_custom16 = np.array(t_stop_custom, dtype=np.float16)
1897- t_start_custom32 = np.array(t_start_custom, dtype=np.float32)
1898- t_stop_custom32 = np.array(t_stop_custom, dtype=np.float32)
1899- t_start_custom64 = np.array(t_start_custom, dtype=np.float64)
1900- t_stop_custom64 = np.array(t_stop_custom, dtype=np.float64)
1901-
1902- # This is OK.
1903- train = SpikeTrain(data64, copy=True, t_start=t_start, t_stop=t_stop)
1904- assert_neo_object_is_compliant(train)
1905-
1906- train = SpikeTrain(data16, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float16)
1907- assert_neo_object_is_compliant(train)
1908- train = SpikeTrain(data16, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float32)
1909- assert_neo_object_is_compliant(train)
1910-
1911- train = SpikeTrain(data32, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float16)
1912- assert_neo_object_is_compliant(train)
1913- train = SpikeTrain(data32, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float32)
1914- assert_neo_object_is_compliant(train)
1915-
1916- train = SpikeTrain(data32, copy=True, t_start=t_start16, t_stop=t_stop16)
1917- assert_neo_object_is_compliant(train)
1918- train = SpikeTrain(data32, copy=True, t_start=t_start16, t_stop=t_stop16, dtype=np.float16)
1919- assert_neo_object_is_compliant(train)
1920- train = SpikeTrain(data32, copy=True, t_start=t_start16, t_stop=t_stop16, dtype=np.float32)
1921- assert_neo_object_is_compliant(train)
1922- train = SpikeTrain(data32, copy=True, t_start=t_start16, t_stop=t_stop16, dtype=np.float64)
1923- assert_neo_object_is_compliant(train)
1924-
1925- train = SpikeTrain(data32, copy=True, t_start=t_start32, t_stop=t_stop32)
1926- assert_neo_object_is_compliant(train)
1927- train = SpikeTrain(data32, copy=True, t_start=t_start32, t_stop=t_stop32, dtype=np.float16)
1928- assert_neo_object_is_compliant(train)
1929- train = SpikeTrain(data32, copy=True, t_start=t_start32, t_stop=t_stop32, dtype=np.float32)
1930- assert_neo_object_is_compliant(train)
1931- train = SpikeTrain(data32, copy=True, t_start=t_start32, t_stop=t_stop32, dtype=np.float64)
1932- assert_neo_object_is_compliant(train)
1933-
1934- train = SpikeTrain(data32, copy=True, t_start=t_start64, t_stop=t_stop64, dtype=np.float16)
1935- assert_neo_object_is_compliant(train)
1936- train = SpikeTrain(data32, copy=True, t_start=t_start64, t_stop=t_stop64, dtype=np.float32)
1937- assert_neo_object_is_compliant(train)
1938-
1939- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom)
1940- assert_neo_object_is_compliant(train)
1941- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float16)
1942- assert_neo_object_is_compliant(train)
1943- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float32)
1944- assert_neo_object_is_compliant(train)
1945- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float64)
1946- assert_neo_object_is_compliant(train)
1947-
1948- train = SpikeTrain(data32, copy=True, t_start=t_start_custom, t_stop=t_stop_custom)
1949- assert_neo_object_is_compliant(train)
1950- train = SpikeTrain(data32, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float16)
1951- assert_neo_object_is_compliant(train)
1952- train = SpikeTrain(data32, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float32)
1953- assert_neo_object_is_compliant(train)
1954- train = SpikeTrain(data32, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float64)
1955- assert_neo_object_is_compliant(train)
1956-
1957- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom)
1958- assert_neo_object_is_compliant(train)
1959- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float16)
1960- assert_neo_object_is_compliant(train)
1961- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float32)
1962- assert_neo_object_is_compliant(train)
1963- train = SpikeTrain(data16, copy=True, t_start=t_start_custom, t_stop=t_stop_custom, dtype=np.float64)
1964- assert_neo_object_is_compliant(train)
1965-
1966- train = SpikeTrain(data32, copy=True, t_start=t_start_custom16, t_stop=t_stop_custom16)
1967- assert_neo_object_is_compliant(train)
1968- train = SpikeTrain(data32, copy=True, t_start=t_start_custom16, t_stop=t_stop_custom16, dtype=np.float16)
1969- assert_neo_object_is_compliant(train)
1970- train = SpikeTrain(data32, copy=True, t_start=t_start_custom16, t_stop=t_stop_custom16, dtype=np.float32)
1971- assert_neo_object_is_compliant(train)
1972- train = SpikeTrain(data32, copy=True, t_start=t_start_custom16, t_stop=t_stop_custom16, dtype=np.float64)
1973- assert_neo_object_is_compliant(train)
1974-
1975- train = SpikeTrain(data32, copy=True, t_start=t_start_custom32, t_stop=t_stop_custom32)
1976- assert_neo_object_is_compliant(train)
1977- train = SpikeTrain(data32, copy=True, t_start=t_start_custom32, t_stop=t_stop_custom32, dtype=np.float16)
1978- assert_neo_object_is_compliant(train)
1979- train = SpikeTrain(data32, copy=True, t_start=t_start_custom32, t_stop=t_stop_custom32, dtype=np.float32)
1980- assert_neo_object_is_compliant(train)
1981- train = SpikeTrain(data32, copy=True, t_start=t_start_custom32, t_stop=t_stop_custom32, dtype=np.float64)
1982- assert_neo_object_is_compliant(train)
1983-
1984- train = SpikeTrain(data32, copy=True, t_start=t_start_custom64, t_stop=t_stop_custom64)
1985- assert_neo_object_is_compliant(train)
1986- train = SpikeTrain(data32, copy=True, t_start=t_start_custom64, t_stop=t_stop_custom64, dtype=np.float16)
1987- assert_neo_object_is_compliant(train)
1988- train = SpikeTrain(data32, copy=True, t_start=t_start_custom64, t_stop=t_stop_custom64, dtype=np.float32)
1989- assert_neo_object_is_compliant(train)
1990- train = SpikeTrain(data32, copy=True, t_start=t_start_custom64, t_stop=t_stop_custom64, dtype=np.float64)
1991- assert_neo_object_is_compliant(train)
1992-
1993- # This use to bug - see ticket #38
1994- train = SpikeTrain(data16, copy=True, t_start=t_start, t_stop=t_stop)
1995- assert_neo_object_is_compliant(train)
1996- train = SpikeTrain(data16, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float64)
1997- assert_neo_object_is_compliant(train)
1998-
1999- train = SpikeTrain(data32, copy=True, t_start=t_start, t_stop=t_stop)
2000- assert_neo_object_is_compliant(train)
2001- train = SpikeTrain(data32, copy=True, t_start=t_start, t_stop=t_stop, dtype=np.float64)
2002- assert_neo_object_is_compliant(train)
2003-
2004- train = SpikeTrain(data32, copy=True, t_start=t_start64, t_stop=t_stop64)
2005- assert_neo_object_is_compliant(train)
2006- train = SpikeTrain(data32, copy=True, t_start=t_start64, t_stop=t_stop64, dtype=np.float64)
2007- assert_neo_object_is_compliant(train)
2008- """
1851+
20091852 def test_as_array (self ):
20101853 data = np .arange (10.0 )
20111854 st = SpikeTrain (data , t_stop = 10.0 , units = "ms" )
0 commit comments