行转换数据压缩包。
lbl-repack的Python项目详细描述
重新打包
重新打包和压缩用于辐射传输计算的线传输数据
这段代码识别了支配频谱的强线 绝大多数弱线。代码返回一个二进制 逐行(lbl)文件,带有强行信息(波数、低行、低行) gf和同位素id),以及一个包含联合贡献的ascii文件 压缩成连续消光系数的弱线 (在cm-1amagat-1中)作为波数和温度的函数。
当前可用的数据库:
- 外显子(http://www.exomol.com/)
- 希特拉语(https://www.cfa.harvard.edu/hitran/)
- 库鲁兹的tio(http://kurucz.harvard.edu/molecules/tio)
团队成员
安装
repack
已经tested在python 2.7、3.6和3.7上工作;并且(至少)在linux和osx中运行。您可以使用pip:
repack
# Note that on PyPI ``repack``is indexed as ``lbl-repack``:
pip install lbl-repack
另外(对于conda用户或开发人员),您可以直接 下载源代码并使用 以下终端命令:
git clone https://github.com/pcubillos/repack/
cd repack
python setup.py install
开始
以下示例压缩exomol hcn线转移数据。首先,下载exomol hcn数据集(无需解压缩文件):
# Download ExoMol HCN data:
wget http://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.states.bz2
wget http://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.trans.bz2
wget http://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.pf
wget http://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.states.bz2
wget http://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.trans.bz2
wget http://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.pf
然后创建一个重新打包配置文件('repack_hcn.cfg'),如下所示:
[REPACK]# Line-transition files:lblfiles= 1H-12C-14N__Harris.trans.bz2 1H-13C-14N__Larner.trans.bz2 # Database type [exomol, hitran, or kurucz]:dbtype= exomol # Output file name (without file extension):outfile= HCN_exomol_0.3-33um_500-3000K # Wavenumber boundaries and sampling rate (in cm-1):wnmin=303.0 wnmax=33334.0 dwn=1.0 # Temperature sampling:tmin=500.0 tmax=3000.0 dtemp=100.0 # Line-intensity threshold for strong/weak lines:sthresh=0.1 # Maximum chunk size of lines to handle at a time:chunksize=15000000
并运行repack
,这将生成以下屏幕输出:
# Call the repack command-line executable for the HCN demo config file: repack repack_HCN.cfg :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: repack: line-transition data compression. Version 1.2.8. Copyright (c)2017-2019 Patricio Cubillos. repack is open-source software under the MIT license. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Starting: Sun Jul 719:52:28 2019 Unzipping: '1H-12C-14N__Harris.trans.bz2'. Unzipping: '1H-13C-14N__Larner.trans.bz2'. Reading: '1H-12C-14N__Harris.trans.bz2'. Reading: '1H-13C-14N__Larner.trans.bz2'. Flagging lines at 500 K (chunk 1/5): Compression rate: 98.13%, 247,715/13,241,389 lines. Flagging lines at 3000 K: Compression rate: 96.17%, 506,751/13,241,389 lines. Total compression rate: 95.11%, 648,132/13,241,389 lines. ... Flagging lines at 500 K (chunk 5/5): Compression rate: 96.94%, 401,033/13,089,891 lines. Flagging lines at 3000 K: Compression rate: 93.09%, 904,262/13,089,891 lines. Total compression rate: 91.42%, 1,122,911/13,089,891 lines. With a threshold strength factor of 0.1, kept a total of 3,009,610 line transitions out of 65,586,274 lines. Successfully rewriten exomol line-transition info into: 'HCN_exomol_0.3-33um_500-3000K_lbl.dat' and 'HCN_exomol_0.3-33um_500-3000K_continuum.dat'. End: Sun Jul 719:59:59 2019
输出二进制文件“hcn_exomol_0.3-33um_500-3000k_lbl.dat” 包含HCN的逐行不透明度信息,该信息表示 大部分不透明度贡献到光谱中。信息 编码为三个双精度数和一个包含 波数(单位:cm-1),较低状态能量(单位:cm-1); gf值和同位素指数,分别为每个过渡。这个 使用以下python脚本可以轻松读取信息:
importrepack.utilsasuwn,elow,gf,iiso=u.read_lbl('HCN_exomol_0.3-33um_500-3000K_lbl.dat')
输出ascii文件“hcn_exomol_0.3-33um_500-3000k_continuum.dat” 包含弱线的剩余不透明度贡献(在cm-1中 amagat-1单位)作为波数和温度的函数。这是一个 与lbl输出文件相比,贡献较小。
友善
请友好并通过引用与本项目相关的文章来感谢作者的努力:
Cubillos (2017): An Algorithm to Compress Line-transition Data for Radiative-transfer Calculations,APJ 850,32页。
许可证
版权所有(c)2017-2019 Patricio Cubilos和贡献者。
repack
是麻省理工学院许可下的开源软件(见LICENSE)。