Exemplo n.º 1
0
    def test_planetaryposition_init(self):
        """Test the transform.PlanetaryPosition constructor."""

        p0 = transform.PlanetaryPosition('Jupiter')
        p1 = transform.PlanetaryPosition('Sun')
        str(p0)
        repr(p0)
Exemplo n.º 2
0
    def test_pointingdirection_init(self):
        """Test the transform.PointingDirection constructor."""

        lon = lwa1.long * 180.0 / math.pi
        lat = lwa1.lat * 180.0 / math.pi
        elv = lwa1.elev

        g0 = transform.GeographicalPosition([lon, lat, elv])
        p0 = transform.PlanetaryPosition('Jupiter')
        str(p0)
        repr(p0)

        d0 = transform.PointingDirection(p0, g0)
Exemplo n.º 3
0
    def test_planetaryposition_jupiter(self):
        """Test the location of Jupiter."""

        t0 = transform.Time('2013-01-08 01:23:45.000', format='STR')

        obs = lwa1.get_observer()
        obs.date = t0.utc_str
        jove = ephem.Jupiter()
        jove.compute(obs)

        p0 = transform.PlanetaryPosition('Jupiter')

        self.assertAlmostEqual(
            p0.apparent_equ(t0)[0], jove.g_ra * 180.0 / math.pi, 4)
        self.assertAlmostEqual(
            p0.apparent_equ(t0)[1], jove.g_dec * 180.0 / math.pi, 4)
Exemplo n.º 4
0
    def test_planetaryposition_saturn(self):
        """Test the location of Saturn."""

        t0 = transform.Time('2013-01-08 01:23:45.000', format='STR')

        obs = lwa1.get_observer()
        obs.date = t0.utc_str
        sat = ephem.Saturn()
        sat.compute(obs)

        p0 = transform.PlanetaryPosition('Saturn')

        self.assertAlmostEqual(
            p0.apparent_equ(t0)[0], sat.g_ra * 180.0 / math.pi, 4)
        self.assertAlmostEqual(
            p0.apparent_equ(t0)[1], sat.g_dec * 180.0 / math.pi, 4)
Exemplo n.º 5
0
    def test_pointingdirection_azalt(self):
        """Test the transform.PointingDirection az/alt transform."""

        t0 = transform.Time('2013-01-08 01:23:45.000', format='STR')

        lon = lwa1.long * 180.0 / math.pi
        lat = lwa1.lat * 180.0 / math.pi
        elv = lwa1.elev
        obs = lwa1.get_observer()
        obs.date = t0.utc_str
        jove = ephem.Jupiter()
        jove.compute(obs)

        g0 = transform.GeographicalPosition([lon, lat, elv])
        p0 = transform.PlanetaryPosition('Jupiter')
        d0 = transform.PointingDirection(p0, g0)
        str(d0)
        repr(d0)

        self.assertAlmostEqual(d0.hrz(t0)[0], jove.az * 180.0 / math.pi, 0)
        self.assertAlmostEqual(d0.hrz(t0)[1], jove.alt * 180.0 / math.pi, 0)
Exemplo n.º 6
0
    def test_pointingdirection_rst(self):
        """Test the transform.PointingDirection az/alt transform."""

        t0 = transform.Time('2013-01-08 01:23:45.000', format='STR')

        lon = lwa1.long * 180.0 / math.pi
        lat = lwa1.lat * 180.0 / math.pi
        elv = lwa1.elev
        obs = lwa1.get_observer()
        obs.date = t0.utc_str
        jove = ephem.Jupiter()
        jove.compute(obs)

        g0 = transform.GeographicalPosition([lon, lat, elv])
        p0 = transform.PlanetaryPosition('Jupiter')
        d0 = transform.PointingDirection(p0, g0)

        rst = d0.rst(t0)
        self.assertAlmostEqual(rst.rise,
                               obs.next_rising(jove) * 1.0 + DJD_OFFSET, 2)
        self.assertAlmostEqual(rst.transit,
                               obs.next_transit(jove) * 1.0 + DJD_OFFSET, 2)
        self.assertAlmostEqual(rst.set,
                               obs.next_setting(jove) * 1.0 + DJD_OFFSET, 2)
Exemplo n.º 7
0
    def __init__(self, cat, name, site, period):

        Tkinter.Toplevel.__init__(self)

        self.lift()
        self.catalog = cat
        self.site = site
        self.period = period
        self.name = name

        if self.catalog is None:
            catName = 'PLANETS'
        else:
            catName = self.catalog.name
        self.title("%s/%s" % (catName, name))

        sourceFrame = Tkinter.Frame(self)
        sourceFrame.pack(expand=True, fill=Tkinter.X)

        labelFrame = Tkinter.Frame(sourceFrame)
        labelFrame.pack(side=Tkinter.LEFT, fill=Tkinter.X)

        SourceLabel(labelFrame, 'Visible')
        SourceLabel(labelFrame, 'J2000 RA')
        SourceLabel(labelFrame, 'J2000 DEC')
        SourceLabel(labelFrame, 'Current RA')
        SourceLabel(labelFrame, 'Current DEC')
        SourceLabel(labelFrame, 'Galactic Long.')
        SourceLabel(labelFrame, 'Galactic Lat.')
        SourceLabel(labelFrame, 'Azimuth')
        SourceLabel(labelFrame, 'Altitude')
        SourceLabel(labelFrame, 'Current Time')
        SourceLabel(labelFrame, 'Rise Time')
        SourceLabel(labelFrame, 'Transit Time')
        SourceLabel(labelFrame, 'Set Time')

        self.values = {}

        valueFrame = Tkinter.Frame(sourceFrame)
        valueFrame.pack(side=Tkinter.RIGHT, fill=Tkinter.X, expand=True)

        self.values['visible'] = SourceValue(valueFrame)
        self.values['visible'].config(anchor=Tkinter.CENTER,
                                      justify=Tkinter.CENTER)
        self.values['mean_ra'] = SourceValue(valueFrame)
        self.values['mean_dec'] = SourceValue(valueFrame)
        self.values['cur_ra'] = SourceValue(valueFrame)
        self.values['cur_dec'] = SourceValue(valueFrame)
        self.values['gal_lng'] = SourceValue(valueFrame)
        self.values['gal_lat'] = SourceValue(valueFrame)
        self.values['az'] = SourceValue(valueFrame)
        self.values['alt'] = SourceValue(valueFrame)
        self.values['date'] = SourceValue(valueFrame)
        self.values['rise'] = SourceValue(valueFrame)
        self.values['transit'] = SourceValue(valueFrame)
        self.values['set'] = SourceValue(valueFrame)

        if self.catalog is None:
            self.position = transform.PlanetaryPosition(self.name)
        else:
            source = self.catalog[self.name]
            self.position = source.position
        self.direction = transform.PointingDirection(self.position, self.site)

        self.after(0, self.timer)
Exemplo n.º 8
0
 
 # setup transform objects
 site = args.site.lower().replace('-', '')
 if site == 'lwa1':
     station = stations.lwa1
 elif site == 'lwasv':
     station = stations.lwasv
 elif site == 'ovrolwa':
     station = stations.lwa1
     station.name = 'OVRO-LWA'
     station.lat, station.lon, station.elev = ('37.2397808', '-118.2816819', 1183.4839)
 else:
     raise RuntimeError("Unknown site name: %s" % site)
 site = transform.GeographicalPosition((station.long*180.0/math.pi, station.lat*180.0/math.pi), name=station.name)
 
 sun_pos = transform.PlanetaryPosition('Sun')
 sun_dir = transform.PointingDirection(sun_pos, site)
 
 jup_pos = transform.PlanetaryPosition('Jupiter')
 jup_dir = transform.PointingDirection(jup_pos, site)
 
 gal_pos = transform.CelestialPosition((astro.hms(17, 42, 0.1),
 astro.dms(True, 28, 55, 8)), name = 'SgrA')
 gal_dir = transform.PointingDirection(gal_pos, site)
 
 tau_pos = transform.CelestialPosition((astro.hms(5, 34, 0.5),
 astro.dms(False, 22, 0, 52)), name = 'TauA')
 tau_dir = transform.PointingDirection(tau_pos, site)
 
 cyg_pos = transform.CelestialPosition((astro.hms(19, 59, 0.8),
 astro.dms(False, 40, 44, 2)), name = 'CygA')