def load_srcs(desc): # Reads in the set of sources to map, returning # [nsrc,{ra,dec,type,name}]. type will be "fixed" # for fixed sources and "planet" for moving sources. # Moving sources will have their coordinates updated for # each TOD. if desc in ephem.__dict__: res = np.zeros(1, src_dtype).view(np.recarray) res.type = "planet" res.name = desc return res try: obj = ephemeris.read_object(desc) name = "obj000" setattr(ephem, name, lambda: obj) res = np.zeros(1, src_dtype).view(np.recarray) res.type = "planet" res.name = name return res except (IOError, OSError): srcs = np.loadtxt(args.srcs, usecols=[0, 1], ndmin=2) res = np.zeros(len(srcs), src_dtype).view(np.recarray) res.ra, res.dec = srcs.T[:2] * utils.degree res.type = "fixed" return res
def load_srcs(desc): # Reads in the set of sources to map, returning # [nsrc,{ra,dec,type,name}]. type will be "fixed" # for fixed sources and "planet" for moving sources. # Moving sources will have their coordinates updated for # each TOD. if desc in ephem.__dict__: res = np.zeros(1, src_dtype).view(np.recarray) res.type = "planet" res.name = desc return res try: obj = ephemeris.read_object(desc) name = "obj000" setattr(ephem, name, lambda: obj) res = np.zeros(1, src_dtype).view(np.recarray) res.type = "planet" res.name = name return res except IOError: srcs = np.loadtxt(args.srcs, usecols=[0,1]) res = np.zeros(len(srcs), src_dtype) res.ra, res.dec = srcs.T[:2]*utils.degree res.type = "fixed" return res
def __call__(self, fname): mjd = utils.ctime2mjd(self.data["t"]) mjd[~np.isfinite(mjd)] = 0 obj = ephemeris.read_object(fname) pos = ephemeris.ephem_pos(obj, mjd)[:2] pos /= utils.degree return pos
def setup_extra_transforms(param): extra = [] if "p9" in param: # Planet 9 search coordinate system: p9=elemfile:tref. Includes # both parallax and motion compensation toks = param["p9"].split(":") elemfile = toks[0] tref = float(toks[1]) if len(toks)>1 else 1380000000.0 tref = utils.ctime2mjd(tref) obj = ephemeris.read_object(elemfile) p9 = planet9.MotionCompensator(obj) def trf(pos, time): # We ignore the polarization rotation for now opos = pos.copy() opos[:2] = p9.compensate(pos[:2], time, tref) return opos extra.append(trf) if "parallax" in param: # Simple parallax compensation. parallax=dist, with dist in AU dist = float(param["parallax"]) def trf(pos, time): opos = pos.copy() opos[:2] = parallax.earth2sun(pos[:2], time, dist) return opos extra.append(trf) return extra
if args.dump_config: print config.to_str() sys.exit(0) dtype = np.float32 if config.get("map_bits") == 32 else np.float64 comm = mpi.COMM_WORLD nmax = config.get("map_cg_nmax") ext = config.get("map_format") tshape= (720,720) #tshape= (100,100) resume= config.get("resume") if args.define_planets: for pdesc in args.define_planets.split(","): name, elemfile = pdesc.split(":") ephemeris.register_object(name, ephemeris.read_object(elemfile)) def parse_src_handling(): res = {} res["mode"] = config.get("src_handling") if res["mode"] == "none": return None res["amplim"] = config.get("src_handling_lim") res["srcs"] = None srcfile = config.get("src_handling_list") if srcfile: res["srcs"] = pointsrcs.read(srcfile) return res src_handling = parse_src_handling() filedb.init()
if args.dump_config: print(config.to_str()) sys.exit(0) dtype = np.float32 if config.get("map_bits") == 32 else np.float64 comm = mpi.COMM_WORLD nmax = config.get("map_cg_nmax") ext = config.get("map_format") tshape= (720,720) #tshape= (100,100) resume= config.get("resume") if args.define_planets: for pdesc in args.define_planets.split(","): name, elemfile = pdesc.split(":") ephemeris.register_object(name, ephemeris.read_object(elemfile)) def parse_src_handling(): res = {} res["mode"] = config.get("src_handling") if res["mode"] == "none": return None res["amplim"] = config.get("src_handling_lim") res["srcs"] = None srcfile = config.get("src_handling_list") if srcfile: res["srcs"] = pointsrcs.read(srcfile) return res src_handling = parse_src_handling() filedb.init()