open-ephys / analysis-tools

Archived code for reading data saved by the Open Ephys GUI
58 stars 176 forks source link

Problem with opening file with load_open_ephys_data.m #66

Open yannunh opened 6 years ago

yannunh commented 6 years ago

image

The m file and spike, continuous and event file is in same dir. ( same error with continuous and event file)

I already tried with this commands: load_open_ephys_data("C:\Open Ephys\2018-06-01_19-23-51\100_CH31.continuous");

anything else I need to do? I copied (https://github.com/open-ephys/analysis-tools/blob/master/load_open_ephys_data.m) this in new script file and named load_open_ephys_data.m

adehad commented 5 years ago

The filename should be given in single quotes not double quotes as you have done.

e.g. load_open_ephys_data('100_CH31.continuous');

malenitzin commented 5 years ago

adehad, this works so well. Thanks

BioCoderR commented 5 years ago

after loading the files how can we plot power-spectrum and amplitude spectrum graphs for certain time period.

adehad commented 5 years ago

@pranavswaroopgundla Try something like this for a PSD:

Fs = 3e3; % sampling frequency
spect.winSize = 2^12;   % window size
spect.win = blackman(spect.winSize);
spect.overlap = 0.8;    % percentage window overlap
spect.nOverlap = floor(spect.winSize*spect.overlap);
spect.nFFT = 10*Fs;     % number of fft samples, e.g. 10 per sample
figure;
spectrogram(sig, spect.win, spect.nOverlap, spect.nFFT, Fs, 'xaxis','psd'); 
colormap(hot)

Where sig is your signal for a given time period. You can replace 'psd' with 'power' for a power spectrum. NOTE: Our data is actually sampled at 30e3, but as the resulting image takes too long to load we used a sampling rate x10 lower, meaning the frequency scale is also scaled.

BioCoderR commented 5 years ago

I tried with code but the problem is i can't see the plot only. Its just blank with a figure window can you help me with this problem. Thank you in advance.

On Sun, May 26, 2019, 10:42 PM adehad notifications@github.com wrote:

@pranavswaroopgundla https://github.com/pranavswaroopgundla Try something like this for a PSD:

Fs = 3e3; % sampling frequency spect.winSize = 2^12; % window size spect.win = blackman(spect.winSize); spect.overlap = 0.8; % percentage window overlap spect.nOverlap = floor(spect.winSizespect.overlap); spect.nFFT = 10Fs; % number of fft samples, e.g. 10 per sample figure; spectrogram(sig, spect.win, spect.nOverlap, spect.nFFT, Fs, 'xaxis','psd'); colormap(hot)

Where sig is your signal for a given time period. You can replace 'psd' with 'power' for a power spectrum. NOTE: Our data is actually sampled at 30e3, but as the resulting image takes too long to load we used a sampling rate x10 lower, meaning the frequency scale is also scaled.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/open-ephys/analysis-tools/issues/66?email_source=notifications&email_token=AHJ5TAHDBM7Q4UHU5QREKCTPXLAJLA5CNFSM4FC6FNG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWIJYIY#issuecomment-496016419, or mute the thread https://github.com/notifications/unsubscribe-auth/AHJ5TACEQNHKKW3WDIXVZKTPXLAJLANCNFSM4FC6FNGQ .

adehad commented 5 years ago

@pranavswaroopgundla What error message are you getting?

adehad commented 5 years ago

Send a screenshot of the command window and the figure

BioCoderR commented 5 years ago

@adehad matlab This is the error happening just take a look the error is in ".png file"

powerspectrum.zip

and the figure is powerspectrum.zip

adehad commented 5 years ago

spectrogram requires a vector input, so try passing in a single row of your Data variable.

BioCoderR commented 5 years ago

@adehad Capture the error is still there I don't know what is the causing an error can u please give me ur mail id so that I can send my files to you so it might solve the problem faster.

adehad commented 5 years ago

Sorry I edited my comment, the function takes in a single channel of data, e.g. Data(1,:)

BioCoderR commented 5 years ago

Yah i did that too but no use. Its same blank window showing up..

On Mon, May 27, 2019, 7:05 PM adehad notifications@github.com wrote:

Sorry I edited my comment, the function takes in a single channel of data, e.g. Data(1,:)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/open-ephys/analysis-tools/issues/66?email_source=notifications&email_token=AHJ5TACFMSNIEI3P7JNSATLPXPPTTA5CNFSM4FC6FNG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWJ2KTQ#issuecomment-496215374, or mute the thread https://github.com/notifications/unsubscribe-auth/AHJ5TACELSU5QVKJAWMJPNTPXPPTTANCNFSM4FC6FNGQ .

adehad commented 5 years ago

Hmm, the error is saying that spect.winSize is greater than the length of your data. I notice that the DATA variable is now transposed in your workspace, so perhaps you need to pass in Data(:, 1), to select a single data channel.

BioCoderR commented 5 years ago

this the error I'm getting now because of the array size limit. how can I manage this?

On Mon, May 27, 2019 at 7:29 PM adehad notifications@github.com wrote:

Hmm, the error is saying that spect.winSize is greater than the length of your data. I notice that the DATA variable is now transposed in your workspace, so perhaps you need to pass in Data(:, 1), to select a single data channel.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/open-ephys/analysis-tools/issues/66?email_source=notifications&email_token=AHJ5TAAIAIUXPDHQJD2RY6LPXPSNXA5CNFSM4FC6FNG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWJ4B3Q#issuecomment-496222446, or mute the thread https://github.com/notifications/unsubscribe-auth/AHJ5TAFJT5PPWHNXQHXN3L3PXPSNXANCNFSM4FC6FNGQ .

adehad commented 5 years ago

Yes, this is a common problem if you have a long recording. There are a few ways of managing this:

  1. Use a shorter segment of your recording, in your case Data(1:1e4, 1). This would plot the spectogram from the first 10,000 samples.
  2. Reduce the frequency resolution, e.g.: spect.nFFT = 2*Fs
  3. Reduce the sampling frequency you are using, as I mentioned I did with my data earlier. Using x10 lower worked for us.
BioCoderR commented 5 years ago

@adehad it worked for me and thank you can you help how to plot the power spectrum graph for certain time limits in the signals.