Exemple #1
0
    def test_get_rise_set_against_lco_rise_set(self):
        facility = FakeFacility()
        sites = facility.get_observing_sites()
        start = datetime(2018, 10, 10)
        end = datetime(2018, 10, 11)

        # Get sunrise/set from rise-set library
        coj = {
            'latitude': Angle(degrees=sites.get('Siding Spring')['latitude']),
            'longitude': Angle(degrees=sites.get('Siding Spring')['longitude'])
        }
        coj_observer = observer_for_site(sites.get('Siding Spring'))
        (transit, control_rise,
         control_set) = calc_sunrise_set(coj, start, 'sunrise')

        # Get rise/set from observations module
        rise_set = get_rise_set(coj_observer, self.sun, start, end)
        rise_delta = timedelta(hours=rise_set[0][0].hour,
                               minutes=rise_set[0][0].minute,
                               seconds=rise_set[0][0].second)
        set_delta = timedelta(hours=rise_set[0][1].hour,
                              minutes=rise_set[0][1].minute,
                              seconds=rise_set[0][1].second)
        self.assertLessEqual(rise_delta - control_rise,
                             abs(timedelta(minutes=5)))
        self.assertLessEqual(set_delta - control_set,
                             abs(timedelta(minutes=5)))
Exemple #2
0
 def test_get_rise_set_valid(self):
     rise_set = get_rise_set(self.observer, self.sun,
                             datetime(2018, 10, 10), datetime(2018, 10, 11))
     self.assertListEqual([(datetime(
         2018, 10, 9, 13, 53, 16), datetime(2018, 10, 10, 1, 26, 33)),
                           (datetime(2018, 10, 10, 13, 54, 2),
                            datetime(2018, 10, 11, 1, 25, 15))], rise_set)
Exemple #3
0
 def test_get_rise_set_no_results(self):
     rise_set = get_rise_set(self.observer, self.sun,
                             datetime(2018, 10, 10, 7, 0, 0),
                             datetime(2018, 10, 10, 7, 0, 1))
     self.assertEqual(len(rise_set), 0)