def __init__(self, lat, west_long, FOV_color=[0, 0, 0], FOV_radius=23, time=0, frequency=20.0, one_ring=False, rot_angle=0.0, pol_angle=8 * np.pi / 9.0, haslam=True): self.lat = [np.float(x) for x in lat] self.west_long = [np.float(x) for x in lat] # galaxy_dic = [20.0,30.0,40.0,50.0,60.0,70.0] self.frequency = frequency # self.skymap = self.haslam = haslam self.lat_radians = (lat[0] + lat[1] / 60.0 + lat[2] / 3600.0) * np.pi / 180.0 self.west_long_radians = (west_long[0] + west_long[1] / 60.0 + west_long[2] / 3600.0) * np.pi / 180.0 self.east_long_radians = 2 * np.pi - self.west_long_radians self.location = sidereal.LatLon(self.lat_radians, self.east_long_radians) if not type(time) == datetime.datetime: self.time = datetime.datetime.utcnow() else: self.time = time self.aa = sidereal.AltAz(0, 0) self.hpmap = hp.read_map( raw_input('Path to skymap?'), verbose=False) #Automate this - include skymaps in package? self.Rotator = hp.Rotator(coord=['C', 'G']) #If skymap is lambda Haslam self.lofasm = v3.LoFASM(441.0, rot_angle=rot_angle, pol_angle=pol_angle) self.lofasm.set_frequency(frequency)
def __init__(self, name, lat, west_long, FOV_color=[0, 0, 0], FOV_radius=23, time=0, frequency=20.0, one_ring=False, rot_angle=0.0, pol_angle=8 * np.pi / 9.0, h_cutoff=0): self.name = name self.lat = [np.float(x) for x in lat] self.west_long = [np.float(x) for x in west_long] self.FOV_color = FOV_color self.FOV_radius = FOV_radius self.frequency = frequency self.lat_degrees = (lat[0] + lat[1] / 60.0 + lat[2] / 3600.0) self.lat_radians = (lat[0] + lat[1] / 60.0 + lat[2] / 3600.0) * np.pi / 180.0 self.west_long_degrees = (west_long[0] + west_long[1] / 60.0 + west_long[2] / 3600.0) self.west_long_radians = (west_long[0] + west_long[1] / 60.0 + west_long[2] / 3600.0) * np.pi / 180.0 self.east_long_degrees = 360.0 - self.west_long_degrees self.east_long_radians = self.east_long_degrees * np.pi / 180.0 self.location = sidereal.LatLon(self.lat_radians, self.east_long_radians) self.FOV_collection = 0 self.one_ring = one_ring if not type(time) == datetime.datetime: self.time = datetime.datetime.utcnow() else: self.time = time self.aa = sidereal.AltAz(0, 0) # Read Haslam 408 MHz skymap # self.hpmap = hp.read_map(os.path.join(os.path.dirname(__file__), "lambda_haslam408_dsds.fits.txt"), verbose=False) self.hpmap = hp.read_map(raw_input('Path to lambda_haslam skymap?'), verbose=False) self.Rotator = hp.Rotator(coord=['C', 'G']) if (one_ring == 'inner'): self.lofasm = v3.LoFASM_onering(441, rot_angle=rot_angle, pol_angle=pol_angle) elif (one_ring == 'outer'): self.lofasm = v3.LoFASM_onering(np.sqrt(3.0) * 441, rot_angle=rot_angle, pol_angle=pol_angle) else: self.lofasm = v3.LoFASM(441.0, rot_angle=rot_angle, pol_angle=pol_angle) self.lofasm.set_frequency(frequency) self.horizon_cutoff = h_cutoff
except SyntaxError, detail: usage("Invalid longitude: %s" % detail) #-- 5 -- # [ if rawDT is a valid date-time string -> # dt := that date-time as a datetime.datetime instance # else -> # sys.stderr +:= error message # stop execution ] try: dt = sidereal.parseDatetime(rawDT) except SyntaxError, detail: usage("Invalid timestamp: %s" % detail) #-- 6 -- latLon = sidereal.LatLon(lat, lon) return (altAz, latLon, dt) # - - - u s a g e def usage(*L): """Print a usage message and stop. [ L is a list of strings -> sys.stderr +:= (usage message) + (elements of L, concatenated) stop execution ] """ print >> sys.stderr, "*** Usage:"
def __init__(self, sysTime): self.sysTime = sysTime [self.Lat, self.Lon] = [angles.Angle(d=49.8997541), angles.Angle(d=-97.1374937)] self.LatLon = sidereal.LatLon(self.Lat.r, self.Lon.r)
def checkArgs(ti): """Process all command line arguments. [ if sys.argv[1:] is a valid set of command line arguments -> return (raDec, latLon, dt) where raDec is a set of celestial coordinates as a sidereal.RADec instance, latLon is position as a sidereal.LatLon instance, and dt is a datetime.datetime instance else -> sys.stderr +:= error message stop execution ] """ #-- 1 -- # [ if sys.argv[1:] has exactly four elements -> # rawRADec, rawLat, rawLon, rawDT := those elements # else -> # sys.stderr +:= error message # stop execution ] argList = sys.argv[1:] if len(argList) != 5: usage("Incorrect command line argument count.") else: rawRADec, rawLat, rawLon, rawDT, fileIONEXTEC = argList rawDT = str(ti) #-- 2 -- # [ if rawRADec is a valid set of equatorial coordinates -> # raDec := those coordinates as a sidereal.RADec instance # else -> # sys.stderr +:= error message # stop execution ] raDec = checkRADec(rawRADec) #-- 3 -- # [ if rawLat is a valid latitude -> # lat := that latitude in radians # else -> # sys.stderr +:= error message # stop execution ] try: lat = sidereal.parseLat(rawLat) except SyntaxError as detail: usage("Invalid latitude: %s" % detail) #-- 4 -- # [ if rawLon is a valid longitude -> # lon := that longitude in radians # else -> # sys.stderr +:= error message # stop execution ] try: lon = sidereal.parseLon(rawLon) except SyntaxError as detail: usage("Invalid longitude: %s" % detail) #-- 5 -- # [ if rawDT is a valid date-time string -> # dt := that date-time as a datetime.datetime instance # else -> # sys.stderr +:= error message # stop execution ] try: dt = sidereal.parseDatetime(rawDT) except SyntaxError as detail: usage("Invalid timestamp: %s" % detail) #-- 6 -- latLon = sidereal.LatLon(lat, lon) return (raDec, latLon, dt)
def __init__(self, sysTime, config): self.sysTime = sysTime [self.Lat, self.Lon] = config.getLatLon() self.LatLon = sidereal.LatLon(self.Lat.r, self.Lon.r)
def __init__(self, name, lat, west_long, FOV_color=[0, 0, 0], FOV_radius=23, time=0, frequency=20.0, config='', rot_angle=0.0, pol_angle=8 * np.pi / 9.0, horizon_cutoff_alt=0.0): self.name = name self.lat = [np.float(x) for x in lat] self.west_long = [np.float(x) for x in west_long] self.FOV_color = FOV_color self.FOV_radius = FOV_radius self.frequency = frequency self.lat_degrees = (lat[0] + lat[1] / 60.0 + lat[2] / 3600.0) self.lat_radians = (lat[0] + lat[1] / 60.0 + lat[2] / 3600.0) * np.pi / 180.0 self.west_long_degrees = (west_long[0] + west_long[1] / 60.0 + west_long[2] / 3600.0) self.west_long_radians = (west_long[0] + west_long[1] / 60.0 + west_long[2] / 3600.0) * np.pi / 180.0 self.east_long_degrees = 360.0 - self.west_long_degrees self.east_long_radians = self.east_long_degrees * np.pi / 180.0 self.location = sidereal.LatLon(self.lat_radians, self.east_long_radians) self.FOV_collection = 0 self.config = config self.horizon_cutoff_costheta = np.cos(np.pi / 2 - horizon_cutoff_alt * np.pi / 180.) if not type(time) == datetime.datetime: self.time = datetime.datetime.utcnow() else: self.time = time self.aa = sidereal.AltAz(0, 0) # Read Haslam 408 MHz skymap self.hpmap = hp.read_map(os.path.join( os.path.dirname(__file__), "lambda_haslam408_dsds.fits.txt"), verbose=False) self.Rotator = hp.Rotator(coord=['C', 'G']) print "CONFIG: ", config if (config == 'inner' or config == 'outer'): radius = 441. if config == 'inner' else np.sqrt(3.) * 441. self.lofasm = v3.LoFASM_onering(radius, rot_angle=rot_angle, pol_angle=pol_angle) elif config == '': self.lofasm = v3.LoFASM(441.0, rot_angle=rot_angle, pol_angle=pol_angle) self.lofasm.set_frequency(frequency)