Pulse: fix import pairwise for python <3.10

This commit is contained in:
Eric Teunis de Boone 2023-05-15 13:41:09 +02:00
parent 208bd9a35d
commit fd636247b9
1 changed files with 11 additions and 1 deletions

View File

@ -5,10 +5,20 @@ from lib import util
from scipy import signal, interpolate, stats
import matplotlib.pyplot as plt
import numpy as np
from itertools import zip_longest, pairwise
from itertools import zip_longest
import h5py
from copy import deepcopy
try:
from itertools import pairwise
except: # pairwise only introduced since python 3.10
from itertools import tee
def pairwise(iterable):
# pairwise('ABCDEFG') --> AB BC CD DE EF FG
a, b = tee(iterable)
next(b, None)
return zip(a, b)
try:
from tqdm import tqdm
except: