Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66372156
liblifetime.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jun 10, 03:15
Size
2 KB
Mime Type
text/x-python
Expires
Wed, Jun 12, 03:15 (2 d)
Engine
blob
Format
Raw Data
Handle
18212469
Attached To
rGEAR Gear
liblifetime.py
View Options
from
numpy
import
*
def
WriteParams
(
f
):
"""
Write lifetime parameters.
For the moment, the values are simply hard coded.
:param f: file
:type f: the file handler
:returns:none
"""
f
.
write
(
"#### Livetime ####
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"-40.1107251082866 5.50992173040633 0.782431795366473
\n
"
)
f
.
write
(
" 141.929566656232 -15.88948185575660 -3.255779246324010
\n
"
)
f
.
write
(
"-261.365531429482 17.07350618651300 9.866058678313810
\n
"
)
f
.
write
(
"
\n
"
)
def
WriteH5Params
(
ParentGroup
,
model
=
"Poirier"
):
"""
Write lifetime parameters.
For the moment, the values are simply hard coded.
:param f: file
:type f: the file handler
:returns:none
"""
if
model
==
"Poirier"
:
""""
This is the default model used in the Poirier Thesis
"""
coeff_z
=
array
([
[
-
40.1107251082866
,
5.50992173040633
,
0.782431795366473
],
[
141.929566656232
,
-
15.88948185575660
,
-
3.255779246324010
],
[
-
261.365531429482
,
17.07350618651300
,
9.866058678313810
]
])
elif
model
==
"POPIII20170112"
:
"""This is a very simple model designed to extrapolate lifetime of very massive stars.
It is based on nothing else than a very simple extrapolation of the Poirier Model and
corresonds to
tau = b * (m)**a # tau in Myr, m in Msol
u_lt0 is computed for units compatibility reasons with the Poirier model
"""
SEC_PER_MEGAYEAR
=
3.155e13
UnitTime_in_s
=
148849920000000.0
UnitTime_in_Megayears0
=
UnitTime_in_s
/
SEC_PER_MEGAYEAR
;
u_lt0
=
-
log10
(
UnitTime_in_Megayears0
*
1e6
);
a
=
-
0.5
b
=
7e-4
*
1e10
/
1e6
coeff_z
=
array
([
[
0
,
0
,
0
],
[
0
,
0
,
a
],
[
0
,
0
,
log10
(
b
)
-
u_lt0
]
])
else
:
print
"no stellar lifetime model corresonds to
%s
"
%
(
model
)
print
"!!! STOP !!!"
sys
.
exit
()
print
"Lifetime model using :
%s
"
%
(
model
)
Group
=
ParentGroup
.
create_group
(
"LiveTimes"
)
Dataset
=
Group
.
create_dataset
(
"coeff_z"
,
data
=
coeff_z
)
Dataset
.
attrs
[
'nx'
]
=
coeff_z
.
shape
[
0
]
Dataset
.
attrs
[
'ny'
]
=
coeff_z
.
shape
[
1
]
Event Timeline
Log In to Comment