Skip to content

Commit 7cd311d

Browse files
added temporal eg (#540)
1 parent fbc59a3 commit 7cd311d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/vector/backends/numpy.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -1778,8 +1778,23 @@ def longitudinal(self) -> LongitudinalNumpy:
17781778

17791779
@property
17801780
def temporal(self) -> TemporalNumpy:
1781-
"""Returns the azimuthal type class for the given ``VectorNumpy4D`` object."""
1782-
# TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194
1781+
"""
1782+
Returns the temporal type class for the given ``VectorNumpy4D`` object.
1783+
1784+
Example:
1785+
>>> import vector
1786+
>>> vec = vector.array(
1787+
... [
1788+
... (1.1, 2.1, 3.1, 4.1),
1789+
... (1.2, 2.2, 3.2, 4.2),
1790+
... (1.3, 2.3, 3.3, 4.3),
1791+
... (1.4, 2.4, 3.4, 4.4)
1792+
... ], dtype=[("x", float), ("y", float), ("z", float), ("t", float)]
1793+
... )
1794+
>>> vec.temporal
1795+
TemporalNumpyT([(4.1,), (4.2,), (4.3,), (4.4,)],
1796+
dtype=[('t', '<f8')])
1797+
"""
17831798
return self.view(self._temporal_type)
17841799

17851800
def _wrap_result(

0 commit comments

Comments
 (0)