def make_source (ns,name,l,m,I=1): """Makes a source with a direction, using the current option set. Returns None for sources out of the "sky". (l^2+m^2>1)"""; l = math.sin(l); m = math.sin(m); if l*l + m*m <= 1: srcdir = Meow.LMDirection(ns,name,l,m); if source_spi is not None: freq0 = source_freq0*1e+6 if source_freq0 else Meow.Context.observation.freq0(); spi = source_spi if source_spi_2 is None else [ source_spi,source_spi_2 ]; else: spi = freq0 = None; if source_pol: Q = I*source_qi; U = I*source_ui; V = I*source_vi; else: Q = U = V = None; if source_type == "point": return Meow.PointSource(ns,name,srcdir,I=I,Q=Q,U=U,V=V,spi=spi,freq0=freq0); elif source_type == "gaussian": s1,s2 = gauss_smaj*ARCSEC,gauss_smin*ARCSEC; pa = gauss_pa*DEG; return Meow.GaussianSource(ns,name,srcdir,I=I,Q=Q,U=U,V=V,spi=spi,freq0=freq0, lproj=s1*math.sin(pa),mproj=s1*math.cos(pa),ratio=s2/s1); # else fall through and return none return None;
def transient_source (ns,name,l,m,tburst,duration,Ipeak=1): """shortcut for making a transient pointsource with a direction. Returns None for sources out of the "sky" (l^2+m^2>1)"""; l = math.sin(l); m = math.sin(m); t_rel = ns.t_rel ** (Meq.Time() - (ns.time0 << 0)) lc = ns.lc << Meq.Exp((-Meq.Pow(t_rel-tburst,2))/(2*duration**2)) Ilc = ns.Ilc << Ipeak * lc if l*l + m*m <= 1: srcdir = Meow.LMDirection(ns,name,l,m); return Meow.PointSource(ns,name,srcdir,I=Ilc); else: return None;
def point_source(ns, name, l, m, I=1): """shortcut for making a pointsource with a direction. Returns None for sources out of the "sky" (l^2+m^2>1)""" l = math.sin(l) m = math.sin(m) if l * l + m * m <= 1: srcdir = Meow.LMDirection(ns, name, l, m) if source_spi is not None: freq0 = source_freq0 or Meow.Context.observation.freq0() else: freq0 = None return Meow.PointSource(ns, name, srcdir, I=I, spi=source_spi, freq0=freq0) else: return None
def source_list (ns,name="cps"): # figure out spectral index parameters if spectral_index is not None: spi_def = Meow.Parm(spectral_index); freq0_def = ref_freq; else: spi_def = freq0_def = None; i_def = Meow.Parm(1); quv_def = Meow.Parm(0); srcdir = Meow.LMDirection(ns,name,0,0); src = Meow.PointSource(ns,name,srcdir,I=i_def,Q=quv_def,U=quv_def,V=quv_def,spi=spi_def,freq0=freq0_def); ## define a parmgroup for source parameters ## now make a solvejobs for the source #pg_src = ParmGroup("source", #src.coherency().search(tags="solvable"), #table_name="sources.mep", #individual=True, #bookmark=True); ## now make a solvejobs for the source #options.append(pg_src.make_solvejob_menu("Calibrate source fluxes")); return [ src ];