Skip to content

Commit bc94e25

Browse files
committed
Add unit tests; update documentation.
1 parent 2537875 commit bc94e25

9 files changed

Lines changed: 215 additions & 84 deletions

File tree

py_ballisticcalc.exts/py_ballisticcalc_exts/base_engine.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ cdef class CythonizedBaseIntegrationEngine:
249249
shot_props_ptr[0].barrel_elevation = angle_rad
250250
__res = self._integrate(shot_props_ptr, target_x_ft, target_x_ft, <double>0.0, <int>TrajFlag_t.NONE)
251251
trajectory = <CBaseTrajSeq>__res[0]
252-
# If trajectory is too short for quadratic interpolation, treat as unreachable
252+
# If trajectory is too short for cubic interpolation, treat as unreachable
253253
n = <Py_ssize_t>len(trajectory)
254254
if n < <Py_ssize_t>3:
255255
return <double>9e9

py_ballisticcalc.exts/py_ballisticcalc_exts/euler_engine.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ cdef class CythonizedEulerIntegrationEngine(CythonizedBaseIntegrationEngine):
124124
&density_ratio,
125125
&mach
126126
)
127-
128-
# Quadratic interpolation requires 3 points, so we will need at least 3 steps
127+
128+
# Cubic interpolation requires 3 points, so we will need at least 3 steps
129129
while (range_vector.x <= range_limit_ft) or integration_step_count < 3:
130130
integration_step_count += 1
131131

py_ballisticcalc.exts/py_ballisticcalc_exts/rk4_engine.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ cdef class CythonizedRK4IntegrationEngine(CythonizedBaseIntegrationEngine):
124124
traj_seq = CBaseTrajSeq()
125125

126126
# Trajectory Loop
127-
# Quadratic interpolation requires 3 points, so we will need at least 3 steps
127+
# Cubic interpolation requires 3 points, so we will need at least 3 steps
128128
while (range_vector.x <= range_limit_ft) or integration_step_count < 3:
129129
integration_step_count += 1
130130

py_ballisticcalc/drag_tables.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -810,18 +810,17 @@ def get_drag_tables_names() -> List[str]:
810810
>>> 'TableG1' in tables
811811
True
812812
"""
813-
return [f"TableG{n}" for n in (1, 7, 2, 5, 6, 8, 'I', 'S', 'RA4')]
813+
names: List[str] = []
814+
for attr_name, value in globals().items():
815+
if not attr_name.startswith('Table'):
816+
continue
817+
if isinstance(value, list) and value and isinstance(value[0], dict):
818+
first = value[0]
819+
if 'Mach' in first and 'CD' in first:
820+
names.append(attr_name)
821+
names.sort()
822+
return names
814823

815824

816825
__all__ = ['get_drag_tables_names', 'DragTablePointDictType']
817-
__all__ += [
818-
'TableG1',
819-
'TableG7',
820-
'TableG2',
821-
'TableG5',
822-
'TableG6',
823-
'TableG8',
824-
'TableGI',
825-
'TableGS',
826-
'TableRA4'
827-
]
826+
__all__ += get_drag_tables_names()

0 commit comments

Comments
 (0)