当前位置: 首页>>代码示例>>Python>>正文


Python FITSFigure.show_colorscale方法代码示例

本文整理汇总了Python中aplpy.FITSFigure.show_colorscale方法的典型用法代码示例。如果您正苦于以下问题:Python FITSFigure.show_colorscale方法的具体用法?Python FITSFigure.show_colorscale怎么用?Python FITSFigure.show_colorscale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aplpy.FITSFigure的用法示例。


在下文中一共展示了FITSFigure.show_colorscale方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GPSFermiPlot

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
class GPSFermiPlot(GalacticPlaneSurveyPanelPlot):

    def main(self, figure, subplot):
        filename = FermiGalacticCenter.filenames()['counts']
        self.fits_figure = FITSFigure(filename, figure=figure, subplot=subplot)
        self.fits_figure.show_colorscale(vmin=1, vmax=10)
        self.fits_figure.ticks.set_xspacing(2)
开发者ID:JonathanDHarris,项目名称:gammapy,代码行数:9,代码来源:survey_example.py

示例2: part_8

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
def part_8():

	object_list = ['ROXs12','ROXs42B','ROXs42B']
	filename_list = ['ROXs12','ROXs42Bb','ROXs42Bc']

	for i in range(len(filename_list)):
		outfile = open('position_'+filename_list[i]+'.dat','w')
		outfile.write('# '+'%25s'%'file name\t'\
							  +'%12s'%'x planet\t'\
							  +'%12s'%'y planet\t'\
							  +'%12s'%'position angle\t'\
							  +'%12s'%'projected separation (pixels)\n')


		if filename_list[i] == 'ROXs12': int_x,int_y = 562,685
		elif filename_list[i] == 'ROXs42Bb': int_x,int_y = 629,495
		elif filename_list[i] == 'ROXs42Bc': int_x,int_y = 546,465
		parts = ['','_CMsub','_ADIsub','_bPSFsub']
		for j in parts:

			filename = object_list[i]+j+'_aligned_median.fits'
			fit_radius = 16

			f = fits.open(filename)
			scidata = f[0].data

			x_data = scidata[int_y,int_x-fit_radius:int_x+fit_radius+1]
			x_data -= min(x_data)
			fit_x = np.linspace(-fit_radius,fit_radius,1+2*fit_radius)
			xfitParam, xfitCovar = curve_fit(gaussian_pdf,fit_x,x_data)
			
			y_data = scidata[int_y-fit_radius:int_y+fit_radius+1,int_x]
			y_data -= min(y_data)
			fit_y = np.linspace(-fit_radius,fit_radius,1+2*fit_radius)
			yfitParam, yfitCovar = curve_fit(gaussian_pdf,fit_y,y_data)

			thisPARANG   = f[0].header['PARANG']
			thisROTPPOSN = f[0].header['ROTPPOSN']
			thisEL       = f[0].header['EL']
			thisINSTANGL = f[0].header['INSTANGL']
			PA_yaxis     = thisPARANG +thisROTPPOSN -thisEL -thisINSTANGL

			PA_planet    = PA_yaxis -rad_to_deg(arctan2(float(xfitParam[0]+int_x-512),float(yfitParam[0]+int_y-512)))
			if PA_planet < 0: PA_planet += 360

			outfile.write('%25s'%str(object_list[i]+j+'_aligned_median.fits')+'\t'\
					+'%8s'%'%.3f'%(float(xfitParam[0]+int_x))+'\t'\
					+'%8s'%'%.3f'%(float(yfitParam[0]+int_y))+'\t'\
					+'%8s'%'%.3f'%(float(PA_planet))+'\t'\
					+'%8s'%'%.3f'%(float(sqrt((xfitParam[0]+int_x-512)**2+(yfitParam[0]+int_y-512)**2)))+'\n')

			tf = FITSFigure(filename)
			tf.show_colorscale(cmap='gray')
			tf.add_colorbar()
			tf.colorbar.show(location='top',box_orientation='horizontal')
			plt.savefig(object_list[i]+j+'_aligned_median.pdf',dpi=200)
			plt.close()

		outfile.close()
开发者ID:aleung12,项目名称:ast381,代码行数:61,代码来源:hw2.py

示例3: FITSFigure

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
                                                method='lima'))
# Gammapy significance
significance = np.nan_to_num(significance(correlated_counts, correlated_model,
                                          method='lima'))

titles = ['Gammapy Significance', 'Fermi Tools Significance']

# Plot

fig = plt.figure(figsize=(10, 5))
hdu1 = fits.ImageHDU(significance, header)
f1 = FITSFigure(hdu1, figure=fig, convention='wells', subplot=(1, 2, 1))
f1.set_tick_labels_font(size='x-small')
f1.tick_labels.set_xformat('ddd')
f1.tick_labels.set_yformat('ddd')
f1.show_colorscale(vmin=0, vmax=10, cmap='afmhot')
f1.add_colorbar(axis_label_text='Significance')
f1.colorbar.set_width(0.1)
f1.colorbar.set_location('right')

hdu2 = fits.ImageHDU(fermi_significance, header)
f2 = FITSFigure(hdu2, figure=fig, convention='wells', subplot=(1, 2, 2))
f2.set_tick_labels_font(size='x-small')
f2.tick_labels.set_xformat('ddd')
f2.hide_ytick_labels()
f2.hide_yaxis_label()
f2.show_colorscale(vmin=0, vmax=10, cmap='afmhot')
f2.add_colorbar(axis_label_text='Significance')
f2.colorbar.set_width(0.1)
f2.colorbar.set_location('right')
fig.text(0.15, 0.92, "Gammapy Significance")
开发者ID:OlgaVorokh,项目名称:gammapy,代码行数:33,代码来源:npred_convolved_significance.py

示例4: FITSFigure

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
# Fermi significance
fermi_significance = np.nan_to_num(significance(correlated_counts, correlated_gtmodel, method="lima"))
# Gammapy significance
significance = np.nan_to_num(significance(correlated_counts, correlated_model, method="lima"))

titles = ["Gammapy Significance", "Fermi Tools Significance"]

# Plot

fig = plt.figure(figsize=(10, 5))
hdu1 = fits.ImageHDU(significance, header)
f1 = FITSFigure(hdu1, figure=fig, convention="wells", subplot=(1, 2, 1))
f1.set_tick_labels_font(size="x-small")
f1.tick_labels.set_xformat("ddd")
f1.tick_labels.set_yformat("ddd")
f1.show_colorscale(vmin=0, vmax=20, cmap="afmhot", stretch="sqrt")
f1.add_colorbar(axis_label_text="Significance")
f1.colorbar.set_width(0.1)
f1.colorbar.set_location("right")

hdu2 = fits.ImageHDU(fermi_significance, header)
f2 = FITSFigure(hdu2, figure=fig, convention="wells", subplot=(1, 2, 2))
f2.set_tick_labels_font(size="x-small")
f2.tick_labels.set_xformat("ddd")
f2.hide_ytick_labels()
f2.hide_yaxis_label()
f2.show_colorscale(vmin=0, vmax=20, cmap="afmhot", stretch="sqrt")
f2.add_colorbar(axis_label_text="Significance")
f2.colorbar.set_width(0.1)
f2.colorbar.set_location("right")
fig.text(0.15, 0.92, "Gammapy Significance")
开发者ID:dlennarz,项目名称:gammapy,代码行数:33,代码来源:npred_convolved_significance.py

示例5: float

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
#import IPython; IPython.embed(); 1/0

# Computing the sub-figure sizes is surprisingly hard
figsize=(5, 15)
figure = mpl.figure(figsize=figsize)
axis_ratio = figsize[0] / float(figsize[1])
edge_margin_x = 0.12
edge_margin_y = edge_margin_x * axis_ratio
edge_margin_x_up = 0.01
edge_margin_y_up = edge_margin_x_up * axis_ratio
inner_margin_x = 0.1
inner_margin_y = inner_margin_x * axis_ratio
size_x = (1 - edge_margin_x - edge_margin_x_up)
size_y = (1 - edge_margin_y - edge_margin_y_up - 2 * inner_margin_y) / 3

for ii, image in enumerate(images):
    subplot = [edge_margin_x, edge_margin_y + ii * (size_y + inner_margin_y), size_x, size_y]
    print('subplot = {0}'.format(subplot))
    f = FITSFigure(image['filename'], figure=figure, subplot=subplot)
    f.recenter(x_center, y_center, 0.95 * radius)
    set_hgps_style(f)
    f.show_colorscale(vmin=-1, vmax=8, stretch='power', exponent=1, cmap='jet') #vmid=-3, stretch='log', )
    if ii == 1:
        f.show_regions('sources.reg')
    else:
        f.show_regions('sources2.reg')

filename = 'icrc2013_89_06.pdf'
print('Writing {}'.format(filename))
figure.savefig(filename)
开发者ID:gammapy,项目名称:enrico-icrc2013-proceedings,代码行数:32,代码来源:plot_images.py

示例6: catalog_image

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
"""Produces an image from 1FHL catalog point sources.
"""
import numpy as np
import matplotlib.pyplot as plt
from aplpy import FITSFigure
from gammapy.datasets import FermiGalacticCenter
from gammapy.image import catalog_image, SkyImage
from gammapy.irf import EnergyDependentTablePSF

# Create image of defined size
reference = SkyImage.empty(nxpix=300, nypix=100, binsz=1).to_image_hdu()
psf_file = FermiGalacticCenter.filenames()['psf']
psf = EnergyDependentTablePSF.read(psf_file)

# Create image
image = catalog_image(reference, psf, catalog='1FHL', source_type='point',
                      total_flux='True')

# Plot
fig = FITSFigure(image.to_fits()[0], figsize=(15, 5))
fig.show_colorscale(interpolation='bicubic', cmap='afmhot', stretch='log', vmin=1E-12, vmax=1E-8)
fig.tick_labels.set_xformat('ddd')
fig.tick_labels.set_yformat('dd')
ticks = np.logspace(-12, -8, 5)
fig.add_colorbar(ticks=ticks, axis_label_text='Flux (ph s^-1 cm^-2 TeV^-1)')
fig.colorbar._colorbar_axes.set_yticklabels(['{:.0e}'.format(_) for _ in ticks])
plt.tight_layout()
plt.show()
开发者ID:OlgaVorokh,项目名称:gammapy,代码行数:30,代码来源:source_image_demo.py

示例7: dict

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
tsimage = dict(label='TSMap', filename=tsfile)

# Determine image center and width / height
dpi = 2000
header = fits.getheader(tsimage['filename'])
wcs = WCS(header)
header['NAXIS1'] / dpi
header['NAXIS2'] / dpi
lon, lat = header['NAXIS1'] / 2., header['NAXIS2'] / 2.
x_center, y_center = wcs.wcs_pix2world(lon, lat, 0)
radius = header['CDELT2'] * header['NAXIS2'] / 2.

# Computing the sub-figure sizes is surprisingly hard
figsize=(5, 5)
figure = mpl.figure(figsize=figsize)

f = FITSFigure(tsimage['filename'], figure=figure)
f.recenter(x_center, y_center, 0.95 * radius)
set_hgps_style(f)
f.show_colorscale(vmin=1e-5, vmax=vmax, stretch=st[0], exponent=1, cmap='jet') #vmid=-3, stretch='log', )

f.show_colorbar()

filename = config["out"]+'/TSMaps.eps'
print('Writing {}'.format(filename))
figure.savefig(filename)
filename = config["out"]+'/TSMaps.png'
print('Writing {}'.format(filename))
figure.savefig(filename)
开发者ID:dcfidalgo,项目名称:enrico,代码行数:31,代码来源:plotTSMaps.py

示例8: prepare_images

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
from astropy.io import fits
from npred_general import prepare_images
from aplpy import FITSFigure

model, gtmodel, ratio, counts, header = prepare_images()

# Plotting

fig = plt.figure()
hdu1 = fits.ImageHDU(model, header)
f1 = FITSFigure(hdu1, figure=fig, convention='wells', subplot=[0.18, 0.264, 0.18, 0.234])
f1.tick_labels.set_font(size='x-small')
f1.tick_labels.set_xformat('ddd')
f1.tick_labels.set_yformat('ddd')
f1.axis_labels.hide_x()
f1.show_colorscale(vmin=0, vmax=0.3)

hdu2 = fits.ImageHDU(gtmodel, header)
f2 = FITSFigure(hdu2, figure=fig, convention='wells', subplot=[0.38, 0.25, 0.2, 0.26])
f2.tick_labels.set_font(size='x-small')
f2.tick_labels.set_xformat('ddd')
f2.tick_labels.hide_y()
f2.axis_labels.hide_y()
f2.show_colorscale(vmin=0, vmax=0.3)
f2.add_colorbar()
f2.colorbar.set_width(0.1)
f2.colorbar.set_location('right')

hdu3 = fits.ImageHDU(ratio, header)
f3 = FITSFigure(hdu3, figure=fig, convention='wells', subplot=[0.67, 0.25, 0.2, 0.26])
f3.tick_labels.set_font(size='x-small')
开发者ID:JonathanDHarris,项目名称:gammapy,代码行数:33,代码来源:npred_convolved.py

示例9: float

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
figure = mpl.figure(figsize=figsize)
axis_ratio = figsize[0] / float(figsize[1])
edge_margin_x = 0.12
edge_margin_y = edge_margin_x * axis_ratio
edge_margin_x_up = 0.01
edge_margin_y_up = edge_margin_x_up * axis_ratio
inner_margin_x = 0.1
inner_margin_y = inner_margin_x * axis_ratio
size_x = (1 - edge_margin_x - edge_margin_x_up)
size_y = (1 - edge_margin_y - edge_margin_y_up - 2 * inner_margin_y) / 3

for ii, image in enumerate(images):
    subplot = [edge_margin_x, edge_margin_y + ii * (size_y + inner_margin_y), size_x, size_y]
    f = FITSFigure(image['filename'], figure=figure, subplot=subplot)
    f.recenter(x_center, y_center, 0.95 * radius)
    set_hgps_style(f)
    print image['filename']
    try : 
      f.show_colorscale(vmin=-1, vmax=vmax, stretch='power', exponent=1, cmap='jet',smooth=3,kernel ='gauss') #vmid=-3, stretch='log', )
    except:
      f.show_colorscale(vmin=-1, vmax=vmax, stretch='power', exponent=1, cmap='jet') #vmid=-3, stretch='log', )
    # TODO: overplot sources  
#    f.show_regions("sources.reg")

filename = config["out"]+'/Maps.eps'
print('Writing {}'.format(filename))
figure.savefig(filename)
filename = config["out"]+'/Maps.png'
print('Writing {}'.format(filename))
figure.savefig(filename)
开发者ID:mahmoud-lsw,项目名称:enrico,代码行数:32,代码来源:plotMaps.py

示例10: prepare_images

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
"""Runs commands to produce convolved predicted counts map in current directory.
"""
import matplotlib.pyplot as plt
from astropy.io import fits
from aplpy import FITSFigure
from npred_general import prepare_images

model, gtmodel, ratio, counts, header = prepare_images()

# Plotting
fig = plt.figure(figsize=(15, 5))

image1 = fits.ImageHDU(data=model, header=header)
f1 = FITSFigure(image1, figure=fig, subplot=(1, 3, 1), convention='wells')
f1.show_colorscale(vmin=0, vmax=0.3, cmap='afmhot')
f1.tick_labels.set_xformat('ddd')
f1.tick_labels.set_yformat('dd')

image2 = fits.ImageHDU(data=gtmodel, header=header)
f2 = FITSFigure(image2, figure=fig, subplot=(1, 3, 2), convention='wells')
f2.show_colorscale(vmin=0, vmax=0.3, cmap='afmhot')
f2.tick_labels.set_xformat('ddd')
f2.tick_labels.set_yformat('dd')

image3 = fits.ImageHDU(data=ratio, header=header)
f3 = FITSFigure(image3, figure=fig, subplot=(1, 3, 3), convention='wells')
f3.show_colorscale(vmin=0.95, vmax=1.05, cmap='RdBu')
f3.tick_labels.set_xformat('ddd')
f3.tick_labels.set_yformat('dd')
f3.add_colorbar(ticks=[0.95, 0.975, 1, 1.025, 1.05])
开发者ID:dlennarz,项目名称:gammapy,代码行数:32,代码来源:npred_convolved.py

示例11: luminosity

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
    n_sources=n_sources, rad_dis=rad_dis, vel_dis=vel_dis, max_age=1e6, spiralarms=spiralarms, random_state=0
)

# Minimum source luminosity (ph s^-1)
luminosity_min = 4e34
# Maximum source luminosity (ph s^-1)
luminosity_max = 4e37
# Luminosity function differential power-law index
luminosity_index = 1.5

# Assigns luminosities to sources
luminosity = sample_powerlaw(luminosity_min, luminosity_max, luminosity_index, n_sources, random_state=0)
table["luminosity"] = luminosity

# Adds parameters to table: distance, glon, glat, flux, angular_extension
table = population.add_observed_parameters(table)
table.meta["Energy Bins"] = np.array([10, 500]) * u.GeV
# Create image
image = catalog_image(reference, psf, catalog="simulation", source_type="point", total_flux=True, sim_table=table)

# Plot
fig = FITSFigure(image.to_fits(format="fermi-background")[0], figsize=(15, 5))
fig.show_colorscale(interpolation="bicubic", cmap="afmhot", stretch="log", vmin=1e30, vmax=1e35)
fig.tick_labels.set_xformat("ddd")
fig.tick_labels.set_yformat("dd")
ticks = np.logspace(30, 35, 6)
fig.add_colorbar(ticks=ticks, axis_label_text="Flux (ph s^-1)")
fig.colorbar._colorbar_axes.set_yticklabels(["{:.0e}".format(_) for _ in ticks])
plt.tight_layout()
plt.show()
开发者ID:dlennarz,项目名称:gammapy,代码行数:32,代码来源:simulated_image_demo.py

示例12: FITSFigure

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
                                                method='lima'))
# Gammapy significance
significance = np.nan_to_num(significance(correlated_counts, correlated_model,
                                          method='lima'))

titles = ['Gammapy Significance', 'Fermi Tools Significance']

#Plot

fig = plt.figure()
hdu1 = fits.ImageHDU(significance, header)
f1 = FITSFigure(hdu1, figure=fig, convention='wells', subplot=[0.15,0.214,0.38,0.494])
f1.set_tick_labels_font(size='x-small')
f1.tick_labels.set_xformat('ddd')
f1.tick_labels.set_yformat('ddd')
f1.show_colorscale(vmin=0, vmax=10)

hdu2 = fits.ImageHDU(fermi_significance, header)
f2 = FITSFigure(hdu2, figure=fig, convention='wells', subplot=[0.56,0.2,0.4,0.52])
f2.set_tick_labels_font(size='x-small')
f2.tick_labels.set_xformat('ddd')
f2.hide_ytick_labels()
f2.hide_yaxis_label()
f2.show_colorscale(vmin=0, vmax=10)
f2.add_colorbar()
f2.colorbar.set_width(0.1)
f2.colorbar.set_location('right')
fig.text(0.22,0.72,"Gammapy Significance",color='black',size='14')
fig.text(0.63,0.72,"Fermi Tools Significance",color='black',size='14')

fig.canvas.draw()
开发者ID:mahmoud-lsw,项目名称:gammapy,代码行数:33,代码来源:npred_convolved_significance.py

示例13: FITSFigure

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
# Fermi significance
fermi_significance = np.nan_to_num(significance(correlated_counts, gtmodel, method="lima"))
# Gammapy significance
significance = np.nan_to_num(significance(correlated_counts, correlated_model, method="lima"))

titles = ["Gammapy Significance", "Fermi Tools Significance"]

# Plot

fig = plt.figure(figsize=(10, 5))
hdu1 = fits.ImageHDU(significance, header)
f1 = FITSFigure(hdu1, figure=fig, convention="wells", subplot=(1, 2, 1))
f1.set_tick_labels_font(size="x-small")
f1.tick_labels.set_xformat("ddd")
f1.tick_labels.set_yformat("ddd")
f1.show_colorscale(vmin=0, vmax=10, cmap="afmhot")
f1.add_colorbar(axis_label_text="Significance")
f1.colorbar.set_width(0.1)
f1.colorbar.set_location("right")

hdu2 = fits.ImageHDU(fermi_significance, header)
f2 = FITSFigure(hdu2, figure=fig, convention="wells", subplot=(1, 2, 2))
f2.set_tick_labels_font(size="x-small")
f2.tick_labels.set_xformat("ddd")
f2.hide_ytick_labels()
f2.hide_yaxis_label()
f2.show_colorscale(vmin=0, vmax=10, cmap="afmhot")
f2.add_colorbar(axis_label_text="Significance")
f2.colorbar.set_width(0.1)
f2.colorbar.set_location("right")
fig.text(0.15, 0.92, "Gammapy Significance")
开发者ID:tibaldo,项目名称:gammapy,代码行数:33,代码来源:npred_convolved_significance.py

示例14: raw_input

# 需要导入模块: from aplpy import FITSFigure [as 别名]
# 或者: from aplpy.FITSFigure import show_colorscale [as 别名]
from aplpy import FITSFigure
from astropy.io import fits
filename = raw_input("File to plot: ")
hdu = fits.open(filename)[1]
fig = FITSFigure(hdu)
fig.show_colorscale(stretch='log', interpolation='none')
#fig.add_colorbar()
#fig.colorbar.set_ticks([0.1e-11, 0.4e-11, 1.2e-11])
#fig.colorbar.set_width(0.1)
#fig.colorbar.set_font('serif')
#fig.colorbar.set_label_properties(size='small')
#fig.hide_ytick_labels()
#fig.hide_yaxis_label()
#fig.hide_xaxis_label()
fig.tick_labels.set_yformat('ddd')
fig.tick_labels.set_xformat('ddd')
fig.set_tick_yspacing(5)
fig.axis_labels.set_font(size='small', family='roman')
fig.set_tick_labels_font('serif')
fig.set_tick_labels_size('small')
fig.save('image.pdf')

开发者ID:ellisowen,项目名称:SciNeGHE_scripts,代码行数:23,代码来源:image_script.py


注:本文中的aplpy.FITSFigure.show_colorscale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。