@@ -58,18 +58,18 @@ def _find_discrete(ts, jd, f, epsilon, num):
58
58
indices = flatnonzero (diff (y ))
59
59
if not len (indices ):
60
60
# Nothing found, so immediately return empty arrays.
61
- ends = jd . take ( indices )
62
- y = y . take ( indices )
61
+ ends = jd [ indices ]
62
+ y = y [ indices ]
63
63
break
64
64
65
- starts = jd . take ( indices )
66
- ends = jd . take ( indices + 1 )
65
+ starts = jd [ indices ]
66
+ ends = jd [ indices + 1 ]
67
67
68
68
# Since we start with equal intervals, they all should fall
69
69
# below epsilon at around the same time; so for efficiency we
70
70
# only test the first pair.
71
71
if ends [0 ] - starts [0 ] <= epsilon :
72
- y = y . take ( indices + 1 )
72
+ y = y [ indices + 1 ]
73
73
# Keep only the last of several zero crossings that might
74
74
# possibly be separated by less than epsilon.
75
75
mask = concatenate (((diff (ends ) > 3.0 * epsilon ), (True ,)))
@@ -174,8 +174,8 @@ def find_maxima(start_time, end_time, f, epsilon=1.0 / DAY_S, num=12):
174
174
jd = y = y [0 :0 ]
175
175
break
176
176
177
- starts = jd . take ( left )
178
- ends = jd . take ( right )
177
+ starts = jd [ left ]
178
+ ends = jd [ right ]
179
179
180
180
jd = o (starts , start_alpha ).flatten () + o (ends , end_alpha ).flatten ()
181
181
jd = _remove_adjacent_duplicates (jd )
@@ -197,21 +197,21 @@ def _identify_maxima(x, y):
197
197
198
198
# Choose every point that is higher than the two adjacent points.
199
199
indices = flatnonzero (dsd == - 2 ) + 1
200
- peak_x = x . take ( indices )
201
- peak_y = y . take ( indices )
200
+ peak_x = x [ indices ]
201
+ peak_y = y [ indices ]
202
202
203
203
# Also choose the midpoint between the edges of a plateau, if both
204
204
# edges are in view. First we eliminate runs of zeroes, then look
205
205
# for adjacent -1 values, then map those back to the main array.
206
206
indices = flatnonzero (dsd )
207
- dsd2 = dsd . take ( indices )
207
+ dsd2 = dsd [ indices ]
208
208
minus_ones = dsd2 == - 1
209
209
plateau_indices = flatnonzero (minus_ones [:- 1 ] & minus_ones [1 :])
210
- plateau_left_indices = indices . take ( plateau_indices )
211
- plateau_right_indices = indices . take ( plateau_indices + 1 ) + 2
212
- plateau_x = x . take ( plateau_left_indices ) + x . take ( plateau_right_indices )
210
+ plateau_left_indices = indices [ plateau_indices ]
211
+ plateau_right_indices = indices [ plateau_indices + 1 ] + 2
212
+ plateau_x = x [ plateau_left_indices ] + x [ plateau_right_indices ]
213
213
plateau_x /= 2.0
214
- plateau_y = y . take ( plateau_left_indices + 1 )
214
+ plateau_y = y [ plateau_left_indices + 1 ]
215
215
216
216
x = concatenate ((peak_x , plateau_x ))
217
217
y = concatenate ((peak_y , plateau_y ))
0 commit comments