place_blink_artifacts#
- pypillometry.signal.place_blink_artifacts(stretches, lengths, n=None, pad=0, seed=None)[source]#
Choose random, non-overlapping places for artifacts in clean stretches.
The stretches are filled with randomly chosen artifacts at random distances; each artifact is used about equally often.
- Parameters:
stretches (np.ndarray) – clean stretches (n x 2, end-exclusive), see
clean_stretches()lengths (sequence of int) – number of samples of each artifact
n (int, optional) – number of places; default (and at most): as many as fit
pad (int) – number of clean samples to keep free on each side of each artifact (twice as many between two artifacts)
seed (int or np.random.Generator, optional) – seed of the random numbers
- Return type:
- Returns:
int array (n x 2), sorted by position: the first sample of each place and the index of the artifact that goes there