Exemplo n.º 1
0
def overlay_on_plot(name, axes, header, roi, deleted_sources, superfile):
    """ Overlay:
        * Deleted 2FGL sources
        * the SNR + best fit extension. 
        * Any avaliable SNR contours
    """
    for source in deleted_sources:
        axes['gal'].plot([source.skydir.l()],[source.skydir.b()], marker='*', color='green', 
                         markeredgecolor='white', markersize=12)

    source = roi.get_source(name)

    # plot the best fit SNR position/center in blue
    ROISmoothedSource.overlay_source(source, axes, color='blue', zorder=10)

    if isinstance(source,ExtendedSource):
        # overlay the best fit SNR size in blue
        ROISmoothedSource.overlay_extension(source, axes, header, extension_color='blue',
                                            extension_zorder=10)


    # overlay the green catalog SNR in red
    ROISmoothedSource.overlay_extension(get_snr(name,superfile), axes, header, extension_color='red',
                                       extension_zorder=10)
Exemplo n.º 2
0

name=args.name
superfile=args.superfile

results=dict(name=name)

# *) Build the ROI
roi=setup_roi(name,superfile, 
              roi_dict=dict(fit_emin=args.emin, fit_emax=args.emax),
              catalog_dict=dict(free_radius=2, max_free=10),
             )

# get the SNR as an extended source object.

snr_radio_template = get_snr(name, superfile)
snrsize = snr_radio_template.spatial_model['sigma']

# *) modify the ROI to remove overlaping background sources. 
deleted_sources = []
for source in roi.get_sources():
    if np.degrees(source.skydir.difference(snr_radio_template.skydir)) < snrsize + 0.1:
        deleted_sources.append(roi.del_source(source))

for source in roi.get_sources():
    # Freeze the spectrum (but not flux) of all other sources in the ROI.
    if np.any(source.model.free):
        free=np.asarray([True]+[False]*(len(source.model._p)-1))
        roi.modify(which=source,free=free)

fit_kwargs = dict(name=name, emin=args.emin, emax=args.emax, snrsize=snrsize)