-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
126 lines (110 loc) · 3.2 KB
/
Copy pathplot.py
File metadata and controls
126 lines (110 loc) · 3.2 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#This is a tool to plot files directly from a light curve file (binned or unbinned)
#Edited by: Eddie Solares
#Version 1.5
import numpy as np
import matplotlib.pyplot as plt
import sys
print("Welcome to the plot generator 1.5.")
print("""
1 - Flux vs Time (PL2 method)
2 - Flux vs Time (flux method)
3 - EFlux vs Time
4 - Index vs Time
5 - TS vs Time
""")
choice = input("Please choose one of the five: ")
file_name = raw_input('\nEnter the lightcurve text file directory: ')
file_title = raw_input('Enter the desired title: ')
for i in range(0, len(g)):
time = ((float(g[i].split()[0])+float(g[i].split()[1]))/2)
terr = ((float(g[i].split()[1])-float(g[i].split()[0]))/2)
if choice == 1:
f = open(file_name,'r')
g = f.readlines()
tavg = list()
flux = list()
errflux = list()
errtime = list()
for i in range(0, len(g)):
tavg.append(time)
flux.append(float(g[i].split()[4]))
errflux.append(float(g[i].split()[5]))
errtime.append(terr)
plt.errorbar(tavg, flux, xerr=errtime, yerr=errflux, fmt='s')
plt.xlabel("Time in "+t_param)
plt.ylabel("Flux >0.1 GeV (ph cm^-2 s^-1)")
plt.title(file_title)
plt.axis
plt.show()
elif choice == 2:
f = open(file_name,'r')
g = f.readlines()
tavg = list()
flux = list()
errflux = list()
errtime = list()
for i in range(0, len(g)):
tavg.append(time)
flux.append(float(g[i].split()[6]))
errflux.append(float(g[i].split()[7]))
errtime.append(terr)
plt.errorbar(tavg, flux, xerr=errtime, yerr=errflux, fmt='s')
plt.xlabel("Time in "+t_param)
plt.ylabel("Flux >0.1 GeV (ph cm^-2 s^-1)")
plt.title(file_title)
plt.axis
plt.show()
elif choice == 3:
f = open(file_name,'r')
g = f.readlines()
tavg = list()
eflux = list()
eerrflux = list()
errtime = list()
for i in range(0, len(g)):
tavg.append(time)
eflux.append(float(g[i].split()[8]))
eerrflux.append(float(g[i].split()[9]))
errtime.append(terr)
plt.errorbar(tavg, eflux, xerr=errtime, yerr=eerrflux, fmt='s')
plt.xlabel("Time in "+t_param)
plt.ylabel("Energy Flux >0.1 GeV (MeV cm^-2 s^-1)")
plt.title(file_title)
plt.axis
plt.show()
elif choice == 4:
f = open(file_name,'r')
g = f.readlines()
tavg = list()
index = list()
errindex = list()
errtime = list()
for i in range(0, len(g)):
tavg.append(time)
index.append(float(g[i].split()[10]))
errindex.append(float(g[i].split()[11]))
errtime.append(terr)
plt.errorbar(tavg, energy, xerr=errtime, yerr=errenergy, fmt='s')
plt.xlabel("Time in "+t_param)
plt.ylabel("Photon Index")
plt.title(file_title)
plt.axis
plt.show()
elif choice == 5:
f = open(file_name,'r')
g = f.readlines()
tavg = list()
ts = list()
errtime = list()
for i in range(0, len(g)):
tavg.append(time)
ts.append(float(g[i].split()[12]))
errtime.append(terr)
plt.errorbar(tavg, ts, xerr=errtime, fmt='s')
plt.xlabel("Time in "+t_param)
plt.ylabel("Test Statistic")
plt.title(file_title)
plt.axis
plt.show()
else:
print("\nNot a valid plot choice, exiting now.")