Ejemplo n.º 1
0
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../')
from pyterpol.synthetic.makespectrum import SyntheticSpectrum

syspe = SyntheticSpectrum(f='temp.dat', teff=10000, logg=4.2)

# check normal output
print syspe.get_spectrum()

# choose a wave region
# this one should raise warning
wave = np.linspace(6500, 6600, 800) 
base_wave, base_intens = syspe.get_spectrum(wave)

# get a shifted spectrum
wave = np.linspace(6500, 6600, 800)
rv_wave, rv_intens =  syspe.get_spectrum(wave, rv=50)
np.savetxt('shifted.dat', np.column_stack([rv_wave, rv_intens]), fmt="%20.10e")

# get rotated spectrum
wave = np.linspace(6500, 6600, 800)
rot_wave, rot_intens =  syspe.get_spectrum(wave, vrot=10)
print rot_wave, rot_intens
np.savetxt('rotated.dat', np.column_stack([rv_wave, rv_intens]), fmt="%20.10e")


plt.plot(base_wave, base_intens, 'k-')
plt.plot(rv_wave, rv_intens, 'r-')
plt.show()
Ejemplo n.º 2
0
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../')
from pyterpol.synthetic.makespectrum import SyntheticSpectrum

syspe = SyntheticSpectrum(f='temp.dat', teff=10000, logg=4.2)

# check normal output
print syspe.get_spectrum()

# choose a wave region
# this one should raise warning
wave = np.linspace(6500, 6600, 800)
base_wave, base_intens = syspe.get_spectrum(wave)

# get a shifted spectrum
wave = np.linspace(6500, 6600, 800)
rv_wave, rv_intens = syspe.get_spectrum(wave, rv=50)
np.savetxt('shifted.dat', np.column_stack([rv_wave, rv_intens]), fmt="%20.10e")

# get rotated spectrum
wave = np.linspace(6500, 6600, 800)
rot_wave, rot_intens = syspe.get_spectrum(wave, vrot=10)
print rot_wave, rot_intens
np.savetxt('rotated.dat', np.column_stack([rv_wave, rv_intens]), fmt="%20.10e")

plt.plot(base_wave, base_intens, 'k-')
plt.plot(rv_wave, rv_intens, 'r-')
plt.show()
Ejemplo n.º 3
0
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../')
from pyterpol.synthetic.makespectrum import SyntheticSpectrum

gridSpec = 'grid.dat'

# basic gridspectrum used by interpol 
c0_wave, c0_int = np.loadtxt(gridSpec, unpack=True, usecols=[0,1])

# shifted and rotated gridspectrum
crs_wave, crs_int = np.loadtxt('output012', unpack=True, usecols=[0,1])

syspe = SyntheticSpectrum(f=gridSpec)
py0_wave, py0_int = syspe.get_spectrum()
pyrs_wave, pyrs_int = syspe.get_spectrum(rv=30, vrot=50)

# get padded spectrum
wave, intens = syspe.get_spectrum()
p_wave, p_intens = syspe.pad_continuum(wave, intens, 10)


plt.subplot(211)
plt.plot(c0_wave, c0_int, 'k-', lw=1)
plt.plot(crs_wave, crs_int, 'k-', lw=2)
plt.plot(py0_wave, py0_int+0.5, 'r-', lw=1)
plt.plot(pyrs_wave, pyrs_int+0.5, 'r-', lw=2)
plt.plot(p_wave, p_intens+0.5, 'b-')