コード例 #1
0
ファイル: test01.py プロジェクト: chrysante87/pyterpol
Test of setting up the class to start fitting.
"""
import pyterpol

rl = pyterpol.RegionList()
rl.add_region(wmin=5300, wmax=5500)
rl.add_region(wmin=6500, wmax=6600)

sl = pyterpol.StarList()
sl.add_component(teff=10000., logg=4.5, rv=10., z=1.0, vrot=20.0)

itf = pyterpol.Interface(sl=sl, rl=rl, debug=True)
print itf

itf.set_parameter(parname='teff', value=20000., vmin=25000., vmax=15000., fitted=True)
itf.set_parameter(parname='logg', value=3.5, vmin=3., vmax=4., fitted=True)
print itf

# have a look at the fitted parameters
parlist = itf.get_fitted_parameters()
print pyterpol.parlist_to_list(parlist)

# setup and plot
itf.setup()
itf.populate_comparisons()
itf.plot_all_comparisons()

reduced = itf.get_comparisons(rv=0)
itf.populate_comparisons(l=reduced)

コード例 #2
0
ファイル: test03.py プロジェクト: jiuyueqingchen1/pyterpol
itf.set_parameter(parname='vrot', component='primary', fitted=True, vmin=40., vmax=80.)
itf.set_parameter(parname='lr', component='primary', fitted=True, vmin=0.2, vmax=0.5)

fitpars = itf.get_fitted_parameters()

# # choose a fitter
itf.choose_fitter('nlopt_nelde_mead', fitparams=fitpars, xtol=1e-4)
# print itf

# first of all reduce the comparison list
l = itf.get_comparisons(rv=3)

# have a look at the chi-2
print itf
print itf.list_comparisons(l=l)
init_pars = pyterpol.parlist_to_list(fitpars)
init_chi2 = itf.compute_chi2(init_pars, l=l)
print "Initial settings:",  init_pars, init_chi2

# plot initial comparison
itf.plot_all_comparisons(l=l, figname='initial')

# # do the fitting
itf.run_fit(l=l)
# #
# # evaluate final parameters
final_pars = pyterpol.parlist_to_list(itf.get_fitted_parameters())
final_chi2 = itf.compute_chi2(final_pars, l=l)
print "Final settings:", final_pars, final_chi2
# #
# # 3 plot initial comparison
コード例 #3
0
ファイル: test01.py プロジェクト: jiuyueqingchen1/pyterpol
rl = pyterpol.RegionList()
rl.add_region(wmin=5300, wmax=5500)
rl.add_region(wmin=6500, wmax=6600)

sl = pyterpol.StarList()
sl.add_component(teff=10000., logg=4.5, rv=10., z=1.0, vrot=20.0)

itf = pyterpol.Interface(sl=sl, rl=rl, debug=True)
print itf

itf.set_parameter(parname='teff',
                  value=20000.,
                  vmin=25000.,
                  vmax=15000.,
                  fitted=True)
itf.set_parameter(parname='logg', value=3.5, vmin=3., vmax=4., fitted=True)
print itf

# have a look at the fitted parameters
parlist = itf.get_fitted_parameters()
print pyterpol.parlist_to_list(parlist)

# setup and plot
itf.setup()
itf.populate_comparisons()
itf.plot_all_comparisons()

reduced = itf.get_comparisons(rv=0)
itf.populate_comparisons(l=reduced)