chorus-ai / chorus_waveform

CHoRUS waveform documentation and various waveform conversion scripts
MIT License
3 stars 3 forks source link

DICOM format - shape error #69

Closed briangow closed 3 months ago

briangow commented 3 months ago

I'm getting the following error when running this WFDB file, /p169/p16955095/82284982, using the DICOMHighBits (and DICOMLowBits) format.

./waveform_benchmark.py -r /p169/p16955095/82284982/82284982 -f waveform_benchmark.formats.dicom.DICOMHighBits
________________________________________________________________
Format: waveform_benchmark.formats.dicom.DICOMHighBits
Record: /p169/p16955095/82284982/82284982
         604 seconds x 5 channels
         566400 timepoints, 562240 samples (99.3%)
________________________________________________________________
Channel summary information:
 signal       fs(Hz)     Bit resolution       Channel length(s)   
 II           249.89     0.005(mV)            599                 
 III          249.89     0.005(mV)            599                 
 V            249.89     0.005(mV)            599                 
 Pleth        124.94     0.000244(NU)         604                 
 Resp         62.47      0.000611(Ohm)        599                 
________________________________________________________________
Output size:    1982 KiB (28.87 bits/sample)
Time to output: 0 sec
________________________________________________________________
Fidelity check:

Chunk        Numeric Samples          NaN Samples
    # Errors  /  Total    % Eq      NaN Values Match
Signal: II
  0              0/    149632   100.000         Y (128)     
Signal: III
  0              0/    149632   100.000         Y (128)     
Signal: V
  0              0/    149632   100.000         Y (128)     
Signal: Pleth
  0              0/     75520   100.000          Y (0)      
Signal: Resp
  0              0/     37440   100.000          Y (0)      
________________________________________________________________
Read performance (median of N trials):
 #seek  #read      KiB      sec     [N]
   nan    nan      nan   0.0058  [1054] read 1 x 604s, all channels
   nan    nan      nan   0.0227   [326] read 5 x 500s, all channels
   nan    nan      nan   0.1456    [51] read 50 x 50s, all channels
   nan    nan      nan   1.2259     [6] read 500 x 5s, all channels
   nan    nan      nan   0.0027  [1767] read 1 x 604s, one channel
Traceback (most recent call last):
  File "/repos/local/chorus_waveform/./waveform_benchmark.py", line 6, in <module>
    waveform_benchmark.__main__.main()
  File "/repos/local/chorus_waveform/waveform_benchmark/__main__.py", line 122, in main
    run_benchmarks(input_record=opts.input_record,
  File "/repos/local/chorus_waveform/waveform_benchmark/benchmark.py", line 234, in run_benchmarks
    fmt().read_waveforms(path, t0, t1, [c])
  File "/repos/local/chorus_waveform/waveform_benchmark/formats/dicom.py", line 703, in read_waveforms
    output[channel][target_start:target_end] = arrs[group_idx][channel_idx, :]
ValueError: could not broadcast input array from shape (123755,) into shape (123756,)
tcpan commented 3 months ago

I have not been able to replicate on my system. This may be a boundary case uncovered by random read windows. The code has been updated to force the same length for both input and output arrays. pull request created.

briangow commented 3 months ago

Fixed by #71 .