-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Addition of recording of the trajectory interruption point for RangeError Fix of test_find_index_for_distance in test_helpers.py * Changed TestDangerSpace to pass. * Added test for checking the addition of last point to HitResult.trajectory in case of RangeError * Refactored test and added test_vertical_shot * Added changes as well to cython version * Changed to cythonic version of call of create_trajectory_row * Added hash method to AbstractDimension. This allows using TrajectoryData in sets, which was not possible before. Removed checked for equality of the last point (as it will be different due to step being advanced in computation loop. Added two tests which are checking for absense of duplicated points in trajectory (One test takes 14 seconds, as it performs 22 shots) * Removed check for time point being different from last point time, as it cannot happen for now as well in cython code * Fix for #150 Removed ranges_length field and should_break method from TrajectoryDataFilter to allow integration cycle to complete to end. Added addition of final point at the end (unless point with same time exist). Corrected tests, which had dependency on length of trajectory. Performed same changes in the trajectory_calc.pyx * Change handling of end_point inclusion through changing logic of range_length computation. Current logic ensures that last point of trajectory lays before the max_range_distance. Restored old tests test_issues.py and test_trajectory.py Changed TestDangerSpace to Davids version of fix Changed cython version of trajectory_calc to match updated version * Fix of cython errors * Removed commented out print statement and dependency on numpy call * _TrajectoryDataFilter patch * Renamed step to record_step, added comment * Removed ranges_length and current_item members in _TrajectoryDataFilter, and method should_break(). * bump to v2.1.0b5 --------- Co-authored-by: o-murphy <[email protected]> Co-authored-by: Dmytro Yaroshenko <[email protected]>
- Loading branch information
1 parent
f254f0d
commit 3d4f616
Showing
10 changed files
with
344 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "py_ballisticcalc.exts" | ||
version = "2.1.0b4" | ||
version = "2.1.0b5" | ||
|
||
authors = [ | ||
{ name="o-murphy", email="[email protected]" }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "py_ballisticcalc" | ||
version = "2.1.0b4" | ||
version = "2.1.0b5" | ||
|
||
authors = [ | ||
{ name="o-murphy", email="[email protected]" }, | ||
|
@@ -50,7 +50,7 @@ include = ["py_ballisticcalc*"] | |
|
||
|
||
[project.optional-dependencies] | ||
exts = ['py_ballisticcalc.exts==2.1.0b4'] | ||
exts = ['py_ballisticcalc.exts==2.1.0b5'] | ||
charts = ['matplotlib', 'pandas'] | ||
visualize = ['matplotlib', 'pandas'] | ||
dev = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import pytest | ||
|
||
from py_ballisticcalc import HitResult, Distance, InterfaceConfigDict, Calculator, DragModel, TableG1, Weight, Ammo, \ | ||
Velocity, Weapon, Shot, Angular | ||
|
||
|
||
def print_out_trajectory_compact(hit_result: HitResult, label="", distance_unit: Distance = Distance.Meter, | ||
top_k: int = 5): | ||
trajectory_length = len(hit_result.trajectory) | ||
if label: | ||
print(f'{label}: Length of trajectory: { trajectory_length=}') | ||
else: | ||
print(f'Length of trajectory: { trajectory_length=}') | ||
|
||
|
||
trajectory = hit_result.trajectory | ||
if top_k<trajectory_length: | ||
end_start_top_k = top_k | ||
start_end_top_k = trajectory_length - top_k-1 | ||
if end_start_top_k<start_end_top_k: | ||
trajectory = trajectory[:end_start_top_k]+trajectory[start_end_top_k:] | ||
|
||
for i, p in enumerate(trajectory): | ||
if i<top_k: | ||
index_to_print = i+1 | ||
else: | ||
index_to_print = (trajectory_length-top_k)+i-top_k | ||
if i==top_k and i!=trajectory_length-(top_k+1): | ||
print("...") | ||
print(f'{index_to_print}. ({p.distance>>distance_unit}, {p.height>>distance_unit})') | ||
|
||
|
||
@pytest.fixture() | ||
def zero_height_calc(): | ||
config = InterfaceConfigDict( | ||
cMinimumVelocity=0, | ||
cMinimumAltitude=Distance.Meter(0), | ||
cMaximumDrop=Distance.Meter(0), | ||
) | ||
calc = Calculator(_config=config) | ||
return calc | ||
|
||
|
||
def create_shot(): | ||
drag_model = DragModel( | ||
bc=0.759, | ||
drag_table=TableG1, | ||
weight=Weight.Gram(108), | ||
diameter=Distance.Millimeter(23), | ||
length=Distance.Millimeter(108.2), | ||
) | ||
ammo = Ammo(drag_model, Velocity.MPS(930)) | ||
gun = Weapon() | ||
shot = Shot( | ||
weapon=gun, | ||
ammo=ammo, | ||
) | ||
return shot | ||
|
||
|
||
def shot_with_relative_angle_in_degrees(angle_in_degrees: float): | ||
shot = create_shot() | ||
shot.relative_angle = Angular.Degree(angle_in_degrees) | ||
return shot | ||
|
||
|
||
@pytest.fixture() | ||
def zero_min_velocity_calc(): | ||
config = InterfaceConfigDict( | ||
cMinimumVelocity=0, | ||
) | ||
return Calculator(_config=config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.