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

Class SED

source code

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. Typically, the units of SEDs are 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.0000001, ageGyr=None, renormalise=False, label=None) 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
 
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
 
renormalise(self, minWavelength='min', maxWavelength='max')
Normalises the SED such that the area under the specified wavelength range is equal to 1.
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
 
calcFlux(self, passband)
Calculates relative flux in the given passband.
source code
float
calcAbsMag(self, passband, magType="Vega")
Calculates the relative absolute magnitude in the given passband.
source code
float
calcAppMag(self, passband, magType="Vega")
Calculates the relative apparent magnitude in the given passband.
source code
float
calcColour(self, passband1, passband2, magType="Vega")
Calculates the colour passband1-passband2.
source code
Method Details [hide private]

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

smooth(self, smoothPix)

source code 

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

Parameters:
  • smoothPix (int)

redshift(self, z)

source code 

Redshifts the SED to redshift z.

Parameters:
  • z (float) - redshift

renormalise(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

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 (astSED.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 relative flux in the given passband.

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

calcAbsMag(self, passband, magType="Vega")

source code 

Calculates the relative absolute magnitude in the given passband. By 'relative', we mean that we calculate -2.5*log10*flux, relative to either the Vega or AB magnitude systems; i.e. we do not assume the flux is coming from an object 10 pc away (as would be the case for a true absolute magnitude), as calculated magnitudes need to be normalised to observations in any case for them to be meaningful.

Parameters:
  • passband (astSED.Passband object) - filter passband through which to calculate the magnitude from the SED
  • magType (string) - either "Vega" or "AB"
Returns: float
relative absolute magnitude on the specified magnitude system

calcAppMag(self, passband, magType="Vega")

source code 

Calculates the relative apparent magnitude in the given passband. By 'relative', we mean that we calculate the apparent mag as 5.0*log10*(dl*1e5)-2.5*log10*flux, where flux is relative to either the Vega or AB systems, and dl is the luminosity distance in Mpc at the redshift of the SED. Calculated magnitudes need to be normalised to observations to make them physically meaningful.

Parameters:
  • passband (astSED.Passband object) - filter passband through which to calculate the magnitude from the SED
  • magType (string) - either "Vega" or "AB"
Returns: float
relative absolute magnitude on the specified magnitude system

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

source code 

Calculates the colour passband1-passband2.

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