import re import glob from line_to_image_list import line_to_image_list frequencies = u.Quantity( [float(row[1].strip('GHz')) for row in line_to_image_list], u.GHz) name_to_freq = { row[0]: frq for frq, row in zip(frequencies, line_to_image_list) } freq_to_name = { frq: row[0] for frq, row in zip(frequencies, line_to_image_list) } hnco = Vamdc.query_molecule('Isocyanic acid HNCO') rt = hnco.data['RadiativeTransitions'] frqs = u.Quantity([ (float(rt[key].FrequencyValue) * u.MHz).to(u.GHz, u.spectral()) for key in rt ]) frqs_to_ids = {frq: key for frq, key in zip(frqs, rt)} upperStateRefs = [rt[key].UpperStateRef for key in rt] degeneracies = [ int(hnco.data['States'][upperStateRef].TotalStatisticalWeight) for upperStateRef in upperStateRefs ] einsteinAij = u.Quantity([float(rt[key].TransitionProbabilityA) for key in rt], 1 / u.s)
from vamdclib import specmodel from astropy import modeling import re import glob from line_to_image_list import line_to_image_list frequencies = u.Quantity([float(row[1].strip('GHz')) for row in line_to_image_list], u.GHz) name_to_freq = {row[0]:frq for frq, row in zip(frequencies, line_to_image_list)} freq_to_name = {frq:row[0] for frq, row in zip(frequencies, line_to_image_list)} linere = re.compile("W51_b6_12M.(.*).image.pbcor") ch3oh = Vamdc.query_molecule('CH3OH') rt = ch3oh.data['RadiativeTransitions'] frqs = u.Quantity([(float(rt[key].FrequencyValue)*u.MHz).to(u.GHz, u.spectral()) for key in rt]) frqs_to_ids = {frq: key for frq,key in zip(frqs, rt)} upperStateRefs = [rt[key].UpperStateRef for key in rt] degeneracies = [int(ch3oh.data['States'][upperStateRef].TotalStatisticalWeight) for upperStateRef in upperStateRefs] einsteinAij = u.Quantity([float(rt[key].TransitionProbabilityA) for key in rt], 1/u.s) # http://www.astro.uni-koeln.de/cdms/catalog#equations # the units are almost certainly wrong; I don't know how to compute line strength # from aij =(
def get_Aul_(frqs): def get_Aul(freq): closest = np.nanargmin(np.abs(freq - frqs)) assert frqs[closest] - freq < 1 * u.MHz return einsteinAij[closest] return get_Aul if __name__ == "__main__": all_lines = {**lines.disk_lines, **lines.absorbers} frequencies = u.Quantity([all_lines[x] for x in all_lines if 'Cl' in x]) kcl35 = Vamdc.query_molecule('KCl-35') rt35 = kcl35.data['RadiativeTransitions'] frqs = u.Quantity([ (float(rt35[key].FrequencyValue) * u.MHz).to(u.GHz, u.spectral()) for key in rt35 ]) upperStateRefs = [rt35[key].UpperStateRef for key in rt35] degeneracies = [ int(kcl35.data['States'][upperStateRef].TotalStatisticalWeight) for upperStateRef in upperStateRefs ] einsteinAij = u.Quantity( [float(rt35[key].TransitionProbabilityA) for key in rt35], 1 / u.s) tbl = table.Table.read(paths.tpath('fitted_stacked_lines.txt'),
import numpy as np import paths import pylab as pl from astroquery.vamdc import Vamdc from vamdclib import specmodel ch3oh = Vamdc.query_molecule("CH3OH") temperatures = np.linspace(10, 300) partition_func = [ specmodel.calculate_partitionfunction(ch3oh.data["States"], temperature=tex)["XCDMS-149"] for tex in temperatures ] pl.matplotlib.rc_file("pubfiguresrc") pl.figure(1).clf() pl.plot(temperatures, partition_func) pl.xlabel("T (K)") pl.ylabel("$Q_{rot}$") pl.savefig(paths.fpath("chemistry/ch3oh_partition_function.png"))
scaling = 1e12 * u.cm**-2 pl.plot(rslt['upperstateenergy'].data, np.log10(rslt['upperlevelpop'].data * scaling.value), '.', label=None, alpha=0.15) #pl.plot(rslt[vzero]['upperstateenergy'].data, np.log10(rslt[vzero]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[vone]['upperstateenergy'].data, np.log10(rslt[vone]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[vzero & obs]['upperstateenergy'].data, np.log10(rslt[vzero & obs]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[vone & obs]['upperstateenergy'].data, np.log10(rslt[vone & obs]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[vtwo]['upperstateenergy'].data, np.log10(rslt[vtwo]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[vtwo & obs]['upperstateenergy'].data, np.log10(rslt[vtwo & obs]['upperlevelpop'].data), 'o', label=None) #pl.plot(rslt[Jeight]['upperstateenergy'].data, np.log10(rslt[Jeight]['upperlevelpop'].data), 's', label=None) nacl = Vamdc.query_molecule('NaCl$') fit_tex(u.Quantity(rslt[vone & obs]['upperstateenergy'], u.K), rslt[vone & obs]['upperlevelpop'] * scaling, molecule=nacl, plot=True, min_nupper=1e-50) fit_tex(u.Quantity(rslt[Jeight]['upperstateenergy'], u.K), rslt[Jeight]['upperlevelpop'] * scaling, molecule=nacl, plot=True, min_nupper=1e-50, color='k') pl.legend(loc='upper right') pl.xlabel("E$_U$ [K]")
from astroquery.vamdc import Vamdc from vamdclib import specmodel from astropy import modeling import re import glob from line_to_image_list import line_to_image_list frequencies = u.Quantity([float(row[1].strip('GHz')) for row in line_to_image_list], u.GHz) name_to_freq = {row[0]:frq for frq, row in zip(frequencies, line_to_image_list)} freq_to_name = {frq:row[0] for frq, row in zip(frequencies, line_to_image_list)} hnco = Vamdc.query_molecule('Isocyanic acid HNCO') rt = hnco.data['RadiativeTransitions'] frqs = u.Quantity([(float(rt[key].FrequencyValue)*u.MHz).to(u.GHz, u.spectral()) for key in rt]) frqs_to_ids = {frq: key for frq,key in zip(frqs, rt)} upperStateRefs = [rt[key].UpperStateRef for key in rt] degeneracies = [int(hnco.data['States'][upperStateRef].TotalStatisticalWeight) for upperStateRef in upperStateRefs] einsteinAij = u.Quantity([float(rt[key].TransitionProbabilityA) for key in rt], 1/u.s) # http://www.astro.uni-koeln.de/cdms/catalog#equations # the units are almost certainly wrong; I don't know how to compute line strength # from aij =(