BayeSED: Bayesian interpretation of the SEDs of galaxies

https://img.shields.io/badge/bitbucket.org-hanyk%2Fbayesed-blue.svg https://readthedocs.org/projects/bayesed/badge/?version=v2.0 http://img.shields.io/badge/license-MIT-blue.svg?style=flat

BayeSED is a general tool for the full Bayesian interpretation of the spectral energy distributions (SEDs) of galaxies. Given the multi-band photometries of galaxies, it can be used for the Bayesian parameter estimation by posteriori probability distributions (PDFs) and the Bayesian SED model comparison by Bayesian evidence. Except for the build-in SED models (stellar population synthesis models, blackbody, greybody and powerlaw), other SED models can be emulated with machine learning techniques. The linear combination of all selected SED model components will then be used for the full Bayesian interpretation of the observational SEDs of galaxies.

_images/flowchart.jpg

DOWNLOAD

USAGE

./bayesed (openmpi v1.8.8 is required for mpirun) [OPTIONS] -i inputfile

OPTIONS:

-a, --ann ARG1[,ARGn]               Select  ann model by name
                                    e.g. -a id,bc03_pr_exp_ch_calzetti,iscalable

-ak, --aknn ARG1[,ARGn]             Select aknn model by name
                                    e.g. -ak id,bc03_pr_exp_ch_calzetti,iscalable,k,f_run,eps,iRad

-bb, --blackbody ARG1[,ARGn]        black body spectrum
                                    e.g. --blackbody id,bb,iscalable,w_min,w_max,Nw

-gb, --greybody ARG1[,ARGn]         grey body spectrum
                                    e.g. --greybody id,gb,iscalable,ithick,w_min,w_max,Nw

-h, -help, --help, --usage          Display usage instructions

-i, --input ARG1[,ARGn]             Input file containing observed photometric SEDs with given unit(0 for flux in uJy, 1 for AB magnitude)
                                    e.g. -i 0,observation/ULTRAVISTA/ULTRAVISTA0.txt

-k, --knn ARG1[,ARGn]               Select knn model by name
                                    e.g. -k id,bc03_pr_exp_ch_calzetti,iscalable,k,f_run

-L, --luminosity ARG1[,ARGn]        compute luminosity between w_min and w_max in rest-frame
                                    e.g. --luminosity w_min,wmax

-pw, --powerlaw ARG1[,ARGn]         power law spectrum
                                    e.g. --powerlaw id,pw,iscalable,w_min,w_max,Nw

-s, --sampling ARG1[,ARGn]          IS,mmodal,ceff,nlive,efr,tol,updInt,Ztol,seed,fb,resume,outfile,logZero,maxiter,acpt_min for MultiNest.
                                    e.g. --sampling 1,0,0,400,0.3,0.1,1000,-1e90,1,0,0,0,-1e90,100000,0.01 (default)

-sfh, --sfh ARG1[,ARGn]             Select a SFH for the csp model
                                    e.g. -sfh id,itype_sfh,itruncated,itype_ceh

-ssp, --ssp ARG1[,ARGn]             Select a ssp model for the csp model
                                    e.g. -ssp id,ynII,iscalable,k,f_run,eps,iRad,iT0,iT1,iT2

-t, --template ARG1[,ARGn]          Use template SED with the given name
                                    e.g. -t id,M82,iscalable

--check                             Print all inputs and their category.

--cl ARG1[,ARGn]                    output estimates at confidence levels e.g. --cl 0.68,0.95 (default)

--cosmology ARG1[,ARGn]             e.g. --cosmology 70,0.7,0.3 (default)

--ebv ARG1[,ARGn]                   set the global value of E(B-V) of MW for all objects
                                    e.g. --ebv 0

--export ARG                        Exports all options including the default values of unset ones.
                                    e.g. --export out.txt

--ext ARG1[,ARGn]                   select extinction curve
                                    e.g. --ext id,ext_law[0-7]
                                    0:Starburst(Calzetti+2000,FAST)
                                    1:Milky Way (Cardelli+1989,FAST)
                                    2:Star-forming(Noll+2009,FAST)
                                    3:MW(Allen+76,hyperz)
                                    4:MW(Fitzpatrick+86,hyperz)
                                    5:LMC(Fitzpatrick+86,hyperz)
                                    6:SMC(Fitzpatrick+86,hyperz)
                                    7:SB(Calzetti2000,hyperz)

--filters ARG                       Set the file containing the definition of filters
                                    e.g. --filters filter/filters.txt

--filters_selected ARG              Set all used filters in the observation and select those needed
                                    e.g. --filters_selected filter/filters_selected.txt

--flux_max ARG                      maximum allowed observational flux in microJy
                                    e.g. --flux_max 1e99 (default)

--flux_min ARG                      minimum allowed observational flux in microJy
                                    e.g. --flux_min 0 (default)

--gsl_integration_qag ARG1[,ARGn]   set epsabs,epsrel,limit for gsl_integration_qag
                                    e.g. --gsl_integration_qag 0,0.01,500 (default)

--import ARG1[,ARGn]                Import one or more files that contain command line options and use # as comment char.
                                    e.g. --import in.txt

--IGM ARG1[,ARGn]                   --IGM [0-5]
                                    Select the model for intergalactic medium attenuation
                                    0:None
                                    1:Madau (1995) model (default)
                                    2:Meiksin (2006) model

--load_priors ARG                   load priors from .hist files for all objects
                                    e.g. --load_priors priors_root

--nzbin ARG                         Number of bins used to sample the prior of redshift.
                                    e.g. --nzbin 20 (default)

--NNF ARG1[,ARGn]                   The MAXITER and toler used in nonnegative quadratic programming.
                                    e.g. --NNF 10000,0 (default)

--NfilterPoints ARG                 e.g. --NfilterPoints 30 (default)

--outdir ARG                        output dir for all results
                                    e.g. --ourdir result/ (default)

--output_PCs ARG                    output the amplitude of first N PCs
                                    e.g. --output_PCs 0 (default)

--output_model_absolute_magnitude   output model absolute magnitude of best fit

--output_model_apparent_magnitude   output model apparent magnitude of best fit

--output_model_flux                 output model flux of best fit

--output_pos_obs                    output posterior estimation of observables

--rename ARG                        rename the model

--save_bestfit                      Save the best fitting result

--save_pos_sfh ARG                  Save the posterior distribution of model SFH with given Ngrid
                                    e.g. --save_pos_sfh 100

--save_pos_spec                     Save the posterior distribution of model spectra (Warning,require memory of size nSamples*Nwavelengths!)

--save_priors                       save priors as .hist files for all objects

--save_sample_obs                   save posteriori sample of observables

--save_sample_par                   Save the posterior sample of parameters

--save_sample_spec                  Save the posterior sample of model spectra

--save_summary                      Save the summary file

--select_sample ARG1[,ARGn]         select a subsample with given conditions
                                    e.g. --select_sample Nvalid_photo_min,Nvalid_spectra_min,SNR_min

--sys_err_model ARG1[,ARGn]         fractional systematic error of model
                                    e.g. --sys_err_model 0,0 (default)

--sys_err_obs ARG1[,ARGn]           fractional systematic error of obs
                                    e.g. --sys_err_obs 0,0 (default)

--test_priors                       test priors by setting the loglike for observational data to be zero

--w_max ARG                         maximum allowed observational wavelength in micron

--w_min ARG                         minimum allowed observational wavelength in micron

--zrange ARG1[,ARGn]                set the global value of z_min and z_max used for the fitting of all objects
                                    e.g. --zrange 0,6

EXAMPLES

run_test

Set the run time parameters for MultiNest sampling:

--sampling 1,0,0,200,0.8,0.1,1000,-1e90,1,2,0,0,-1e90,100000,0.01

Set the input file:

-i 0,observation/ULTRAVISTA/test.txt
# ULTRAVISTA0 30 0
#ID z_min z_max E(B-V) Ks eKs H eH J eJ Y eY ch4 ech4 ch3 ech3 ch2 ech2 ch1 ech1 zp ezp ip eip rp erp V eV gp egp B eB u eu IA484 eIA484 IA527 eIA527 IA624 eIA624 IA679 eIA679 IA738 eIA738 IA767 eIA767 IB427 eIB427 IB464 eIB464 IB505 eIB505 IB574 eIB574 IB709 eIB709 IB827 eIB827 fuv efuv nuv enuv mips24 emips24 K_flag K_star K_Kron apcor z_spec z_spec_cc z_spec_id star contamination nan_contam orig_cat_id orig_cat_field USE z ltau metal lage Av lmass lsfr lssfr la2t chi2 ra dec xpix ypix Ks_tot eKs_tot
ULTRAVISTA114558 0.8379 0.8379 0 27.4907 0.584591 21.0782 0.522225 15.6179 0.356165 10.0914 0.313335 25.4707 5.30565 27.0285 6.80395 27.0156 2.81926 34.3339 3.22051 7.86572 0.187851 3.97121 0.0939253 1.48011 0.0736374 0.704697 0.0533496 0.343633 0.0465869 0.214646 0.0315589 0.106576 0.0480897 0.428297 0.123981 0.650911 0.136004 1.56478 0.186348 2.25254 0.184845 3.58026 0.272759 3.78943 0.285533 0.115042 0.0909197 0.217136 0.120224 0.451205 0.140512 1.07821 0.188602 2.6156 0.226172 5.97773 0.365933 -0.127991 0.0916711 0.323215 0.181088 30.3239 5.21473 0.000 0.190 11.84121 1.00093 0.83790 4.50000 823976 0 0 0 35639 5 1 0.8349 8.60 0.020 9.40 0.30 10.60 -0.49 -11.09 0.80 1.71e+00 150.28802 2.1318095 3298.41602 6082.29980 75.711 1.610
ULTRAVISTA99938 0.5532 0.5532 0 7.77833 0.824963 6.39761 0.800201 6.14951 0.577344 6.42505 0.493935 5.36558 5.83991 -0.0146301 7.1562 2.10368 1.65123 3.7008 1.41404 5.15284 0.310176 5.05043 0.169424 3.26739 0.153785 2.022 0.113384 1.4435 0.0912282 1.43131 0.0847119 1.24478 0.213735 1.53555 0.337544 1.68368 0.324512 3.63801 0.428772 4.61091 0.402707 4.69626 0.487419 6.26411 0.555189 1.22832 0.370126 1.68977 0.409223 1.58554 0.381855 2.48041 0.41574 4.01108 0.437895 3.73067 0.47569 0.269437 0.158998 1.31915 0.23198 -60.8977 -130.196 0.000 0.030 14.70963 1.00000 0.55320 4.50000 829240 0 0 0 61860 4 1 0.5493 8.20 0.020 8.70 0.20 9.23 -0.14 -9.37 0.50 2.80e+00 150.58911 2.4122887 6799.39502 12815.56348 21.422 2.272

Set the files for the definition and selection of filters:

--filters observation/ULTRAVISTA/filters.txt --filters_selected observation/ULTRAVISTA/filters_selected.txt

filters.txt filters_selected.txt

#iused iselected id name information
1 2 225 Ks # 1 0   434 VISTA_Ks  +atm  lambda_c= 2.1487e+04  AB-Vega= xxxx
1 1 224 H # 1 0   382 VISTA_H  +atm  lambda_c= 1.6464e+04  AB-Vega= xxxx
1 1 223 J # 1 0   233 VISTA_J  +atm  lambda_c= 1.2541e+04  AB-Vega= xxxx
1 1 222 Y # 1 0   135 VISTA_Y  +atm  lambda_c= 1.0211e+04  AB-Vega= xxxx
1 0 20 8.0micron # 1 1   158 IRAC/irac_tr4_2004-08-09.dat  8.0micron  lambda_c= 7.9158e+04  AB-Vega= 4.387
1 0 19 5.8micron # 1 1    95 IRAC/irac_tr3_2004-08-09.dat  5.8micron  lambda_c= 5.7450e+04  AB-Vega= 3.747
1 1 18 4.5micron # 1 1    86 IRAC/irac_tr2_2004-08-09.dat  4.5micron  lambda_c= 4.5020e+04  AB-Vega= 3.254
1 1 17 3.6micron # 1 1    94 IRAC/irac_tr1_2004-08-09.dat  3.6micron  lambda_c= 3.5569e+04  AB-Vega= 2.781
1 1 82 z+ # 1 0    81 COSMOS/SUBARU_filter_z.txt     lambda_c= 9.0282e+03  AB-Vega= 0.514
1 1 81 i+ # 1 0    94 COSMOS/SUBARU_filter_i.txt     lambda_c= 7.6712e+03  AB-Vega= 0.380
1 1 80 r+ # 1 0    92 COSMOS/SUBARU_filter_r.txt     lambda_c= 6.2755e+03  AB-Vega= 0.154
1 1 78 Vj # 1 0   107 COSMOS/SUBARU_filter_V.txt     lambda_c= 5.4702e+03  AB-Vega=-0.000
1 1 79 g+ # 1 0   118 COSMOS/SUBARU_filter_g.txt     lambda_c= 4.7609e+03  AB-Vega=-0.101
1 1 77 Bj # 1 0   161 COSMOS/SUBARU_filter_B.txt     lambda_c= 4.4480e+03  AB-Vega=-0.112
1 1 87 u* # 1 0   132 megaprime/cfht_mega_u_cfh9301.dat  CFHT-LS+atm  lambda_c= 3.8280e+03  AB-Vega= 0.325
1 1 183 IA484 # 1 0    32 Subaru_MB/IA484.dat     lambda_c= 4.8473e+03  AB-Vega=-0.037
1 1 185 IA527 # 1 0    35 Subaru_MB/IA527.dat     lambda_c= 5.2593e+03  AB-Vega=-0.035
1 1 189 IA624 # 1 0    33 Subaru_MB/IA624.dat     lambda_c= 6.2308e+03  AB-Vega= 0.142
1 1 191 IA679 # 1 0    39 Subaru_MB/IA679.dat     lambda_c= 6.7816e+03  AB-Vega= 0.245
1 1 193 IA738 # 1 0    32 Subaru_MB/IA738.dat     lambda_c= 7.3595e+03  AB-Vega= 0.334
1 1 194 IA768 # 1 0    28 Subaru_MB/IA768.dat     lambda_c= 7.6804e+03  AB-Vega= 0.387
1 1 180 IA427 # 1 0    39 Subaru_MB/IA427.dat     lambda_c= 4.2600e+03  AB-Vega=-0.161
1 1 182 IA464 # 1 0    28 Subaru_MB/IA464.dat     lambda_c= 4.6333e+03  AB-Vega=-0.167
1 1 184 IA505 # 1 0    34 Subaru_MB/IA505.dat     lambda_c= 5.0608e+03  AB-Vega=-0.077
1 1 187 IA574 # 1 0    42 Subaru_MB/IA574.dat     lambda_c= 5.7629e+03  AB-Vega= 0.054
1 1 192 IA709 # 1 0    33 Subaru_MB/IA709.dat     lambda_c= 7.0735e+03  AB-Vega= 0.287
1 1 196 IA827 # 1 0    25 Subaru_MB/IA827.dat     lambda_c= 8.2468e+03  AB-Vega= 0.475
1 1 119 FUV # 1 0    18 CAPAK/galex1500.res  FUV  lambda_c= 1.5364e+03  AB-Vega= 2.128
1 1 120 NUV # 1 0    27 CAPAK/galex2500.res  NUV  lambda_c= 2.2992e+03  AB-Vega= 1.665
1 0 226 24micron # 1 2 'MIPS_24' (http://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/MIPSfiltsumm.txt)
2 0 152 U # 1 0    23 REST_FRAME/maiz-apellaniz_Johnson_U.res  2006AJ....131.1184M  lambda_c= 3.5900e+03  AB-Vega= 0.769
2 0 153 B # 1 0    41 REST_FRAME/maiz-apellaniz_Johnson_B.res  2006AJ....131.1184M  lambda_c= 4.3722e+03  AB-Vega=-0.106
2 0 154 V # 1 0    47 REST_FRAME/maiz-apellaniz_Johnson_V.res  2006AJ....131.1184M  lambda_c= 5.4794e+03  AB-Vega= 0.002
2 0 160 J_2mass # 1 0    89 2MASS/J.res     lambda_c= 1.2358e+04  AB-Vega= 0.885
2 0 161 H_2mass # 1 0    58 2MASS/H.res     lambda_c= 1.6458e+04  AB-Vega= 1.362
2 0 162 K_2mass # 1 0    63 2MASS/K.res     lambda_c= 2.1603e+04  AB-Vega= 1.830

Set the SED model (SSP, star-formation histroy and dust extinction law):

--ssp 0,bc2003_lr_BaSeL_chab,1,3,1,0,0,0,0,0 --sfh 0,2,0,0 --ext 0,7

Set output directory of all results:

--outdir test

Set the systematic error in the data as a free parameter:

--sys_err_obs 0,1

Set the allowed redshift range which will override that set in the inputfile:

--zrange 0,6

Save the best-fitting results and the posteriori PDFs of model spectra, SFH, and parameters:

--save_bestfit --save_pos_spec --save_pos_sfh 100 --save_sample_par

Full command to run:

time ./bayesed --sampling 1,0,0,200,0.8,0.1,1000,-1e90,1,2,0,0,-1e90,100000,0.01 -i 0,observation/ULTRAVISTA/test.txt --filters observation/ULTRAVISTA/filters.txt --filters_selected observation/ULTRAVISTA/filters_selected.txt --ssp 0,bc2003_lr_BaSeL_chab,1,3,1,0,0,0,0,0 --sfh 0,2,0,0 --ext 0,7 --outdir test --sys_err_obs 0,1 --zrange 0,6 --save_bestfit --save_pos_spec --save_pos_sfh 100 --save_sample_par

The results of SED fitting for the PEG ULTRAVISTA114558 (left) and the SFG ULTRAVISTA99938 (right). Except for the best-fit SED, the median, 68% and 95% credible region obtained from the posterior PDFs of the model SEDs are also shown. The GALEX FUV and NUV, Spitzer IRAC 3.6 and 4.5um data have been labeled in the figure.

_images/plot_fit.jpg

plot_fit.gpi

um='{/Symbol m}m'
lam='{/Symbol l}'
uJy='{/Symbol m}Jy'
set log xy 10
set xlabel lam.'_{rest}/'.um
set ylabel 'Flux/'.uJy
set key at 0.35,36 vertical 
set xrange [0.08:10]
set yrange [0.02:44]
#set xtics 0.1,0.5,5
set multiplot layout 2,2
set label 'NUV' at 0.118731,0.11 center
set label '3.6'.um at 1.82181,20 center
set label '4.5'.um at 2.30539,14 center
plot 'test/ULTRAVISTA0/ULTRAVISTA114558/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_spectra_pos.txt' u 1:6:7 w filledcurves t '95% CR','' u 1:4:5 w filledcurves t '68% CR','' u 1:3 w l t 'Median','test/ULTRAVISTA0/ULTRAVISTA114558/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_bestfit.txt' index 1 u 1:3 w l t 'Best-fit','' index 0 u 4:($2>0?$9:0/0):3:5:($9-$10):($9+$10) w xye t 'Obs' pt 7 ps 0.7 lt -1
unset label
set label 'FUV' at 0.0942646,0.09 left
set label 'NUV' at 0.14234,2 center
set label '3.6'.um at 2.18407,1.8 center
set label '4.5'.um at 2.7638,0.35 center
plot 'test/ULTRAVISTA0/ULTRAVISTA99938/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_spectra_pos.txt' u 1:6:7 w filledcurves t '95% CR','' u 1:4:5 w filledcurves t '68% CR','' u 1:3 w l t 'Median','test/ULTRAVISTA0/ULTRAVISTA99938/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_bestfit.txt' index 1 u 1:3 w l t 'Best-fit','' index 0 u 4:($2>0?$9:0/0):3:5:($9-$10):($9+$10) w xye t 'Obs' pt 7 ps 0.7 lt -1
unset multiplot

The posterior PDF for the SFH of the PEG ULTRAVISTA114558 (left) and the SFG ULTRAVISTA99938 (right). Only the median, 68% and 95% credible region obtained from the posterior PDF of the SFH for the two galaxies are shown.

_images/plot_sfh.jpg

plot_sfh.gpi

Msun='M_{/CMSY10 \014}'
set colorsequence classic
set xlabel 't/Gyr'
set ylabel 'SFR/['.Msun.'/yr]'
set multiplot layout 2,2
set log xy 10
set yrange [1e-3:1e6]
plot 'test/ULTRAVISTA0/ULTRAVISTA114558/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_sfh_pos.txt' u 1:5:6 w filledcurves t 'Confidence region (95%)','' u 1:3:4 w filledcurves t 'Confidence region (68%)','' u 1:2 w l t 'median'
plot 'test/ULTRAVISTA0/ULTRAVISTA99938/10csp200_bc2003_lr_BaSeL_chab000_hyperz5_sfh_pos.txt' u 1:5:6 w filledcurves t 'Confidence region (95%)','' u 1:3:4 w filledcurves t 'Confidence region (68%)','' u 1:2 w l t 'median'
unset multiplot
_images/pdftreex.jpg

The 1 and 2-D posterior PDFs of free parameters for the PEG ULTRAVISTA114558. They represent our state of knowledge about them. The presence of multiple peaks and/or strong correlations in the 2D PDFs indicate the degeneracies between the free parameters of the SED model.

_images/pdftreey.jpg

The 1 and 2-D posterior PDFs of free parameters for the SFG ULTRAVISTA99938. They represent our state of knowledge about them. The presence of multiple peaks and/or strong correlations in the 2D PDFs indicate the degeneracies between the free parameters of the SED model.

pdftree.py

import getdist.plots as gplot
import os

analysis_settings = {'max_corr_2D': u'0.99', 'boundary_correction_order': u'1', 'converge_test_limit': u'0.95', 'smooth_scale_2D': u'0.3', 'credible_interval_threshold': u'0.05', 'contours': u'0.68 0.95 0.99', 'fine_bins_2D': u'400', 'num_bins': u'100', 'mult_bias_correction_order': u'1', 'fine_bins': u'3072', 'num_bins_2D': u'40', 'max_scatter_points': u'2000', 'range_ND_contour': u'-1', 'range_confidence': u'0.01', 'smooth_scale_1D': u'-1', 'ignore_rows': u'0'}
param_3d = None
params=[u'z', u'sys_err0', u'log(age/yr)[0,1]', u'log(tau/yr)[0,1]', u'log(Z/Zsun)[0,1]', u'A_v/mag[0,1]']
roots = ['10csp200_bc2003_lr_BaSeL_chab000_hyperz5_sample_par']

g=gplot.getSubplotPlotter(chain_dir=r'./test/ULTRAVISTA0/ULTRAVISTA114558',analysis_settings=analysis_settings)
g.settings.colormap = "jet"
g.settings.lab_fontsize=12
g.settings.axes_fontsize
g.triangle_plot(roots, params, plot_3d_with_param=param_3d, filled=False, shaded=True)
g.export("pdftreex.eps")

g=gplot.getSubplotPlotter(chain_dir=r'./test/ULTRAVISTA0/ULTRAVISTA99938',analysis_settings=analysis_settings)
g.settings.colormap = "jet"
g.settings.lab_fontsize=12
g.triangle_plot(roots, params, plot_3d_with_param=param_3d, filled=False, shaded=True)
g.export("pdftreey.eps")

run_HH2019

openmpi v1.8.8 is required for mpirun

./run_HH2019 160
#!/bin/bash
np=$1
id=$(date  +'%Y_%m_%d_%H_%M_%S')
for i in bc2003_lr_BaSeL_chab bc2003_lr_BaSeL_kroup bc2003_lr_BaSeL_salp cb2007_lr_BaSeL_chab cb2007_lr_BaSeL_kroup cb2007_lr_BaSeL_salp galev0_Kroupa galev0_Salpeter galev_Kroupa galev_Salpeter m05krr m05ssr ynIIs ynIIb BPASSv2_imf135_300b BPASSv2_imf135_300s
do
	for j in 4 5 6 7
	do
		for k in 0 1 2 3 5
		do
			echo "i=$i,j=$j,k=$k"
			time -p mpirun -output-filename $(pwd)/$id/log.$i.$j.$k -np $np ./bin/linux/bayesed --sampling 1,0,0,400,0.3,0.1,1000,-1e90,1,0,0,0,-1e90,100000,0.01 -i 0,observation/ULTRAVISTA/ULTRAVISTA0.txt --filters observation/ULTRAVISTA/filters.txt --filters_selected observation/ULTRAVISTA/filters_selected.txt --ssp 0,$i,1,3,1,0,0,0,0,0 --sfh 0,$k,0,0 --ext 0,$j --outdir result --sys_err_obs 0,1
		done
	done
done

SED model emulation with machine learning

As an example, we show how the SED library of CLUMPY AGN dust torus emission model can be imported into BayeSED and then used in the Bayesian analysis of photometric measurements of NGC1068 from GALSEDATLAS.

Preparation of SED library:

wget -P models https://www.clumpy.org/downloads/clumpy_models_201410_tvavg.hdf5
./models/clumpy/convert_clumpy.py tor

Principal Component Analysis (PCA):

./bin/mac/sed2pca clumpy201410tor 1 0.1 1e-6

K-Nearest Neighbors (KNN) algorithm:

./bin/train_knn clumpy201410tor 1 1 1e-6 mac
./bin/train_knn clumpy201410tor_derived 1 0 1e-6 mac
time ./bin/mac/bayesed --sampling 1,0,0,200,0.8,0.1,1000,-1e90,1,1,0,0,-1e90,100000,0.01 -i 1,observation/hlsps/test.txt --filters observation/hlsps/filters.txt --filters_selected observation/hlsps/filters_selected_gal.txt --ssp 0,bc2003_lr_BaSeL_kroup,1,3,1,0,0,0,0,0 --sfh 0,2,0,0 --ext 0,7 -ak 1,clumpy201410tor,1,1,1,0,0 --sys_err_obs 0,1 --outdir galsedatlas0 --save_bestfit

Artificial Neural Network (ANN):

./bin/train_ann clumpy201410tor 1 1 1e-6 mac
./bin/train_ann clumpy201410tor_derived 1 0 1e-6 mac
time ./bin/mac/bayesed --sampling 1,0,0,200,0.8,0.1,1000,-1e90,1,1,0,0,-1e90,100000,0.01 -i 1,observation/hlsps/test.txt --filters observation/hlsps/filters.txt --filters_selected observation/hlsps/filters_selected_gal.txt --ssp 0,bc2003_lr_BaSeL_kroup,1,3,1,0,0,0,0,0 --sfh 0,2,0,0 --ext 0,7 -a 1,clumpy201410tor,1  --sys_err_obs 0,1 --outdir galsedatlas0 --save_bestfit

Plot of best-fit results

gnuplot observation/hlsps/plot_bestfit_NGC1068.gpi

plot_bestfit_NGC1068.gpi

um='{/Symbol m}m'
lam='{/Symbol l}'
uJy='{/Symbol m}Jy'
set log xy 10
set xlabel lam.'_{rest}/'.um
set ylabel 'Flux/'.uJy
set  key top left
set term postscript enhanced color eps lw 3 dl 2
#use ANN emulation of clumpy201410tor
set output 'NGC1068_ANN.eps'
plot [][1000:] 'galsedatlas0/galsedatlas/NGC1068/1clumpy201410tor_10csp200_bc2003_lr_BaSeL_kroup000_hyperz5_bestfit.txt' index 0 u 4:9:10 w ye t 'obs','' index 2 u 1:3 w l t 'stellar emission','' index 1 u 1:3 w l t 'AGN dust torus emission','' index 3 u 1:3 w l t 'Best-fit'
#use KNN emulation of clumpy201410tor
set output 'NGC1068_KNN.eps'
plot [][1000:] 'galsedatlas0/galsedatlas/NGC1068/6clumpy201410tor_10csp200_bc2003_lr_BaSeL_kroup000_hyperz5_bestfit.txt' index 0 u 4:9:10 w ye t 'obs','' index 2 u 1:3 w l t 'stellar emission','' index 1 u 1:3 w l t 'AGN dust torus emission','' index 3 u 1:3 w l t 'Best-fit'
_images/NGC1068.jpg

FAQs

Changelogs

Version 1.0 - Aug. 2014

Version 2.0 - Nov. 2018