Skip to content

Shot

Shot

A base class for creating Shot. Stores shot parameters for the trajectory calculation.

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)

weapon Weapon

Weapon instance uses for making shot

ammo Ammo

Ammo instance uses for making shot

atmo Atmo

Atmo instance uses for making shot

Parameters:

Name Type Description Default
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
weapon Weapon

Weapon instance used for making shot

required
ammo Ammo

Ammo instance used for making shot

required
atmo Optional[Atmo]

Atmo instance used for making shot

None
winds Optional[List[Wind]]

list of winds used for making shot

None
Example

This is how you can create a shot

from py_ballisticcalc import Weapon, Ammo, Atmo, Wind
shot = Shot(
    weapon=Weapon(...),
    ammo=Ammo(...),
    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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
def __init__(self,
             weapon: Weapon,
             ammo: Ammo,
             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[List[Wind]] = None
             ):
    """
    A base class for creating Shot.
    Stores shot parameters for the trajectory calculation.

    Args:
        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)
        weapon: Weapon instance used for making shot
        ammo: Ammo instance used for making shot
        atmo: Atmo instance used for making shot
        winds: list of winds used for making shot

    Example:
        This is how you can create a shot
        ```python
        from py_ballisticcalc import Weapon, Ammo, Atmo, Wind
        shot = Shot(
            weapon=Weapon(...),
            ammo=Ammo(...),
            look_angle=Unit.Degree(5),
            relative_angle=Unit.Degree(0),
            cant_angle=Unit.Degree(0),
            atmo=Atmo(...),
            winds=[Wind(...), ... ]
        )
        ```
    """
    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.weapon = weapon
    self.ammo = ammo
    self.atmo = atmo or Atmo.icao()
    self._winds = winds or [Wind()]

look_angle instance-attribute

look_angle: Angular = angular(look_angle or 0)

relative_angle instance-attribute

relative_angle: Angular = angular(relative_angle or 0)

cant_angle instance-attribute

cant_angle: Angular = angular(cant_angle or 0)

weapon instance-attribute

weapon: Weapon = weapon

ammo instance-attribute

ammo: Ammo = ammo

atmo instance-attribute

atmo: Atmo = atmo or icao()

winds property writable

winds: Tuple[Wind, ...]

Property that returns winds sorted by until distance

Returns:

Type Description
Tuple[Wind, ...]

Tuple[Wind, ...] sorted by until distance

barrel_elevation property

barrel_elevation: Angular

Barrel elevation in vertical plane from horizontal

Returns:

Type Description
Angular

Angle of barrel elevation in vertical plane from horizontal

barrel_azimuth property

barrel_azimuth: Angular

Horizontal angle of barrel relative to sight line

Returns:

Type Description
Angular

Horizontal angle of barrel relative to sight line