Esempio n. 1
0
    dist_scale = (np.pi / 180.) * gal.distance.to(u.kpc).value

    if make_plot:

        phys_radius = data["r"] * scale * dist_scale
        plot_pars = pars.copy()
        plot_pars[2] *= scale * dist_scale
        p.errorbar(phys_radius, data["Vt"], yerr=data['eVt'],
                   fmt='-', color='b', label="This work",
                   drawstyle='steps-mid')
        p.plot(phys_radius, vcirc(phys_radius, *plot_pars), 'r-')
        p.ylabel(r"V$_{\mathrm{circ}}$ (km / s)")
        p.xlabel(r"Radius (kpc)")
        p.grid()
        p.draw()
        p.savefig(paper1_figures_path("M33_vrot_{}_wfit.pdf".format(params)))
        p.savefig(paper1_figures_path("M33_vrot_{}_wfit.png".format(params)))

        # raw_input("Next plot?")
        p.clf()

        # load in the Corbelli curve for comparison
        corbelli = Table.read(c_hi_analysispath("rotation_curves/corbelli_rotation_curve.csv"))

        p.errorbar(phys_radius, data["Vt"], yerr=data['eVt'],
                   fmt='-', color='b', label="This work", drawstyle='steps-mid')
        p.errorbar(corbelli["R"][corbelli["R"] <= 8.0],
                   corbelli["Vr"][corbelli["R"] <= 8.0],
                   yerr=corbelli["dVr"][corbelli["R"] <= 8.0],
                   fmt='--', color='r', label="Corbelli et al. (2014)",
                   drawstyle='steps-mid')
Esempio n. 2
0
           color="r", label="CO(2-1)")

# p.plot(bin_centers, hi_vals / np.nanmax(hi_vals), 'bD-',
#        label="HI")
# p.plot(bin_centers, co_vals / np.nanmax(co_vals), 'ro-',
#        label="CO(2-1)")
# p.xlim([0.0, 200])
p.ylim([0.0, 1.1])
p.xlabel("Distance from mask edge (pc)")
p.ylabel("Normalized Intensity")
p.vlines(0.0, 0.0, 1.1, 'k')
p.legend(loc='upper left')
p.grid()
p.draw()

p.savefig(paper1_figures_path("mask_edge_radial_profiles.pdf"))
p.savefig(paper1_figures_path("mask_edge_radial_profiles.png"))

# raw_input("Next plot?")
p.clf()

# Show the total number of elements in each distance bin

p.semilogy(bin_centers, binned_elements, 'bD-')
p.xlabel("Distance from mask edge (pc)")
p.ylabel("Number of pixels")
p.grid()

p.savefig(paper1_figures_path("mask_edge_radial_profiles_numbin.pdf"))
p.savefig(paper1_figures_path("mask_edge_radial_profiles_numbin.png"))
Esempio n. 3
0
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)

p.tight_layout()


def updater(i):

    pb.update()

    layer = layers[i]

    im = ax.imshow(layer.value, origin='lower',
                   norm=ImageNormalize(vmin=-0.001,
                                       vmax=mx,
                                       stretch=AsinhStretch()),
                   cmap=p.cm.gray_r)
    # ax.annotate("${0:.0f} km/s$".format(center_vels[i]),
    #             (0.53, 0.9),
    #             xycoords='axes fraction', color='k',
    #             fontsize=15.5)


ani = anim.FuncAnimation(fig, updater, range(len(center_vels)))
# p.show()

p.ioff()
writer = anim.writers['ffmpeg'](fps=3)
ani.save(paper1_figures_path("m33_rotsub_movie.mp4"), writer=writer, dpi=300)
p.ion()
Esempio n. 4
0
ax = p.subplot(121, projection=skew.wcs)
ax.imshow(skew.value,
          origin='lower', vmin=-2, vmax=2,
          interpolation='nearest', cmap='seismic')
ax.set_title("Skewness")
ax.set_ylabel("DEC (J2000)")
ax.set_xlabel("RA (J2000)")
ax2 = p.subplot(122, projection=kurt.wcs)
ax2.imshow(kurt.value, vmin=1, vmax=4,
           origin='lower', interpolation='nearest', cmap='binary')
ax2.set_title("Kurtosis")
ax2.set_xlabel("RA (J2000)")
lat = ax2.coords[1]
lat.set_ticklabel_visible(False)

p.savefig(paper1_figures_path("skew_kurt_maps.pdf"))
p.savefig(paper1_figures_path("skew_kurt_maps.png"))

# raw_input("Next plot?")
p.clf()

# Interesting regions:

# Northern HI infall: [1373, 630], [1373, 640], [1373, 650]
nplume_positions = \
    np.array([[1375, 603], [1375, 613], [1375, 623], [1375, 633], [1375, 643]])

# SArm positions
sarm_positions = np.array([[680, 730], [670, 730], [660, 730], [650, 730],
                           [640, 730],
                           [630, 730]])
Esempio n. 5
0
total_spectrum_hi = total_spectrum_hi * u.K

# Significant CO emission is limited to within about 6 kpc
total_spectrum_co = total_spectrum_co_radial.sum(0)

p.plot(hi_cube.spectral_axis.to(u.km / u.s).value,
       total_spectrum_hi.value,
       'b-', drawstyle='steps-mid', label="HI")
p.xlabel("Velocity (km/s)")
p.ylabel("Total Intensity (Jy)")
p.xlim([-100, 100])
p.grid()
p.draw()

p.savefig(paper1_figures_path("total_profile_corrected_velocity_rotsub_hi.pdf"))
p.savefig(paper1_figures_path("total_profile_corrected_velocity_rotsub_hi.png"))

# raw_input("Next plot?")
p.clf()

p.plot(hi_cube.spectral_axis.to(u.km / u.s).value,
       (total_spectrum_hi / total_spectrum_hi.max()).value,
       'b-', drawstyle='steps-mid', label="HI")
# There's a 1 channel offset from my rotation subtraction in the cube
p.plot(co_cube.spectral_axis.to(u.km / u.s).value,
       (total_spectrum_co / total_spectrum_co.max()).value,
       # np.roll((total_spectrum_co / total_spectrum_co.max()).value, -1),
       'g--', drawstyle='steps-mid', label="CO(2-1)")
p.xlabel("Velocity (km/s)")
p.ylabel("Normalized Total Intensity")
Esempio n. 6
0
    # # and save the plot and the parameters shown in verbose mode.
    # p.ioff()
    # fils.find_widths(verbose=True, max_distance=500, auto_cut=False, try_nonparam=False)

    # Fit Parameters: [ 541.31726502  129.85351117  180.0710914   304.01262168
    # Fit Errors: [ 0.89151974  0.48394493  0.27313627  1.1462345 ]

    skeleton = medial_axis(~bub.mask)

    # Overplot the skeleton on the moment0
    ax = p.subplot(111, projection=mom0.wcs)
    ax.imshow(mom0.value, origin='lower')
    ax.contour(skeleton, colors='r')
    p.draw()

    p.savefig(paper1_figures_path("moment0_w_skeletons.pdf"), rasterize=True)
    p.savefig(paper1_figures_path("moment0_w_skeletons.png"))

    # raw_input("Next plot?")
    p.clf()

    pixscale = \
        mom0.header['CDELT2'] * (np.pi / 180.) * gal.distance.to(u.pc).value
    beam_width = \
        mom0.meta['beam'].major.to(u.deg).value * (np.pi / 180.) * \
        gal.distance.to(u.pc).value

    # HI profile and fit
    fit, err, model, profile = \
        fit_skeleton_width(skeleton, mom0.value, pixscale, beam_width)
Esempio n. 7
0
            elif i == Nrows - 1:
                ax[i, j].xaxis.set_ticks_position('bottom')
                p.setp(ax[i, j].get_xticklabels(), visible=True)
            else:
                ax[i, j].xaxis.set_ticks_position('none')
                p.setp(ax[i, j].get_xticklabels(), visible=False)
                ax[i, j].xaxis.set_ticklabels([])

            if j == 0:
                ax[i, j].yaxis.set_ticks_position('left')
            elif j == Ncols - 1:
                ax[i, j].yaxis.set_ticks_position('right')
                p.setp(ax[i, j].get_yticklabels(), visible=False)
                ax[i, j].yaxis.set_ticklabels([])
            else:
                ax[i, j].yaxis.set_ticks_position('none')
                p.setp(ax[i, j].get_yticklabels(), visible=False)
                ax[i, j].yaxis.set_ticklabels([])

    p.subplots_adjust(hspace=0,
                      wspace=0)

    # p.draw()

    # raw_input("Next plot?")
    p.savefig(paper1_figures_path("M33_rotsub_channels_{}.pdf".format(n)),
              bbox_inches="tight", dpi=300)
    p.savefig(paper1_figures_path("M33_rotsub_channels_{}.png".format(n)),
              bbox_inches="tight", dpi=300)
    p.clf()