Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using loading_MAHNOB, the ECG signal waveform I obtained seems to be wrong. #13

Open
daozihappy opened this issue Apr 4, 2020 · 2 comments

Comments

@daozihappy
Copy link

Dear Dr,

Hello, can you help me with the following problem? Thank you very much !

Using "loading_MAHNOB" , I try to get the ECG signal in MAHNOB.

However, the waveform I obtained seems to be wrong, because it is unlike the standard ECG signal waveform (fig2 of the paper publishing MAHNOB database). The signal I obtained and the standard signal are attached.

the ECG  signal waveform  I obtained
【the ECG signal waveform I obtained using "loading_MAHNOB"】
the standard  ECG signal waveform
【the standard ECG signal waveform】

Note that, when I run "loading_MAHNOB", I change line 69-72 of "loading_MAHNOB", because I can not obtain the raw signal without this change. line 69-72 of "loading_MAHNOB" was changed to:

total_sec = floor(size(data.Record,2) / phys_data.srate);
phys_data.data = zeros(n_chans+1, (total_sec)*phys_data.srate);
for j = 1:n_chans
      raw_data = data.Record(strcmp(electrode_labels{j},electrode_labels_orig), 1:(total_sec) * 
                            phys_data.srate);
 end
 ECG_signal = phys_data.data(33,:)-phys_data.data(34,:);

Can you please help me have a look on this? Thank you very much for all your help!
Best regards

@Gijom
Copy link
Owner

Gijom commented Apr 6, 2020

Could you please precise what happen when you do not change the lines ? Why cannot you obtain the raw signal without this change ?

In your code you only update the structure raw_data for each electrode (overwriting the previous assignment) and then you use phys_data to compute ECG. Since phys_data should be 0 I am surprised you even obtain a signal different from 0.

@daozihappy
Copy link
Author

daozihappy commented Apr 6, 2020

Dear Dr, @Gijom @msoley @JoseCalero @Frankkkkk

Thank you so much for your reply.

If I use the line68-72 of the original code "loading_MAHNOB.m", I can not obtain the true length of one trial. Specifically, there are only two sampling points in the phys_data.data(j,:) (the shape of a trial phys_data.data(j,:) is 1×2) instead of the true length of one trial. In other words, .

For example, for the trial 1 of the subject 10, the shape of "data.Record " is 47×29440. However, after using the line68-72 of the original code, the shape of "phys_data.data" becomes 39×2 instead of 39×29440 where 29440 is the true length of the trial.

The reason of this phenomenon is that "triggers(3)-triggers(1)" is equal to 2.

The line68-72 of the original code "loading_MAHNOB.m":

triggers = find(diff(data.Record(47,:))~=0);                                   (line68)
phys_data.data = zeros(n_chans+1,(triggers(3)-triggers(1)));        (line69)
for j = 1:n_chans                                                                         (line70)
       phys_data.data(j,:) =                                                             (line71)
              data.Record(strcmp(electrode_labels{j},electrode_labels_orig),triggers(1)+1:triggers(3));
end                                                                                             (line72)

Thus, I change line 69: phys_data.data = zeros(n_chans+1,(triggers(3)-triggers(1)));
to: phys_data.data = zeros(n_chans+1, (total_sec)*phys_data.srate). I found that, in this way, the raw signals can be successfully extracted, since the shape of "phys_data.data" become 39×29440 (rather than 39×2) when the shape of "data.Record " is 47×29440. Here 29440 is the length of one signal of the trial (trial 1 of the subject 10).

Strangely, there is something wrong with the EXG signal waveform using the code after doing the change.

Actually, in the original code, I don't know what "triggers" in line68-71 used for. Also,I do not know whether it is reasonable to do the change.

Could you please help me check whether the change is right and what's wrong with me ?
Thank you very much for all your help.
Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants