欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

plot astrodendro

程序员文章站 2022-03-20 23:52:15
...
import aplpy
from astropy.io import fits
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os

from astrodendro import Dendrogram
from astrodendro.analysis import PPStatistic
from astrodendro import Dendrogram, pp_catalog
from astropy import units as u
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.wcs import WCS

inputfits='1.3mm_910klambda_subfits_aplpy.fits'
ra, dec = np.loadtxt('gauss_fragments.txt.txt',usecols=(0,1),unpack=True,dtype='str')
c = SkyCoord(ra, dec, frame='fk5')
w = WCS(inputfits)
pix1, pix2 = np.loadtxt('dendro_fragments.txt',usecols=(0,1),unpack=True)
dendro_frag = w.wcs_pix2world(pix1,pix2,0)
major, minor, pa = np.loadtxt('dendro_fragments.txt',usecols=(2,3,4),unpack=True)
maj_plot = major/3600
min_plot = minor/3600

f = plt.figure(figsize=(60,30))
fig = aplpy.FITSFigure(inputfits,figure=f,subplot=(1,1,1))
fig.show_colorscale(vmin=0.0004)
fig.show_contour(inputfits,levels=[0.0009],colors='White')
fig.add_colorbar()
fig.show_markers(xw=c.ra,yw=c.dec,coords_frame='world',marker='+',c='orange',s=300)
#fig.show_markers(xw=dendro_frag[0],yw=dendro_frag[1],coords_frame='world',marker='o',c='red',s=50)
fig.show_ellipses(xw=dendro_frag[0],yw=dendro_frag[1],coords_frame='world',width=maj_plot,height=min_plot,angle=pa,edgecolor = 'red',facecolor='none')
#fig.show_ellipses(xw=0,yw=0,coords_frame='world',width=60,height=30,angle=-40,edgecolor = 'red',facecolor='none')
fig.savefig('marker.pdf')

plot astrodendro

相关标签: 天文软件