Skip to content

Commit

Permalink
Add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jank324 committed Dec 4, 2024
1 parent adb59bb commit cfb362e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cheetah/particles/particle_beam.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Union

import torch
from scipy import constants
Expand Down Expand Up @@ -1074,7 +1074,7 @@ def momenta(self) -> torch.Tensor:
"""Momenta of the individual particles."""
return torch.sqrt(self.energies**2 - electron_mass_eV**2)

def __getitem__(self, item):
def __getitem__(self, item: Union[int, slice, torch.Tensor]) -> "ParticleBeam":
vector_shape = torch.broadcast_shapes(
self.particles.shape[:-2],
self.energy.shape,
Expand Down

0 comments on commit cfb362e

Please sign in to comment.