-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyypars.py
More file actions
executable file
·46 lines (44 loc) · 1.84 KB
/
yypars.py
File metadata and controls
executable file
·46 lines (44 loc) · 1.84 KB
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
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
pyplot.ioff()
import q2
def main(Star):
sp = q2.yypars.SolvePars(key_parameter_known='logg')
sp.smooth_window_len_logl = 5
sp.smooth_window_len_mv = 11
sp.smooth_window_len_r = 7
pp = q2.yypars.PlotPars()
pp.directory = Star.directory
q2.yypars.solve_one(Star, sp, pp)
print(Star.name)
print("-"*len(Star.name))
print("Age (Gyr) = {0:.1f} [{1:.1f} - {2:.1f}] [{3:.1f} - {4:.1f}]".
format(Star.yyage["most_probable"],
Star.yyage["lower_limit_1sigma"],
Star.yyage["upper_limit_1sigma"],
Star.yyage["lower_limit_2sigma"],
Star.yyage["upper_limit_2sigma"])
)
print("Mass (Msun) = {0:.2f} [{1:.2f} - {2:.2f}] [{3:.2f} - {4:.2f}]".
format(Star.yymass["most_probable"],
Star.yymass["lower_limit_1sigma"],
Star.yymass["upper_limit_1sigma"],
Star.yymass["lower_limit_2sigma"],
Star.yymass["upper_limit_2sigma"])
)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(
description='Uses Y2 isochrones to derive stellar parameters')
parser.add_argument('name', help='The name of the star')
parser.add_argument('teff', help='effective temperature (K)', type=int)
parser.add_argument('err_teff', help='error', type=int)
parser.add_argument('logg', help='surface gravity [cgs]', type=float)
parser.add_argument('err_logg', help='error', type=float)
parser.add_argument('feh', help='iron abundance', type=float)
parser.add_argument('err_feh', help='error', type=float)
parser.add_argument('-d', '--directory', default='',
help='where figures are saved')
main(parser.parse_args())