Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete shot handling #154

Merged
merged 17 commits into from
Feb 4, 2025

Conversation

serhiy-yevtushenko
Copy link
Contributor

Removal of usage of chart_resolution for extra_data=True

Changes that ensure that point, at which trajectory was interrupted are getting added to the incomplete_trajectory in case of RangeError.

Change of TestDangerSpace test to use trajectory_step=Distance.Foot(0.2) in order to run again after removal of usage of chart_resolution.

@o-murphy - Feel free to improve things, which you consider should be done differently (for example, passing to DangerSpaceTest chart_resolution_step, or anything else)

…ata 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)
… it cannot happen for now as well in cython code
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
…e_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
py_ballisticcalc/trajectory_calc/_trajectory_calc.py Outdated Show resolved Hide resolved
py_ballisticcalc/trajectory_calc/_trajectory_calc.py Outdated Show resolved Hide resolved
@@ -326,15 +326,16 @@ def _integrate(self, shot_info: Shot, maximum_range: float, step: float,
# endregion

# With non-zero look_angle, rounding can suggest multiple adjacent zero-crossings
min_step = min(self.calc_step, step)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart, but you have to write comments there, it cause it can create misunderstanding in future, and maybe we should rename step to record_step and we can to not provide min_step, we can just redefine calc_step

self.calc_step = min(self.calc_step, record_step) 

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# With non-zero look_angle, rounding can suggest multiple adjacent zero-crossings
self.calc_step = min(self.calc_step, step)
data_filter = _TrajectoryDataFilter(filter_flags=filter_flags,
                                    ranges_length=int((maximum_range)/ self.calc_step) + 1,
                                    time_step=time_step)
data_filter.setup_seen_zero(range_vector.y, self.barrel_elevation, self.look_angle)

# region Trajectory Loop
warnings.simplefilter("once")  # used to avoid multiple warnings in a loop
it = 0
while range_vector.x <= maximum_range + self.calc_step:
    it += 1
    data_filter.clear_current_flag()

Copy link
Owner

@o-murphy o-murphy Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but i can't suggest now why this fail on 2 of your tests

possibly cause of row delta_time = self.calc_step / max(1.0, velocity)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done - but need to be tested. My implementation was heavily affected by getting all tests pasisng

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done - but need to be tested. My implementation was heavily affected by getting all tests pasisng
Please check it
it looks like small fix should be done, possibly assersions in tests would be not as strict

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested change breaks two of the newer tests in test_end_points_are_include, and cause distance difference in distances between end points in extra_data on and off mode to be bigger than 0.2 Feet. So, I will not go with it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested change breaks two of the newer tests in test_end_points_are_include, and cause distance difference in distances between end points in extra_data on and off mode to be bigger than 0.2 Feet. So, I will not go with it.

Just intresting why it's that

…yevtushenko/py-ballisticcalc into incomplete_shot_handling

Renemed step to record_step as well in cython
Copy link
Owner

@o-murphy o-murphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are close to done it

@dbookstaber
Copy link
Contributor

This seems to be working. But I don't understand why the need to break the "extra_data" flag. All of the tests still pass if I uncomment this line (251) in _trajectory_calc.py :

        if extra_data:
            dist_step = Distance.Foot(self._config.chart_resolution)

... and restoring this allows danger_space to function without specifying a small step distance for Calculator.fire to pass through to trajectory.

@o-murphy o-murphy merged commit 3d4f616 into o-murphy:master Feb 4, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants