level_L_label = tbl3['J'][tbl3['Level'] == level_L][0] prefix = "ch3oh_{0}-{1}".format(level_U_label, level_L_label) im = radmc3dPy.image.readImage('image.out') shutil.move('image.out', '{0}_image_X={1}.out'.format(prefix, x_ch3oh)) im = radmc3dPy.image.readImage('{0}_image_X={1}.out'.format( prefix, x_ch3oh)) im.writeFits('{0}_image_X={1}.fits'.format(prefix, x_ch3oh), fitsheadkeys={}, dpc=5400, coord='19h23m43.963s +14d30m34.56s', overwrite=True) fh = convert_to_K('{0}_image_X={1}.fits'.format(prefix, x_ch3oh)) fh.writeto("{0}_image_K_X={1}.fits".format(prefix, x_ch3oh), clobber=True) img = fh[0].data velo = np.linspace(vkms - widthkms / 2, vkms + widthkms / 2, linenlam) pl.figure(3).clf() pl.plot(velo, img[:, 25, 25], label='center pixel') pl.plot(velo, img[:, 15, 15], label='15,15') pl.plot(velo, img[:, 5, 5], label='5,5') pl.ylabel("Line Brightness (K)") pl.xlabel("Velocity (km/s)") pl.legend(loc='best') pl.savefig("{0}_spectrum_X={1}.png".format(prefix, x_ch3oh)) #radmc3dPy.image.makeImage(iline=240, widthkms=5, linenlam=40, nostar=True,
level_U = int(tbl2['Upper'][tbl2['Transition'] == trans]) level_L = int(tbl2['Lower'][tbl2['Transition'] == trans]) level_U_label = tbl3['J'][tbl3['Level'] == level_U][0] level_L_label = tbl3['J'][tbl3['Level'] == level_L][0] prefix = "ch3oh_{0}-{1}".format(level_U_label,level_L_label) im = radmc3dPy.image.readImage('image.out') shutil.move('image.out', '{0}_image_X={1}.out'.format(prefix, x_ch3oh)) im = radmc3dPy.image.readImage('{0}_image_X={1}.out'.format(prefix, x_ch3oh)) im.writeFits('{0}_image_X={1}.fits'.format(prefix, x_ch3oh), fitsheadkeys={}, dpc=5400, coord='19h23m43.963s +14d30m34.56s', overwrite=True) fh = convert_to_K('{0}_image_X={1}.fits'.format(prefix, x_ch3oh)) fh.writeto("{0}_image_K_X={1}.fits".format(prefix, x_ch3oh), clobber=True) img = fh[0].data velo = np.linspace(vkms-widthkms/2, vkms+widthkms/2, linenlam) pl.figure(3).clf() pl.plot(velo, img[:,25,25], label='center pixel') pl.plot(velo, img[:,15,15], label='15,15') pl.plot(velo, img[:,5,5], label='5,5') pl.ylabel("Line Brightness (K)") pl.xlabel("Velocity (km/s)") pl.legend(loc='best') pl.savefig("{0}_spectrum_X={1}.png".format(prefix, x_ch3oh)) #radmc3dPy.image.makeImage(iline=240, widthkms=5, linenlam=40, nostar=True,
power=power, luminosity=lstar*u.L_sun,) else: dust_temperature = read_dust_temperature(dusttem_fn, sz) dust_image = 'dustim1323um_{0}.fits'.format(outname) dust_image_K = 'dustim1323um_{0}_K.fits'.format(outname) if not os.path.exists(dust_image_K): shutil.copy(dusttem_fn, 'dust_temperature.bdat') if os.path.exists('lines.inp'): os.remove('lines.inp') os.system('radmc3d image npix 50 incl 0 sizeau 10000 noscat pointau 0.0 0.0 0.0 fluxcons lambda 1323 dpc 5400') im = radmc3dPy.image.readImage('image.out') im.writeFits(dust_image, fitsheadkeys={}, dpc=5400, coord='19h23m43.963s +14d30m34.56s', overwrite=True) im_K = convert_to_K(dust_image) im_K.writeto(dust_image_K, clobber=True) imdata = fits.getdata(dust_image_K) fig1 = pl.figure(1) fig1.clf() ax1 = pl.subplot(1,2,1) im = ax1.imshow(dust_temperature[:,:,sz/2], cmap='hot') pl.colorbar(im, ax=ax1) ax2 = pl.subplot(1,2,2) ax2.plot(rr.ravel(), dust_temperature.ravel(), '.', alpha=0.25) pl.savefig("midplane_dust_temperature_{0}.png".format(outname)) ax3 = fig2.gca() ax3.plot(rr_u, dust_temperature.flat[inds], linestyle=linestyles[power],
dust_image = 'dustim1323um_{0}.fits'.format(outname) dust_image_K = 'dustim1323um_{0}_K.fits'.format(outname) if not os.path.exists(dust_image_K): shutil.copy(dusttem_fn, 'dust_temperature.bdat') if os.path.exists('lines.inp'): os.remove('lines.inp') os.system( 'radmc3d image npix 50 incl 0 sizeau 10000 noscat pointau 0.0 0.0 0.0 fluxcons lambda 1323 dpc 5400' ) im = radmc3dPy.image.readImage('image.out') im.writeFits(dust_image, fitsheadkeys={}, dpc=5400, coord='19h23m43.963s +14d30m34.56s', overwrite=True) im_K = convert_to_K(dust_image) im_K.writeto(dust_image_K, clobber=True) imdata = fits.getdata(dust_image_K) fig1 = pl.figure(1) fig1.clf() ax1 = pl.subplot(1, 2, 1) im = ax1.imshow(dust_temperature[:, :, sz / 2], cmap='hot') pl.colorbar(im, ax=ax1) ax2 = pl.subplot(1, 2, 2) ax2.plot(rr.ravel(), dust_temperature.ravel(), '.', alpha=0.25) pl.savefig("midplane_dust_temperature_{0}.png".format(outname)) ax3 = fig2.gca() ax3.plot(rr_u, dust_temperature.flat[inds],