outmask="mom_12co21.mask") peak = imstat(dir_data + im_12co10)["max"][0] myim.createmask(dir_data=dir_data, imagename=im_12co10, thres=0.05 * peak, outmask="mom_12co10.mask") ### create mask for line ratio map outfile = dir_data + "R_12co21_12co10.mask" os.system("rm -rf " + outfile) immath(imagename=[dir_data + "mom_12co21.mask", dir_data + "mom_12co10.mask"], mode="evalexpr", expr="IM0 * IM1", outfile=outfile) imagenames = glob.glob(dir_data + "R_*.mask") for i in range(len(imagenames)): makemask(mode="copy", inpimage=imagenames[i], inpmask=imagenames[i], output=imagenames[i] + ":mask0", overwrite=True) ### create line ratio map myim.line_ratio(dir_data=dir_data, im1=im_12co21, im2=im_12co10, outfile="R_12co21_12co10.image", diff="4.", mask="R_12co21_12co10.mask")
immath( imagename=[dir_data + "12co21_mom0.mask", dir_data + "12co10_mom0.mask"], mode="evalexpr", expr="IM0 * IM1", outfile=outfile) imagenames = glob.glob(dir_data + "R_*.mask") for i in range(len(imagenames)): makemask(mode="copy", inpimage=imagenames[i], inpmask=imagenames[i], output=imagenames[i] + ":mask0", overwrite=True) ### create line ratio map myim.line_ratio(dir_data=dir_data, im1=im_ci10.split("/")[-1] + ".moment0", im2=im_12co10.split("/")[-1] + ".moment0", outfile="R_ci_12co10.image", diff="18.23", mask="R_ci_12co10_mom0.mask") myim.line_ratio(dir_data=dir_data, im1=im_12co21.split("/")[-1] + ".moment0", im2=im_12co10.split("/")[-1] + ".moment0", outfile="R_12co21_12co10.image", diff="4.", mask="R_12co21_12co10_mom0.mask") os.system("rm -rf " + dir_data + "*.mask")
peak = imstat(im_co21)["max"][0] myim2.createmask(im_co21, peak * multiplier_co21, outmask_co21) outfile = dir_data1 + galname + "_r21_" + suffix + ".mask" os.system("rm -rf " + outfile) immath(imagename=[outmask_co10, outmask_co21], mode="evalexpr", expr="IM0*IM1", outfile=outfile) makemask(mode="copy", inpimage=outfile, inpmask=outfile, output=outfile + ":mask0", overwrite=True) ### create line ratio map outfile = dir_data1 + galname + "_r21_" + suffix + ".image" mask = dir_data1 + galname + "_r21_" + suffix + ".mask" myim.line_ratio(dir_data="", im1=im_co21, im2=im_co10, outfile=outfile, diff="4.", mask=mask) fitsimage = outfile.replace(".image", ".fits") os.system("rm -rf " + fitsimage) exportfits(imagename=outfile, fitsimage=fitsimage)