python waveform_benchmark.py "/home/briangow/chorus/data/mimic_iv/waves/p100/p10079700/85594648/85594648.hea" "waveform_benchmark.formats.wfdb.WFDBFormat516"
________________________________________________________________
Format: waveform_benchmark.formats.wfdb.WFDBFormat516
(WFDB with FLAC compression)
Record: /home/briangow/chorus/data/mimic_iv/waves/p100/p10079700/85594648/85594648
214981 seconds x 6 channels
255177600 timepoints, 199126720 samples (78.0%)
________________________________________________________________
Traceback (most recent call last):
File "/home/briangow/chorus/repos/chorus_waveform/waveform_benchmark.py", line 6, in <module>
waveform_benchmark.__main__.main()
File "/home/briangow/chorus/repos/chorus_waveform/waveform_benchmark/__main__.py", line 12, in main
run_benchmarks(input_record=opts.input_record,
File "/home/briangow/chorus/repos/chorus_waveform/waveform_benchmark/benchmark.py", line 66, in run_benchmarks
fmt().write_waveforms(path, waveforms)
File "/home/briangow/chorus/repos/chorus_waveform/waveform_benchmark/formats/wfdb.py", line 43, in write_waveforms
sig_samples[start:end] = chunk['samples']
~~~~~~~~~~~^^^^^^^^^^^
ValueError: could not broadcast input array from shape (25610240,) into shape (26860800,)
This occurs on the Pleth waveform (but not the ECG waveforms run before it). In the following block:
for name, waveform in waveforms.items():
sig_name.append(name)
units.append(waveform['units'])
sfreq.append(waveform['samples_per_second'])
# Convert chunks into an array with no gaps.
sig_length = round(length * waveform['samples_per_second'])
sig_samples = numpy.empty(sig_length, dtype=numpy.float32)
sig_samples[:] = numpy.nan
sig_gain = 0
for chunk in waveform['chunks']:
start = chunk['start_sample']
end = chunk['end_sample']
sig_samples[start:end] = chunk['samples']
sig_gain = max(sig_gain, chunk['gain'])
It gives the error when running sig_samples[start:end] = chunk['samples'] on the last chunk out of 3. The chunk is:
{'start_time': 0.0, 'end_time': 204972.10772740006, 'start_sample': 0, 'end_sample': 51220480, 'gain': 4096.0, 'samples': array([0. , 0. , 0. , ..., 0.50561523, 0.5046387 , 0.5029297 ], dtype=float32)}
I'm getting the following error:
This occurs on the
Pleth
waveform (but not the ECG waveforms run before it). In the following block:It gives the error when running
sig_samples[start:end] = chunk['samples']
on the last chunk out of 3. The chunk is:{'start_time': 0.0, 'end_time': 204972.10772740006, 'start_sample': 0, 'end_sample': 51220480, 'gain': 4096.0, 'samples': array([0. , 0. , 0. , ..., 0.50561523, 0.5046387 , 0.5029297 ], dtype=float32)}