Setup SGP4 Propagator with unit testing #650
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Closes #366 .
Addresses points in parent pr. However, note that setup_sgp4() in positioning/tle.py is bugged, resulting in failure of test_get_sat_position() in python_test/positioning/test_sgp4_handler.py
New Changes
Moved gs/positioning/tle.py to gs/backend/positioning/tle.py
Added tests for functions in positioning/tle.py
Created sgp4_handler.py and setup sgp4 in accelerated mode
Made function to takes in a TLEData object and datetime to return the sgp4 progagator data as custom object SGP4Data
Added tests for functions in both tle.py and sgp4_handler.py in new positioning directory under python_test
Testing
tle.py functions:
Tested calculate_checksum with sample TLEs to ensure the correct checksum value is returned
Tested convert_decimal_point_assumed() returns expected decimal values. Note that this function fails on negative values, but I believe through research that TLEs will not have negative values that break the function so should work as intended in practice
Tested parse_tle_data() with sample TLEs with expected results
Tested parse_tle_data_invalid() to identify mismatched checksums
sgp4_handler functions:
Tested test_setup_sgp4() to ensure it returns valid Satrec object
Tested get_sat_position() with sample TLEs and datetimes. Currently works only on some TLEs. Returns eccentricity out of range error for the following sample TLE:
"CSS (MENGTIAN)\n"
"1 54216U 22143A 25308.16010129 .00032649 00000-0 38953-3 0 9993\n"
"2 54216 41.4668 251.0039 0006377 319.7576 40.2790 15.60341380158647"
Source of error should be setup_sgp4() in positioning/tle.py. Error occurs for TLEs where tle.eccentricity is low while tle.drag_term is high. See comments in testing files for specifics.
Outstanding Changes
Should create new pr for anyone that wants to tackle debugging