Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Problem with opening file with load_open_ephys_data.m #66

Open
yannunh opened this issue Jun 2, 2018 · 16 comments
Open

Problem with opening file with load_open_ephys_data.m #66

yannunh opened this issue Jun 2, 2018 · 16 comments

Comments

@yannunh
Copy link

yannunh commented Jun 2, 2018

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
Copy link

adehad commented Oct 20, 2018

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
Copy link

adehad,
this works so well.
Thanks

@BioCoderR
Copy link

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

@adehad
Copy link

adehad commented May 26, 2019

@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
Copy link

BioCoderR commented May 27, 2019 via email

@adehad
Copy link

adehad commented May 27, 2019

@pranavswaroopgundla What error message are you getting?

@adehad
Copy link

adehad commented May 27, 2019

Send a screenshot of the command window and the figure

@BioCoderR
Copy link

@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
Copy link

adehad commented May 27, 2019

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

@BioCoderR
Copy link

@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
Copy link

adehad commented May 27, 2019

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

@BioCoderR
Copy link

BioCoderR commented May 27, 2019 via email

@adehad
Copy link

adehad commented May 27, 2019

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
Copy link

BioCoderR commented May 27, 2019 via email

@adehad
Copy link

adehad commented May 27, 2019

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
Copy link

@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.

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

No branches or pull requests

4 participants