diff --git a/docs/cpp_objects.rst b/docs/cpp_objects.rst index aaace241..6e4fccb4 100644 --- a/docs/cpp_objects.rst +++ b/docs/cpp_objects.rst @@ -126,7 +126,7 @@ indices)``:: # Extract full data without "decompressing" ts. shape = (len(ts.names), len(ts.times)) dest = np.empty(shape, dtype=ts.dtype) - ts.extract(dest, None, None) + ts.extract(dest) # Extract only data for detector at index 1. indices = np.array([1]) @@ -137,6 +137,10 @@ indices)``:: dest = np.empty((6, len(ts.times)), dtype=ts.dtype) ts.extract(dest, np.array([0, 2, 4]), np.array([1, 3, 5])) + # Extract all dets, samples [100:200]. + dest = np.empty((len(ts.names), 100), dtype=ts.dtype) + ts.extract(dest, None, None, 100, 200) + How to work with float arrays diff --git a/test/test_g3super.py b/test/test_g3super.py index e35a2b57..e997c378 100644 --- a/test/test_g3super.py +++ b/test/test_g3super.py @@ -356,11 +356,14 @@ def _get_ts(): with self.assertRaises(ValueError): ts.extract(dest) - ts = _get_ts() idx = np.array([2, 1, 3]) dest = np.zeros((len(idx), 100), dtype='float32') + ts = _get_ts() ts.extract(dest, None, idx) np.testing.assert_array_equal(dest, ts.data[idx]) + ts = _get_ts() + ts.extract(dest, src_indices=idx) + np.testing.assert_array_equal(dest, ts.data[idx]) ts = _get_ts() dest = np.zeros((1, 2, 100), dtype='float32') @@ -380,6 +383,11 @@ def _get_ts(): with self.assertRaises(ValueError): ts.extract(dest, None, idx) + # Sample subset + ts = _get_ts() + dest = np.zeros((5, 91-10), dtype='float32') + ts.extract(dest, start=10, stop=91) + #Injection test. ts = _get_ts() src_i = np.array([2, 1, 3])