Created
June 2, 2020 06:32
-
-
Save iphysresearch/6a24344e49297eab15ca02ada9e294f6 to your computer and use it in GitHub Desktop.
Chapter 4 - Mass distribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set(context='paper', | |
style='ticks', | |
font_scale=1, | |
rc={'figure.figsize': (8, 5), | |
'figure.dpi': 100, # need fixed | |
'xtick.direction': 'in', | |
'ytick.direction': 'in', | |
'axes.linewidth': '1.3', | |
'axes.labelsize': 12, | |
'xtick.labelsize': 12, | |
'ytick.labelsize': 12, | |
'savefig.dpi': 300, | |
'legend.fontsize': 10, | |
# 'text.usetex':True, | |
}) | |
# 链接:https://pan.baidu.com/s/1D-Djfo0ve81lRJ3jUpwhKg 密码:wo9r | |
para_train = pd.DataFrame(np.load('./GWaveform/data_T2_fs8192_1.81.8_keys_train.npy'),columns=['train']) | |
para_train_m1 = para_train.train.map(lambda x: x.split('|')).map(lambda x: float(x[0]) ).values | |
para_train_m2 = para_train.train.map(lambda x: x.split('|')).map(lambda x: float(x[1]) ).values | |
para_test = pd.DataFrame(np.load('./GWaveform/data_T2_fs8192_1.81.8_keys_test.npy'),columns=['test']) | |
para_test_m1 = para_test.test.map(lambda x: x.split('|')).map(lambda x: float(x[0]) ).values | |
para_test_m2 = para_test.test.map(lambda x: x.split('|')).map(lambda x: float(x[1]) ).values | |
plt.figure(figsize=(8,5), dpi=100) | |
plt.scatter(para_train_m1, para_train_m2, s=4, marker='.', label = 'Training data') | |
plt.scatter(para_test_m1, para_test_m2, s=4,marker=',', label = 'Testing data') | |
plt.plot([0,80], [0,80], 'k--') | |
plt.xlabel('$m_1\,\,[M_\odot]$') | |
plt.ylabel('$m_2 \,\,[M_\odot]$') | |
plt.legend() | |
# plt.savefig('C4_imags/C4_distrimass.png', dpi=300, bbox_inches='tight') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment