Closed alistairewj closed 7 years ago
The inconsistency is produced by the output of line 172:
ann=javaWfdbExec.execToDoubleArray(wfdb_argument);
I did notice that this ann
array is Nx5 for records with headers without a time/date, and Nx6 for those with a time/date like this problem record.
I'm just reasoning here without delving into the workings of the java class but my simple change seems to have fixed the error. Do you think I should close this issue?
Thanks @cx1111 for looking into this issue. It works for the following case now ann = rdann('slp01a', 'ecg') But, for the following case [ann_atr]=rdann('slp01a', 'ecg', 1, 1650000, 1500001);
It gives me error: [java] java.lang.NullPointerException error: called from: error: /home/user/Desktop/entry_sleep/entry_87.53_best_correct/wfdb-app-toolbox-0-9-9/mcode/rdann.m at line 172, column 4
Although, there are annotations beyond 1650000
I'm using the latest github development version of everything. I copied your command in exactly and got a 668x1 double for ann_atr. Can you try with the most up to date version of the toolbox and tell me what you get?
Either way I found another error when reading annotation files with aux fields (when the number of outputs is 1).
Error using rdann (line 173)
Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: 8
at org.physionet.wfdb.Wfdbexec.execToDoubleArray(Unknown Source)
So unfortunately the problem is within the java code. I'll be investigating.
I'm not using a tarball/release version but rather the latest development version on github. I git clone the repo, then in matlab:
[old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end
cd mcode
addpath(pwd);savepath
In terminal:
cd ~/Testfolder/
git clone https://github.com/ikarosilva/wfdb-app-toolbox.git
matlab &
In matlab:
[old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end
cd wfdb-app-toolbox/mcode
addpath(pwd);savepath
>> tic; sig=rdsamp('16265'); toc;
Elapsed time is 1.488436 seconds.
Thanks @cx1111, I also spotted that error in rdann. Also, when using wrann in matlab/octave for this slpdb dataset, I get the following error.
[ann_atr]=rdann('slp01a', 'ecg') wrann('slp01a', 'ecg1', ann_atr)
java.io.IOException: Broken pipe at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:318) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129) at java.io.BufferedWriter.write(BufferedWriter.java:230) at java.io.Writer.write(Writer.java:157) at org.physionet.wfdb.InputWriter.run(Unknown Source) Process exited with errors!! Error code = 139 warning: broken pipe -- some output may be lost
Maybe they are related
@cx1111 Did you figure out why java code is causing problems for slpdb database?
Sorry I haven't had time to work on it but yea I found the error. I'll be editing the java method. In the meantime if you want you can delete that if(nargout==1) clause to make rdann work.
Ok hopefully I've fixed the issue. Changed Wfdbexec.java and Wfdbexec.class in the jar files, along with a bit in rdann.
Also thanks @mansirankawat for pointing out the wrann issue. I've just made some moderately large changes to wrann. Let me know if it works now.
Thanks to @mansirankawat for noticing this. Reproducible using
slp01a.ecg
andslp01a.hea
at https://www.physionet.org/physiobank/database/slpdb/If all outputs of
rdann
are requested, then the output looks correct:But if only a single output is requested, then the annotations all return 50:
Verified using the wfdb-app-toolbox-0-9-9 release on Ubuntu 16.04.