-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3d.py
More file actions
36 lines (30 loc) · 1.09 KB
/
3d.py
File metadata and controls
36 lines (30 loc) · 1.09 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 11 12:11:21 2022
@author: draco
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import colors
mettalicity = np.genfromtxt("time_BHillustris1_30.dat",comments="#",usecols=(3), unpack=True,max_rows=10000)
mass1 = np.genfromtxt("time_BHillustris1_30.dat",comments="#",usecols=(6), unpack=True,max_rows=10000)
mass2 = np.genfromtxt("time_BHillustris1_30.dat",comments="#",usecols=(7), unpack=True,max_rows=10000)
tdelay = np.genfromtxt("time_BHillustris1_30.dat",comments="#",usecols=(8), unpack=True,max_rows=10000)
mtot = mass1 + mass2
mchirp = ((mass2*mass1)**(3/5))/(mtot**(1/5))
########## Plot3d #########
fig = plt.figure(figsize=plt.figaspect(0.5))
ax = fig.add_subplot(1, 1, 1, projection='3d')
X = mtot
Y = mettalicity
Z = tdelay
surf=ax.scatter(X,Y,Z,c=mchirp)
ax.set_xlabel('Total Mass (M_sun)')
ax.set_ylabel('Progenitor_s Metallicity')
ax.set_zlabel('Delay time (Gyr)')
fig.colorbar(surf, shrink=0.5, aspect=10)
plt.tight_layout()
plt.show()