本文整理汇总了Python中ximpol.utils.matplotlib_.pyplot.figure函数的典型用法代码示例。如果您正苦于以下问题:Python figure函数的具体用法?Python figure怎么用?Python figure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了figure函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
"""
"""
plt.figure(figsize=(10, 6), dpi=80)
plt.title('Swift XRT light curves of GRBs up to 130427A')
#get_all_swift_grb_names = ['GRB 130427A','GRB 041223']
num_grb = 0
for i,grb_name in enumerate(get_all_swift_grb_names()):
flux_outfile = download_swift_grb_lc_file(grb_name)
if type(flux_outfile) is str:
integral_flux_spline = parse_light_curve(flux_outfile)
if integral_flux_spline != 0:
if grb_name == 'GRB 130427A':
integral_flux_spline.plot(num_points=1000,logx=True,\
logy=True,show=False,\
color="red",linewidth=1.0)
num_grb += 1
break
plt.title('Swift XRT light curves of GRBs up to now')
else:
c = random.uniform(0.4,0.8)
integral_flux_spline.plot(num_points=1000,logx=True,\
logy=True,show=False,\
color='%f'%c,linewidth=1.0)
num_grb += 1
print num_grb
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:27,代码来源:all_grb_lc.py
示例2: plotmdp
def plotmdp():
spin00_pol_degree_spline = buildspline(0.5)
spin00_mcube = xBinnedModulationCube(fetch_mcubepath(0.5))
spin998_pol_degree_spline = buildspline(0.998)
spin998_mcube = xBinnedModulationCube(fetch_mcubepath(0.998))
spin00_mcube.fit()
spin998_mcube.fit()
spin00_fit_results = spin00_mcube.fit_results[0]
spin998_fit_results = spin998_mcube.fit_results[0]
plt.figure('MDP')
spin00_mdp = spin00_mcube.mdp99[:-1]
spin998_mdp = spin998_mcube.mdp99[:-1]
emean = spin00_mcube.emean[:-1]
emin = spin00_mcube.emin[:-1]
emax = spin00_mcube.emax[:-1]
width = (emax-emin)/2.
plt.errorbar(emean,spin00_mdp,xerr=width, label='Spin 0.5',marker='o',linestyle='--')
plt.errorbar(emean,spin998_mdp,xerr=width, label='Spin 0.998',marker='o',linestyle='--')
plt.figtext(0.2, 0.85,'XIPE %s ks'%((SIM_DURATION*NUM_RUNS)/1000.),size=18)
plt.xlim([1,10])
plt.ylabel('MPD 99\%')
plt.xlabel('Energy (keV)')
plt.legend()
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:33,代码来源:grs1915_polfrac_plot.py
示例3: plot
def plot(self, show=True):
"""Plot the energy dispersion.
"""
from ximpol.utils.matplotlib_ import pyplot as plt
from ximpol.utils.matplotlib_ import context_two_by_two
emin = self.matrix.xmin()
emax = self.matrix.xmax()
def _plot_vslice(energy, position):
"""Convenience function to plot a generic vertical slice of the
energy dispersion.
"""
ax = plt.subplot(2, 2, position)
vslice = self.matrix.vslice(energy)
vslice.plot(overlay=False, show=False)
plt.text(0.1, 0.9, '$E = %.2f\\ \\rm{keV}$' % energy,
transform=ax.transAxes)
ppf = vslice.build_ppf()
eres = 0.5*(ppf(0.8413) - ppf(0.1586))/ppf(0.5)
plt.text(0.1, 0.85, '$\sigma_E/E = %.3f$' % eres,
transform=ax.transAxes)
with context_two_by_two():
plt.figure(1)
ax = plt.subplot(2, 2, 1)
self.matrix.plot(show=False)
ax = plt.subplot(2, 2, 2)
self.ebounds.plot(overlay=False, show=False)
_plot_vslice(emin + 0.333*(emax - emin), 3)
_plot_vslice(emin + 0.666*(emax - emin), 4)
if show:
plt.show()
开发者ID:pabell,项目名称:ximpol,代码行数:32,代码来源:rmf.py
示例4: plot_swift_lc
def plot_swift_lc(grb_list,show=True):
"""Plots Swift GRB light curves.
"""
plt.figure(figsize=(10, 8), dpi=80)
plt.title('Swift XRT light curves')
num_grb = 0
for grb_name in grb_list:
flux_outfile = download_swift_grb_lc_file(grb_name, min_obs_time=21600)
if flux_outfile is not None:
integral_flux_spline = parse_light_curve(flux_outfile)
if integral_flux_spline is not None:
if grb_name == 'GRB 130427A':
integral_flux_spline.plot(num_points=1000,logx=True,\
logy=True,show=False,\
color="red",linewidth=1.0)
num_grb += 1
else:
c = random.uniform(0.4,0.8)
integral_flux_spline.plot(num_points=1000,logx=True,\
logy=True,show=False,\
color='%f'%c,linewidth=1.0)
num_grb += 1
else:
continue
logger.info('%i GRBs included in the plot.'%num_grb)
if show:
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:27,代码来源:grb_swift_lc.py
示例5: display
def display():
"""Display the source model.
"""
print(ROI_MODEL)
from ximpol.utils.matplotlib_ import pyplot as plt
fig = plt.figure('Energy spectrum')
spectral_model.plot(show=False, logy=True)
fig = plt.figure('Polarization degree')
pol_degree.plot(show=False)
fig = plt.figure('Polarization angle')
pol_angle.plot(show=False)
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:12,代码来源:mcg_6_30_15.py
示例6: main
def main():
"""Simple test code.
"""
from ximpol.utils.matplotlib_ import pyplot as plt
model = xpeInterstellarAbsorptionModel()
trans = model.transmission_factor(1.e22)
energy = numpy.linspace(1, 10, 10)
print(trans(energy))
plt.figure()
model.xsection.plot(logx=True, logy=True, show=False)
plt.figure()
trans.plot(logx=True)
开发者ID:lucabaldini,项目名称:ximpol,代码行数:12,代码来源:gabs.py
示例7: test_plots
def test_plots(self):
"""
"""
model = xpeInterstellarAbsorptionModel()
plt.figure()
model.xsection.plot(logx=True, logy=True, show=False)
save_current_figure('gabs_xsection.png', clear=False)
plt.figure()
model.xsection_ecube().plot(logx=True, show=False)
save_current_figure('gabs_xsection_ecube.png', clear=False)
plt.figure()
ra, dec = 10.684, 41.269
column_density = mapped_column_density_HI(ra, dec, 'LAB')
trans = model.transmission_factor(column_density)
trans.plot(logx=True, show=False, label='$n_H = $%.3e' % column_density)
plt.legend(loc='upper left')
save_current_figure('gabs_trans_lab.png', clear=False)
plt.figure()
for column_density in [1.e20, 1.e21, 1.e22, 1.e23]:
trans = model.transmission_factor(column_density)
trans.plot(logx=True, show=False, label='$n_H = $%.1e' %\
column_density)
plt.legend(loc='upper left')
save_current_figure('gabs_trans_samples.png', clear=False)
if sys.flags.interactive:
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:26,代码来源:test_gabs.py
示例8: view
def view(self, off_axis_angle = 10., show=True):
"""Plot the effective area.
"""
from ximpol.utils.matplotlib_ import pyplot as plt
plt.figure('Effective area')
xInterpolatedUnivariateSplineLinear.plot(self, show=False,
label='On axis')
plt.plot(self.x, self.eval_(self.x, off_axis_angle),
label='%s arcmin off-axis' % off_axis_angle)
plt.legend(bbox_to_anchor=(0.85, 0.75))
plt.figure('Vignetting')
self.vignetting.plot(show=False)
if show:
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:14,代码来源:arf.py
示例9: plot
def plot(self, show=True):
"""Overloaded plot method.
"""
fig = plt.figure('Phasogram')
plt.errorbar(self.phase, self.counts, yerr=self.error, fmt='o')
plt.xlabel('Phase')
plt.ylabel('Counts/bin')
if show:
plt.show()
开发者ID:pabell,项目名称:ximpol,代码行数:9,代码来源:binning.py
示例10: plot
def plot(save=False):
"""Plot the stuff in the analysis file.
"""
sim_label = 'XIPE %s ks' % (SIM_DURATION/1000.)
sim_label = 'OBS: %s ks' % (SIM_DURATION/1000.)
mod_label = 'Input model'
lc_label = 'Light curve'
_phase, _phase_err, _pol_deg, _pol_deg_err, _pol_angle,\
_pol_angle_err, _index, _index_err, _norm,\
_norm_err = numpy.loadtxt(ANALYSIS_FILE_PATH, unpack=True)
plt.figure('Polarization degree')
pl_normalization_spline.plot(scale=0.12, show=False, color='lightgray',
label=lc_label)
_pol_deg_err_p=numpy.where((_pol_deg+_pol_deg_err)<1.0,_pol_deg_err,1.0-_pol_deg)
_pol_deg_err_m=numpy.where((_pol_deg-_pol_deg_err)>0.0,_pol_deg_err,_pol_deg)
#if (_pol_deg+_pol_deg_err)>1.0: _pol_deg_err=1.0-yerr_p
plt.errorbar(_phase, _pol_deg, xerr=_phase_err, yerr=[_pol_deg_err_m,_pol_deg_err_p], fmt='o',
label=sim_label)
pol_degree_spline.plot(show=False, label=mod_label)
plt.axis([0., 1., 0., 0.5])
plt.legend(bbox_to_anchor=(0.45, 0.95))
if save:
save_current_figure('crab_polarization_degree', OUTPUT_FOLDER, False)
plt.figure('Polarization angle')
pl_normalization_spline.plot(scale=0.4, offset=1.25, show=False,
color='lightgray', label=lc_label)
plt.errorbar(_phase, _pol_angle, xerr=_phase_err, yerr=_pol_angle_err,
fmt='o', label=sim_label)
pol_angle_spline.plot(show=False, label=mod_label)
plt.axis([0., 1., 1.25, 3.])
plt.legend(bbox_to_anchor=(0.45, 0.95))
if save:
save_current_figure('crab_polarization_angle', OUTPUT_FOLDER, False)
plt.figure('PL normalization')
plt.errorbar(_phase, _norm, xerr=_phase_err, yerr=_norm_err, fmt='o',
label=sim_label)
pl_normalization_spline.plot(show=False, label=mod_label)
plt.axis([0., 1., None, None])
plt.legend(bbox_to_anchor=(0.45, 0.95))
if save:
save_current_figure('crab_pl_norm', OUTPUT_FOLDER, False)
plt.figure('PL index')
pl_normalization_spline.plot(scale=0.18, offset=1.3, show=False,
color='lightgray', label=lc_label)
plt.errorbar(_phase, _index, xerr=_phase_err, yerr=_index_err, fmt='o',
label=sim_label)
pl_index_spline.plot(show=False, label=mod_label)
plt.axis([0., 1., 1.3, 2.1])
plt.legend(bbox_to_anchor=(0.45, 0.95))
if save:
save_current_figure('crab_pl_index', OUTPUT_FOLDER, False)
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:54,代码来源:crab_pulsar_img.py
示例11: display
def display():
"""Display the source model.
"""
from ximpol.utils.matplotlib_ import pyplot as plt
from ximpol.srcmodel.img import xFITSImage
print(ROI_MODEL)
fig = plt.figure('Energy spectrum')
spectral_model_spline.plot(logy=True, show=False, label='Total')
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:10,代码来源:abell478.py
示例12: view
def view():
_mcube = xBinnedModulationCube(MCUBE_FILE_PATH)
_mcube.fit()
_fit_results = _mcube.fit_results[0]
plt.figure('Polarization degree')
_mcube.plot_polarization_degree(show=False, color='blue')
pol_degree_spline.plot(color='lightgray',label='Spin %s'%spindegree, show=False)
plt.figtext(0.2, 0.85,'XIPE %s ks'%(SIM_DURATION/1000.),size=18)
#plt.errorbar(_energy_mean, _pol_deg, yerr=_pol_deg_err, color='blue',marker='o')
plt.legend()
plt.figure('Polarization angle')
_mcube.plot_polarization_angle(show=False, color='blue', degree=False)
pol_angle_spline.plot(color='lightgray',label='Spin %s'%spindegree, show=False)
plt.figtext(0.2, 0.85,'XIPE %s ks'%(SIM_DURATION/1000.),size=18)
#plt.errorbar(_energy_mean,_pol_angle, yerr= _pol_angle_err,color='blue',marker='o')
plt.xlim([1,10])
plt.legend()
plt.figure('MDP %s'%base_name)
mdp = _mcube.mdp99[:-1]
emean = _mcube.emean[:-1]
emin = _mcube.emin[:-1]
emax = _mcube.emax[:-1]
width = (emax-emin)/2.
plt.errorbar(emean,mdp,xerr=width, label='MDP99',marker='o',linestyle='--')
plt.figtext(0.2, 0.85,'XIPE %s ks'%(SIM_DURATION/1000.),size=18)
plt.xlim([1,10])
plt.ylabel('MPD 99\%')
plt.xlabel('Energy (keV)')
#plt.legend()
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:33,代码来源:grs1915.py
示例13: test_power_law
def test_power_law(self):
"""
"""
norm = 1.
index = 2.
emin = 1.
emax = 10.
num_points = 5
_x = numpy.logspace(numpy.log10(emin), numpy.log10(emax), num_points)
_y = norm*_x**(-index)
slin = xInterpolatedUnivariateSplineLinear(_x, _y)
slog = xInterpolatedUnivariateLogSplineLinear(_x, _y)
target_norm = self.power_law_integral(norm, index, emin, emax)
lin_norm = slin.norm()
log_norm = slog.norm()
delta = abs(target_norm - log_norm)/target_norm
msg = 'delta = %.3e' % delta
self.assertTrue(delta < 0.01, msg)
if self.interactive:
plt.figure()
slin.plot(logx=True, logy=True, overlay=True, show=False)
slog.plot(logx=True, logy=True, overlay=True, show=False)
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:23,代码来源:test_spline_log.py
示例14: plot
def plot(save_plots=False):
"""
"""
sim_label = 'XIPE %s ks' % (SIM_DURATION/1000.)
mod_label = 'Input model'
_phase, _phase_err, _pol_deg, _pol_deg_err, _pol_angle,\
_pol_angle_err = numpy.loadtxt(ANALYSIS_FILE_PATH, unpack=True)
_colors = ['blue']*len(_pol_deg)
plt.figure('Polarization degree')
_good_fit = _pol_deg > 2*_pol_deg_err
_bad_fit = numpy.logical_not(_good_fit)
plt.errorbar(_phase[_good_fit], _pol_deg[_good_fit],
xerr=_phase_err[_good_fit], yerr=_pol_deg_err[_good_fit],
fmt='o', label=sim_label, color='blue')
plt.errorbar(_phase[_bad_fit], _pol_deg[_bad_fit],
xerr=_phase_err[_bad_fit], yerr=_pol_deg_err[_bad_fit],
fmt='o', color='gray')
pol_degree_spline.plot(show=False, label=mod_label, color='green')
plt.axis([0., 1., 0., 0.1])
plt.legend(bbox_to_anchor=(0.37, 0.95))
plt.figtext(0.6, 0.8, '%.2f--%.2f keV' %\
(E_BINNING[0], E_BINNING[-1]), size=16)
if save_plots:
plt.savefig('gk_per_polarization_degree.png')
plt.figure('Polarization angle')
plt.errorbar(_phase[_good_fit], _pol_angle[_good_fit],
xerr=_phase_err[_good_fit], yerr=_pol_angle_err[_good_fit],
fmt='o', label=sim_label, color='blue')
plt.errorbar(_phase[_bad_fit], _pol_angle[_bad_fit],
xerr=_phase_err[_bad_fit], yerr=_pol_angle_err[_bad_fit],
fmt='o', color='gray')
pol_angle_spline.plot(show=False, label=mod_label, color='green',
scale=numpy.radians(1.))
plt.axis([0., 1., -0.1, 1.5])
plt.xlabel('Rotational phase')
plt.ylabel('Polarization angle [rad]')
plt.legend(bbox_to_anchor=(0.37, 0.95))
plt.figtext(0.6, 0.8, '%.2f--%.2f keV' %\
(E_BINNING[0], E_BINNING[-1]), size=16)
if save_plots:
plt.savefig('gk_per_polarization_angle.png')
_ebinning = zip(E_BINNING[:-1], E_BINNING[1:])
if len(_ebinning) > 1:
_ebinning.append((E_BINNING[0], E_BINNING[-1]))
for i, (_emin, _emax) in enumerate(_ebinning):
plt.figure('Phasogram %d' % i)
phasogram = xBinnedPhasogram(_phasg_file_path(i))
_scale = phasogram.counts.sum()/phasogram_spline.norm()/\
len(phasogram.counts)
phasogram_spline.plot(show=False, label=mod_label, scale=_scale,
color='green')
phasogram.plot(show=False, color='blue', label=sim_label )
plt.legend(bbox_to_anchor=(0.37, 0.95))
plt.figtext(0.65, 0.8, '%.2f--%.2f keV' % (_emin, _emax), size=16)
if save_plots:
plt.savefig('gk_per_phasogram_%d.png' % i)
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:57,代码来源:gk_per.py
示例15: plot
def plot():
spherical_mcube = xBinnedModulationCube(SPHERICAL_MCUBE_PATH)
wedge_mcube = xBinnedModulationCube(WEDGE_MCUBE_PATH)
spherical_mcube.fit()
wedge_mcube.fit()
spherical_fit_results = spherical_mcube.fit_results[0]
wedge_fit_results = wedge_mcube.fit_results[0]
plt.figure('Polarization degree')
spherical_mcube.plot_polarization_degree(show=False, color='blue')
pol_degree_spline_spherical.plot(color='lightblue',label='Spherical corona model (40 degree inclination)', show=False)
wedge_mcube.plot_polarization_degree(show=False, color='red')
pol_degree_spline_wedge.plot(color='lightsalmon',label='Wedge corona model (40 degree inclination)', show=False)
plt.figtext(0.2, 0.85,'XIPE %s ks'%((SIM_DURATION*NUM_RUNS)/1000.),size=18)
plt.xlim([1,10])
plt.legend()
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:24,代码来源:cyg_x1_polfrac_plot.py
示例16: plot
def plot(self, show=True, zlabel='Counts/pixel', subplot=(1, 1, 1)):
"""Plot the image.
This is using aplpy to render the image.
Warning
-------
We have to figure out the subplot issue, here. I put in a horrible
hack to recover the previous behavior when there's only one
subplot.
"""
import aplpy
with context_no_grids():
if subplot == (1, 1, 1):
fig = aplpy.FITSFigure(self.hdu_list[0], figure=plt.figure())
else:
fig = aplpy.FITSFigure(self.hdu_list[0], figure=plt.figure(0,figsize=(10*subplot[1], 10*subplot[0])), subplot=subplot)
fig.add_grid()
fig.show_colorscale(cmap = 'afmhot', vmin=self.vmin, vmax=self.vmax)
fig.add_colorbar()
fig.colorbar.set_axis_label_text(zlabel)
if show:
plt.show()
return fig
开发者ID:lucabaldini,项目名称:ximpol,代码行数:24,代码来源:img.py
示例17: plot
def plot(save=False):
"""Plot the stuff in the analysis file.
"""
for j in range(len(E_BINNING)):
if (j==len(E_BINNING)-1):
analysis_file = ANALYSIS_FILE_PATH
emin=E_BINNING[0]
emax=E_BINNING[-1]
else:
analysis_file = '%s_%d' % (ANALYSIS_FILE_PATH,j)
emin=E_BINNING[j]
emax=E_BINNING[j+1]
sim_label = 'XIPE %s ks' % (SIM_DURATION/1000.)
mod_label = 'Input model'
lc_label = 'Light curve'
_phase, _phase_err, _pol_deg, _pol_deg_err, _pol_angle,\
_pol_angle_err, _index, _index_err, _norm,\
_norm_err = numpy.loadtxt(ANALYSIS_FILE_PATH, unpack=True)
plt.figure('Polarization degree (%g-%g keV)' % (emin,emax))
plt.title('Her X-1 (%g-%g keV)' % (emin,emax))
pl_normalization_spline.plot(scale=20, show=False, color='lightgray',
label=lc_label)
plt.errorbar(_phase, _pol_deg, xerr=_phase_err, yerr=_pol_deg_err, fmt='o',
label=sim_label)
pol_degree_spline.plot(show=False, label=mod_label)
# pol_degree_spline_noqed.plot(show=False, label='No QED')
plt.axis([0., 1., 0., 1.1])
plt.legend(bbox_to_anchor=(0.4, 0.5))
if save:
save_current_figure('herx1_polarization_degree_%d' % j, OUTPUT_FOLDER, False)
plt.figure('Polarization angle (%g-%g keV)' % (emin,emax))
plt.title('Her X-1 (%g-%g keV)' % (emin,emax))
pl_normalization_spline.plot(scale=60, offset=0, show=False,
color='lightgray', label=lc_label)
plt.errorbar(_phase, _pol_angle, xerr=_phase_err, yerr=_pol_angle_err,
fmt='o', label=sim_label)
pol_angle_spline.plot(show=False, label=mod_label)
plt.axis([0., 1., 0, 3.15])
plt.legend(bbox_to_anchor=(0.4, 0.3))
if save:
save_current_figure('herx1_polarization_angle_%d' %j, OUTPUT_FOLDER, False)
plt.figure('Flux (%g-%g keV)' % (emin,emax))
plt.title('Her X-1 (%g-%g keV)' % (emin,emax))
plt.errorbar(_phase,
0.21*_norm/(2-_index)*(10.**(2.0-_index)-2.**(2.-_index)), xerr=_phase_err,
yerr=0.21*_norm_err/(2-_index)*(10.**(2-_index)-2.**(2.-_index)), fmt='o',
label=sim_label)
pl_normalization_spline.plot(scale=1,show=False, label=mod_label)
plt.axis([0., 1., None, None])
plt.legend(bbox_to_anchor=(0.75, 0.95))
if save:
save_current_figure('herx1_flux_%d' % j, OUTPUT_FOLDER, False)
plt.show()
开发者ID:UBC-Astrophysics,项目名称:QEDSurface,代码行数:54,代码来源:herx1_pulsar_test.py
示例18: display
def display():
"""Display the source model.
"""
from ximpol.utils.matplotlib_ import pyplot as plt
print(ROI_MODEL)
fig = plt.figure('Energy spectrum')
total_spectral_model.plot(logy=True, show=False, label='Total')
nonthermal_spectral_model.plot(logy=True, show=False, label='Non-thermal')
thermal_spectral_model.plot(logy=True, show=False, label='Thermal')
plt.legend(bbox_to_anchor=(0.95, 0.95))
fig = thermal_component.image.plot(show=False)
fig.add_label(0.1, 0.92, '1.5-3 keV', relative=True, size='xx-large',
color='white', horizontalalignment='left')
fig = nonthermal_component.image.plot(show=False)
fig.add_label(0.1, 0.92, '4-6 keV', relative=True, size='xx-large',
color='white', horizontalalignment='left')
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:17,代码来源:tycho.py
示例19: view
def view(self, show=True):
"""Overloaded plot method (with default log scale on the y-axis).
"""
from ximpol.utils.matplotlib_ import pyplot as plt
plt.figure("PSF")
xInterpolatedUnivariateSpline.plot(self, logy=True, show=False)
plt.figure("Solid-angle convolution")
self.generator.plot(logy=True, show=False)
plt.figure("EEF")
self.eef.plot(show=False)
if show:
plt.show()
开发者ID:lucabaldini,项目名称:ximpol,代码行数:13,代码来源:psf.py
示例20: plot_polarization_degree
def plot_polarization_degree(self, show=True):
"""
"""
import aplpy
if self.x_img is None:
self.x_img = xFITSImage(self.xmap_file_path, build_cdf=False)
if self.y_img is None:
self.y_img = xFITSImage(self.ymap_file_path, build_cdf=False)
_data = numpy.sqrt(self.x_data ** 2 + self.y_data ** 2)
hdu_list = [self.x_img.hdu_list[0].copy()]
hdu_list[0].data = _data
with context_no_grids():
fig = aplpy.FITSFigure(hdu_list[0], figure=plt.figure())
fig.add_grid()
fig.show_colorscale(cmap="afmhot", vmin=None, vmax=None)
fig.add_colorbar()
fig.colorbar.set_axis_label_text("Polarization degree")
if show:
plt.show()
return fig
开发者ID:lucabaldini,项目名称:ximpol,代码行数:21,代码来源:polarization.py
注:本文中的ximpol.utils.matplotlib_.pyplot.figure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论