备忘--identify.py

本文介绍了一种使用myXCLASS进行分子谱线拟合时的高效绘图方法。通过设置is_molfit_file_changed参数为'no',可以在不重新进行耗时拟合的情况下直接绘制先前的拟合结果,节省大量时间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

myXCLASS的拟合非常耗时间,如果不小心关掉面板再想重新看图就特别耗时间。

这里提供了一个简单的命令,在不改变molfit文件,只重复前一次拟合的结果时,
is_molfit_file_changed = ‘no’
再执行就能不拟合,直接画图。

##remove the old runing data
import os
import shutil
path = '/home/zhang/software/XCLASS-Interface/run/myXCLASS/'
try:
    files = os.listdir(path)
except OSError:
    files = []
if len(files)>0:
    shutil.rmtree(path)
    
spw = 'spw35'
is_molfit_file_changed = 'no'

#data
FreqMin = 9.753638179980000132e+04
FreqMax = 9.941000529416945938e+04
#data off
#FreqMin = 219345
#FreqMax = 221323

FreqStep = 0.49
#######################
TelescopeSize = 1.582
######################
Inter_Flag = True

t_back_flag = False
#tBack = 0
#tslope = 0.0000000000E+00

nH_flag = False
#N_H = 3.0000000000E+24
#beta_dust = 2.0
#kappa_1300 = 0.02
path = os.getcwd()
MolfitsFileName = path+"/%s.molfit" %(spw)

iso_flag = False
#IsoTableFileName = " "

RestFreq = 0.0
vLSR = 0.0

#----------------------------------------------------------
result_file = "xclass_spectrum_output"
transition_file = "transition_energies"
form = '.dat'
if is_molfit_file_changed == 'yes':
    if os.path.exists(result_file+'_'+spw+form) and os.path.exists(transition_file+'_'+spw+form):
        os.remove(result_file+'_'+spw+form)
        os.remove(transition_file+'_'+spw+form)

if os.path.exists(path+'/'+result_file+'_'+spw+form):
    import numpy as np
    modeldata = np.loadtxt(result_file+'_'+spw+form,usecols=(0,1),unpack=True)
    modeldata = modeldata.T
    with open(transition_file+'_'+spw+form,'r') as f:
        data = f.readlines()
    TransEnergies = []
    for line in data:
        TransEnergies.append(line.split())

else:
    modeldata,log,TransEnergies,IntOptical,jobDir = myXCLASS ()
    shutil.move(jobDir+result_file+form,path+"/"+result_file+'_'+spw+form)
    shutil.move(jobDir+transition_file+form,path+"/"+transition_file+'_'+spw+form)
#---------------------------------------------------------

FileName = path+"/I17233-3606_%s_17h26m42.542s_-36d9m17.270s.txt" %(spw)
NumHeaderLines = 0
expdata = LoadASCIIFile()




MinTransEnergy = 0.0
#data
xLowerLimit = 9.753638179980000132e+04
xUpperLimit = 9.941000529416945938e+04
#data off
#xLowerLimit = 219345
#xUpperLimit = 221323

yLowerLimit = -8
yUpperLimit = 100
PlotTitle = "I17233_%s" %(spw)
LegendFlag = True
SaveFigureFile = " "
#OutputDevice = " "
myXCLASSPlot()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值