-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamCalibration.py
52 lines (45 loc) · 1.91 KB
/
streamCalibration.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
import numpy as np
class StreamCalibration:
def __init__(self, dataParser):
self.svSums250 = np.zeros((2, 40, 4))
self.svSums500 = np.zeros((5, 20, 2))
self.svSums1000 = np.zeros((31, 10))
self.dataParser = dataParser
def reset(self):
self.svSums250 = np.zeros((2, 40, 4))
self.svSums500 = np.zeros((5, 20, 2))
self.svSums1000 = np.zeros((31, 10))
def addPacketToCal(self, pk, byte, ifovs):
for ifov in ifovs:
for band in range(0, 2):
for sample in range(0, 4):
for detector in range(0, 4):
row = (4 * ifov) + detector
col = sample
try:
self.svSums250[band][row][col] += byte[(ifov % 5)*83 + sample*4 + detector + band*16] # noqa
except IndexError:
pass
for band in range(0, 5):
for sample in range(0, 2):
for detector in range(0, 2):
row = (2 * ifov) + detector
col = sample
try:
self.svSums500[band][row][col] += byte[(ifov % 5)*83 + sample*2 + detector + 32 + band*4] # noqa
except IndexError:
pass
for band in range(0, 31):
if (band+7) not in self.bandlist:
continue
row = ifov
try:
self.svSums1000[band][row] += byte[(ifov % 5)*83 + 52 + band] # noqa
except IndexError:
pass
def procDCP(self, byte, groupSequence):
arr = self.dataParser.read_uint12(byte)
if groupSequence == 1:
self.addPacketToCal(arr, range(0, 5))
elif groupSequence == 2:
self.addPacketToCal(arr, range(5, 10))