Skip to main content

Fits of IR SEDs including AGN contribution.

Project description

iragnsep

iragnsep performs IR (i.e. 8--1000 microns) SED fits to separate the AGN and the galaxy contributions allowing to measure the host galaxy properties (e.g. SFRs) free of AGN contamination. The advantage of iragnsep is that, in addition to fit observed photometric fluxes, it allows to incorporate spectra in the fits which improves the robustness at separating the AGN and the galaxy components. For the galaxy component iragnsep uses a library of templates that are representative of local star-forming galaxies. For the AGN contribution, if the input dataset contains a mixed of a spectral and photometric data, iragnsep uses a combination of power-laws for the AGN continuum and some broad features for the silicate emissions. If the dataset contains photometric data only, the AGN contribution is accounted for by using a fixed library of AGN templates representative of typical AGN emission at IR wavelengths. The advanced fitting techniques used by iragnsep (i.e. MLE optimised with MCMC) combined with the powerful model comparison tests (e.g. AIC) allow iragnsep to provide a statistically robust interpretation of the data in terms of AGN--galaxy separation for the IR emission of galaxies harbouring AGNs at their centre.

The aim of this README is to show how to use iragnsep and to present the various modules used throughout. Further information concerns the limitations of iragnsep as well as future work expected to improve iragnsep. These are important to consider while using iragnsep. Any use of iragnsep out of those defined boundaries are to be done with care.

For a detailed description on the templates and the models see Bernhard et al. (in prep.).

Contacts: e.p.bernhard@sheffield.ac.uk

Getting Started

These instructions should assist you in getting iragnsep running on your machine. iragnsep is written in python 3 and is available on PyPI to ease installation and updates.

Prerequisites

iragnsep requires various non-standard libraries (dependencies) to run. These should automatically get installed when downloading and installing iragnsep. If not, these can be manually installed using the pip3 command. The dependencies are as follow,

  • NumPy - NumPy is the fundamental package for scientific computing with Python.
  • Matplotlib - Matplotlib is a Python 2D plotting library.
  • Astropy - The Astropy Project is a community effort to develop a common core package for Astronomy in Python and foster an ecosystem of inter-operable astronomy packages.
  • SciPy - SciPy is a Python-based ecosystem of open-source software for mathematics, science, and engineering.
  • pandas - pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
  • tqdm - tqdm is a fast, extensible progress bar for Python and CLI.
  • emcee - emcee is an MIT licensed pure-Python implementation of Goodman & Weare’s Affine Invariant Markov chain Monte Carlo (MCMC) Ensemble sampler.

Installation

We recommend to install iragnsep and its dependencies using pip,

pip3 install --index-url https://test.pypi.org/simple/ iragnsep

The project is also publicly available on bitbucket at https://bitbucket.org/ebernhard/iragnsep/src/master/ .

Quick start

In this section we show how to infer the SFR of the galaxy mrk1066 using iragnsep.

Step 1: Get the data and the script

You can download the data at https://bitbucket.org/ebernhard/iragnsepex/src/master/. The file data_mrk1066.csv contains the Herschel fluxes of mrk1066 and the file data_mrk1066_spec.csv contains the IRS spectrum of mrk1066. The file main.py is the script to run. Once downloaded, create a folder with all of these files.

Step 2: Run the script

In a terminal simply cd to the folder that contains the files and run,

python3 main.py

iragnsep is now fitting mrk1066, first using a combination of the IRS spectra and Herschel photometry, then using photometry only as if the IRS spectra was not available. The user can open the file main.py which is commented and can be used as a template for future use of iragnsep.

Step 3: Output

Once the fit is performed the plots and tables are generated and saved in the same folder.

  • mrk1066_fitRes_spec.csv - contains the results of the fits for all possible combinations of models. Each line corresponds to a specific model. This file is for fits based on data which include the IRS spectrum. The best model is flagged by a value of 1.0 in the column 'bestModelFlag'. See the section ** Description of the tables** for a full description of each of the columns.
  • mrk1066_fitResAll_spec.pdf - shows the results of each of the models fit to the data which include the IRS spectrum.
  • mrk1066_fitResBM_spec.pdf - shows the best fit to the data which do not include the IRS spectrum. The best fit corresponds to a weighted combination of all the different models.
  • mrk1066_fitRes_photo.csv - contains the results of the fits for all possible combinations of models. Each line corresponds to a specific model. This file is for fits based on data which do not includes the IRS spectrum. The best model is flagged by a value of 1.0 in the column 'bestModelFlag'. See the section ** Description of the tables** for a full description of each of the columns.
  • mrk1066_fitResAll_photo.pdf - shows the results of each of the models fit to the data which do not include the IRS spectrum.
  • mrk1066_fitResBM_photo.pdf - shows the best fit to the data which do not include the IRS spectrum. The best fit corresponds to a weighted combination of all the different models.

(Important notice: for this example the number of steps for the MCMC is set to 1000. This is way too short and should be increased to get a more reliable fit. We use 1000 here so it is not too much time consuming and the fits appear to be OK.)

Preparing your data

As this is the first version of iragnsep it is important to make sure that the data in input are compatible with the code. Future versions will allow more flexibility in the format of the input data. The main input are the wavelengths of the SED (or combined spectrum and photometry) and the corresponding fluxes and their uncertainties. Here is a (non-exhaustive) check list of points that are required to ensure a robust behaviour of iragnsep.

  • the wavelengths are in microns, the fluxes and the uncertainties are in Jy.
  • the vector wavelength is in monotonically increasing order.
  • their is no negative or undefined (e.g. nan) values in the fluxes and their uncertainties (upper-limits can be passed via the keyword UL).
  • the vectors fed in the keywords 'wavToFit', 'filters' and 'UL' are of the same length. The later is defined by the number of photometric points in the SED.
  • if any of the keywords 'wavToFit', 'filters' and 'UL' are changed, they all need to be changed accordingly (see the example of mrk1066 where there is no flux at 500 micron).
  • if using iragnsep with a combination of spectrum and photometry, make sure that no photometric points are overlapping with the spectral data (e.g. IRS spectra and MIPS 24 mic would be overlapping).
  • from practice, a good value for Nmc (the number of steps in the MCMC) is at least >10000 steps.
  • do not forget to set the redshift of the source using the keyword z.

Should you find anything non-intuitive missing from the above list, contact us at: e.p.bernhard@sheffield.ac.uk

Description of the tables

The output of the fits can be saved using the keyword saveRes as shown in the main.py of the Quick Start example on mrk1066. In particular two types of tables can be generated whether using the version of the code with spectra or that of with photometry only.

The table sourceName_fitRes_spec.csv is a comma separated values table which contains the results of the fits performed on data which includes spectra (i.e. using the full model for AGN emission). Each line of the table is a possible model that has been fit to the data. Columns are as follow,

  • normGal_dust, enormGal_dust - the log-normalisation of the galaxy dust continuum emission and its uncertainties.
  • normGal_PAH, enormGal_PAH - the log-normalisation of the PAH emission template and its uncertainties.
  • normAGN_PL, enormAGN_PL - the overall normalisation of the continuum emission for AGN (combination of power-laws) and its uncertainties.
  • lBreak_PL, elBreak_PL - the position of the main break for the AGN emission and its uncertainties.
  • alpha1_PL, ealpha1_PL - the slope of the AGN power-law below 15 micron and its uncertainties.
  • alpha2_PL, ealpha2_PL - the slope of the AGN power-law above 15 micron and below lbreak_PL and its uncertainties.
  • normAGN_G10, enormAGN_G10 - the log-normalisation of the silicate emission at 10 micron and its uncertainties.
  • normAGN_G18, enormAGN_G18 - the log-normalisation of the silicate emission at 18 micron and its uncertainties.
  • logl - the loglikelihood of the fit given the model.
  • AGNon - if set to 0.0 the fit was performed assuming no AGN and if set to 1.0 the AGN was included in the fit.
  • tplName - the name of the template for the galaxy emission.
  • bestModelFlag - a value of 1.0 indicates the best model.
  • Aw - the Akaike weight of the model.
  • tau9p7 - the total extinction at 9.7 micron.
  • loglum_hostIR - the IR (8--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_hostMIR - the MIR (5--35 microns) luminosity of the host free of AGN contamination.
  • loglum_hostFIR - the FIR (40--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_AGNIR - the IR luminosity of the AGN free of host contamination.
  • loglum_AGNMIR - the MIR luminosity of the AGN free of host contamination.
  • loglum_AGNFIR - the FIR luminosity of the AGN free of host contamination.
  • AGNfrac_IR - the fraction of the total IR luminosity which is attributed to the AGN.
  • AGNfrac_MIR - the fraction of the total MIR luminosity which is attributed to the AGN.
  • AGNfrac_FIR - the fraction of the total FIR luminosity which is attributed to the AGN.
  • SFR - the star formation rate free of AGN contamination.
  • wSFR - the weighted star formation rate free of AGN contamination.

The table sourceName_fitRes_photo.csv is a comma separated values table which contains the results of the fits performed on data with photometry only (i.e. using the templates for the AGN emission). Each line is a possible model that has been fit to the data. Columns are as follow,

  • normGal_dust, enormGal_dust - the log-normalisation of the galaxy dust continuum emission and its uncertainties.
  • normGal_PAH, enormGal_PAH - the log-normalisation of the PAH emission template and its uncertainties.
  • normAGN, enormAGN - the log-normalisation of the template for the AGN emission and its uncertainties.
  • normSiem, enormSiem - the log-normalisation of the template for the silicate emission and its uncertainties.
  • AGNon - if set to 0.0 the fit was performed assuming no AGN and if set to 1.0 the AGN was included in the fit.
  • tplName_gal - the name of the template for the galaxy emission.
  • tplName_AGN - the name of the template for the AGN emission.
  • bestModelFlag - a value of 1.0 indicates the best model.
  • Aw - the Akaike weight of the model.
  • loglum_hostIR - the IR (8--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_hostMIR - the MIR (5--35 microns) luminosity of the host free of AGN contamination.
  • loglum_hostFIR - the FIR (40--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_AGNIR - the IR luminosity of the AGN free of host contamination.
  • loglum_AGNMIR - the MIR luminosity of the AGN free of host contamination.
  • loglum_AGNFIR - the FIR luminosity of the AGN free of host contamination.
  • AGNfrac_IR - the fraction of the total IR luminosity which is attributed to the AGN.
  • AGNfrac_MIR - the fraction of the total MIR luminosity which is attributed to the AGN.
  • AGNfrac_FIR - the fraction of the total FIR luminosity which is attributed to the AGN.
  • SFR - the star formation rate free of AGN contamination.
  • wSFR - the weighted star formation rate free of AGN contamination.

iragnsep: modules

--

SEDanalysis

--

The module SEDanalysis is the main module which runs the fits (yet see the run_all module for an end-to-end use of iragnsep, including generating plots and tables). SEDanalysis contains two functions. runSEDspecFit is for dataset which combine spectral and photometric fluxes and runSEDphotFit is for dataset which contain photometric data only.


res, resBM = SEDanalysis.runSEDspecFit(lambdaObs, fluxObs, efluxObs, z = 0.01, filters = ['PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'], wavToFit = [70., 100., 160., 250., 350., 500.], UL = [0., 0., 0., 0., 0., 0.], IRSobsCorr = True, Nmc = 500, nthreads = 1, pgrbar = 1, Pdust = [5., 15.], PdPAH = [-0.3, 0.3], Ppl = [-5., 5.], Pbreak = [1.5, 0.01], Pslope1 = [0., 5.], Pslope2 = [0., 5.], Plsg = [-5., 5.], Pllg = [-5., 5.], templ = '')

INPUT:

  • lambdaObs - observed wavelengths in microns.
  • fluxObs - observed flux in Jy.
  • efluxObs - uncertainties on the observed flux in Jy.

OUTPUT:

  • res - dataframe which contains all the results of the fits for each of the models fit (see the section Description of the tables).
  • resBM - same as res but for the best model only.

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • filters - name of the broad band filters. Default: ['PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'].
  • wavToFit - observed wavelengths of the broad band filters used in the fit. Default: [70., 100., 160., 250., 350., 500.].
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: [0., 0., 0., 0., 0., 0.].
  • IRSobsCorr - if True, performs polynomial fits of the continuum around the 9.7micron absorption feature to correct for obscuration. Default: True.
  • Nmc - numbers of steps in the MCMC. Default: 500 (way too low!!! However runs fast for end-to-end tests).
  • nthreads - number of cores to use for parallel computing. Default: 1.
  • pgrbar - if set to 1, displays a progress bar. Default: 1.
  • Pdust - flat prior on the log-normalisation of the galaxy dust continuum component. Default: [5., 15.]
  • PdPAH - flat prior on the deviation of the log-normalisation of the PAH emission component (uncertainties around Eq. 1 in Bernhard et al, in prep.). Default: [-0.3, 0.3] (Should remain default as scientifically motivated).
  • Ppl - flat prior on the log-normalisation of power-laws for the AGN emission. Default: [-5., 5.].
  • Pbreak - prior on the position of the break for the AGN component. The prior is define by a Gaussian centred on x (log-wavelength) and of width y. Default: [x = 1.5, 0.01].
  • Pslope1 - flat prior on the slope of the AGN power-law below 15 micron. Default: [0., 5.].
  • Pslope2 - flat prior on the slope of the AGN power-law above 15 micron and below the main break. Default: [0., 5.].
  • Plsg - flat prior on the log-normalisation of the silicate emission at 10 micron. Default: [-5., 5.].
  • Pllg - flat prior on the log-normalisation of the silicate emission at 19 micron. Default: [-5., 5.].
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).

res, resBM = SEDanalysis.runSEDphotFit(lambdaObs, fluxObs, efluxObs, z = 0.01, filters = ['MIPS24', 'PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'], wavToFit = [24., 70., 100., 160., 250., 350., 500.], UL = [0., 0., 0., 0., 0., 0., 0.], Nmc = 500, nthreads = 1, pgrbar = 1, NoSiem = False, Pdust = [5., 15.], PdPAH = [-0.3, 0.3], PnormAGN = [5., 15.], PSiEm = [5., 15.], templ = '')

INPUT:

  • lambdaObs - observed wavelengths in microns.
  • fluxObs - observed flux in Jy.
  • efluxObs - uncertainties on the observed flux in Jy.

OUTPUT:

  • res - dataframe which contains all the results of the fits for each of the models fit (see the section Description of the tables).
  • resBM - same as res but for the best model only.

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • filters - name of the broad band filters. Default: ['MIPS24', 'PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'].
  • wavToFit - observed wavelengths of the broad band filters used in the fit. Default: [24., 70., 100., 160., 250., 350., 500.].
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: [0., 0., 0., 0., 0., 0., 0.].
  • Nmc - numbers of steps in the MCMC. Default: 500 (way too low!!! However runs fast for end-to-end tests).
  • nthreads - number of cores to use for parallel computing. Default: 1.
  • pgrbar - if set to 1 displays a progress bar. Default: 1.
  • Pdust - flat prior on the log-normalisation of the galaxy dust continuum component. Default: [5., 15.]
  • PdPAH - flat prior on the deviation of the log-normalisation of the PAH emission component (uncertainties around Eq. 1 in Bernhard et al, in prep.). Default: [-0.3, 0.3] (Should remain default as scientifically motivated).
  • PnormAGN - flat prior on the log-normalisation of the AGN template component. Default: [5., 15.]
  • PSiEm - flat prior on the log-normalisation of the silicate emission template component. Default: [5., 15.]
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).

--

toolplot

--

The module toolplot generates plots based on the results of the fits. toolplot contains four functions. plotFitSpec and plotFitSpecBM plot the full possible combination of models and the best model, respectively, for dataset which combine spectral and photometric data, and plotFitPhoto and plotFitPhotoBM are the same but for dataset with photometry only.


toolplot.plotFitSpec(df, data, z = 0.01, UL = np.array([]), pathFig = './', sourceName = 'NoName', templ = '', saveRes = True)

INPUT:

  • df - dataframe containing the output of SEDanalysis.runSEDspecFit (defined as "res" in this manual).
  • data - a list of 3xNobs, where Nobs is the number of observed points, and the first, second and third dimensions are the observed wavelengths, the observed fluxes and the uncertainties on the fluxes, respectively (i.e. [lambdaObs, fluxObs, efluxObs]).

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: np.array([]).
  • pathFig - if the figures are to be saved, pathFig specifies the location. Default: './'.
  • sourceName - if the figures are to be saved, sourceName specifies the name to be given. Default: 'NoName'.
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).
  • saveRes - if set to True the figures are saved as pathFig/sourceName_fitResAll_spec.pdf. Default = True.

toolplot.plotFitSpecBM(df, data, z = 0.01, UL = np.array([]), pathFig = './', sourceName = 'NoName', templ = '', saveRes = True)

INPUT:

  • df - dataframe containing the output of SEDanalysis.runSEDspecFit (defined as "res" in this manual).
  • data - a list of 3xNobs, where Nobs is the number of observed points, and the first, second and third dimensions are the observed wavelengths, the observed fluxes and the uncertainties on the fluxes, respectively (i.e. [lambdaObs, fluxObs, efluxObs]).

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: np.array([]).
  • pathFig - if the figures are to be saved pathFig specifies the location. Default: './'.
  • sourceName - if the figures are to be saved sourceName specifies the name to be given. Default: 'NoName'.
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).
  • saveRes - if set to True the figures are saved as pathFig/sourceName_fitResBM_spec.pdf. Default = True.

toolplot.plotFitPhoto(df, data, z = 0.01, UL = np.array([]), pathFig = './', sourceName = 'NoName', templ = '', saveRes = True)

INPUT:

  • df - dataframe containing the output of SEDanalysis.runSEDphotFit (defined as "res" in this manual).
  • data - a list of 3xNobs, where Nobs is the number of observed points, and the first, second and third dimensions are the observed wavelengths, the observed fluxes and the uncertainties on the fluxes, respectively (i.e. [lambdaObs, fluxObs, efluxObs]).

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: np.array([]).
  • pathFig - if the figures are to be saved pathFig specifies the location. Default: './'.
  • sourceName - if the figures are to be saved sourceName specifies the name to be given. Default: 'NoName'.
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).
  • saveRes - if set to True the figures are saved as pathFig/sourceName_fitResAll_photo.pdf. Default = True.

toolplot.plotFitPhotoBM(df, data, z = 0.01, UL = np.array([]), pathFig = './', sourceName = 'NoName', templ = '', saveRes = True)

INPUT:

  • df - dataframe containing the output of SEDanalysis.runSEDphotFit (defined as "res" in this manual).
  • data - a list of 3xNobs, where Nobs is the number of observed points, and the first, second and third dimensions are the observed wavelengths, the observed fluxes and the uncertainties on the fluxes, respectively (i.e. [lambdaObs, fluxObs, efluxObs]).

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: np.array([]).
  • pathFig - if the figures are to be saved pathFig specifies the location. Default: './'.
  • sourceName - if the figures are to be saved sourceName specifies the name to be given. Default: 'NoName'.
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep.).
  • saveRes - if set to True the figures are saved as pathFig/sourceName_fitResAll_photo.pdf. Default = True.

--

run_all

--

The module run_all is made to ease the use of iragnsep by running everything from the fits to the plots and give the possibility to save the results. run_all contains two functions. fitSpec performs everything on datasets which combine spectral and photometric data and fitPhoto does the same but on datasets with photometry only.


res, resBM = run_all.fitSpec(wav, flux, eflux, z = 0.01, filters = ['PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'], wavToFit = [70., 100., 160., 250., 350., 500.], UL = [0., 0., 0., 0., 0., 0.], IRSobsCorr = True, Nmc = 500, nthreads = 1, pgrbar = 1, Pdust = [5., 15.], PdPAH = [-0.3, 0.3], Ppl = [-5., 5.], Pbreak = [1.5, 0.01], Pslope1 = [0., 5.], Pslope2 = [0., 5.], Plsg = [-5., 5.], Pllg = [-5., 5.], sourceName = 'NoName', pathTable = './', pathFig = './', redoFit = True, saveRes = True)

INPUT:

  • wav - observed wavelengths in microns.
  • flux - observed flux in Jy.
  • eflux - uncertainties on the observed flux in Jy.

OUTPUT:

  • res - dataframe which contains all the results of the fits for each of the models fit (see the section Description of the tables).
  • resBM - same as res but for the best model only.

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • filters - name of the broad band filters. Default: ['PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'].
  • wavToFit - observed wavelengths of the broad band filters used in the fit. Default: [70., 100., 160., 250., 350., 500.].
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: [0., 0., 0., 0., 0., 0.].
  • IRSobsCorr - if True, performs polynomial fits of the continuum around the 9.7micron absorption feature to correct for obscuration. Default: True.
  • Nmc - numbers of steps in the MCMC. Default: 500 (way too low!!! However runs fast for end-to-end tests).
  • nthreads - number of cores to use for parallel computing. Default: 1.
  • pgrbar - if set to 1, displays a progress bar. Default: 1.
  • Pdust - flat prior on the log-normalisation of the galaxy dust continuum component. Default: [5., 15.]
  • PdPAH - flat prior on the deviation of the log-normalisation of the PAH emission component (uncertainties around Eq. 1 in Bernhard et al, in prep.). Default: [-0.3, 0.3] (Should remain default as scientifically motivated).
  • Ppl - flat prior on the log-normalisation of power-laws for the AGN emission. Default: [-5., 5.].
  • Pbreak - prior on the position of the break for the AGN component. The prior is define by a Gaussian centred on x (log-wavelength) and of width y. Default: [x = 1.5, 0.01].
  • Pslope1 - flat prior on the slope of the AGN power-law below 15 micron. Default: [0., 5.].
  • Pslope2 - flat prior on the slope of the AGN power-law above 15 micron and below the main break. Default: [0., 5.].
  • Plsg - flat prior on the log-normalisation of the silicate emission at 10 micron. Default: [-5., 5.].
  • Pllg - flat prior on the log-normalisation of the silicate emission at 19 micron. Default: [-5., 5.].
  • sourceName - if the results are to be saved sourceName specifies the name to be given to the files. Default: 'NoName'.
  • pathTable - if the results are to be saved pathTable specifies the location. Default: './'.
  • pathFig - if the figures are to be saved pathFig specifies the location. Default: './'.
  • redoFit - if set to True re-performs the fits. If set to False, get the results saved in pathTable/SourceName_fitRes_spec.csv to only produce the plots and the analysis. Default: True.
  • saveRes - if set to True save the resulting tables as pathTable/SourceName_fitRes_spec.csv and plots as pathFig/SourceName_fitResAll_spec.csv and pathFig/SourceName_fitResBM_spec.csv.

res, resBM = run_all.fitPhoto(wav, flux, eflux, z = 0.01, filters = ['PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'], wavToFit = [70., 100., 160., 250., 350., 500.], UL = [0., 0., 0., 0., 0., 0.], IRSobsCorr = True, Nmc = 500, nthreads = 1, pgrbar = 1, NoSiem = False, Pdust = [5., 15.], PdPAH = [-0.3, 0.3], PnormAGN = [5., 15.], PSiEm = [5., 15.], sourceName = 'NoName', pathTable = './', pathFig = './', redoFit = True, saveRes = True)

INPUT:

  • wav - observed wavelengths in microns.
  • flux - observed flux in Jy.
  • eflux - uncertainties on the observed flux in Jy.

OUTPUT:

  • res - dataframe which contains all the results of the fits for each of the models fit (see the section Description of the tables).
  • resBM - same as res but for the best model only.

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • filters - name of the broad band filters. Default: ['MIPS24', 'PACS70', 'PACS100', 'PACS160', 'SPIRE250ps', 'SPIRE350ps', 'SPIRE500ps'].
  • wavToFit - observed wavelengths of the broad band filters used in the fit. Default: [24., 70., 100., 160., 250., 350., 500.].
  • UL - if any of the value in the list is set to 1, the flux is treated as an upper limit. Default: [0., 0., 0., 0., 0., 0., 0.].
  • Nmc - numbers of steps in the MCMC. Default: 500 (way too low!!! However runs fast for end-to-end tests).
  • nthreads - number of cores to use for parallel computing. Default: 1.
  • pgrbar - if set to 1 displays a progress bar. Default: 1.
  • Pdust - flat prior on the log-normalisation of the galaxy dust continuum component. Default: [5., 15.]
  • PdPAH - flat prior on the deviation of the log-normalisation of the PAH emission component (uncertainties around Eq. 1 in Bernhard et al, in prep.). Default: [-0.3, 0.3] (Should remain default as scientifically motivated).
  • PnormAGN - flat prior on the log-normalisation of the AGN template component. Default: [5., 15.]
  • PSiEm - flat prior on the log-normalisation of the silicate emission template component. Default: [5., 15.]
  • sourceName - if the results are to be saved sourceName specifies the name to be given to the files. Default: 'NoName'.
  • pathTable - if the results are to be saved pathTable specifies the location. Default: './'.
  • pathFig - if the figures are to be saved pathFig specifies the location. Default: './'.
  • redoFit - if set to True re-performs the fits. If set to False, get the results saved in pathTable/SourceName_fitRes_photo.csv to only produce the plots and the analysis. Default: True.
  • saveRes - if set to True save the resulting tables as pathTable/SourceName_fitRes_photo.csv and plots as pathFig/SourceName_fitResAll_photo.csv and pathFig/SourceName_fitResBM_photo.csv.

--

func

--

The module func contains a bunch of functions used to run the fits, the best model selection and the analysis.


get_prop(df, z = 0.01, specOn = True, templ = '')

Description:

This function runs the analysis to derive various properties (see OUTPUT) based on the fits of the IR SEDs.

INPUT:

  • df - dataframe containing the results of the fits as output of any SEDanalysis modules.

OUTPUT:

  • loglum_hostIR - the IR (8--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_hostMIR - the MIR (5--35 microns) luminosity of the host free of AGN contamination.
  • loglum_hostFIR - the FIR (40--1000 microns) luminosity of the host free of AGN contamination.
  • loglum_AGNIR - the IR luminosity of the AGN free of host contamination.
  • loglum_AGNMIR - the MIR luminosity of the AGN free of host contamination.
  • loglum_AGNFIR - the FIR luminosity of the AGN free of host contamination.
  • AGNfrac_IR - the fraction of the total IR luminosity which is attributed to the AGN.
  • AGNfrac_MIR - the fraction of the total MIR luminosity which is attributed to the AGN.
  • AGNfrac_FIR - the fraction of the total FIR luminosity which is attributed to the AGN.
  • SFR - the star formation rate free of AGN contamination.
  • wSFR - the weighted star formation rate free of AGN contamination.

KEYWORDS:

  • z - redshift of the source. Default: 0.01.
  • specOn - if set to True the data are a combination of spectrum and photometry. If set to Fasle the data are photometry only. Default: True.
  • templ - templates to be used. Default: '' (B18 templates as described in Bernhard et al., in prep).

basictests(wav, flux, eflux, filters, wavToFit, UL, z, specOn = True)

Description:

This function runs some basic tests to check that everything is ready to be fed to the various modules of iragnsep.

INPUT:

  • wav - observed wavelengths in microns.
  • flux - observed flux in Jy.
  • eflux - uncertainties on the observed flux in Jy.
  • filters - name of the broad band filters.
  • wavToFit - observed wavelengths of the broad band filters used in the fit.
  • UL - vector of length equal to wavToFit. If any of the value in the list is set to 1, the flux is treated as an upper limit.
  • z - redshift of the source.

OUTPUT:

Pass or crash with error messages.

KEYWORDS:

  • specOn - if set to True the data are a combination of spectrum and photometry. If set to False the data are photometry only. Default: True.

exctractBestModel(logl, k, n, corrected = True)

Description:

This function finds the best model across the various possible combination of models accounting for the differences in the numbers of degrees of freedom by using the AIC or the corrected AIC.

INPUT:

  • logl - the log-likelihood of the fit.
  • k - the total numbers of free parameters in the models.
  • n - the total numbers of data points.

OUTPUT:

  • bestModelInd - the index of the best model.
  • Awi - the Akaike weight of each individual model.

KEYWORDS:

  • corrected - if set to true applies the corrected AIC (AICc). Default: True.

nuLnuToFnu(spec_wav, nuLnu, z)

Description:

This function take the model nuLnu and transforms it to observed fluxes at the given redshift.

INPUT:

  • spec_wav - the wavelengths in microns.
  • nuLnu - the model nuLnu.
  • z - the redshift of the source.

OUTPUT:

  • Fnu - observed flux in Jy.

getFluxInFilt(filt_wav, filt_QE, spec_wav, nuLnu, z)

Description:

This function calculates the observed flux within a given filter from the model nuLnu located at a redshift z.

INPUT:

  • filt_wav - passband of the filter.
  • filt_QE - quantum efficiency of the filter.
  • spec_wav - the wavelengths in microns.
  • nuLnu - the model nuLnu.
  • z - the redshift of the source.

OUTPUT:

  • flux_Obs - the observed flux.

Gauss(x, mu, sigma)

Decription:

This function returns a simple Gaussian centred on mu and of width sigma.

INPUT:

  • x - vector for the wavelengths in microns.
  • mu - central location of the Gaussian.
  • sigma - width of the Gaussian.

OUTPUT:

  • Bnu - Gaussian normalised to the peak value.

AGNmodel(x, lambdab1, lambdab2, alpha1, alpha2, alpha3)

Description:

This function calculates the shape of the model for the AGN emission as described in Bernhard et al. (in prep).

INPUT:

  • x - vector in wavelengths in microns.
  • lambda1 - position of the break for the first broken power-law.
  • lambda2 - position of the break for the second broken power-law.
  • alpha1 - slope of the first power-law below lambda1.
  • alpha2 - slope of the first power-law above lambda1. Also, slope of the second power-law below lambda2.
  • alpha3 - slope of the second power-law above lambda2.

OUTPUT:

  • Bnu - full model for AGN normalised at 15 microns.

KVTextinctCurve(lambda_obs)

Description:

This function calculates the extinction curve as presented in Kemper et al. (2004).

INPUT:

  • lambda_obs - the observed wavelengths in microns.

OUTPUT:

  • tau - the value of the extinction at any given wavelengths.

drude(x, gamma_r, lambda_r, normed = True)

Description:

This function calculates a Drude profile given a central wavelengths gamma_r and a fractional FWHM.

INPUT:

  • x - wavelengths in microns.
  • gamma_r - central wavelengths.
  • lambda_r - fractional FWHM.

OUTPUT:

  • drudeVal - the corresponding drude model at wavelength x.

KEYWORDS:

  • normed - if set to True the drude profile is normalised to its maximum value.

corrIRSobs(IRSwavRest, IRSflux, eIRSflux):

Description:

This function takes an observed flux and corrects for extinction as described in Bernhard et al. (in prep).

INPUT:

  • IRSwavRest - rest-wavelengths in microns of the observed SED.
  • IRSflux - observed (attenuated) fluxes in Jy.
  • eIRSflux - uncertainties on the observed fluxes in Jy.

OUTPUT:

  • IRSflux_corr - de-attenuated flux in Jy.
  • eIRSflux_corr - uncertainties on the de-attenuated flux in Jy.
  • _tau9p7 - total absorption at 9.7 microns.

mod_black_body_norm(x, T, beta)

Description:

This function calculates the modified black-body curve at a temperature T and with beta index beta.

INPUT:

  • x - the vector wavelengths in microns.
  • T - the temperature in K.
  • beta - the beta index of the source.

OUTPUT:

  • Bnu - normalised modified black body curve.

--

classes

--

The module classes contains one class called 'modelToSED' which calls various functions to return the photometric point at a given wavelengths in a given filters for a model nuLnu. The available filters are as follow:

Note: to add filter please contact e.p.bernhard@sheffield.ac.uk.


Cautionary notes

As this is the first version of iragnsep we suggest the user to check carefully the results and to report anything that is possibly a bug. To do this, please contact us at: e.p.bernhard@sheffield.ac.uk.

The templates and models built for iragnsep are based on observations out to z0.3. As a consequence there is no proof that these are valid at higher redshifts. We are currently testing this and early results suggest that iragnsep can be used for sources at higher redshifts i.e. z3. However, this is at the user's own risk.

Future work

Future version will allow a more flexible input for the observed data. In addition it will be possible for the user to choose a complete different set of templates if necessary and to use iragnsep as a fitting and analysis routine only. We also plan to increase to even higher level the robustness of the model selection by using different model testing methods.

Versioning

We use three numbers for the versions defined as x.y.z. If only y and z are changed the output of iragnsep is unchanged and minor patches are applied. If x changes it means that major changes has been applied and results are likely to differ from the x-1 version.

Authors

  • Emmanuel Bernhard - Initial work
  • James Mullaney
  • Clive Tadhunter

The associated paper can be found at Bernhard et al. (in prep).

Citation

Please cite Bernhard et al. (in prep) when using iragnsep.

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iragnsep-0.0.0.tar.gz (177.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page