@@ -2192,7 +2192,7 @@ def update_num_components(t, sv, Ab, Cf, Yres_buf, Y_buf, rho_buf,
2192
2192
for ij in ijSig ]), dims , order = 'F' ).ravel ()
2193
2193
2194
2194
cin_circ = cin .get_ordered ()
2195
- useOASIS = False # whether to use faster OASIS for cell detection
2195
+ useOASIS = False # whether to use faster OASIS for cell detection FIXME don't hardcode things internally like this
2196
2196
accepted = True # flag indicating new component has not been rejected yet
2197
2197
2198
2198
if Ab_dense is None :
@@ -2248,18 +2248,32 @@ def update_num_components(t, sv, Ab, Cf, Yres_buf, Y_buf, rho_buf,
2248
2248
ind_new .append (ijSig )
2249
2249
2250
2250
if oases is not None :
2251
- if not useOASIS :
2251
+ if not useOASIS : # FIXME bad variable name, also hardcoded?
2252
2252
# lambda from Selesnick's 3*sigma*|K| rule
2253
2253
# use noise estimate from init batch or use std_rr?
2254
2254
# sn_ = sqrt((ain**2).dot(sn[indices]**2)) / sqrt(1 - g**2)
2255
+ # The one-liner below was too hard to read -- breaking it apart for legibility
2256
+ # (and also to make it easier to temporarily add assertions with np.isscalar and
2257
+ # unpack size-1 arrays that are no longer ok in newer versions of numpy/scipy)
2255
2258
sn_ = std_rr
2256
- oas = OASIS (np .ravel (g )[0 ], 3 * sn_ /
2257
- (sqrt (1 - g ** 2 ) if np .size (g ) == 1 else
2258
- sqrt ((1 + g [1 ]) * ((1 - g [1 ])** 2 - g [0 ]** 2 ) / (1 - g [1 ])))
2259
- if s_min == 0 else 0 ,
2260
- s_min , num_empty_samples = t +
2261
- 1 - len (cin_res ),
2262
- g2 = 0 if np .size (g ) == 1 else g [1 ])
2259
+ if np .size (sn_ ) == 1 :
2260
+ sn_ = np .ravel (std_rr )[0 ]
2261
+ else :
2262
+ logger .warning ("std_rr has more dimensionality than expected and this may lead to problems" )
2263
+ sn_ = std_rr
2264
+
2265
+ oasis_g = np .ravel (g )[0 ]
2266
+ if s_min != 0 :
2267
+ oasis_lambda = 0
2268
+ elif np .size (g ) == 1 :
2269
+ oasis_lambda = 3 * sn_ / (sqrt (1 - np .ravel (g )[0 ]** 2 ))
2270
+ else :
2271
+ oasis_lambda = 3 * sn_ / sqrt ((1 + np .ravel (g )[1 ]) * ((1 - np .ravel (g )[1 ])** 2 - np .ravel (g )[0 ]** 2 ) / (1 - np .ravel (g )[1 ]))
2272
+
2273
+ oasis_ne = t + 1 - len (cin_res )
2274
+ oasis_g2 = 0 if np .size (g ) == 1 else np .ravel (g )[1 ]
2275
+
2276
+ oas = OASIS (oasis_g , oasis_lambda , s_min , num_empty_samples = oasis_ne , g2 = oasis_g2 )
2263
2277
for yt in cin_res :
2264
2278
oas .fit_next (yt )
2265
2279
0 commit comments