Firefly (Fitting IteRativEly For Likelihood analYsis): a full spectral
  fitting code
  We present a new spectral fitting code, Firefly, for deriving the stellar
population properties of stellar systems. Firefly is a chi-squared minimisation
fitting code that fits combinations of single-burst stellar population models
to spectroscopic data, following an iterative best-fitting process controlled
by the Bayesian Information Criterion. No priors are applied, rather all
solutions within a statistical cut are retained with their weight. Moreover, no
additive or multiplicative polynomia are employed to adjust the spectral shape.
This fitting freedom is envisaged in order to map out the effect of intrinsic
spectral energy distribution (SED) degeneracies, such as age, metallicity, dust
reddening on galaxy properties, and to quantify the effect of varying input
model components on such properties. Dust attenuation is included using a new
procedure, which was tested on Integral Field Spectroscopic (IFS) data in a
previous paper. The fitting method is extensively tested with a comprehensive
suite of mock galaxies, real galaxies from the Sloan Digital Sky Survey and
Milky Way globular clusters. We also assess the robustness of the derived
properties as a function of signal-to-noise ratio and adopted wavelength range.
We show that \FF\ is able to recover age, metallicity, stellar mass and even
the star formation history remarkably well down to a $S/N\sim5$, for moderately
dusty systems. Code and results are publicly available at
www.icg.port.ac.uk/firefly.
