def print_sm2(self): CatIn = self.SourceCat ind = np.argsort(CatIn.Cluster) Cat = CatIn[ind] TEMPLATE = ( ' %(Cluster)5s %(name)10s %(RA)15s %(DEC)15s %(Flux)10s %(alpha)10s %(RefFreq)10s %(Kill)6s ' ) print() print(" TARGET LIST: ") print( TEMPLATE % { 'Cluster': "K".center(5), 'name': "Name".center(10), 'RA': "RA".center(15), 'DEC': "DEC".center(15), 'Flux': "Flux".rjust(10), 'alpha': "alpha".rjust(10), 'RefFreq': "RefFreq".rjust(10), 'Kill': "Kill" }) for i in range(Cat.shape[0]): SName = Cat.Name[i] SRa = rad2hmsdms.rad2hmsdms(Cat.ra[i], Type="ra").replace(" ", ":") SDec = rad2hmsdms.rad2hmsdms(Cat.dec[i]).replace(" ", ".") SI = "%6.3f" % Cat.I[i] SAlpha = "%4.2f" % Cat.alpha[i] SRefFreq = "%5.1f" % (Cat.RefFreq[i] / 1.e6) SKill = "%i" % Cat.kill[i] SCluster = "%2.2i" % Cat.Cluster[i] StrOut = TEMPLATE % { 'Cluster': SCluster.center(5), 'name': SName.center(10), 'RA': SRa, 'DEC': SDec, 'Flux': SI, 'alpha': SAlpha, 'RefFreq': SRefFreq, 'Kill': SKill } print(StrOut)
def print_sm(self, Cat): if self.infile_cluster == "": print(" TARGET LIST: ") format = "%13s%20s%20s%10s%10s%10s" #%10s" print(format % ("Name", "Ra", "Dec", "Flux", "alpha", "RefFreq")) #,"Kill") for i in range(Cat.shape[0]): SName = Cat.Name[i] SRa = rad2hmsdms.rad2hmsdms(Cat.ra[i] / 15).replace(" ", ":") SDec = rad2hmsdms.rad2hmsdms(Cat.dec[i]).replace(" ", ".") SI = Cat.I[i] SAlpha = Cat.alpha[i] SRefFreq = Cat.RefFreq[i] SKill = str(Cat.kill[i] == 1) #print "%13s%20s%20s%10.4f%10s%10.2e%8s"%(SName,SRa,SDec,SI,SAlpha,SRefFreq,SKill) print("%13s%20s%20s%10.4f%10s%10.2e" % (SName, SRa, SDec, SI, SAlpha, SRefFreq)) #,SKill) else: format = "%10s%10s%15s%15s%10s%10s%10s" #%8s" print() print(" TARGET LIST: ") print(format % ("Group", "Name", "Ra", "Dec", "Flux", "alpha", "RefFreq")) #,"kill") for i in range(np.max(Cat.Cluster) + 1): ind = np.where(Cat.Cluster == i)[0] for j in range(ind.shape[0]): jj = ind[j] SName = Cat.Name[jj] SRa = rad2hmsdms.rad2hmsdms(Cat.ra[jj] / 15).replace( " ", ":") SDec = rad2hmsdms.rad2hmsdms(Cat.dec[jj]).replace(" ", ".") SI = Cat.I[jj] SAlpha = Cat.alpha[jj] SRefFreq = Cat.RefFreq[jj] SKill = str(Cat.kill[jj] == 1) SGroup = str(i) #print "%10s%10s%15s%15s%8.4f%10s%10.2e%8s"%(SGroup,SName,SRa,SDec,SI,SAlpha,SRefFreq)#,SKill) print("%10s%10s%15s%15s%8.4f%10s%10.2e" % (SGroup, SName, SRa, SDec, SI, SAlpha, SRefFreq)) #,SKill)