Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: added an example for temporal property #540

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading