-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfulltable_cs.py
More file actions
55 lines (47 loc) · 4.45 KB
/
fulltable_cs.py
File metadata and controls
55 lines (47 loc) · 4.45 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
#!/usr/bin/python3
#
############################# PROGRAM DESCRIPTION #####################################
#
# Create a big astropy table and a dictionary for all the stars from all the detectors.
#
############################# BLOCK IMPORTS AND STUFF #################################
import numpy as np
from glob import glob
from astropy.table import Table
import gc
#######################################################################################
myd = glob("C*.erawh5")
myd.sort()
print (myd)
ddict = {}
names = []; datas = []
for i in myd:
name = i
names.append(name)
print (i)
data = Table.read(i)
datas.append(data)
for eachname in names:
print (eachname)
ddict['%02s' % (eachname)] = {}
for ind,eachdata in enumerate(datas):
ddict[names[ind]]['data'] = eachdata
gc.collect()
def increment(basla,bitis,i, incr, to):
m = (to["Jerr"] < 0.2) & (to["Kerr"] < 0.2) & (to["Sharp"] < 1.0) & (to["Sharp"] > -1.0) & (to["CS"] < i+incr) & (to["CS"] > i)
print (i, "m", i+incr)
x = to["J"]; y = to["K"]; c = to["CS"]
return x[m], y[m], c[m]
l = []; b=[]; j=[]; je=[]; k=[]; ke=[]; sh=[]; ch=[]; cs=[]
for i in (sorted(ddict.keys())):
print(i)
l.extend(ddict[i]['data']["L"])
b.extend(ddict[i]['data']["B"])
j.extend(ddict[i]['data']["J"])
je.extend(ddict[i]['data']["Jerr"])
k.extend(ddict[i]['data']["K"])
ke.extend(ddict[i]['data']["Kerr"])
sh.extend(ddict[i]['data']["Sharp"])
ch.extend(ddict[i]['data']["Chi"])
cs.extend(ddict[i]['data']["CS"])
to = Table([l,b,j,je,k,ke,sh,ch, cs], names=["l","b","j","je","k","ke","sh","ch","cs"])