Frequently Asked Questions (FAQ)

(1) How precise does the redshift of my source need to be before running CAFE?

CAFE is not designed to solve for the redshift of a source, so the input redshift should be as accurate as possible, preferably at least as precise as the resolution of the data. The code performs an initial search for the emission lines the user has requested to fit via the lines.H.recombination_***.txt, lines.atomic_***.txt and lines.molecular_***.txt files contained in the CAFE/inp_parfiles/ folder. The search is done at the expected rest-frame wavelength of the line (after correcting the observed spectrum to rest frame). By default the feature wavelengths are set to the input redshift and not allowed to vary individually, but users can adjust the EPSVgrad keyword in the .ini file (see Spectral Fitting section) to allow for a simultaneous shift of all the line, PAH and Gaussian opacity features. The units of EPSVgrad are [km/s]. If the redshift is incorrect, or the line is too red/blue-shifted with respect to the systemic redshift and beyond the search radius, the finder may fail and CAFE will ignore the line and will not attempt to fit it. The list of ignored lines are printed in the output given by the jupyter notebook cell that calls for the fit. Alternatively, the user may want to allow for the central wavelength of the features to vary independently of each other, by setting the FitWave0_??? keyword to True. However, the amount of allowed shifting, controlled by the EPSWave0_??? keyword (also in [km/s]), applies to all lines equally. That is, the amount of allowed shifting cannot be set separately for different lines. We also note that allowing the feature wavelengths to vary may lead to poor or wrong line fits in low SNR regions of the spectra, in addition to increase significantly the time for the fitter to converge to a solution.

(2) Can I fit high redshift sources with CAFE?

Yes, but there are potential pitfalls. The emission line table that CAFE uses goes down to the ultraviolet domain, and the user can add more lines to that table if they wish. The amount of continuum components available for fitting is large and sufficiently versatile to capture the shape of the near and mid-IR spectra of sources, even the most embedded ones. Below ~2-3 micron, where the hottest of the dust components starts to contribute less significantly to the emission, CAFE uses templates to fit the observed continuum (see Spectral Fitting). These templates are: an AGN accretion-disk component (DSK), an average interstellar radiation field (STR), and up to three single stellar population (SSP) templates from the SB99 library to account for recent star formation (2, 10 and 100Myr age starbursts). These components are enough to characterize the spectral shapes of the vast majority of sources in the near-IR, but when the wavelength range to be fitted extends well below rest-frame ~1 micron (likely the case for high redshift sources observed with NIRSpec/IFU in the shortest wavelength gratings: G140X or G235X), they may not be sufficient to capture the complexity of the continuum below the emission lines in the spectrum, potentially leading to very poor fits in the rest-frame optical and UV.

(3) Can I fit multiple emission line components to each line?

CAFE can fit up to two Gaussian components to a given emission line. In particular, the user can set up specific emission lines to be fitted with a narrow and a broad component. To assign a broad component to a line, the user needs to edit the lines.H.recombination_***.txt, lines.atomic_***.txt or lines.molecular_***.txt files contained in the CAFE/inp_parfiles/ folder and set the value of the DOUBLE (last) column to 1. Then, the user can set the fit constraints in the [PAH & LINE OPTIONS] section in the .ini file (see Spectral Fitting). The narrow and broad components are controlled by the _N’ and _B keywords, respectively. Please note that while the parameters (Peak, Gamma/width and Wavelength) of each component are fitted independently for each line, the constraints (i.e., whether to vary/fit them, and if so, by how much they are allowed to shift from the initial value) apply to all lines equally.

(4) Can I add and fit photometric points together with my spectrum?

Yes, photometric data can be included as part of the fit in order to better constrain the SED of the source at wavelengths beyond those covered by the spectral data. The photometry is ingested from a table that needs to contain the following columns: (1) name of the filter, (2) central wavelength (in [um]), (3) flux density (in [Jy]), (4) flux density uncertainty, and (5) width of the filter (in [um]); (header/title/comment lines must be preceded by a #). If the width of the filter is unknown it should be set to a value of 0.0, in which case the spectrum will not be convolved with the filter bandpass width but instead will be evaluated monochromatically. The photometric data is imported via the cafe.read_phot() command, similar to how a spectrum is ingested, if it is read from a simple .dat or .txt file. In addition to the data, the user needs to use the photometry_opt.cafe file instead of the default_opt.cafe as the options cafe file, within the opt_parfiles/ folder. Note however, that CAFE assumes all data are aperture-matched, including additional long-wavelength photometric points that are typically derived from measurements with increasingly large beams. It is the responsibility of the user to properly match all the photometric data to themselves and to the JWST spectra being fit, to obtain accurate results with CAFE over a broad wavelength range.