badenlab / mea_analysis_gui Goto Github PK
View Code? Open in Web Editor NEWContains all files for the Matlab GUI to analyse MEA data + spatial stimulator
License: BSD 2-Clause "Simplified" License
Contains all files for the Matlab GUI to analyse MEA data + spatial stimulator
License: BSD 2-Clause "Simplified" License
The variable RF_coords, which I assume stores information about the location of the Receptive field, can be assigned with values that are bigger than the number of pixel contained in the stimulus.
In my example I have a stimulus with size 20x20. However, RF_coords contains the value of 21 multiple times.
I assume the reason for this is line 37, but Iam not 100% sure what is checked in the if statement:
if max_RF_col_temp - p.RF_layers <= p.stim_columns - 1
max_RF_col = max_RF_col_temp + p.RF_layers;
else
max_RF_col = p.stim_columns;
end
If RF_coords contains values bigger than the number of pixel in the stimulus RF_Ident_fn_v7 crashes in line 1554
for j = 1:RF_Ident.STASD_Box_FullRF_Num_pixels
RF_Ident.STASD_Box_FullRF_STA{i}(j,:) = STA(RF_Ident.STASD_Box_FullRF_coords(j,1),RF_Ident.STASD_Box_FullRF_coords(j,2),:,i);
RF_Ident.STASD_Box_FullRF_STA_SD{i}(j) = STA_SD(RF_Ident.STASD_Box_FullRF_coords(j,1),RF_Ident.STASD_Box_FullRF_coords(j,2),i);
end
I have tried to quick-fixed it by changing Box_RF_fn_alt_vs.m in line 37 to only allow smaller cases in the first if statement. Not sure this makes sense in the context of what is done here and it still chrases sometimes.
if max_RF_col_temp - p.RF_layers < p.stim_columns - 1
max_RF_col = max_RF_col_temp + p.RF_layers;
else
max_RF_col = p.stim_columns;
end
Should RF_Ident.STASD_Box_FullRF_Num_pixels be empty of zero if no significant pixel was found? In line 699 it is defined that this variable should be 0 if no significan pixel was found.
if Sig_Pix_Indicator_STASD == 0
if p.RF_Type(1) == 1 % Box
RF_Ident.STASD_Box_FullRF_Num_pixels = 0;
end
if p.RF_Type(2) == 1 % All Significant Pixels
RF_Ident.STASD_ASP_FullRF_Num_pixels = 0;
end
if p.RF_Type(3) == 1 % Gaussian
RF_Ident.STASD_Gaus_FullRF_Num_pixels = 0;
end
But than in line 1549 it is checked if the variable is empty
if ~isempty(RF_Ident.STASD_Box_FullRF_Num_pixels)...
Since RF_Ident.STASD_Box_FullRF_Num_pixels is 0 at this point it will pass the test in the if statement will run. However, in line 1563 the code tries to index into variables that are empty
RF_Ident.STASD_Box_FullRF_STA_time{i} = squeeze(STA(RF_Ident.STASD_Box_RF_coords_centre{maxSTASD_Box_index}(1),RF_Ident.STASD_Box_RF_coords_centre{maxSTASD_Box_index}(2),:,i));
I suggest either setting the variable to empty or testing against if the variable is 0 in the if statement.
sf_organizer (https://github.com/BadenLab/MEA_analysis_GUI/blob/master/sf_organizer.m) currently doesnt work with files larger than 2GB as that requires version 7.3 .mat files. The function 'matfile' does not allow for creating files in version 7.3. So sf_organizer has to be changed in that it first saves the variable (using matlab's save command, which allows for v.3.7 files. Than open that file as matfile and save the variables.
Line 653 and probably lines before (have to investigate):
spike_times_vec_loop(indices_loop) = a_loop + (spike_times_vec_loop(indices_loop) - a_dash_loop)*(b_loop - a_loop)/(b_dash_loop - a_dash_loop);
Some spiketimes are not set to the value they should have according to their position inside the noise chunk repeats. The following barplot shows the spiketimes in spike_times_vec_loop:
Notice the outliers in the spiketime, there is something wrong their. It looks like this happens mostly at the end of a loop, but not always. Possible connected to issue #2
Resulting error:
Index in position 3 is invalid. Array indices must be positive integers or logical values.
Error in STE_Full_fn (line 13)
STE_Full(:,:,:,i) = stimulus_arr(:,:,STE_index_loop-p.Num_STE_bins:STE_index_loop-1);
Error in RF_Ident_fn_v5 (line 207)
STE_Full(:,:,:,:,i) = STE_Full_fn(stimulus_arr(:,:,:,i),trig_times_vec,spike_times_vec,p);
Error in RF_Ident_CL_4_GUI_Ready (line 608)
RF_Ident{i} = RF_Ident_fn_v5(stimulus_arr,trig_times_vec_trunc,spike_times_vec_loop,length_spike_times_loop,p_par); % PAR Mod 27,08,2020 --> was 'RF_Ident_fn_v4' and
'trig_times_vec'
Bug in line 566 of the RF_Ident_[....]Ready.mat file. Line 566, second part of the & argument
&(spike_times_vec_loop<trig_times_vec_par(j*p_par.stim_frames+p_par.Num_STE_bins+1))) = [];
trig_times_vec_par is a vector with dimension 1x8402
j = 7
p_par.stim_frames = 1200
p_par.Num_STE_bins = 20
j*p_par.stim_frames+p_par.Num_STE_bins+1 = 8421
this exceeds the limits of trig_times_vec_par and also cuts spikes from beyond the gap.
suggested fix:
trig_times_vec_par(j*p_par.stim_frames+1)
+1 because the next element in trig_times_vec_par is the first trigger of the next noise chunk, so we cut spikes from the end of the current noise chunk to the begining of the next.
Added some figures
Some elements of the GUI (parameters on the left for calculating RF) are not drawing fast enough. I think this is because there is no direct callback untill "Find RFs" Button is clicked. Fix it by introducing some drawing commands...
p.Gap_Ind cannot be 1. But the only function for the variable is to be either 1 or 2. Should be deleted.
All analysis .mat files should be saved using the -v7.3 file formate to allow for partiall loading of data chunks out of big files.
At the moment there is no way to remove a stimulus from the recording loaded, which should be possible.
The problem is that also all data that is connected to that stimulus need to be deleted properly or the gui will crash. Have to write a function which cleans all the data. Can probably use "delete_dataset" function.
If STE_Full_Choise = 1 I get this error message.
Error using STE_Full_fn_2 (line 28)
Index in position 3 is invalid. Array indices must be positive integers or logical values.
Error in RF_Ident_fn_v8 (line 271)
STE_Full(:,:,:,:,i) = STE_Full_fn_2(stimulus_arr(:,:,:,i),trig_times_vec,spike_times_vec,p);
If STE_Full_Choise = 2 I get another error message
Error using STA_fn_2 (line 32)
Index in position 3 is invalid. Array indices must be positive integers or logical values.
Error in RF_Ident_fn_v8 (line 284)
STA(:,:,:,i)
When running https://github.com/BadenLab/MEA_analysis_GUI/blob/master/App_functions/noise_spiketrain_analysis.m to plot the spike trains over the noise repeats, there is a clear shift in the spiketrains between different repeats.
This is probably because the script does not account for dropped/prolonged frames. Will check...
Error message:
Index in position 3 is invalid. Array indices must be positive integers or logical values.
Error in STE_Full_fn (line 13)
STE_Full(:,:,:,i) = stimulus_arr(:,:,STE_index_loop-p.Num_STE_bins:STE_index_loop-1);
Error in RF_Ident_fn_v5 (line 207)
STE_Full(:,:,:,:,i) = STE_Full_fn(stimulus_arr(:,:,:,i),trig_times_vec,spike_times_vec,p);
Cause:
Index is negative at position 3 in line 13 in STE_Full_fn
STE_Full(:,:,:,i) = stimulus_arr(:,:,STE_index_loop-p.Num_STE_bins:STE_index_loop-1);
STE_index_loop-p.Num_STE_bins:STE_index_loop-1
ans =
-18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1
The variable in line 176, "RawLocCovar_Choice" is unused in the entire script https://github.com/BadenLab/MEA_analysis_GUI/blob/Paul_RF_GUI_implementation/Paul_RF_code/RF_Ident_CL_4_GUI_Ready_Update_09_10_2020_Onwards.m
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.