fit_SN2

sitelle.fit.fit_SN2(source, cube, v_guess=None, v_min=-800.0, v_max=0.0, lines=None, return_fit_params=False, kwargs_spec={}, kwargs_bkg={}, debug=False)

Function specialized to fit sources found in the SN2 cube. The background spectrum is fitted as well. Can be used in a parallel process. The SNR of the spec is estimated using the stats_without_lines() method. Only the velocity of the background is estimated, as the flux is biased by an unkown amount of absorption.

Parameters:
  • source (Series) – A row from a DataFrame containing detected sources. Should have columns xpos, ypos, assumed to correspond to the SN2 pixel coordinates.
  • cube (SpectralCube) – The cube taken in SN2 filter.
  • v_guess (float) – (Optional) If None, a guess is performed using guess_source_velocity() and refine_velocity_guess()
  • v_min (float) – (Optional) v_min used by guess_source_velocity(). Default = -800
  • v_max (float) – (Optional) v_max used by guess_source_velocity(). Default = 0
  • lines (list of str) – (Optinal) Names of the lines to fit. If None, SN2_LINES are used, except if no v_guess has been found; then we assume it’s only a Hbeta line at very fast velocity.
  • return_fit_params (bool, Default = False) – (Optional) If True, returns the full parameters of the fit.
  • kwargs_spec (dict) – (Optional) Additional keyword arguments to be used by fit_spectrum() when fitting the source spectrum.
  • kwargs_bkg (dict) – (Optional) Additional keyword arguments to be used by fit_spectrum() when fitting the background spectrum.
  • debug (bool, Default = False) – (Optional) If True, the velocity guess is verbose.
Returns:

fit_res – A dict containg a lot of information about the fit.

Parameter Description
err estimated noise value on the spectra
guess_snr SNR guess
exit_status code to identify cause of crash
v_guess guessed velocity in km/s
chi2 chi2 computed on the residual
rchi2 reduced chi2 computed on the residual
ks_pvalue ks test computed on the residuals
logGBF log Gaussian Bayes Factor on the residuals
rchi2 reduced chi2 computed on the residual
broadening broadening estimation of the lines
broadening_err error on the brodeaning estimation
velocity estimated velocity
velocity_err error on the fitted velocity
flux_* flux estimation for * line, where * is the line name
flux_*_err error on the flux estimation for * line, where * is the line name
snr_* Estimated SNR of the * line
bkg_v_guess guess on the background spectrum velocity
bkg_exit_status code to identify cause of crash
bkg_velocity estimated velocity of the background spectrum
bkg_velocity_err error on the background velocity estimation

Return type:

dict

See also

fit_SN3()