-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The obvious way is to have a maximum gap parameter and then don't do the fit if the spectrum includes a gap larger than this.
Here is an algorithm to find gaps from this stack overflow query
import numpy as np
from itertools import groupby
x = np.array([10., 20., np.nan, 40., 50., np.nan, np.nan, np.nan, 10.,0.,-10.])
y = np.zeros_like(x, dtype=int)
y[np.where(np.isnan(x))] = 1 # Locate where the array is nan
z = []
for a, b in groupby(y, lambda x: x == 0):
if a: # Where the value is 0, simply append to the list
z.extend(list(b))
else: # Where the value is one, replace 1 with the number of sequential 1's
l = len(list(b))
z.extend([l]*l)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request