def plot_dust_overlay(nh3_image_fits,h2_image_fits,region,plot_param,v_min,v_max,maskLim,obsMaskFits):
text_size = 14
b18_text_size = 20
# Contour parameters (currently NH3 moment 0)
cont_color='black'
cont_lw = 0.6
cont_levs=2**np.arange( 0,20)*plot_param['w11_step']
# Masking of small (noisy) regions
selem = np.array([[0,1,0],[1,1,1],[0,1,0]])
LowestContour = cont_levs[0]*0.5
w11_hdu = fits.open(nh3_image_fits)
map = w11_hdu[0].data
mask = binary_opening(map > LowestContour, selem)
MaskedMap = mask*map
w11_hdu[0].data = MaskedMap
# Labels
if region == 'B18':
label_colour = 'white'
text_size = b18_text_size
else:
label_colour = 'white'
fig=aplpy.FITSFigure(h2_image_fits,figsize=(plot_param['size_x'], plot_param['size_y']))
fig.show_colorscale(cmap='hot',vmin=v_min,vmax=v_max,stretch='log',vmid=v_min-v_min*plot_param['vmid_scale'])
fig.set_nan_color('0.95')
# Observations mask contour
fig.show_contour(obsMaskFits,colors='white',levels=1,linewidths=1.5)
# NH3 moment contours
fig.show_contour(w11_hdu,colors=cont_color,levels=cont_levs,linewidths=cont_lw)
fig.axis_labels.set_font(family='sans_serif',size=text_size)
# Ticks
fig.tick_labels.set_font(family='sans_serif',size=text_size)
fig.ticks.set_color('white')
fig.tick_labels.set_xformat('hh:mm:ss')
fig.tick_labels.set_style('colons')
fig.tick_labels.set_yformat('dd:mm')
# Scale bar
# magic line of code to obtain scale in arcsec obtained from
# http://www.astropy.org/astropy-tutorials/Quantities.html
ang_sep = (plot_param['scalebar_size'].to(u.au)/plot_param['distance']).to(u.arcsec, equivalencies=u.dimensionless_angles())
fig.add_scalebar(ang_sep.to(u.degree))
fig.scalebar.set_font(family='sans_serif',size=text_size)
fig.scalebar.set_corner(plot_param['scalebar_pos'])
fig.scalebar.set(color='white')
fig.scalebar.set_label('{0:4.2f}'.format(plot_param['scalebar_size']))
fig.add_label(plot_param['label_xpos'], plot_param['label_ypos'],
'{0}\n{1}'.format(region,'500 $\mu$m'),
relative=True, color=label_colour,
horizontalalignment=plot_param['label_align'],
family='sans_serif',size=text_size)
fig.save( 'figures/{0}_continuum_image.pdf'.format(region),adjust_bbox=True,dpi=200)#, bbox_inches='tight')
fig.close()
GAS_Herschel_analysis.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录