Пример #1
0
def growing_aperture_paper():
    filename = "./data/Pisco.cii.455kms.image.fits"
    ra, dec = (205.533741, 9.477317341)  # we know where the source is
    redshift = (1900.538 / 222.547) - 1  # redshift from the observed line peak, z= freq_rest_CII / freq_obs - 1
    aper_rad = 1.3  # final manually chosen aperture radius

    mcub = MultiCube(filename)  # load maps

    # This map is a single channel collapse over a [CII] emission line, total width of 455 km/s
    # If line fluxes in units of Jy.km/s are preferred, use the lower scaling
    scale = mcub["image"].deltavel()  # channel width in kms

    radius, flux, err, tab = mcub.growing_aperture_corrected(ra=ra, dec=dec, maxradius=3, calc_error=True)

    # tab.write("growth.txt", format="ascii.fixed_width", overwrite=True)  # save results in a human readable format

    fig, ax = plt.subplots(figsize=(4.8, 3))
    ax.plot(radius, flux * scale, color="firebrick", lw=2, label="Corrected")
    ax.fill_between(radius, (flux - err) * scale, (flux + err) * scale, color="firebrick", lw=0, alpha=0.2)
    ax.plot(radius, tab["flux_image"] * scale, label="Uncorrected", ls="--", color="gray")

    ax.axvline(aper_rad, color="gray", lw=0.75, ls=":", label="Chosen aperture size")

    # Could obtain just the single flux value at given aper_rad with
    # flux, err, tab = mcub.spectrum_corrected(ra=ra, dec=dec, radius=aper_rad, calc_error=True)

    # print(flux*scale,err*scale)
    ax.tick_params(direction='in', which="both")
    ax.set_xlabel("Aperture radius (arcsec)")
    ax.set_ylabel("Line flux density (Jy km/s)")
    ax.set_xlim(0, 3)
    ax.legend(loc="lower right", frameon=False)

    # add physical distances scale
    kpc_per_arcsec = iftools.arcsec2kpc(redshift)

    ax2 = ax.twiny()
    ax2.set_xlim(ax.get_xlim()[0] * kpc_per_arcsec, ax.get_xlim()[1] * kpc_per_arcsec)
    ax2.set_xlabel("Radius (kpc)")
    ax2.tick_params(direction='in', which="both")

    plt.savefig("./plots/growing_aperture_paper.pdf", bbox_inches="tight")  # save plot
    plt.savefig("./thumbnails/growing_aperture_paper.png", bbox_inches="tight", dpi=72)  # web raster version

    plt.show()
Пример #2
0
def growing_aperture_technical():
    """
    Compute curve of growths in multiple maps up to some maximum radius.
    Derive corrected flux using residual scaling.
    """
    filename = "./data/Pisco.cii.455kms.image.fits"
    ra, dec = (205.533741, 9.477317341)  # we know where the source is
    scale = 1e3  # map units are Jy/beam, will use to scale fluxes to mJy/beam

    mcub = MultiCube(filename)  # load maps
    radius, flux, err, tab = mcub.growing_aperture_corrected(ra=ra, dec=dec, maxradius=3, calc_error=True)

    # tab.write("growth.txt", format="ascii.fixed_width", overwrite=True)  # save results in a human readable format

    fig, ax = plt.subplots(figsize=(4.8, 3))
    ax.set_title("Curves of growth")
    ax.plot(radius, flux * scale, color="firebrick", lw=2, label="Corrected")
    ax.fill_between(radius, (flux - err) * scale, (flux + err) * scale, color="firebrick", lw=0, alpha=0.2)

    ax.plot(radius, tab["flux_dirty"] * scale, label="Dirty", color="black", ls=":")
    ax.plot(radius, tab["flux_clean"] * scale, label="Cleaned components only", ls="-.", color="navy")
    ax.plot(radius, tab["flux_residual"] * scale, label="Residual", ls="--", color="orange")
    ax.plot(radius, tab["flux_image"] * scale, label="Uncorrected: clean + residual", dashes=[10, 3],
            color="forestgreen")
    ax.plot(radius, tab["epsilon"], color="gray", label="Clean-to-dirty beam ratio")
    ax.axhline(0, color="gray", lw=0.5, ls=":")

    ax.tick_params(direction='in', which="both")
    ax.set_xlabel("Radius (arcsec)")
    ax.set_ylabel("Cumulative flux density (mJy)")
    ax.tick_params(direction='in', which="both")
    ax.set_xlim(0, 3)

    ax.legend(bbox_to_anchor=(1, 0.8))

    plt.savefig("./plots/growing_aperture_technical.pdf", bbox_inches="tight")  # save plot
    plt.savefig("./thumbnails/growing_aperture_technical.png", bbox_inches="tight", dpi=72)  # web raster version

    plt.show()