def calculate_stft_stats_batch( batch, n_fft:int=256, # number of ffts to perform win_length:int=250, # window of ffts pad_mode:str='replicate', # padding mode center:bool=True, # center stft? hop_length:int=125, # hop length? normalized:bool=True, decibel_scale:bool=True, return_complex:bool=True):
def calculate_stft_stats( idx, zarr_file, # zarr file with arrays channels, # channels to perform stft and calculate stats on n_fft:int=256, # number of ffts to perform win_length:int=250, # window of ffts pad_mode:str='replicate', # padding mode center:bool=True, # center stft? hop_length:int=125, # hop length? normalized:bool=True, decibel_scale:bool=True, return_complex:bool=True, clip_interpolations:NoneType=None):
Function to calculate stft stats on an individual zarr array, including a clip interpolate range
Function to check if a signal is NOT constant. This works for NaNs and constant values.
channels = [['ECG', 'ECG (LL-RA)', 'EKG', 'ECG (L-R)'], ['EOG(L)', 'EOG-L', 'E1', 'LOC', 'E1-M2', 'E1-AVG'], ['EMG', 'cchin_l', 'chin', 'EMG (L-R)', 'EMG (1-2)', 'EMG (1-3)', 'Chin3'], ['C4-M1', 'C4_M1', 'EEG', 'EEG3', 'C3-M2', 'C3_M2', 'C4-AVG'], ['SaO2', 'SpO2','spo2'], ['THOR RES', 'Thor', 'thorax', 'Thoracic', 'Chest'], ['ABDO RES', 'abdomen', 'Abdo', 'Abdominal', 'ABD']]channels = ['ABP', 'II', 'V', 'PLETH','RESP']updated_channels = []avail_channels = ['II']ifall(isinstance(i, list) for i in channels):for p in channels: updated_channels.append(next((x for x in p if x in avail_channels), None))else: updated_channels = [p if p in avail_channels elseNonefor p in channels]updated_channels