/
FitBstar.py
74 lines (63 loc) · 2.22 KB
/
FitBstar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import sys
import numpy as np
import matplotlib.pyplot as plt
from astropy import units
import HelperFunctions
import s4
def main2():
vsini = 250
fname = "/Users/kgulliks/t15000g40a00p00_w300_700_r1.dat"
x, y, c = np.loadtxt(fname, usecols=(0, 1, 2), unpack=True)
import DataStructures
import Broaden
order = DataStructures.xypoint(x=x, y=y, cont=c)
order = Broaden.RotBroad(order, vsini * units.km.to(units.cm))
left = np.searchsorted(order.x, 4780)
right = np.searchsorted(order.x, 4960)
arr = order[left:right].toarray(norm=True)
syn = s4.synthesis.Synplot(15000,
4.0,
idl="/Applications/itt/idl/bin/idl",
wstart=order.x[left],
wend=order.x[right],
observ=arr,
relative=1,
vrot=vsini,
rv=83)
syn.run()
syn.plot()
plt.figure(2)
# spec = syn.spectrum
#plt.plot(spec[:,0], spec[:,1])
#plt.plot(arr[:,0], arr[:,1])
plt.show()
def main1():
fname = "HIP_77635.fits"
orders = HelperFunctions.ReadExtensionFits(fname)
for order in orders:
if order.x[0] < 492 and order.x[-1] > 492:
break
order.x *= units.nm.to(units.angstrom)
syn = s4.synthesis.Synplot(15000,
4.0,
idl="/Applications/itt/idl/bin/idl",
wstart=order.x[0],
wend=order.x[-1],
observ=order.toarray(norm=True),
relative=1,
vrot=225,
rv=-31)
syn.run()
syn.plot()
plt.show()
s4.fitting.Fit("teff", 18000, 21000, 500,
"logg", 3.5, 4.5, 0.2,
"rv", -60, -10, 10,
idl="/Applications/itt/idl/bin/idl",
wstart=order.x[0],
wend=order.x[-1],
observ=order.toarray(norm=True),
relative=1,
vrot=225)
if __name__ == "__main__":
main2()