2024-03-22 13:55:14 +01:00
|
|
|
# {'TIME': [data], 'CH1': [data], 'CH2': [data]}
|
|
|
|
def cut_time(data : dict, start : float, end : float) -> dict:
|
|
|
|
idx_start = 0
|
|
|
|
idx_end = 0
|
|
|
|
|
|
|
|
for idx, t in enumerate(data['TIME']):
|
|
|
|
if t > start and idx_start == 0:
|
|
|
|
idx_start = idx
|
|
|
|
if t > end and idx_end == 0:
|
|
|
|
idx_end = idx
|
|
|
|
if idx_end != 0 and idx_start != 0:
|
|
|
|
break
|
|
|
|
|
|
|
|
if idx_end != 0 and idx_start != 0:
|
|
|
|
return {key: value[idx_start:idx_end] for key, value in data.items()}
|
|
|
|
else:
|
2024-04-11 14:31:13 +02:00
|
|
|
raise Exception("Start or end out of range")
|