1 """
2 Line
3 """
4
5 import numpy as np
6 import pyfits as pf
7 from math import *
8
10
11 """Represents an absorption or emission line. It is defined by its name, a wavelength, a typical width and its amplitude"""
12 - def __init__(self, name, restangst, restwidth = 25.0, height = 50.0, strength = 0, plotlinewidth=1.0):
13 self.name = name
14 self.z = 0.0
15 self.restangst = restangst
16 self.angst = restangst
17 self.restwidth = restwidth
18 self.width = restwidth
19 self.height = height
20 self.strength = strength
21 self.plotlinewidth = 1.0
22
24 """sets the redshift of the line (changes its wavelength and its width)"""
25 self.z = z
26 self.angst = self.restangst * (1 + z)
27 self.width = self.restwidth * (1 + z)
28
30 """give me a wavelength l, I return the corresponding flux for a gaussian profile"""
31
32 return self.height*np.exp(-4*log(2)*((l-self.angst)/self.width)**2)
33