1
+ from amuse .units import units , constants
2
+ from amuse .io import write_set_to_file
3
+ from amuse .io import read_set_from_file
4
+ from amuse .support .console import set_printing_strategy
5
+ import numpy as np
6
+
7
+
8
+
9
+ bin_type = {
10
+ 'unknown' : 0 ,
11
+ 'merger' : 1 ,
12
+ 'disintegrated' : 2 ,
13
+ 'detached' : 3 ,
14
+ 'contact' : 4 ,
15
+ 'collision' : 5 ,
16
+ 'semisecular' : 6 ,
17
+ 'rlof' : 7 , #only used for stopping conditions
18
+ 'stable_mass_transfer' : 8 ,
19
+ 'common_envelope' : 9 ,
20
+ 'common_envelope_energy_balance' : 10 ,
21
+ 'ce_e' : 11 ,
22
+ 'ce_alpha' : 12 ,
23
+ 'common_envelope_angular_momentum_balance' : 13 ,
24
+ 'ce_J' : 14 ,
25
+ 'ce_gamma' : 15 ,
26
+ 'double_common_envelope' : 16 ,
27
+ 'dce' : 17 ,
28
+ }
29
+
30
+
31
+
32
+
33
+
34
+
35
+ def rdc (file_name_root , file_type ):
36
+ f_type = file_type
37
+ if file_type == "hdf5" :
38
+ f_type = "hdf"
39
+
40
+ file_name = file_name_root + "." + f_type
41
+ if file_name_root [- 4 :]== ".hdf" :
42
+ file_name = file_name_root
43
+
44
+ triple = read_set_from_file (file_name , file_type )
45
+ counter = list (enumerate (triple .history ))[0 ][1 ].number
46
+
47
+ for i , triple in enumerate (triple .history ):
48
+ if triple [0 ].number == counter :
49
+ counter += 1
50
+ print ('\n \n ' )
51
+
52
+ print (' ' )
53
+ print (i , triple [0 ].time , triple [0 ].number , triple [0 ].relative_inclination , triple [0 ].dynamical_instability , triple [0 ].kozai_type , triple [0 ].error_flag_secular )
54
+
55
+ print ( ' bs: ' , triple [0 ].child2 .bin_type , triple [0 ].child2 .is_stable , triple [0 ].child2 .semimajor_axis , triple [0 ].child2 .eccentricity , triple [0 ].child2 .argument_of_pericenter , triple [0 ].child2 .longitude_of_ascending_node ,)# triple[0].child2.mass_transfer_rate,
56
+ print ( '|' , triple [0 ].bin_type , triple [0 ].is_stable , triple [0 ].semimajor_axis , triple [0 ].eccentricity , triple [0 ].argument_of_pericenter , triple [0 ].longitude_of_ascending_node )#, triple[0].mass_transfer_rate
57
+ print ( ' st: ' , triple [0 ].child2 .child1 .is_donor , triple [0 ].child2 .child1 .stellar_type , triple [0 ].child2 .child1 .mass , triple [0 ].child2 .child1 .spin_angular_frequency , triple [0 ].child2 .child1 .radius , triple [0 ].child2 .child1 .core_mass ,)
58
+ print ( '|' , triple [0 ].child2 .child2 .is_donor , triple [0 ].child2 .child2 .stellar_type , triple [0 ].child2 .child2 .mass , triple [0 ].child2 .child2 .spin_angular_frequency , triple [0 ].child2 .child2 .radius ,triple [0 ].child2 .child2 .core_mass , )
59
+ print ( '|' , triple [0 ].child1 .is_donor , triple [0 ].child1 .stellar_type , triple [0 ].child1 .mass , triple [0 ].child1 .spin_angular_frequency , triple [0 ].child1 .radius , triple [0 ].child1 .core_mass )
60
+
61
+
62
+
63
+
64
+ def parse_arguments ():
65
+ from amuse .units .optparse import OptionParser
66
+ parser = OptionParser ()
67
+ parser .add_option ("-f" , dest = "file_name_root" , default = "TRES" ,
68
+ help = "file name [%default]" )
69
+ parser .add_option ("-F" , dest = "file_type" , default = "hdf5" ,
70
+ help = "file type [%default]" )
71
+
72
+
73
+ options , args = parser .parse_args ()
74
+ return options .__dict__
75
+
76
+
77
+ if __name__ == '__main__' :
78
+ options = parse_arguments ()
79
+
80
+ set_printing_strategy ("custom" ,
81
+ preferred_units = [units .MSun , units .RSun , units .Myr ],
82
+ precision = 11 , prefix = "" ,
83
+ separator = " [" , suffix = "]" )
84
+
85
+
86
+
87
+ print (' ' )
88
+ rdc (** options )
89
+
0 commit comments