Modules¶
Spectral Components¶
Component Base¶
-
class
spamm.components.ComponentBase.Component¶ Description of Component class here.
This class is abstract; use (or create) subclasses of this class. Functionality that is common to all subclasses should be implemented here.
-
property
fast_interp¶ Determines if fast interpolation should be used instead of rebin_spec
-
grid_spacing()¶ Return the spacing of the wavelength grid in Ångstroms. Does not support variable grid spacing.
-
abstract
initial_values(spectrum=None)¶ Return type must be a list (not an np.array.
-
initialize(data_spectrum=None)¶
-
abstract
ln_priors(params)¶ Return a list of the ln of all of the priors.
@param params
-
native_wavelength_grid()¶ Returns the wavelength grid native to this component.
This needs to be overridden by subclasses.
-
property
parameter_count¶ Returns the number of parameters of this component.
-
parameter_index(parameter_name)¶
-
property
Balmer Continuum¶
-
class
spamm.components.BalmerContinuumCombined.BalmerCombined(pars=None, BalmerContinuum=False, BalmerPseudocContinuum=False)¶ Model of the combined BalmerContinuum (BC) based on Grandi et al. (1982) and Kovacevic & Popovic (2014).It contains two components: an analytical function to describe optically thick clouds with a uniform temperature for wavelength <3646A and the sum of higher order Balmer lines which merge into a pseudo-continuum for wavelength >=3646A. The resulting flux is therefore given by the combination of these two components, here BC_flux + BpC_flux. When initialising set which components to use
-
BC_flux(spectrum=None, parameters=None)¶ Analytic model of the BalmerContinuum (BC) based on Grandi et al. (1982) and Kovacevic & Popovic (2013).
F(lambda) = F(3646 A) * B(T_e) * (1 - e^-tau(lambda)) tau(lambda) = tau(3646) * (lambda/3646)^3
This component has 5 parameters:
parameter1 : The flux normalization at the Balmer Edge lambda = 3646 A, F(3646) parameter2 : The electron temperture T_e for the Planck function B(T_e) parameter3 : The optical depth at the Balmer edge, tau(3646) parameter4 : A shift of the line centroids parameter5 : The width of the Gaussians
note that all constants, and the units, are absorbed in the parameter F(3646 A). To impliment this appropriately, the planck function is normalized at 3646 A, so that F(3646) actually represents the flux at this wavelength.
priors: p1 : Flat between 0 and the measured flux at 3466 A. p2 : Flat between 5 000 and 20 000 Kelvin p3 : Flat between 0.1 and 2.0 p4 : Determined from Hbeta, if applicable. p5 : Determined from Hbeta, if applicable.
-
BpC_flux(spectrum=None, parameters=None)¶ Analytic model of the high-order Balmer lines, making up the Pseudo continuum near 3666 A.
Line profiles are Gaussians (for now). The line ratios are fixed to Storey &^ Hummer 1995, case B, n_e = 10^10 cm^-3. This component has 3 parameters:
parameter1 : The flux normalization near the Balmer Edge lambda = 3666 A, F(3666) parameter4 : A shift of the line centroids parameter5 : The width of the Gaussians parameter6 : The log of the electron density
note that all constants, and the units, are absorbed in the parameter F(3656 A).
priors: p1 : Flat, between 0 and the observed flux F(3656). p4 : Determined from Hbeta, if applicable. p5 : Determined from Hbeta, if applicable. p6 : Flat between 2 and 14.
note that all constants, and the units, are absorbed in the parameter F(3656 A).
-
balmer_ratio(n_e, line_orders, T)¶ Calculate the ratio between Balmer lines. (Intensity values from Storey and Hammer 1`995 results and Kovacevic et al 2014)
- Parameters
n_e (float) – Electron density.
() (T) – Electron Temperature
lines (int array) – array of lines to include.
- Returns
Ratio of Balmer lines, with Htheta (N=10 -> N=2) first.
- Return type
array (array)
-
balmerseries(line_orders)¶ Calculate a Balmer series line wavelength [Angstroms]
- Parameters
line_orders (int or array of ints) – Quantum number of the electron.
- Returns
Wavelength of the transition from n=n to n=2.
- Return type
float (float)
-
flux(spectrum=None, parameters=None)¶ Returns the flux for this component for a given wavelength grid and parameters.
-
initial_values(spectrum=None)¶ Needs to sample from prior distribution. These are the first guess for the parameters to be fit for in emcee, unless specified elsewhere.
-
ln_priors(params)¶ Return a list of the ln of all of the priors.
@param params
-
log_conv(wavelength, orig_flux, width_lines)¶ Perform convolution in log space.
- Parameters
() (width_lines) – wavelength of original spectrum
() – Flux of spectrum before convolution
() – width of the lines wanted in v/c
- Returns
- Return type
array (array)
-
makelines(sp_wavel, T, n_e, shift, width)¶ - Parameters
sp_wavel (array) – Wavelengths at which to evaluate the line fluxes.
T (int or float) – Electron temperature.
n_e (float) – Electron density.
shift (int or float) – Offset from expected Balmer wavelengths.
width (int or float) – Width of emission line.
-
Broad Lines¶
Iron Forest¶
Host Galaxy¶
Nuclear Continuum¶
-
class
spamm.components.NuclearContinuumComponent.NuclearContinuumComponent(pars=None, broken=None)¶ AGN Continuum Component
$ F_{lambda,{ m PL}}=F_{ m PL,0}
left(
rac{lambda}{lambda_0} ight)^{lpha} $
- This component has two parameters:
normalization :
$ F_{ m PL,0} $
slope :
$ lpha $
- Attributes:
broken_powerlaw (Bool): True if a broken power law should be used. model_parameter_names (list): List of model parameter names,
e.g. slope1, wave_break
name (str): Name of component, i.e. “Nuclear” norm_min (): norm_max (): slope_min (): slope_max (): wave_break_min (): wave_break_max ():
-
flux(spectrum, parameters=None)¶ Compute the flux for this component for a given wavelength grid and parameters. Use the initial parameters if none are specified.
- Parameters
spectrum (Spectrum object) –
?
() (parameters) –
?
- Returns
Flux of the componenet.
- Return type
flux ()
-
initial_values(spectrum)¶ Needs to sample from prior distribution. Return type must be a list (not an np.array).
Called by emcee.
- Parameters
spectrum (Spectrum object) –
?
- Returns
slope_init (array):
- Return type
norm_init (array)
-
property
is_analytic¶ Method that stores whether component is analytic or not
- Returns
True if componenet is analytic.
- Return type
Bool (Bool)
-
ln_priors(params)¶ Return a list of the ln of all of the priors.
# norm: Uniform linear prior between 0 and the maximum of the # spectral flux after computing running median. # slope: Uniform linear prior in range [-3,3]??
- Args:
params (): ?
- Returns:
ln_priors (list): ln of all the priors.