Shot
Shot
dataclass
¶
Shot(
*,
ammo: Ammo,
atmo: Optional[Atmo] = None,
weapon: Optional[Weapon] = None,
winds: Optional[Sequence[Wind]] = None,
look_angle: Optional[Union[float, Angular]] = None,
relative_angle: Optional[Union[float, Angular]] = None,
cant_angle: Optional[Union[float, Angular]] = None,
azimuth: Optional[float] = None,
latitude: Optional[float] = None,
)
All information needed to compute a ballistic trajectory.
Attributes:
| Name | Type | Description |
|---|---|---|
ammo |
Ammo
|
Ammo used for shot. |
atmo |
Atmo
|
Atmosphere in effect during shot. |
weapon |
Weapon
|
Weapon used for shot. |
winds |
Sequence[Wind]
|
List of Wind in effect during shot, sorted by |
look_angle |
slant_angle
|
Angle of sight line relative to horizontal.
If |
cant_angle |
Angular
|
Tilt of gun from vertical. If |
relative_angle |
Angular
|
Elevation adjustment (a.k.a. "hold") added to |
azimuth |
Optional[float]
|
Azimuth of the shooting direction in degrees [0, 360). Optional, for Coriolis effects. Should be geographic bearing where 0 = North, 90 = East, 180 = South, 270 = West. Difference from magnetic bearing is usually negligible. |
latitude |
Optional[float]
|
Latitude of the shooting location in degrees [-90, 90]. Optional, for Coriolis effects. |
barrel_elevation |
Angular
|
Total barrel elevation (in vertical plane) from horizontal.
|
barrel_azimuth |
Angular
|
Horizontal angle of barrel relative to sight line. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ammo
|
Ammo
|
Ammo instance used for shot. |
required |
atmo
|
Optional[Atmo]
|
Atmosphere in effect during shot. |
None
|
weapon
|
Optional[Weapon]
|
Weapon instance used for shot. |
None
|
winds
|
Optional[Sequence[Wind]]
|
List of Wind in effect during shot. |
None
|
look_angle
|
Optional[Union[float, Angular]]
|
Angle of sight line relative to horizontal.
If |
None
|
cant_angle
|
Optional[Union[float, Angular]]
|
Tilt of gun from vertical. If |
None
|
relative_angle
|
Optional[Union[float, Angular]]
|
Elevation adjustment (a.k.a. "hold") added to |
None
|
azimuth
|
Optional[float]
|
Azimuth of the shooting direction in degrees [0, 360). Optional, for Coriolis effects. Should be geographic bearing where 0 = North, 90 = East, 180 = South, 270 = West. Difference from magnetic bearing is usually negligible. |
None
|
latitude
|
Optional[float]
|
Latitude of the shooting location in degrees [-90, 90]. Optional, for Coriolis effects. |
None
|
Example
from py_ballisticcalc import Weapon, Ammo, Atmo, Wind, Unit, Shot
shot = Shot(
ammo=Ammo(...),
atmo=Atmo(...),
weapon=Weapon(...),
winds=[Wind(...), ... ]
look_angle=Unit.Degree(5),
cant_angle=Unit.Degree(0),
relative_angle=Unit.Degree(1),
azimuth=90.0, # East
latitude=45.0 # 45° North
)
Source code in py_ballisticcalc/shot.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
Attributes¶
azimuth
property
writable
¶
azimuth: Optional[float]
Azimuth of the shooting direction in degrees [0, 360).
Should be geographic bearing where 0 = North, 90 = East, 180 = South, 270 = West. However, difference from magnetic bearing is usually negligible.
latitude
property
writable
¶
latitude: Optional[float]
Latitude of the shooting location in degrees [-90, 90].
barrel_azimuth
property
¶
barrel_azimuth: Angular
Horizontal angle of barrel relative to sight line.
Coriolis
dataclass
¶
Coriolis(
sin_lat: float,
cos_lat: float,
sin_az: Optional[float],
cos_az: Optional[float],
range_east: Optional[float],
range_north: Optional[float],
cross_east: Optional[float],
cross_north: Optional[float],
flat_fire_only: bool,
muzzle_velocity_fps: float,
)
Precomputed Coriolis helpers for applying Earth's rotation.
The calculator keeps ballistic state in a local range/up/cross (x, y, z) frame where the x axis points down-range, y points up, and z points to the shooter's right. Coriolis forces originate in the Earth-fixed East-North-Up (ENU) frame. This class precumputes the scalars to transform between the two frames.
If we are given latitude but not azimuth of the shot, this class falls back on a flat-fire approximation of Coriolis effects: north of the equator the deflection is to the right; south of the equator it is to the left. Given both azimuth \(A\) and latitude \(L\) we compute the full 3D Coriolis acceleration as:
Attributes:
| Name | Type | Description |
|---|---|---|
sin_lat |
float
|
Sine of the firing latitude, used to project the Earth's rotation vector. |
cos_lat |
float
|
Cosine of the firing latitude. |
sin_az |
Optional[float]
|
Sine of the firing azimuth, or |
cos_az |
Optional[float]
|
Cosine of the firing azimuth, or |
range_east |
Optional[float]
|
Projection of the local range axis onto geographic east (None in flat-fire mode). |
range_north |
Optional[float]
|
Projection of the local range axis onto geographic north (None in flat-fire mode). |
cross_east |
Optional[float]
|
Projection of the local cross axis onto geographic east (None in flat-fire mode). |
cross_north |
Optional[float]
|
Projection of the local cross axis onto geographic north (None in flat-fire mode). |
flat_fire_only |
bool
|
|
muzzle_velocity_fps |
float
|
Muzzle velocity in feet per second (only needed by the flat-fire approximation). |
Methods:
| Name | Description |
|---|---|
create |
Build a |
coriolis_acceleration_local |
Compute the Coriolis acceleration for a velocity expressed in the local frame. |
flat_fire_offsets |
Estimate flat-fire vertical and horizontal corrections. |
adjust_range |
Apply the flat-fire offsets to a range vector when necessary. |
Attributes¶
full_3d
property
¶
full_3d: bool
Whether full 3D Coriolis model is available (i.e., both azimuth and latitude).
Functions¶
create
classmethod
¶
create(
latitude: Optional[float],
azimuth: Optional[float],
muzzle_velocity_fps: float,
) -> Optional[Coriolis]
Build a Coriolis helper for a shot when latitude is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
Optional[float]
|
Latitude of the shooting location in degrees [-90, 90]. |
required |
azimuth
|
Optional[float]
|
Azimuth of the shooting direction in degrees [0, 360). |
required |
muzzle_velocity_fps
|
float
|
Muzzle velocity in feet per second for the projectile. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Coriolis]
|
A populated |
Notes
When azimuth is omitted we fall back to the flat fire approximation, which only corrects for the horizontal drift term that dominates short-range, low-arc engagements.
Source code in py_ballisticcalc/conditions.py
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 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | |
coriolis_acceleration_local
¶
Compute the Coriolis acceleration for a velocity expressed in the local frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
velocity
|
Vector
|
Projectile velocity vector in the local range/up/cross basis (feet per second). |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
A |
Vector
|
Returns the |
Source code in py_ballisticcalc/conditions.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
flat_fire_offsets
¶
Estimate flat-fire vertical and horizontal corrections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float
|
Time of flight in seconds for the sample point. |
required |
distance_ft
|
float
|
Down-range distance in feet at the sample point. |
required |
drop_ft
|
float
|
Local vertical displacement in feet (positive is up). |
required |
Returns:
| Type | Description |
|---|---|
float
|
A tuple |
float
|
Both values are zero when |
Source code in py_ballisticcalc/conditions.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | |
adjust_range
¶
Apply the flat-fire offsets to a range vector when necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float
|
Time of flight in seconds for the sample point. |
required |
range_vector
|
Vector
|
Original range/up/cross vector (feet) produced by the integrator. |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
Either the original vector (for full 3D solutions) or a new vector with the flat-fire offsets applied. |
Source code in py_ballisticcalc/conditions.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |