Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77991267
cosmictime_plot_azt.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
Sat, Aug 17, 17:21
Size
1 KB
Mime Type
text/x-python
Expires
Mon, Aug 19, 17:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19959686
Attached To
rGEAR Gear
cosmictime_plot_azt.py
View Options
#!/usr/bin/env python
from
pNbody
import
ic
from
pNbody
import
units
from
numpy
import
*
from
PyGear
import
cosmic
import
Ptools
as
pt
import
sys
import
time
cosmic
.
InitDefaultParameters
()
# init default parameters
params
=
{}
params
[
'Omega0'
]
=
0.279
params
[
'OmegaLambda'
]
=
0.721
params
[
'OmegaBaryon'
]
=
0.046
params
[
'HubbleParam'
]
=
0.7
params
[
'BoxSize'
]
=
2000.0
cosmic
.
SetParameters
(
params
)
cosmic
.
Init
()
params
=
cosmic
.
GetParameters
()
# units
system_of_units
=
units
.
Set_SystemUnits_From_Params
(
params
)
out_units
=
units
.
UnitSystem
(
'local'
,[
units
.
Unit_cm
,
units
.
Unit_Msol
,
units
.
Unit_Gyr
,
units
.
Unit_K
])
# convert in Gyr and physical units
ft
=
system_of_units
.
convertionFactorTo
(
out_units
.
UnitTime
)
/
params
[
'HubbleParam'
]
a_s
=
arange
(
0
,
1
,
0.01
)
t_s
=
zeros
(
len
(
a_s
))
z_s
=
zeros
(
len
(
t_s
))
for
i
,
a
in
enumerate
(
a_s
):
t_s
[
i
]
=
cosmic
.
get_CosmicTime_from_a
(
a
)
*
ft
z_s
[
i
]
=
cosmic
.
get_Redshift_from_a
(
a
)
pt
.
subplot
(
2
,
1
,
1
)
pt
.
plot
(
a_s
,
t_s
)
pt
.
xlabel
(
'Scaling Factor'
)
pt
.
ylabel
(
'Cosmic Time'
)
pt
.
subplot
(
2
,
1
,
2
)
pt
.
plot
(
a_s
,
z_s
)
pt
.
xlabel
(
'Scaling Factor'
)
pt
.
ylabel
(
'Redshift'
)
pt
.
show
()
Event Timeline
Log In to Comment