Stellar population model¶
This class is dedicated to handling the fitting of the stellar population model with the FIREFLY code, see Wilkinson et al. 2015.
https://arxiv.org/abs/1503.01124
General purpose:¶
The class StellarPopulationModel is a wrapper dedicated to handling the fit of stellar population models on observed spectra. It gathers all inputs : from the model and from the data.
Imports:
import numpy as np
import astropy.io.fits as pyfits
import astropy.units as u
import glob
import pandas as pd
import os
from firefly_instrument import *
from firefly_dust import *
from firefly_fitter import *
from firefly_library import *
-
class
StellarPopulationModel.
StellarPopulationModel
(specObs, outputFile, cosmo, models='m11', model_libs=['MILES_UVextended'], imfs=['ss', 'kr'], hpf_mode='on', age_limits=[6, 10.1], downgrade_models=True, dust_law='calzetti', max_ebv=1.5, num_dust_vals=200, dust_smoothing_length=200, max_iterations=10, fit_per_iteration_cap=1000, pdf_sampling=300, data_wave_medium='vacuum', Z_limits=[-0.1, 0.1], wave_limits=[0, 99999990], suffix='-fireflyFits.fits', use_downgraded_models=False)[source]¶ Parameters: - specObs – specObs observed spectrum object initiated with the GalaxySpectrumFIREFLY class.
- models –
choose between ‘m11’, ‘bc03’ or ‘m09’.
- m11 corresponds to all the models compared in Maraston and Stromback 2011.
- m09 to Maraston et al. 2009.
- bc03 to the Bruzual and Charlot 2003 models.
- model_libs – only necessary if using m11.
Choose between MILES, MILES revisednearIRslope, MILES UVextended, STELIB, ELODIE, MARCS.
- MILES, MILES revisednearIRslope, MILES UVextended, STELIB, ELODIE are empirical libraries.
- MARCS is a theoretical library.
Parameters: imfs – choose the initial mass function:
- ‘ss’ for `Salpeter <http://adsabs.harvard.edu/abs/1955ApJ...121..161S>`_or
- ‘kr’ for Kroupa or
- ‘cha’ for Chabrier.
Note
- This is how it proceeds :
- reads the parameter file by using parameters_obtain(parameters.py)
- It opens the data file, model files, then it matches their resolutions by downgrading the models to instrumental and velocity dispersion resolution
- Determines dust attenuation curve to be applied to the models. Two options : through HPF fitting (3.1.) or through filtered values to determing SP properties (3.2.).
- It fits the models to the data
- Gets mass-weighted SSP contributions using saved M/L ratio.
- Convert chis into probabilities and calculates all average properties and errors (assuming the number of degrees of freedom is the number of wavelength points)
- Optionally produces a plot
- Finally, it writes the output files
-
fit_models_to_data
()[source]¶ - Once the data and models are loaded, then execute this function to find the best model. It loops overs the models to be fitted on the data:
- gets the models
- matches the model and data to the same resolution
- normalises the spectra
-
get_model
(model_used, imf_used, deltal, vdisp, wave_instrument, r_instrument, ebv_mw)[source]¶ Retrieves all relevant model files, in their downgraded format. If they aren’t downgraded to the correct resolution / velocity dispersion, takes the base models in their native form and converts to downgraded files.
Parameters: - model_used – list of models to be used, for example [‘m11’, ‘m09’].
- imf_used – list of imf to be used, for example [‘ss’, ‘cha’].
- deltal – delta lambda in the models.
- vdisp – velocity dispersion observed in the galaxy.
- wave_instrument – wavelength array from the observations
- r_instrument – resolution array from the observations
- ebv_mw – E(B-V) from the dust maps for the galaxy.
- loads the models m11 or m09: maps parameters to the right files. Then it constructs the model array. Finally converts wavelengths to air or vacuum.
- downgrades the model to match data resolution
- applies attenuation
- stores models in
- self.model_wavelength, self.model_flux, self.age_model, self.metal_model
and returns it as well