def test_geographicalposition_init(self): """Test the transform.GeographicalPosition constructor.""" lon = lwa1.long * 180.0 / math.pi lat = lwa1.lat * 180.0 / math.pi elv = lwa1.elev g0 = transform.GeographicalPosition([lon, lat, elv]) str(g0) repr(g0)
def test_geographicalposition_ecef(self): """Test the tranform.GeographicalPosition EC-EF transform.""" lon = lwa1.long * 180.0 / math.pi lat = lwa1.lat * 180.0 / math.pi elv = lwa1.elev g0 = transform.GeographicalPosition([lon, lat, elv]) self.assertAlmostEqual(g0.ecef[0], lwa1.geocentric_location[0], 6) self.assertAlmostEqual(g0.ecef[1], lwa1.geocentric_location[1], 6) self.assertAlmostEqual(g0.ecef[2], lwa1.geocentric_location[2], 6)
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)
def test_geographicalposition_lst(self): """Test the tranform.GeographicalPosition sidereal time.""" 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() g0 = transform.GeographicalPosition([lon, lat, elv]) # The astro.get_apparent_sidereal_time() function doesn't care about # elevation obs.elev = 0.0 obs.date = t0.utc_str self.assertAlmostEqual(g0.sidereal(t0), obs.sidereal_time() * 12.0 / math.pi, 4)
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)
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)
def __init__(self, root, args): self.root = root self.period = args.period * 1000 self.catalog = None self.cursor = self.root.cget("cursor") site = args.site.lower().replace('-', '') if site == 'lwa1': station = stations.lwa1 elif site == 'lwasv': station = stations.lwasv elif site == 'ovrolwa': station = stations.lwa1 station.lat, station.lon, station.elev = ('37.23977727', '-118.2816667', 1182.89) else: raise RuntimeError("Unknown site name: %s" % site) self.site = transform.GeographicalPosition( (station.long * 180.0 / math.pi, station.lat * 180.0 / math.pi), name=station.name) self.root.title('LWA Catalog Viewer') frame = Tkinter.Frame(self.root) frame.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=True) self.catalog_name = Tkinter.StringVar() frame1 = Tkinter.Frame(frame) frame1.pack(side=Tkinter.LEFT, fill=Tkinter.Y) catNames = catalog.CatalogFactory.get_names() catNames.sort() for name in catNames: button = Tkinter.Radiobutton(frame1, text=name, value=name, anchor=Tkinter.W, variable=self.catalog_name, command=self.select_catalog, indicatoron=False) button.pack(fill=Tkinter.X) button = Tkinter.Radiobutton(frame1, text='PLANETS', value='PLANETS', anchor=Tkinter.W, variable=self.catalog_name, command=self.select_catalog, indicatoron=False) button.pack(fill=Tkinter.X) button = Tkinter.Button(frame1, text='Select', command=self.select_source) button.pack(fill=Tkinter.X, side=Tkinter.BOTTOM) frame2 = Tkinter.Frame(frame) frame2.pack(side=Tkinter.RIGHT, fill=Tkinter.BOTH, expand=True) yscroll = Tkinter.Scrollbar(frame2, orient=Tkinter.VERTICAL) xscroll = Tkinter.Scrollbar(frame2, orient=Tkinter.HORIZONTAL) self.source_list = Tkinter.Listbox(frame2, height=40, width=60, yscrollcommand=yscroll.set, xscrollcommand=xscroll.set, font="fixed 12 bold", selectmode=Tkinter.SINGLE, exportselection=False, selectbackground='yellow') yscroll.config(command=self.source_list.yview) xscroll.config(command=self.source_list.xview) self.source_list.bind("<Double-Button-1>", self.select_source) yscroll.pack(side=Tkinter.RIGHT, fill=Tkinter.Y) xscroll.pack(side=Tkinter.BOTTOM, fill=Tkinter.X) self.source_list.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True) frame = Tkinter.Frame(self.root) frame.pack(side=Tkinter.BOTTOM, fill=Tkinter.BOTH) self.utc_time = Tkinter.Label(frame, relief=Tkinter.SUNKEN, anchor=Tkinter.W) self.last_time = Tkinter.Label(frame, relief=Tkinter.SUNKEN, anchor=Tkinter.W) self.utc_time.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True) self.last_time.pack(side=Tkinter.RIGHT, fill=Tkinter.BOTH, expand=True) self.root.after(0, self.timer)
help='site name') args = parser.parse_args() # 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)