Package astLib :: Module astSED :: Class SED
[hide private]
[frames] | no frames]

Class SED

source code

Known Subclasses:

This class describes a Spectral Energy Distribution (SED).

To create a SED object, lists (or numpy arrays) of wavelength and relative flux must be provided. The SED can optionally be redshifted. The wavelength units of SEDs are assumed to be Angstroms - flux calculations using Passband and SED objects specified with different wavelength units will be incorrect.

The StellarPopulation class (and derivatives) can be used to extract SEDs for specified ages from e.g. the Bruzual & Charlot 2003 or Maraston 2005 models.

Instance Methods [hide private]
 
__init__(self, wavelength=[], flux=[], z=0.0, ageGyr=None, normalise=False, label=None) source code
SED object
copy(self)
Copies the SED, returning a new SED object
source code
 
loadFromFile(self, fileName)
Loads SED from a white space delimited file in the format wavelength, flux.
source code
 
writeToFile(self, fileName)
Writes SED to a white space delimited file in the format wavelength, flux.
source code
list
asList(self)
Returns a two dimensional list of [wavelength, flux], suitable for plotting by gnuplot.
source code
 
plot(self, xmin='min', xmax='max')
Produces a simple (wavelength, flux) plot of the SED.
source code
float
integrate(self, wavelengthMin='min', wavelengthMax='max')
Calculates flux in SED within given wavelength range.
source code
 
smooth(self, smoothPix)
Smooths SED.flux with a uniform (boxcar) filter of width smoothPix.
source code
 
redshift(self, z)
Redshifts the SED to redshift z.
source code
 
normalise(self, minWavelength='min', maxWavelength='max')
Normalises the SED such that the area under the specified wavelength range is equal to 1.
source code
 
normaliseToMag(self, ABMag, passband)
Normalises the SED to match the flux equivalent to the given AB magnitude in the given passband.
source code
 
matchFlux(self, matchSED, minWavelength, maxWavelength)
Matches the flux in the wavelength range given by minWavelength, maxWavelength to the flux in the same region in matchSED.
source code
float
calcFlux(self, passband)
Calculates flux in the given passband.
source code
float
calcMag(self, passband, addDistanceModulus=True, magType='Vega')
Calculates magnitude in the given passband.
source code
float
calcColour(self, passband1, passband2, magType='Vega')
Calculates the colour passband1-passband2.
source code
 
getSEDDict(self, passbands)
This is a convenience function for pulling out fluxes from a SED for a given set of passbands in the same format as made by mags2SEDDict - designed to make fitting code simpler.
source code
 
extinctionCalzetti(self, EBMinusV)
Applies the Calzetti et al.
source code
Method Details [hide private]

copy(self)

source code 

Copies the SED, returning a new SED object

Returns: SED object
SED

loadFromFile(self, fileName)

source code 

Loads SED from a white space delimited file in the format wavelength, flux. Lines beginning with # are ignored.

Parameters:
  • fileName (string) - path to file containing wavelength, flux data

writeToFile(self, fileName)

source code 

Writes SED to a white space delimited file in the format wavelength, flux.

Parameters:
  • fileName (string) - path to file

asList(self)

source code 

Returns a two dimensional list of [wavelength, flux], suitable for plotting by gnuplot.

Returns: list
list in format [wavelength, flux]

plot(self, xmin='min', xmax='max')

source code 

Produces a simple (wavelength, flux) plot of the SED.

Parameters:
  • xmin (float or 'min') - minimum of the wavelength range of the plot
  • xmax (float or 'max') - maximum of the wavelength range of the plot

integrate(self, wavelengthMin='min', wavelengthMax='max')

source code 

Calculates flux in SED within given wavelength range.

Parameters:
  • wavelengthMin (float or 'min') - minimum of the wavelength range
  • wavelengthMax (float or 'max') - maximum of the wavelength range
Returns: float
relative flux

smooth(self, smoothPix)

source code 

Smooths SED.flux with a uniform (boxcar) filter of width smoothPix. Cannot be undone.

Parameters:
  • smoothPix (int) - size of uniform filter applied to SED, in pixels

redshift(self, z)

source code 

Redshifts the SED to redshift z.

Parameters:
  • z (float) - redshift

normalise(self, minWavelength='min', maxWavelength='max')

source code 

Normalises the SED such that the area under the specified wavelength range is equal to 1.

Parameters:
  • minWavelength (float or 'min') - minimum wavelength of range over which to normalise SED
  • maxWavelength (float or 'max') - maximum wavelength of range over which to normalise SED

normaliseToMag(self, ABMag, passband)

source code 

Normalises the SED to match the flux equivalent to the given AB magnitude in the given passband.

Parameters:
  • ABMag (float) - AB magnitude to which the SED is to be normalised at the given passband
  • passband (an Passband object) - passband at which normalisation to AB magnitude is calculated

matchFlux(self, matchSED, minWavelength, maxWavelength)

source code 

Matches the flux in the wavelength range given by minWavelength, maxWavelength to the flux in the same region in matchSED. Useful for plotting purposes.

Parameters:
  • matchSED (SED object) - SED to match flux to
  • minWavelength (float) - minimum of range in which to match flux of current SED to matchSED
  • maxWavelength (float) - maximum of range in which to match flux of current SED to matchSED

calcFlux(self, passband)

source code 

Calculates flux in the given passband.

Parameters:
  • passband (Passband object) - filter passband through which to calculate the flux from the SED
Returns: float
flux

calcMag(self, passband, addDistanceModulus=True, magType='Vega')

source code 

Calculates magnitude in the given passband. If addDistanceModulus == True, then the distance modulus (5.0*log10*(dl*1e5), where dl is the luminosity distance in Mpc at the redshift of the SED) is added.

Parameters:
  • passband (Passband object) - filter passband through which to calculate the magnitude from the SED
  • addDistanceModulus (bool) - if True, adds 5.0*log10*(dl*1e5) to the mag returned, where dl is the luminosity distance (Mpc) corresponding to the SED z
  • magType (string) - either "Vega" or "AB"
Returns: float
magnitude through the given passband on the specified magnitude system

calcColour(self, passband1, passband2, magType='Vega')

source code 

Calculates the colour passband1-passband2.

Parameters:
  • passband1 (Passband object) - filter passband through which to calculate the first magnitude
  • passband1 (Passband object) - filter passband through which to calculate the second magnitude
  • magType (string) - either "Vega" or "AB"
  • passband2 (Passband object)
Returns: float
colour defined by passband1 - passband2 on the specified magnitude system

getSEDDict(self, passbands)

source code 

This is a convenience function for pulling out fluxes from a SED for a given set of passbands in the same format as made by mags2SEDDict - designed to make fitting code simpler.

Parameters:
  • passbands (list of Passband objects) - list of passbands through which fluxes will be calculated

extinctionCalzetti(self, EBMinusV)

source code 

Applies the Calzetti et al. 2000 (ApJ, 533, 682) extinction law to the SED with the given E(B-V) amount of extinction. R_v' = 4.05 is assumed (see equation (5) of Calzetti et al.).

Parameters:
  • EBMinusV (float) - extinction E(B-V), in magnitudes