def test_opacity_Fe_vald3(T, P): PH = P * H_He_HH_VMR[0] PHe = P * H_He_HH_VMR[1] PHH = P * H_He_HH_VMR[2] qt = np.ones_like(adbFe.A) * np.float32(adbFe.qr_interp('Fe 1', T)) # ↑Unlike the case of HITRAN (using Qr_HAPI), we ignored the isotopes. Sij = SijT(T, adbFe.logsij0, adbFe.nu_lines, adbFe.elower, qt) sigmaD = doppler_sigma(adbFe.nu_lines, T, Amol) gammaL = atomll.gamma_vald3(T, PH, PHH, PHe, adbFe.ielem, adbFe.iion, adbFe.dev_nu_lines, adbFe.elower, adbFe.eupper, adbFe.atomicmass, adbFe.ionE, adbFe.gamRad, adbFe.gamSta, adbFe.vdWdamp, enh_damp=1.0) val = np.array([np.sum(Sij), np.sum(sigmaD), np.sum(gammaL)]) diff = np.abs(REFS[0, :] - val) print(diff) assert (diff[0] < 1.e-11 and diff[1] < 1.e-3 and diff[2] < 1.e-3)
def comperr(Nnu, plotfig=False): nus = np.logspace(np.log10(1.e7 / 2700), np.log10(1.e7 / 2100.), Nnu, dtype=np.float64) # nus=np.logspace(np.log10(3000),np.log10(6000.0),Nnu,dtype=np.float64) mdbCO = moldb.MdbHit('/home/kawahara/exojax/data/CO/05_hit12.par', nus) Mmol = 28.010446441149536 Tref = 296.0 Tfix = 1000.0 Pfix = 1.e-3 # #USE TIPS partition function Q296=np.array([107.25937215917970,224.38496958496091,112.61710362499998,\ 660.22969049609367,236.14433662109374,1382.8672147421873]) Q1000=np.array([382.19096582031250,802.30952197265628,402.80326733398437,\ 2357.1041210937501,847.84866308593757,4928.7215078125000]) qr = Q1000 / Q296 qt = np.ones_like(mdbCO.isoid, dtype=np.float64) for idx, iso in enumerate(mdbCO.uniqiso): mask = mdbCO.isoid == iso qt[mask] = qr[idx] Sij = SijT(Tfix, mdbCO.logsij0, mdbCO.nu_lines, mdbCO.elower, qt) gammaL = gamma_hitran(Pfix, Tfix, Pfix, mdbCO.n_air, mdbCO.gamma_air, mdbCO.gamma_self) #+ gamma_natural(A) #uncomment if you inclide a natural width sigmaD = doppler_sigma(mdbCO.nu_lines, Tfix, Mmol) cnu, indexnu, R, dq = initspec.init_modit(mdbCO.nu_lines, nus) nsigmaD = normalized_doppler_sigma(Tfix, Mmol, R) ngammaL = gammaL / (mdbCO.nu_lines / R) ngammaL_grid = set_ditgrid(ngammaL) xs_modit_lp = modit_xsvector(cnu, indexnu, R, dq, nsigmaD, ngammaL, Sij, nus, ngammaL_grid) wls_modit = 100000000 / nus #ref (direct) d = 10000 ll = mdbCO.nu_lines xsv_lpf_lp = lpf_xsection(nus, ll, sigmaD, gammaL, Sij, memory_size=30) dif = xs_modit_lp / xsv_lpf_lp - 1. med = np.median(dif) iju = 22940. ijd = 26400. limu, limd = np.searchsorted(wls_modit[::-1], [iju, ijd]) std = np.std(dif[::-1][limu:limd]) return med, std, R, ijd, iju, wls_modit, xs_modit_lp, xsv_lpf_lp, dif
def linest(self, T): """line strength. Args: T: temperature (K) Returns: line strength (cm) """ if self.database == 'ExoMol': qt = self.mdb.qr_interp(T) elif self.database == 'HITRAN' or self.database == 'HITEMP': qt = self.mdb.Qr_line_HAPI(T) return SijT(T, self.mdb.logsij0, self.mdb.nu_lines, self.mdb.elower, qt)
Q296 = np.array([ 107.25937215917970, 224.38496958496091, 112.61710362499998, 660.22969049609367, 236.14433662109374, 1382.8672147421873 ]) Q1000 = np.array([ 382.19096582031250, 802.30952197265628, 402.80326733398437, 2357.1041210937501, 847.84866308593757, 4928.7215078125000 ]) qr = Q1000 / Q296 qt = np.ones_like(mdbCO.isoid, dtype=np.float64) for idx, iso in enumerate(mdbCO.uniqiso): mask = mdbCO.isoid == iso qt[mask] = qr[idx] Sij = SijT(Tfix, mdbCO.logsij0, mdbCO.nu_lines, mdbCO.elower, qt) gammaL = gamma_hitran(Pfix, Tfix, Pfix, mdbCO.n_air, mdbCO.gamma_air, mdbCO.gamma_self) # + gamma_natural(A) #uncomment if you inclide a natural width sigmaD = doppler_sigma(mdbCO.nu_lines, Tfix, Mmol) cnu, indexnu, R, pmarray = initspec.init_modit(mdbCO.nu_lines, nus) nsigmaD = normalized_doppler_sigma(Tfix, Mmol, R) ngammaL = gammaL / (mdbCO.nu_lines / R) ngammaL_grid = set_ditgrid(ngammaL) xs_modit_lp = modit_xsvector(cnu, indexnu, R, pmarray, nsigmaD, ngammaL, Sij, nus, ngammaL_grid) wls_modit = 100000000 / nus #ref (direct)