if 'DespoticTem' not in catalog.colnames: from despotic_heating import tkin_all print("Adding DESPOTIC-derived temperatures to dendrograms.") from astropy import units as u import gaussian_correction gcorfactor = gaussian_correction.gaussian_correction(catalog['Smin303']/catalog['Smax303']) # use 2*reff because we care about diameter, not radius # then deconvolve out the beam # (see paper: 28" -> 30" beam because of gridding_ beam_pc = (30/(np.sqrt(8*np.log(2)))*u.arcsec*8.5*u.kpc).to(u.pc, u.dimensionless_angles()) dtems = [tkin_all(density=10**row['density_chi2']*u.cm**-3, sigma=row['v_rms']*u.km/u.s*gf, lengthscale=2*((row['reff']*u.pc*gf)**2-(beam_pc)**2)**0.5, gradient=5*u.km/u.s/u.pc, #min(5,row['v_rms']/row['reff'])*u.km/u.s/u.pc, tdust=row['higaldusttem']*u.K, crir=1e-17*u.s**-1, ISRF=1, tdust_rad=(row['higaldusttem']*u.K * (1-np.exp(-(10**row['logh2column']/1e24))))) for row,gf in ProgressBar(zip(catalog, gcorfactor))] catalog.add_column(Column(name='DespoticTem', data=dtems)) catalog.add_column(Column(name='gausscorrfactor', data=gcorfactor)) # time estimate: 30m-1h dctems = [tkin_all(density=10**row['density_chi2']*u.cm**-3, sigma=row['v_rms']*u.km/u.s*gf, lengthscale=2*((row['reff']*u.pc*gf)**2-(beam_pc)**2)**0.5, gradient=5*u.km/u.s/u.pc, #min(5,row['v_rms']/row['reff'])*u.km/u.s/u.pc, tdust=row['higaldusttem']*u.K, crir=1e-17*u.s**-1,
pl.subplots_adjust(hspace=0.45) outf = paths.fpath('param_fits/{name}_oneD_{num}_parameter_constraints.pdf'.format(name=row['Source_Name'], num=num)) pl.savefig(outf, bbox_inches='tight') 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.")
from astropy import units as u import gaussian_correction gcorfactor = gaussian_correction.gaussian_correction(catalog['Smin303'] / catalog['Smax303']) # use 2*reff because we care about diameter, not radius # then deconvolve out the beam # (see paper: 28" -> 30" beam because of gridding_ beam_pc = (30 / (np.sqrt(8 * np.log(2))) * u.arcsec * 8.5 * u.kpc).to( u.pc, u.dimensionless_angles()) dtems = [ tkin_all( density=10**row['density_chi2'] * u.cm**-3, sigma=row['v_rms'] * u.km / u.s * gf, lengthscale=2 * ((row['reff'] * u.pc * gf)**2 - (beam_pc)**2)**0.5, gradient=5 * u.km / u.s / u.pc, #min(5,row['v_rms']/row['reff'])*u.km/u.s/u.pc, tdust=row['higaldusttem'] * u.K, crir=1e-17 * u.s**-1, ISRF=1, tdust_rad=(row['higaldusttem'] * u.K * (1 - np.exp(-(10**row['logh2column'] / 1e24))))) for row, gf in ProgressBar(zip(catalog, gcorfactor)) ] catalog.add_column(Column(name='DespoticTem', data=dtems)) catalog.add_column(Column(name='gausscorrfactor', data=gcorfactor)) # time estimate: 30m-1h dctems = [ tkin_all( density=10**row['density_chi2'] * u.cm**-3, sigma=row['v_rms'] * u.km / u.s * gf,
outf = paths.fpath( 'param_fits/{name}_oneD_{num}_parameter_constraints.pdf'.format( name=row['Source_Name'], num=num)) 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'))