Пример #1
0
    def test_sometimes_visible(self):
        now = vis.get_ephem(greenwich.equatorial_transiting_at_ve,
                                    self.site, self.time)
        later = vis.get_ephem(greenwich.equatorial_transiting_at_ve_p12hr,
                                    self.site, self.time)
        self.assertEqual(now[tkeys.type], 'sometimes')
        self.assertEqual(now[tkeys.visible_now], True)

        self.assertEqual(later[tkeys.type], 'sometimes')
        self.assertEqual(later[tkeys.visible_now], False)

        print
        print now[tkeys.current_pos]
        print now[tkeys.next_transit_pos]
        print later[tkeys.current_pos]
        print later[tkeys.next_transit_pos]
Пример #2
0
        def test_tgt(tgt):
#            print "----------------------------"
            print "Target: ", tgt.ra, tgt.dec
#            print
            for site in self.sites:
                vis = get_ephem(tgt, site, self.time)
                site_report = self.template.render(site=site,
                                                   vis=vis,
                                                   dt_style=datetime_format_long)
                print site_report
Пример #3
0
    def test_always_visible(self):
        target = greenwich.circumpolar_north_transit_at_ve
        e = vis.get_ephem(target,
                                    self.site, self.time)
        self.assertEqual(e[tkeys.type], 'always')
        self.assertEqual(e[tkeys.visible_now], True)

        target_polar_offset = (90 - target.dec*DEG_PER_RADIAN)
        self.assertAlmostEqual(e[tkeys.next_transit_pos][0],
                               self.site.lat*DEG_PER_RADIAN + target_polar_offset,
                               places=1)
Пример #4
0
def generate_report_text(alert, sites, actions_taken,
                         report_timestamp=None):
    if report_timestamp is None:
        report_timestamp = datetime.datetime.now(pytz.utc)
    site_reports = [(site, get_ephem(alert.position, site, report_timestamp))
                            for site in sites]
    notification_template = env.get_template('notify.j2')
    msg_context=dict(alert=alert,
                report_timestamp=report_timestamp,
                site_reports=site_reports,
                actions_taken=actions_taken,)
    msg_context.update(ps.base_context())
    msg = notification_template.render(msg_context)
    return msg
Пример #5
0
 def test_never_visible(self):
     e = vis.get_ephem(greenwich.never_visible_source,
                                 self.site, self.time)
     self.assertEqual(e[tkeys.type], 'never')
     self.assertEqual(e[tkeys.visible_now], False)