Closed superbin98 closed 1 year ago
15
but 738
(check with len(array)
). Try transposing the array. NaN
should be converted to within-range units (just set to 0 is my recommendation)Currently the headers do not have any information about the sampling frequency, so they expect the data to have the same sampling frequency. You should edit those in the signal header accordingly to your data.
Hello,
I am trying to create an EDF+ file from a Pandas dataframe. I convert the dataframe into a ndarray (df.to_numpy()).
When I pass the array into the function I get the following error message:
AssertionError: signals and signal_headers must be same length
The Shape of the given array is (738,15) and it contains floats and strings (because of the timestamp and the event channel).
I don't know why this error occurs because the length of my array is 15 and the header list is also 15.
channel_names = ['Time', 'PEEP', 'PIP', 'Insptime', 'JetFreq', 'O2-Conc', 'SpO2', 'tcpCO2', 'tPR', 'tPO2', 'tPI', 'tHP', 'Status', 'event', 'event_def']
headers = highlevel.make_signal_headers(channel_names)
highlevel.write_edf(edf_file='edf_file.edf', signals=data, signal_headers=headers, file_type=1)
Is the problem because not all data have the same sample frequency and there are NaN Values?