Package ivs :: Package spectra :: Module lsd
[hide private]
[frames] | no frames]

Module lsd

source code

Compute Least-Square-Deconvolutions of spectra.

Section 1. Single stars

Section 1.1 Without Tikhonov regularization

Generate some spectra of a single star:

>>> velos,V,S,masks = __generate_test_spectra(1,binary=False,noise=0.01)

Compute the LSD profiles in certain radial velocity range:

>>> rvs = np.linspace(-10,10,100)
>>> Z,cc = lsd(velos,V,S,rvs,masks)

Plot both the input spectrum and the LSD and CCF profiles:

>>> p = pl.figure()
>>> p = pl.subplot(121)
>>> p = pl.plot(velos,V[:,0],'k-',label='Observation')
>>> p = pl.vlines(masks[0][0],1,1-np.array(masks[0][1]),color='r',label='Mask')
>>> p = pl.legend(loc='best')
>>> p = pl.subplot(122)
>>> p = pl.plot(rvs,Z[0][0],'k-',label='LSD')
>>> p = pl.plot(rvs,cc[0][0],'r-',label='CCF')
>>> p = pl.legend(loc='best')

]]include figure]]ivs_spectra_lsd01.png]

Section 1.2 With Tikhonov regularization

Do the same as above, but for more noise and different Tikhonov regularizations.

>>> velos,V,S,masks = __generate_test_spectra(1,binary=False,noise=0.1)
>>> rvs = np.linspace(-10,10,100)
>>> lambdas = [0.,0.1,0.5,1.0]
>>> output = [lsd(velos,V,S,rvs,masks,Lambda=lam) for lam in lambdas]

We plot both the input spectrum and the LSD and CCF profiles:

>>> p = pl.figure()
>>> p = pl.subplot(121)
>>> p = pl.plot(velos,V[:,0],'k-',label='Observation')
>>> p = pl.vlines(masks[0][0],1,1-np.array(masks[0][1]),color='r',label='Mask')
>>> p = pl.legend(loc='best')
>>> p = pl.subplot(122)
>>> for lam,(Z,cc) in zip(lambdas,output):
...     p = pl.plot(rvs,Z[0][0],'-',label='$\Lambda$=%.1f'%(lam),lw=2)
>>> p = pl.legend(loc='best')

]]include figure]]ivs_spectra_lsd02.png]

Section 2. Binary stars

Generate some spectra of a binary star:

>>> velos,V,S,masks = __generate_test_spectra(1,binary=True,noise=0.01)

Compute the LSD profiles in certain radial velocity range, first using only one line mask, then both:

>>> rvs = np.linspace(-10,10,100)
>>> Z1,cc1 = lsd(velos,V,S,rvs,masks[:1])
>>> Z2,cc2 = lsd(velos,V,S,rvs,masks)

Plot both the spectrum and the LSD and CCF profiles. Note that the CCF in the binary case is exactly the same as in the single star case (see implementation). First, we plot the LSD profile under the assumption of a single star. Second, we plot the LSD profile when taking binarity into account.

>>> p = pl.figure()
>>> p = pl.subplot(121)
>>> p = pl.plot(velos,V[:,0],'k-',label='Observation')
>>> p = pl.vlines(masks[0][0],1,1-np.array(masks[0][1]),color='r',label='Mask 1',lw=2)
>>> p = pl.legend(loc='lower right')
>>> p = pl.subplot(122)
>>> p = pl.plot(rvs,Z1[0][0],'k-',label='LSD 1')
>>> p = pl.plot(rvs,cc1[0][0],'r-',label='CCF 1')
>>> p = pl.legend(loc='best')

]]include figure]]ivs_spectra_lsd03.png]

>>> p = pl.figure()
>>> p = pl.subplot(121)
>>> p = pl.plot(velos,V[:,0],'k-',label='Observation')
>>> p = pl.vlines(masks[0][0],1,1-np.array(masks[0][1]),color='r',label='Mask 1',lw=2)
>>> p = pl.vlines(masks[1][0],1,1-np.array(masks[1][1]),color='b',label='Mask 2',lw=2)
>>> p = pl.legend(loc='lower right')
>>> p = pl.subplot(122)
>>> p = pl.plot(rvs,Z2[0][0],'r-',label='LSD 1',lw=2)
>>> p = pl.plot(rvs,Z2[0][1],'b-',label='LSD 2',lw=2)
>>> p = pl.legend(loc='best')

]]include figure]]ivs_spectra_lsd04.png]

Functions [hide private]
2D array, 2D array
lsd(velos, V, S, rvs, masks, Lambda=0.)
Compute LSD profiles and cross correlation functions.
source code
 
__generate_test_spectra(Nspec, binary=False, noise=0.01) source code
Function Details [hide private]

lsd(velos, V, S, rvs, masks, Lambda=0.)

source code 

Compute LSD profiles and cross correlation functions.

Possibility to include Tikhonov regularization to clean up the profiles, when setting Lambda>0.

Possibility to include multiprofile LSD. Parameter masks should be a list of (centers,weights) (if you give only one mask, give masks=[(centers,weights)].

See Donati, 1997 for the original paper and Kochukhov, 2010 for extensions.

Parameters:
  • velos (array of length N_spec) - velocity vector of observations
  • V (N_obs x N_spec array) - observation array
  • S (array of length N_spec) - weights of individual pixels
  • rvs (array of length N_rv) - radial velocity vector to compute the profile on
  • Lambda (float) - Tikhonov regularization parameter
  • masks (list (length N_mask) of tuples of 1D arrays) - list of tuples (center velocities, weights)
Returns: 2D array, 2D array
LSD profile, CCF of shape (N_obs x (N_rv.N_mask))