# Load data in cube = SpectralCube.read(iram_co21_data_path("m33.co21_iram.fits")) del cube._header[""] # cube = cube.with_mask(cube > 0.1 * u.K) mask = fits.getdata(iram_co21_data_path("m33.co21_new_assign_clfind.fits")) cube = cube.with_mask(mask.astype(bool)) lwidth_co = cube.linewidth_sigma() lwidth_hi = fits.open(fourteenB_HI_data_path(lwidth_name))[0] lwidth_hi = Projection(lwidth_hi.data, wcs=WCS(lwidth_hi.header), unit=u.m / u.s) dr = 250 * u.pc rs, sd, sd_sigma = radial_profile(gal, lwidth_co, max_rad=6 * u.kpc, dr=dr) sd = sd.to(u.km / u.s) sd_sigma = sd_sigma.to(u.km / u.s) p.errorbar(rs.value, sd.value, yerr=sd_sigma.value, fmt="-", color="b", drawstyle='steps-mid') p.xlabel("R (kpc)") p.ylabel("CO Velocity Dispersion (km/s)") p.grid() p.draw() p.savefig(paper1_figures_path("co_veldisp_profile_{}pc.pdf".format(dr.value))) p.savefig(paper1_figures_path("co_veldisp_profile_{}pc.png".format(dr.value))) p.close()
p.draw() # raw_input("Next plot?") p.savefig(paper1_figures_path("filfinder_radial_profile_models.pdf")) p.savefig(paper1_figures_path("filfinder_radial_profile_models.png")) p.clf() # Now create a radial profile of the distance between filaments # Create a radial profile of the HI vel disp out to 8 kpc. dist_arr = Projection(nd.distance_transform_edt(~skeleton) * pixscale, unit=u.pc, wcs=mom0.wcs) dist_arr.meta['beam'] = beam rs, sd, sd_sigma = radial_profile(gal, dist_arr, max_rad=10 * u.kpc, dr=100 * u.pc) # Multiply 2 to get the average distance instead of radius sd = 2 * sd sd_sigma = 2 * sd_sigma p.errorbar(rs.value, sd.value, yerr=sd_sigma.value, fmt="-", color="b", drawstyle='steps-mid') p.xlabel("R (kpc)") p.ylabel("Average Distance between Filaments (pc)") p.grid() p.xlim([0, 8]) p.ylim([80, 300]) p.draw()