Commits
360 360 | - list of masking channel ranges to be *excluded* from the fit. __conver_flags_to_masklist() calls it. |
361 361 | - list of fitting channel ranges to be *included* in the fit. ___calc_baseline_param() calls it. |
362 362 | """ |
363 363 | # get indices of clump boundaries |
364 364 | idx = (mask[1:] ^ mask[:-1]).nonzero() |
365 365 | idx = (idx[0] + 1) |
366 366 | # idx now contains pairs of start-end indices, edges need handling |
367 367 | # depending on first and last mask value |
368 368 | if mask[0]: |
369 369 | if len(idx) == 0: |
370 - | return [[0, len(mask)]] |
370 + | return [[0, len(mask) - 1]] |
371 371 | r = [[0, idx[0]]] |
372 372 | if len(idx) % 2 == 1: |
373 373 | r.extend(idx[1:].reshape(-1, 2).tolist()) |
374 374 | else: |
375 375 | r.extend(idx[1:-1].reshape(-1, 2).tolist()) |
376 376 | else: |
377 377 | if len(idx) == 0: |
378 378 | return [] |
379 379 | if len(idx) % 2 == 1: |
380 380 | r = (idx[:-1].reshape(-1, 2).tolist()) |