satellogic / orbit-predictor

Python library to propagate satellite orbits.
MIT License
140 stars 43 forks source link

round_time in AccuratePredictPass() #28

Closed enritoomey closed 5 years ago

enritoomey commented 5 years ago

In lines https://github.com/satellogic/orbit-predictor/blob/d4ec34d34a596b3dd2567aab232809d7f364cbcf/orbit_predictor/accuratepredictor.py#L159-L161 a round_time() function is used. I really don't understand the requirement of this, but when I remove that rounding, the following tests crash:

_______________________________ERROR at setup of test_benchmark_numeric ________________________________                                                                                                         
file /home/henry/SATELLOGIC_REPOS/OTHERS/orbit-predictor-github/tests/test_benchmark_numeric.py, line 9
  def test_benchmark_numeric(benchmark):                                                                                                                                                                           
E       fixture 'benchmark' not found                                                                                                                                                                              
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwa
rn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory                                                               
>       use 'pytest --fixtures [testpath]' for help on them.                                             

/home/henry/SATELLOGIC_REPOS/OTHERS/orbit-predictor-github/tests/test_benchmark_numeric.py:9
=============================================== FAILURES ================================================
_______________ AccuratePredictorTests.test_predicted_passes_are_equal_between_executions _______________

self = <test_accurate_predictor.AccuratePredictorTests testMethod=test_predicted_passes_are_equal_between_executions>

                            -55.35189435098657, 1780.674044538666)
        first_set = list(
            self.predictor.passes_over(location, self.start, self.end))
        second_set = list(
            self.predictor.passes_over(location, self.start + timedelta(seconds=3), self.end)
        )

        self.assertEqual(first_set, second_set)

>   def test_predicted_passes_have_elevation_positive_and_visible_on_date(self):
E   AssertionError: Lists differ: [<Pre[50 chars]:35:59.091277>, <PredictedPass 41558U over bad[1224 chars]630>] != [<Pre[50 chars]:35:58.673505>, <PredictedPass 41558U over bad[1224 chars]856>]
E   
E   First differing element 0:
E   <PredictedPass 41558U over bad-case-1 on 2017-03-06 13:35:59.091277>
E   <PredictedPass 41558U over bad-case-1 on 2017-03-06 13:35:58.673505>
E   
E   Diff is 5490 characters long. Set self.maxDiff to None to see it.

tests/test_accurate_predictor.py:128: AssertionError
=========================================== warnings summary ============================================
tests/test_accurate_predictor.py::AccuratePredictorTests::test_pass_is_always_returned
  /home/henry/SATELLOGIC_REPOS/OTHERS/orbit-predictor-github/venv/lib/python3.5/site-packages/hypothesis/internal/conjecture/engine.py:354: HypothesisDeprecationWarning: Your tests are hitting the settings timeo
ut (60.00s). This functionality will go away in a future release and you should not rely on it. Instead, try setting max_examples to be some value lower than 8185 (the number of examples your test successfully r
an here). Or, if you would prefer your tests to run to completion, regardless of how long they take, you can set the timeout value to hypothesis.unlimited.
    verbosity=self.settings.verbosity,

-- Docs: https://docs.pytest.org/en/latest/warnings.html

====================== 1 failed, 102 passed, 1 warnings, 1 error in 70.11 seconds =======================
astrojuanlu commented 5 years ago

Regarding that particular test: I introduced it in #14 and I'm sure I copy-pasted the values from the result, to at least verify that we were not breaking things. However, it's not a super good way of testing it, so I will generate new values using GMAT and make it more tolerant.

As seen in https://github.com/satellogic/orbit-predictor/pull/19/, however, there are other tests breaking, so we will have to inspect those more closely.

astrojuanlu commented 5 years ago

GMAT does not support SGP4.

astrojuanlu commented 5 years ago

STK, on the other hand, claims to use "the algorithm provided by CSSI, available at www.centerforspace.com", which is "freely available":

http://www.centerforspace.com/downloads/

This can be used as an alternative validation method.