Skip to content

Commit

Permalink
feat: coordinate transformation functions with momentum names
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Feb 19, 2024
1 parent 6aef998 commit a81ba39
Showing 1 changed file with 200 additions and 0 deletions.
200 changes: 200 additions & 0 deletions src/vector/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,27 @@ def to_xy(self) -> VectorProtocolPlanar:
"""
raise AssertionError

def to_pxpy(self) -> VectorProtocolPlanar:
"""
Converts to $px$-$py$ coordinates, possibly eliminating dimensions with a
projection.
"""
raise AssertionError

Check warning on line 214 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L214

Added line #L214 was not covered by tests

def to_rhophi(self) -> VectorProtocolPlanar:
r"""
Converts to $\rho$-$\phi$ coordinates, possibly eliminating dimensions with a
projection.
"""
raise AssertionError

def to_ptphi(self) -> VectorProtocolPlanar:
r"""
Converts to $pt$-$\phi$ coordinates, possibly eliminating dimensions with a
projection.
"""
raise AssertionError

Check warning on line 228 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L228

Added line #L228 was not covered by tests

def to_xyz(self) -> VectorProtocolSpatial:
"""
Converts to $x$-$y$-$z$ coordinates, possibly eliminating or imputing
Expand All @@ -234,6 +248,27 @@ def to_xyeta(self) -> VectorProtocolSpatial:
"""
raise AssertionError

def to_pxpypz(self) -> VectorProtocolSpatial:
"""
Converts to $px$-$py$-$pz$ coordinates, possibly eliminating or imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 256 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L256

Added line #L256 was not covered by tests

def to_pxpytheta(self) -> VectorProtocolSpatial:
r"""
Converts to $px$-$py$-$\theta$ coordinates, possibly eliminating or imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 263 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L263

Added line #L263 was not covered by tests

def to_pxpyeta(self) -> VectorProtocolSpatial:
r"""
Converts to $px$-$py$-$\eta$ coordinates, possibly eliminating or imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 270 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L270

Added line #L270 was not covered by tests

def to_rhophiz(self) -> VectorProtocolSpatial:
r"""
Converts to $\rho$-$\phi$-$z$ coordinates, possibly eliminating or imputing
Expand All @@ -255,6 +290,27 @@ def to_rhophieta(self) -> VectorProtocolSpatial:
"""
raise AssertionError

def to_ptphipz(self) -> VectorProtocolSpatial:
r"""
Converts to $pt$-$\phi$-$pz$ coordinates, possibly eliminating or imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 298 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L298

Added line #L298 was not covered by tests

def to_ptphitheta(self) -> VectorProtocolSpatial:
r"""
Converts to $pt$-$\phi$-$\theta$ coordinates, possibly eliminating or
imputing dimensions with a projection.
"""
raise AssertionError

Check warning on line 305 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L305

Added line #L305 was not covered by tests

def to_ptphieta(self) -> VectorProtocolSpatial:
r"""
Converts to $pt$-$\phi$-$\eta$ coordinates, possibly eliminating or
imputing dimensions with a projection.
"""
raise AssertionError

Check warning on line 312 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L312

Added line #L312 was not covered by tests

def to_xyzt(self) -> VectorProtocolLorentz:
"""
Converts to $x$-$y$-$z$-$t$ coordinates, possibly imputing dimensions with
Expand Down Expand Up @@ -297,6 +353,48 @@ def to_xyetatau(self) -> VectorProtocolLorentz:
"""
raise AssertionError

def to_pxpypzenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$pz$-$energy$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 361 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L361

Added line #L361 was not covered by tests

def to_pxpythetaenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$\theta$-$energy$ coordinates, possibly imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 368 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L368

Added line #L368 was not covered by tests

def to_pxpyetaenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$\eta$-$energy$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 375 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L375

Added line #L375 was not covered by tests

def to_pxpypzmass(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$pz$-$mass$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 382 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L382

Added line #L382 was not covered by tests

def to_pxpythetamass(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$\theta$-$energy$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 389 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L389

Added line #L389 was not covered by tests

def to_pxpyetamass(self) -> VectorProtocolLorentz:
r"""
Converts to $px$-$py$-$\eta$-$mass$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 396 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L396

Added line #L396 was not covered by tests

def to_rhophizt(self) -> VectorProtocolLorentz:
r"""
Converts to $\rho$-$\phi$-$z$-$t$ coordinates, possibly imputing dimensions
Expand Down Expand Up @@ -339,6 +437,48 @@ def to_rhophietatau(self) -> VectorProtocolLorentz:
"""
raise AssertionError

def to_ptphipzenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$pz$-$energy$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 445 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L445

Added line #L445 was not covered by tests

def to_ptphithetaenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$\theta$-$energy$ coordinates, possibly imputing
dimensions with a projection.
"""
raise AssertionError

Check warning on line 452 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L452

Added line #L452 was not covered by tests

def to_ptphietaenergy(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$\eta$-$energy$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 459 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L459

Added line #L459 was not covered by tests

def to_ptphipzmass(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$pz$-$mass$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 466 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L466

Added line #L466 was not covered by tests

def to_ptphithetamass(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$\theta$-$mass$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 473 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L473

Added line #L473 was not covered by tests

def to_ptphietamass(self) -> VectorProtocolLorentz:
r"""
Converts to $pt$-$\phi$-$\theta$-$mass$ coordinates, possibly imputing dimensions
with a projection.
"""
raise AssertionError

Check warning on line 480 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L480

Added line #L480 was not covered by tests

def unit(self: SameVectorType) -> SameVectorType:
"""
Returns vector(s) normalized to unit length, which is `rho == 1` for 2D
Expand Down Expand Up @@ -2656,6 +2796,9 @@ def to_xy(self) -> VectorProtocolPlanar:
1,
)

def to_pxpy(self) -> VectorProtocolPlanar:
return self.to_xy()

Check warning on line 2800 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2800

Added line #L2800 was not covered by tests

def to_rhophi(self) -> VectorProtocolPlanar:
from vector._compute import planar

Expand All @@ -2666,6 +2809,9 @@ def to_rhophi(self) -> VectorProtocolPlanar:
1,
)

def to_ptphi(self) -> VectorProtocolPlanar:
return self.to_rhophi()

Check warning on line 2813 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2813

Added line #L2813 was not covered by tests

def to_xyz(self) -> VectorProtocolSpatial:
from vector._compute import planar, spatial

Expand Down Expand Up @@ -2708,6 +2854,15 @@ def to_xyeta(self) -> VectorProtocolSpatial:
1,
)

def to_pxpypz(self) -> VectorProtocolSpatial:
return self.to_xyz()

Check warning on line 2858 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2858

Added line #L2858 was not covered by tests

def to_pxpytheta(self) -> VectorProtocolSpatial:
return self.to_xytheta()

Check warning on line 2861 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2861

Added line #L2861 was not covered by tests

def to_pxpyeta(self) -> VectorProtocolSpatial:
return self.to_xyeta()

Check warning on line 2864 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2864

Added line #L2864 was not covered by tests

def to_rhophiz(self) -> VectorProtocolSpatial:
from vector._compute import planar, spatial

Expand Down Expand Up @@ -2750,6 +2905,15 @@ def to_rhophieta(self) -> VectorProtocolSpatial:
1,
)

def to_ptphipz(self) -> VectorProtocolSpatial:
return self.to_rhophiz()

Check warning on line 2909 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2909

Added line #L2909 was not covered by tests

def to_ptphitheta(self) -> VectorProtocolSpatial:
return self.to_rhophitheta()

Check warning on line 2912 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2912

Added line #L2912 was not covered by tests

def to_ptphieta(self) -> VectorProtocolSpatial:
return self.to_rhophieta()

Check warning on line 2915 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L2915

Added line #L2915 was not covered by tests

def to_xyzt(self) -> VectorProtocolLorentz:
from vector._compute import lorentz, planar, spatial

Expand Down Expand Up @@ -2852,6 +3016,24 @@ def to_xyetatau(self) -> VectorProtocolLorentz:
1,
)

def to_pxpypzenergy(self) -> VectorProtocolLorentz:
return self.to_xyzt()

Check warning on line 3020 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3020

Added line #L3020 was not covered by tests

def to_pxpythetaenergy(self) -> VectorProtocolLorentz:
return self.to_xythetat()

Check warning on line 3023 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3023

Added line #L3023 was not covered by tests

def to_pxpyetaenergy(self) -> VectorProtocolLorentz:
return self.to_xyetat()

Check warning on line 3026 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3026

Added line #L3026 was not covered by tests

def to_pxpypzmass(self) -> VectorProtocolLorentz:
return self.to_xyztau()

Check warning on line 3029 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3029

Added line #L3029 was not covered by tests

def to_pxpythetamass(self) -> VectorProtocolLorentz:
return self.to_xythetatau()

Check warning on line 3032 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3032

Added line #L3032 was not covered by tests

def to_pxpyetamass(self) -> VectorProtocolLorentz:
return self.to_xyetatau()

Check warning on line 3035 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3035

Added line #L3035 was not covered by tests

def to_rhophizt(self) -> VectorProtocolLorentz:
from vector._compute import lorentz, planar, spatial

Expand Down Expand Up @@ -2954,6 +3136,24 @@ def to_rhophietatau(self) -> VectorProtocolLorentz:
1,
)

def to_ptphipzenergy(self) -> VectorProtocolLorentz:
return self.to_rhophizt()

Check warning on line 3140 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3140

Added line #L3140 was not covered by tests

def to_ptphithetaenergy(self) -> VectorProtocolLorentz:
return self.to_rhophithetat()

Check warning on line 3143 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3143

Added line #L3143 was not covered by tests

def to_ptphietaenergy(self) -> VectorProtocolLorentz:
return self.to_rhophietat()

Check warning on line 3146 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3146

Added line #L3146 was not covered by tests

def to_ptphipzmass(self) -> VectorProtocolLorentz:
return self.to_rhophiztau()

Check warning on line 3149 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3149

Added line #L3149 was not covered by tests

def to_ptphithetamass(self) -> VectorProtocolLorentz:
return self.to_rhophithetatau()

Check warning on line 3152 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3152

Added line #L3152 was not covered by tests

def to_ptphietamass(self) -> VectorProtocolLorentz:
return self.to_rhophietatau()

Check warning on line 3155 in src/vector/_methods.py

View check run for this annotation

Codecov / codecov/patch

src/vector/_methods.py#L3155

Added line #L3155 was not covered by tests


class Vector2D(Vector, VectorProtocolPlanar):
def to_Vector2D(self) -> VectorProtocolPlanar:
Expand Down

0 comments on commit a81ba39

Please sign in to comment.