(1-np.exp(-(10**row['logh2column']/1e24)))),
                  gmc=gmc)
    print("Chemical equilbrium temperature: ",T1)
    cool1 = gmc.dEdt(PsiUser=turb_heating_generator(lengthscale))
    print("CO cooling: ",cool1['LambdaLine']['co'])
    print("O cooling: ",cool1['LambdaLine']['o'])
    print("C cooling: ",cool1['LambdaLine']['c'])
    print("C+ cooling: ",cool1['LambdaLine']['c+'])
    print("oH2 cooling: ",cool1['LambdaLine']['oh2'])
    print("pH2 cooling: ",cool1['LambdaLine']['ph2'])
    print("HD cooling: ",cool1['LambdaLine']['hd'])


if __name__ == "__main__":
    import matplotlib
    matplotlib.rc_file(paths.pcpath('pubfiguresrc'))

    densities = np.logspace(3,7,20)
    tem = [tkin_all(n*u.cm**-3, 10*u.km/u.s, lengthscale=5*u.pc,
                    gradient=5*u.km/u.s/u.pc, tdust=25*u.K,
                    crir=1e-17*u.s**-1) for n in ProgressBar(densities)]
    pl.figure(1)
    pl.clf()
    pl.plot(densities, tem, 'k--', label='CRIR=1e-17, $\sigma=10$ km/s')
    pl.xlabel(r'$\log\,N_{\rm H}$')
    pl.ylabel('Temperature (K)')
    pl.xscale('log')
    pl.legend(loc='best')
    pl.savefig(paths.fpath("despotic/TvsN.png"))

    row_data = mf.get_parconstraints()
    for key,value in row_data.iteritems():
        row[key] = value


    width = row['width']*u.km/u.s
    row['reff_pc'] = reff.to(u.pc).value

    row['tkin_turb'] = heating.tkin_all(density=10**row['density_chi2']*u.cm**-3,
                                        sigma=width,
                                        lengthscale=reff,
                                        gradient=width/reff,
                                        tdust=row['higaldusttem']*u.K,
                                        crir=0./u.s)


    #if row_data['temperature_chi2'] == 10:
    #    import ipdb; ipdb.set_trace()

log.info("Completed source loop.")

fittable.write(tpath('fitted_line_parameters_Chi2Constraints.ipac'),
               format='ascii.ipac')

log.info("Wrote table file.  Continuing to parameter plots.")


execfile(paths.pcpath('parameter_comparisons.py'))

pl.show()
from paths import pcpath

execfile(pcpath('parameter_comparisons.py'))
execfile(pcpath('dendrotem_plots.py'))
execfile(pcpath('figure_ratio_maps.py'))
execfile(pcpath('individual_full_spectra.py'))
execfile(pcpath('integrated_data_figures.py'))
execfile(pcpath('tmap_pv.py'))
execfile(pcpath('t_vs_r.py'))
# not included in pub: execfile(pcpath('tmap_compare.py'))
# not included in publication (Jan 17):
#execfile(pcpath('pyspeckit_region_figures.py'))
Exemple #4
0
    pl.savefig(outf, bbox_inches='tight')

    row_data = mf.get_parconstraints()
    for key, value in row_data.items():
        row[key] = value

    width = row['width'] * u.km / u.s
    row['reff_pc'] = reff.to(u.pc).value

    row['tkin_turb'] = heating.tkin_all(density=10**row['density_chi2'] *
                                        u.cm**-3,
                                        sigma=width,
                                        lengthscale=reff,
                                        gradient=width / reff,
                                        tdust=row['higaldusttem'] * u.K,
                                        crir=0. / u.s)

    #if row_data['temperature_chi2'] == 10:
    #    import ipdb; ipdb.set_trace()

log.info("Completed source loop.")

fittable.write(tpath('fitted_line_parameters_Chi2Constraints.ipac'),
               format='ascii.ipac')

log.info("Wrote table file.  Continuing to parameter plots.")

execfile(paths.pcpath('parameter_comparisons.py'))

pl.show()
Exemple #5
0
from spectral_cube import SpectralCube, BooleanArrayMask, Projection
import aplpy
import pylab as pl
import matplotlib
import copy
from paths import mpath,apath,fpath,molpath,hpath
from astropy import units as u
from astropy import coordinates
from astropy.io import ascii, fits
from astropy import log
from astropy.wcs import WCS
from astropy import wcs
from piecewise_rtotem import pwtem
import paths
import matplotlib
matplotlib.rc_file(paths.pcpath('pubfiguresrc'))

# obsolete x,y = np.loadtxt(apath('orbit_K14.dat')).T
table = ascii.read(apath('orbit_K14_2.dat'), format='basic', comment="#", guess=False) 
coords = coordinates.SkyCoord(table['l']*u.deg, table['b']*u.deg, frame='galactic')
P = pvextractor.Path(coords, width=300*u.arcsec)

dl = (table['l'][1:]-table['l'][:-1])
db = (table['b'][1:]-table['b'][:-1])
dist = (dl**2+db**2)**0.5
cdist = np.zeros(dist.size+1)
cdist[1:] = dist.cumsum()

reftime = -2
bricktime = 0.3
time = table['t']
import matplotlib
from paths import hpath, apath, fpath, pcpath

matplotlib.rc_file(pcpath("pubfiguresrc"))
import numpy as np
import pylab as pl

from astropy.table import Table, Column
from astropy import log
from astropy import units as u
from scipy.interpolate import PiecewisePolynomial

from h2co_modeling.temperature_mapper import ph2cogrid, TemperatureMapper
from dendrograms import catalog, catalog_sm, dend, dendsm
import heating
import gaussian_correction

import lte_model


if "tm" not in locals():
    tm = TemperatureMapper(logdensities=[3, 4, 5], abundances=(1.2e-9,))
    tm2 = TemperatureMapper(logdensities=[4], deltav=20.0)
    tm3 = TemperatureMapper(logdensities=[4], deltav=1.0)
    tm4 = TemperatureMapper(logdensities=[4], abundances=(1e-8, 1e-10))

segmentdata = {
    "alpha": [(0.0, 1.0, 1.0), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0)],
    "blue": [(0.0, 1.0, 1.0), (0.5, 0.0, 0.0), (1.0, 0.0, 0.0)],
    "green": [(0.0, 0.0, 0.0), (0.5, 0.75, 0.75), (1.0, 0.0, 0.0)],
    "red": [(0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (1.0, 1.0, 1.0)],