-
Notifications
You must be signed in to change notification settings - Fork 0
/
measure.py
48 lines (41 loc) · 1.53 KB
/
measure.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
import numpy as np
import pickle as pic
regnames = ["5053","5215","5654","6405","6449"]
for regname in regnames:
region = __import__(regname)
spec1 = region.qu1
lines1 = region.qu1lines
res = {}
for i,line in enumerate(lines1):
name ="{}_{}".format(line.name.split()[0],int(line.cent*10))
try:
res[name] = line.measure(spec1)
except Exception as err:
print("Line {} failed to measure:".format(name))
print(err)
np.savez_compressed("bin/{}_qu1".format(regname),**res)
pic.dump(lines1,open("bin/{}_qu1.lin".format(regname),"wb"))
spec2 = region.qu2
lines2 = region.qu2lines
res = {}
for i,line in enumerate(lines2):
name ="{}_{}".format(line.name.split()[0],int(line.cent*10))
try:
res[name] = line.measure(spec2)
except Exception as err:
print("Line {} failed to measure:".format(name))
print(err)
np.savez_compressed("bin/{}_qu2".format(regname),**res)
pic.dump(lines2,open("bin/{}_qu2.lin".format(regname),"wb"))
spec3 = region.spt
lines3 = region.sptlines
res = {}
for i,line in enumerate(lines3):
name ="{}_{}".format(line.name.split()[0],int(line.cent*10))
try:
res[name] = line.measure(spec3)
except Exception as err:
print("Line {} failed to measure:".format(name))
print(err)
np.savez_compressed("bin/{}_spt".format(regname),**res)
pic.dump(lines3,open("bin/{}_spt.lin".format(regname),"wb"))