Skip to content

Commit 91dcd30

Browse files
committed
Fixed the sleep counting algorithm, AGAIN! and finally for good
1 parent 2950298 commit 91dcd30

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pysolo_slices.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ def __CalculateSleep__(self, fly_to_calc=None, inactivity=0, use_legacy_algorith
133133
for fly in fc:
134134

135135
sf_1 = np.array([( single_flies[fly][i:i+5].sum() <= inactivity ) for i in range (d*c)])
136-
sf_2 = np.array([( single_flies[fly][i-5:i].sum() <= inactivity ) for i in range (d*c)])
136+
sf_2 = np.array([( single_flies[fly][i-1:i+4].sum() <= inactivity ) for i in range (d*c)])
137+
sf_3 = np.array([( single_flies[fly][i-2:i+3].sum() <= inactivity ) for i in range (d*c)])
138+
sf_4 = np.array([( single_flies[fly][i-3:i+2].sum() <= inactivity ) for i in range (d*c)])
139+
sf_5 = np.array([( single_flies[fly][i-4:i+1].sum() <= inactivity ) for i in range (d*c)])
137140

138-
single_flies5min[fly] = sf_1 + sf_2
141+
single_flies5min[fly] = sf_1 + sf_2 + sf_3 + sf_4 + sf_5
139142

140143
single_flies30min[fly] = [ single_flies5min[fly][i-b2:i+a2].sum() for i in range (d*c)]
141144

0 commit comments

Comments
 (0)