Skip to content

Commit

Permalink
added temporal eg (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schefflera-Arboricola authored Dec 11, 2024
1 parent fbc59a3 commit 7cd311d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/vector/backends/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,8 +1778,23 @@ def longitudinal(self) -> LongitudinalNumpy:

@property
def temporal(self) -> TemporalNumpy:
"""Returns the azimuthal type class for the given ``VectorNumpy4D`` object."""
# TODO: Add an example here - see https://github.com/scikit-hep/vector/issues/194
"""
Returns the temporal type class for the given ``VectorNumpy4D`` object.
Example:
>>> import vector
>>> vec = vector.array(
... [
... (1.1, 2.1, 3.1, 4.1),
... (1.2, 2.2, 3.2, 4.2),
... (1.3, 2.3, 3.3, 4.3),
... (1.4, 2.4, 3.4, 4.4)
... ], dtype=[("x", float), ("y", float), ("z", float), ("t", float)]
... )
>>> vec.temporal
TemporalNumpyT([(4.1,), (4.2,), (4.3,), (4.4,)],
dtype=[('t', '<f8')])
"""
return self.view(self._temporal_type)

def _wrap_result(
Expand Down

0 comments on commit 7cd311d

Please sign in to comment.