-
Notifications
You must be signed in to change notification settings - Fork 0
/
pairplot.py
112 lines (91 loc) · 3.3 KB
/
pairplot.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import matplotlib.pyplot as plt
from astropy.table import Table
import numpy as np
import seaborn as sns
import pandas as pd
from scipy.stats import kendalltau
sns.set( )
import fnmatch
import os
import os.path
import sys
def main():
ann_metadata = pd.read_csv(sys.argv[1])
if len(sys.argv) == 3:
deltas = pd.read_csv(sys.argv[2], sep=" ") #, header=0, names=["ID","EXP_ID","RF_DELTA","KNN_DELTA","AVG_DELTA"])
'''
print ann_metadata.columns
print ""
print deltas.columns
print ""
'''
ann_metadata = pd.merge(ann_metadata, deltas, how='left', on=['EXP_ID'])
'''
ann_metadata["AVG_5K_FLUX"] = 0
path = '.'
for file in os.listdir(path):
if fnmatch.fnmatch(file, sys.argv[2]):
data = Table.read(os.path.join(path, file), format="ascii.csv")
mask = (data['ivar'] == 0)
total_flux = data['flux']+data['con_flux']
avg_5k_flux = np.average(total_flux[1518:1558], weights=data['ivar'][1518:1558])
file_split = file.split("-")
plate = file_split[0][12:]
mjd = file_split[1]
exp = file_split[2][3:]
index_val = ann_metadata[(ann_metadata["PLATE"]==int(plate)) &
(ann_metadata["MJD"]==int(mjd)) &
(ann_metadata["EXP_ID"]==int(exp))].index
ann_metadata.loc[index_val,"AVG_5K_FLUX"] = avg_5k_flux
'''
'''
del ann_metadata["TAI-END"]
del ann_metadata["TAI-BEG"]
del ann_metadata["PLATE"]
del ann_metadata["MJD"]
del ann_metadata["EXP_ID"]
'''
hue=None
if len(sys.argv) == 3:
#ann_metadata = ann_metadata[ann_metadata["AVG_5K_FLUX"]!=0]
ann_metadata = ann_metadata.dropna()
ann_metadata["RF_DELTA"] = np.sqrt(ann_metadata["RF_DELTA"])
#hue="AVG_5K_FLUX"
#print ann_metadata
'''
g = sns.pairplot(ann_metadata, vars={"LUNAR_MAGNITUDE", "LUNAR_ELV",
"LUNAR_SEP", "SOLAR_ELV", "SOLAR_SEP"}, hue=hue)
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"LUNAR_MAGNITUDE", "LUNAR_ELV",
"LUNAR_SEP"}, hue=hue)
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"SOLAR_ELV", "SOLAR_SEP", "SS_AREA", "SS_COUNT"})
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"AIRMASS", "GALACTIC_CORE_SEP",
"GALACTIC_PLANE_SEP", "AVG_5K_FLUX"})
plt.show()
plt.close()
g = sns.jointplot(ann_metadata["ALT"], ann_metadata["AIRMASS"], stat_func=kendalltau)
plt.show()
plt.close()
g = sns.jointplot(ann_metadata["ALT"], ann_metadata["LUNAR_SEP"], stat_func=kendalltau)
plt.show()
plt.close()
'''
g = sns.pairplot(ann_metadata, vars={"LUNAR_MAGNITUDE", "LUNAR_ELV", "LUNAR_SEP", "RF_DELTA"})
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"SOLAR_ELV", "SOLAR_SEP", "SS_AREA", "SS_COUNT", "RF_DELTA"})
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"AIRMASS", "GALACTIC_CORE_SEP", "GALACTIC_PLANE_SEP", "RF_DELTA"})
plt.show()
plt.close()
g = sns.pairplot(ann_metadata, vars={"RA", "DEC", "ALT", "AZ", "RF_DELTA"})
plt.show()
plt.close()
if __name__ == '__main__':
main()