💣 Ammo
API Documentation
The way to define projectile
properties in py-ballisticcalc is via Ammo dataclass.
Ammo instances are simply and reusable.
Ammo initialization¶
Import the necessary types to create a Weapon instance
from py_ballisticcalc import Ammo, Unit, DragModel
Then create a weapon
ammo = Ammo(
dm=DragModel(
bc=0.381,
drag_table=TableG7,
weight=Unit.Grain(300),
length=Unit.Inch(1.7),
diameter=Unit.Inch(0.338),
),
mv=Unit.MPS(815),
powder_temp=Unit.Celsius(15),
temp_modifier=0.123,
use_powder_sensitivity=True,
)
Unit
to initialize Ammo
fields with specific unit types.
We also can do it using float
's then fields will be initialized with unit types defined in PreferredUnit
class,
or we can directly specify the dimension with referencing to dimension type class
Fields of a Ammo
can be accessed as normal attributes of ammo
instance
Ammo instance is mutable object and field values can be changed through attribute assignment
Warning
Direct values assignment to attributes of ammo
is restricted and not recommended, it can be not reinitialized properly after that
Weapon possess the following methods and attributes:
dm
: DragModel for projectilemv
: Muzzle Velocitypowder_temp
: Baseline temperature that produces the given mvtemp_modifier
: Change in velocity w temperature: % per 15°C.use_powder_sensitivity
: Flag to enable adjusting muzzle velocity to powder temperaturecalc_powder_sens
: Method to calculate powder temperature sensitivity coefficientget_velocity_for_temp
: Method to get adjusted muzzle velocity to powder sensitivity
Note
See the API documentation of Ammo
for the class definition including a full list of methods and attributes.