Skip to content

Shot

Shot dataclass

Shot(
    ammo: Ammo,
    weapon: Optional[Weapon] = None,
    look_angle: Optional[Union[float, Angular]] = None,
    relative_angle: Optional[Union[float, Angular]] = None,
    cant_angle: Optional[Union[float, Angular]] = None,
    atmo: Optional[Atmo] = None,
    winds: Optional[Sequence[Wind]] = None,
)

All information needed to compute a ballistic trajectory.

Attributes:

Name Type Description
look_angle Angular

Angle of sight line relative to horizontal. If the look_angle != 0 then any target in sight crosshairs will be at a different altitude: With target_distance = sight distance to a target (i.e., as through a rangefinder): * Horizontal distance X to target = cos(look_angle) * target_distance * Vertical distance Y to target = sin(look_angle) * target_distance

relative_angle Angular

Elevation adjustment added to weapon.zero_elevation for a particular shot.

cant_angle Angular

Tilt of gun from vertical, which shifts any barrel elevation from the vertical plane into the horizontal plane by sine(cant_angle)

ammo Ammo

Ammo instance used for making shot

weapon Weapon

Weapon instance used for making shot

atmo Atmo

Atmo instance used for making shot

Parameters:

Name Type Description Default
ammo Ammo

Ammo instance used for making shot

required
weapon Optional[Weapon]

Weapon instance used for making shot

None
look_angle Optional[Union[float, Angular]]

Angle of sight line relative to horizontal. If the look_angle != 0 then any target in sight crosshairs will be at a different altitude: With target_distance = sight distance to a target (i.e., as through a rangefinder): * Horizontal distance X to target = cos(look_angle) * target_distance * Vertical distance Y to target = sin(look_angle) * target_distance

None
relative_angle Optional[Union[float, Angular]]

Elevation adjustment added to weapon.zero_elevation for a particular shot.

None
cant_angle Optional[Union[float, Angular]]

Tilt of gun from vertical, which shifts any barrel elevation from the vertical plane into the horizontal plane by sine(cant_angle)

None
atmo Optional[Atmo]

Atmo instance used for making shot

None
winds Optional[Sequence[Wind]]

list of winds used for making shot

None
Example
from py_ballisticcalc import Weapon, Ammo, Atmo, Wind
shot = Shot(
    ammo=Ammo(...),
    weapon=Weapon(...),
    look_angle=Unit.Degree(5),
    relative_angle=Unit.Degree(0),
    cant_angle=Unit.Degree(0),
    atmo=Atmo(...),
    winds=[Wind(...), ... ]
)
Source code in py_ballisticcalc/conditions.py
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
def __init__(self,
             ammo: Ammo,
             weapon: Optional[Weapon] = None,
             look_angle: Optional[Union[float, Angular]] = None,
             relative_angle: Optional[Union[float, Angular]] = None,
             cant_angle: Optional[Union[float, Angular]] = None,
             atmo: Optional[Atmo] = None,
             winds: Optional[Sequence[Wind]] = None
             ):
    """
    Initialize shot parameters for the trajectory calculation.

    Args:
        ammo: Ammo instance used for making shot
        weapon: Weapon instance used for making shot
        look_angle: Angle of sight line relative to horizontal.
            If the look_angle != 0 then any target in sight crosshairs will be at a different altitude:
                With target_distance = sight distance to a target (i.e., as through a rangefinder):
                    * Horizontal distance X to target = cos(look_angle) * target_distance
                    * Vertical distance Y to target = sin(look_angle) * target_distance
        relative_angle: Elevation adjustment added to weapon.zero_elevation for a particular shot.
        cant_angle: Tilt of gun from vertical, which shifts any barrel elevation
            from the vertical plane into the horizontal plane by sine(cant_angle)
        atmo: Atmo instance used for making shot
        winds: list of winds used for making shot

    Example:
        ```python
        from py_ballisticcalc import Weapon, Ammo, Atmo, Wind
        shot = Shot(
            ammo=Ammo(...),
            weapon=Weapon(...),
            look_angle=Unit.Degree(5),
            relative_angle=Unit.Degree(0),
            cant_angle=Unit.Degree(0),
            atmo=Atmo(...),
            winds=[Wind(...), ... ]
        )
        ```
    """
    self.ammo = ammo
    self.weapon = weapon or Weapon()
    self.look_angle = PreferredUnits.angular(look_angle or 0)
    self.relative_angle = PreferredUnits.angular(relative_angle or 0)
    self.cant_angle = PreferredUnits.angular(cant_angle or 0)
    self.atmo = atmo or Atmo.icao()
    self.winds = winds or [Wind()]

Attributes

winds property writable
winds: Sequence[Wind]

Sequence[Wind] sorted by until_distance.

barrel_elevation property writable
barrel_elevation: Angular

Total barrel elevation (in vertical plane) from horizontal.

Returns:

Type Description
Angular

Angle of barrel elevation in vertical plane from horizontal = look_angle + cos(cant_angle) * zero_elevation + relative_angle

barrel_azimuth property
barrel_azimuth: Angular

Horizontal angle of barrel relative to sight line.

slant_angle property writable
slant_angle: Angular

Synonym for look_angle.