sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e607ad27aad2b5b9804dcb997179228936d821286a22f868b25e4ac5a1adb218
MATLAB
824
38
% FullTimeClassicBRFS - update to use Gramm clear close all PostSetup('BrockHome') flag_SaveFigs = true; %% Get IDX global IDXDIR cd(IDXDIR) if ~exist(strcat(IDXDIR,'\IDX_iScienceSubmission.mat'),'file') IDX_iScienceSubmission end load(strcat(IDXDIR,'\IDX_iScienceSubmission.mat')) %% Main loop for i = 1:...
18f852259de6e35c713fc5cafcff5f96751ada7ba67176912c76bd277ed7aa84
MATLAB
825
46
q=parallel.pool.PollableDataQueue; f=parfeval(@asynchSound,0,q); gotMsg=false; while ~gotMsg [startmessage, gotMsg]=poll(q); end disp(startmessage); gotMsg=false; while ~gotMsg [qout, gotMsg]=poll(q); end disp(qout) gotMsg=false; while ~gotMsg [dev, gotMsg]=poll(q); end disp(dev) data=[]; while ~strcmp(data...
acd770b4cfa28853233cbadd883b844843e215989021936440545794239b1b93
MATLAB
826
30
function [counts, labels, tags] = loadTIFF_multi(path) % expects path to specify a folder tiff = Tiff(path); counts = []; labels = {}; tags = {}; last = 0; while ~last index = currentDirectory(tiff); counts(:,:,index) = read(tiff); tags{index} = getTagStruct(tiff...
cb4225410e3166837cb00e27dca4c8272340f298a40ba1055d55ea123874f35c
MATLAB
826
30
function plotResults(sPlot,p) % Plots summation layer firing rates FA = sPlot.sol(:,19); FB = sPlot.sol(:,20); tSol = sPlot.time; finalsplits = sPlot.finalsplits; WTA = sPlot.WTA; PercentRivalry = sPlot.perc; D = sPlot.dur; CV = sPlot.CV;...
ee7979b1e08ed33c786bfa905bf944eb277658544475caff330ea380d82dad4a
MATLAB
836
23
function [Result] = AO_StartSave(); %Function used to start saving on the SnR/Neuro Omega %The file saved contains the channels listed on the Data Options %The filename and the saving path could be set before saving using matlab commands:AO_SetSaveFileName,AO_SetSavePath. otherwise it will be saved as defined in the...
8c6968cd7c357b90ce75f69b9b6217649e9969f45dd185c3a1ef2c05dd6ce05a
MATLAB
839
22
function [pointnumber, dirindex] = getNumber(point_path, point) dirs = strsplit(point_path, {'\', '/'}); hasPoint = ~cellfun('isempty', strfind(dirs, point)); dirindex = find(hasPoint); if numel(dirindex)==1 pointname = dirs{dirindex}; pointnumstr = strrep(pointname, point, ''); ...
7b1cdf73d52f6171851e85de666fd563c6103c7b04649507c2e8cd985ee0380f
MATLAB
840
25
function mdp_table = make_mdp_table(experimenter, ts_snr_state, ... last_idx_before_skip, maestro_file, out_folder) log_msg(out_folder, 'start-state-align', ... 'Starting alignment of state events'); [mdp_table, ts_stats] = align_state_times(ts_snr_state, last_idx_before_skip, ... maestro_file.MDPData.MDP...
de4ef565727b0dc0bacb52846b5e85ccd4b8934bcc42d0a95ce17d77286e943c
MATLAB
840
17
function [t_value, p_value, effectSize, df, weightedSD] = weighted_t_test(x, w) %------------------------------------------------------------------------- % The functions computes weighted t test. For a similar function in R, see % http://www.r-bloggers.com/weighted-t-test-in-r/ %---------------------------------...
f2a54a1c4689e3a520675e69a3e632baf6c09eae8a22f1b14a5f0709331503a5
MATLAB
840
40
function [Xsub,idx]=licols(X,tol) %Extract a linearly independent set of columns of a given matrix X % % [Xsub,idx]=licols(X) % %in: % % X: The given input matrix % tol: A rank estimation tolerance. Default=1e-10 % %out: % % Xsub: The extracted columns of X % idx: The indices (into X) of the extracte...
72b87ee4eed313f0a888ea12b7c843adf80b34cc5666eb31c5b9136b482fbb9e
MATLAB
842
22
function list=get_comp_list(varargin) % GET_COMP_LIST returns the list of components. % LIST=GET_COMP_LIST(SIG_COORD) returns the list of % components of the Main_signal object that the given % Signal-coodinator coordinates, including components that consists % it's Envelopes. % LIST=GET_COMP_LIST(SIG_COORD,EXTERNAL_C...
cbe5ca71573cd53800509073dcf570fe1f0f3acd7c5d746c6d8149d01fe2a41a
MATLAB
842
20
function countsNoBg = gui_MibiRemoveBackgroundByMaskAllChannels_3(countsAllSFiltCRSum,mask, removeVals) % function MibiRemoveBackgroundByMaskAllChannels % function receives a matrix of counts and a logical 2d-mask, and reduces % values where mask is positive. The amount of reduction is set by % removeVal. If it is not ...
5dd7ed86417726d0bca857ec27685153d4630c686b1d8a074c44c2ef5302b1ab
MATLAB
843
22
function sig= change_seq_values(sig,comp,arr,str_arr) % CHANGE_SEQ_VALUES changes the sequenced-values of the given component. % SIG=CHANGE_SEQ_VALUES(SIG,COMP,ARR,STR_ARR) changes the signal component's sequenced % values to the given arr and it's string representation to str_arr. % Returns the Signal after the change...
f748d89c69099fce831357326f8ef2765c4da0088119ea59aba5a76ba7f182de
MATLAB
847
20
function countsNoBg = gui_MibiRemoveBackgroundByMaskAllChannels(countsAllSFiltCRSum,mask, removeVals) % function MibiRemoveBackgroundByMaskAllChannels % function receives a matrix of counts and a logical 2d-mask, and reduces % values where mask is positive. The amount of reduction is set by % removeVal. If it is not pr...
f4c1c96314d7836dcd9f8517fda1b6f367b8b76b886809b6fdbd3300ca8b40f8
MATLAB
853
29
function trapeze=TRAPEZE(varargin) % NEW_ENV class constructor. switch nargin case 0 % if no input arguments, create a default object env=Envelope('TRAPEZE'); trapeze.num_of_comps=4; trapeze=class(trapeze,'TRAPEZE',env); trapeze=add_to_comp_list(trapeze,'Freq_comp',Freq_co...
7b580b9f02263d700d4020e758e0408b4ca1eaec0f0f42c9266b428819fc6f6c
MATLAB
854
27
function [Result] = AO_SetSavePath(path); % Function used to set the path of the directory to save in % path: contain the path of the directory for saving the files %% Result is an integer result of the AO_SetSavePath, 0 = no function errors %% % Copyright (C) 2011 AlphaLabSnR EthernetStandAlone % Author: Majid ...
c68b6a4c13706299e42e08bb5ff4e48169ae4b405ff53f59a683c0df6caf06b4
MATLAB
854
27
function [conv_result] = svconv_forward(label, nmf_map, nmf_psf) % svconv_forward - svconv_forward propagation % Written by: % Jiachen, 06/10/2021 [hh, ww, channel, depth] = size(label); label = gpuArray(label); % svconv forward projection conv_result = gpuArray.zeros(size(label)); conv_result_buf = gpuArray.zeros(h...
2c13a56b0d7ea80550b0a4f22f285579b007c630a318da04bc3505094f890d65
MATLAB
856
27
function [dCa_m, J_uni, J_NaCa] = mitochondrial_Ca2_handling(delta_Psi_m, Ca_m, Ca_i, data) P_Ca=data.P_Ca; Z_Ca=data.Z_Ca; alpha_m=data.alpha_m; alpha_e=data.alpha_e; V_NC=data.V_NC; Na_e=data.Na_e; Na_m=data.Na_m; beta_Ca=data.beta_Ca*10; K_Na=data.K_Na; K_Ca = data.K_Ca; R=data.R; T=data.T; F=data.F; % The Ca2+ un...
9176bb569229674799edb5ae377f32bc90b8baef4318e3d8ea7d498e4c5c710f
MATLAB
856
35
function [allAdjMat,subjs] = loadData(measure,ROI_table,ROImap,subjects) filepath = [getLocalPath('ECoGoutput') 'MeanConn' filesep 'RS - ' measure '-earlySVD.mat']; thisM = ['mean_' measure]; state = 'RS'; load(filepath,'dataTable'); if ~istable(dataTable) dataTable = struct2table(dataTable); end if n...
367d6fd7d7595786739c52cc32ddcf21a2a3f6f22307780c83b302920b700a7a
MATLAB
857
22
function []=semilog_imagesc_Fig04(x,y,C,logaxis) % this function plots a matrix in manner similar to imagesc, except one axis is plotted logarithmically % x - vector of n bin centers on x axis (length(x)=n) % y - vector of m bin centers on y axis (length(y)=m) % C - n-by-m matrix of values to be plotted as an i...
6dc0e5a8ad2b902247e837ae59b1da81db83e3246ccda722a4181c99b5c88ffb
MATLAB
857
22
function []=semilog_imagesc_FigS7(x,y,C,logaxis) % this function plots a matrix in manner similar to imagesc, except one axis is plotted logarithmically % x - vector of n bin centers on x axis (length(x)=n) % y - vector of m bin centers on y axis (length(y)=m) % C - n-by-m matrix of values to be plotted as an i...
95d410f03bb2a8c065e5fbccca5f56df39fa273782fe935eda8a0d2aab6cd0ce
MATLAB
857
22
function []=semilog_imagesc_Fig05(x,y,C,logaxis) % this function plots a matrix in manner similar to imagesc, except one axis is plotted logarithmically % x - vector of n bin centers on x axis (length(x)=n) % y - vector of m bin centers on y axis (length(y)=m) % C - n-by-m matrix of values to be plotted as an i...
ee6a09a60a333182dd60e5635b60b94da1ace00255c2fb8dc23e7e18394bfba4
MATLAB
857
22
function []=semilog_imagesc_FigS6(x,y,C,logaxis) % this function plots a matrix in manner similar to imagesc, except one axis is plotted logarithmically % x - vector of n bin centers on x axis (length(x)=n) % y - vector of m bin centers on y axis (length(y)=m) % C - n-by-m matrix of values to be plotted as an i...
59c809d20e47a0d5aaf0361c472272a5033596c6dbea10cfbedaac594b4dd33c
MATLAB
858
34
function [dom,mix,dur,init,fin,w] = analyseEpochs(Acell,Bcell,splits,segments,tSol,p) % Checks length and WTA index of an epoch dom = 0; mix = 0; dur = 0; init = 0; fin = 0; w = 0; if ~isempty(Acell) t_init = mean([tSol(max([splits-1,1])),tSol(splits)]); t_fin = mean([tSol(min([splits+segments,length(...
a13feb78533c10354db0814136916d5349ab798dbf0d79e965ad7be5144f6294
MATLAB
859
35
function val = get(swp,prop_name) % GET Get Sweep property from the specified object % and return the value. Property names are: Sdata, Sdata_formula % Edata, Edata_formula, Num_data, Num_data_formula, Reps, Reps_formula, % Mode, Step,Seq_length. switch prop_name case 'Sdata' val = swp.sdata; case 'Sdata_formul...
57f90f882b668361592496fae0b2bf81f8ea0cfb6cf1b6dadf6e1aba307e7a26
MATLAB
860
31
function MI1 = MI1_dis(probs, q_probs) %------------------------------------------------------------------------------------------------- % PURPOSE: calculate mutual (multi) information between subsystems in discretized data % % INPUTS: % probs: probability distributions computed from X % probs.p: probability ...
9135ade6b41c47db436032e7ae1466f92e10f31f03d1f0ec64ddc580ad1c4d24
MATLAB
861
30
% % raster2fr v1.0 % 07.10.2020 % Mohammad Shams % m.shamsahmar@gmail.com % % Estimates the firing rate of a neuron given as a raster % % convolved_raster = raster2fr(raster,kernel_std) % % INPUT % raster: a trial by time matrix of integers with ones indicating a spike and zeros no spike % kernel_std: the standard devi...
a7d84b0458dc891b2000c77991a401e6baea30f74542a6037866028b93f6a897
MATLAB
864
16
load('Aggregated_Stats_Data.mat'); ages=fieldnames(Aggregated_Stats_Data); for ageNum=1:size(ages,1) transField=unique(Aggregated_Stats_Data.(ages{ageNum}).dataTable(:,2)); p_values=table('Size',[size(transField,1),2],'VariableTypes',{'string','double'},'VariableNames',{'TransitionType','pValue'}); for fieldNum=1:...
3c9a14e348689fbb250d5cdbfef176f59eee7ef7ab67277d7811882261a1583b
MATLAB
866
37
%Author: Tatjana Schmitt, 2019-2022 clearvars % meta analysis red_cell_idx = true; % true if double labelling, false if retro GCaMP save_flag = true; nr_subfields = 3; animal_idx = 11; %% filepath root_path = 'directory to data folder'; load 'Jet_colormap_2P.mat'; % FRA analysis %fitti...
f9374089ab9e4b13cb3ab4b1aa5d3df551bae35f171cdc2667a3bd90ddc7def3
MATLAB
866
30
function [newObj] = avgByROI(obj,ROIs) %avgByROI Average adjacency matrix by ROI % If ROIs defined, output will have shape of length ROIs x ROIs and % include NaN for missing values, otherwise ROIs will come from input % object newObj(numel(obj)) = AdjMatrix; for iEl = 1:numel(obj) roi = obj(iEl).ROI; ...
69e254edc6e7fb4459f8ca27215e33a756c584b7c843edcd430ed09d62d222ca
MATLAB
868
32
function env = Envelope(varargin) % Envelope class constructor. % Envelope(name) constructs an envelope with a given name. % Envelope is the base class of all Envelopes (MTF ...etc) . switch nargin case 0 % if no input arguments, create a default object name='none'; env.comp_list={}; env.comp_list_st...
aefd0ceba9042903397682b6b04061537490bd7d3fa7bb0d587c8881d10cb161
MATLAB
871
35
function plotRasterAndMeanSDFForTrialsInCondition(SUA,SDF,TM,textForSave,textForTitle) global OUTDIR cd(OUTDIR) figure subplot(2,1,1) spikesIn = SUA == 1; MarkerFormat.MarkerSize = 5; MarkerFormat.Marker = '.'; plotSpikeRaster(spikesIn,'PlotType','scatter','MarkerFormat',MarkerFormat); newTM = TM(50:50:end); if newTM...
cd0a4c7c9247f934dfbc07e31d50c1d1d9505a58839a0a7906b52d142820c98c
MATLAB
872
48
clc clear close all figure('Units','normalized','OuterPosition',[.1 .1 .13 .25]) isubplot = 1; plotlegend = 0; prep_for_fig05B('action_preference','count',... isubplot,plotlegend) isubplot = 2; plotlegend = 1; prep_for_fig05B('LDA','count',... isubplot,plotlegend) add_shades figure('Units','normalized',...
34c1cdd8b3029128a522c895bc4e0729d4be9d4503c8c36f57592f844aafae7e
MATLAB
874
24
clear clc behav_NE = readtable('./data/final_curves_NE_after_exclusion.csv'); behav_NM = readtable('./data/final_curves_NM_after_exclusion.csv'); eeg_NE = readmatrix('./data/EEG_NE_Cz_filtered.xlsx','range','C1:CTO141'); eeg_NM = readmatrix('./data/EEG_NM_Cz_filtered.xlsx','range','C1:CTO145'); NE = struct; ...
b10bf27540be63bb996d770fc61fa17af04d787910dcc4a5a34e5c60efc38db9
MATLAB
874
24
function delete_db_Kilosorted_files(folder) % JN 2021-02-15 % This function deletes the output of the script % create_db_Kilosorted_files.m % The purpose is to make sure that repeated runs of kilosort do not result % in a nonsense combination of clustering results (especially plots % related to the clustering) from di...
197a3195d341601f674eb2ff0fd964cbde91d589480d532ac7e76f9354a7aa35
MATLAB
875
46
function ROI=fb_convert_imagej_roi(FILENAME,varargin) % % % % % % wrapper for ReadImageJROI % pull in data, if cell, then map to multiple ROIs rois=ReadImageJROI(FILENAME); ROI.coordinates={}; if iscell(rois) for i=1:length(rois) % return in x,y pair format (all coordinates inside ROI) tmp=rois{i}.vnRectBoun...
60cb1939b12447f7778ccb39204951c661eb5fa3cdbe390a8e5e1ebadbb3bea4
MATLAB
875
37
function f = readmolcsv(filename,driftcorr); A = csvread(filename,1,0); [N,M] = size(A); mol.cat = zeros(N,1); mol.id = A(:,1); mol.frame = A(:,2); mol.x = A(:,3); % x [nm] mol.y = A(:,4); % y [nm] mol.z = zeros(N,1); % z [nm] mol.sigma = A(:,5); % sigma [nm] if (~driftcorr) mol.I = A(:,6);...
5a31e52f7b7de596133915387e356850db76a16a9b366dc4441f6816bd1b707c
MATLAB
876
29
function [Result] = AO_SetSaveFileName(fileName); % Function to set the name of the file in wich we want to save % fileName:contains the file name. File name must be less than 30 chars % Note: if the file exists the old file will be deleted %% Result is an integer result of the AO_SetSaveFileName, 0 = no function err...
0f124a98413f2c66c2c1bf00aea48658d695e2affa247f8aeb8ace37ddbcae47
MATLAB
878
43
function y = modulate2(x, type, center) % MODULATE2 2D modulation % % y = modulate2(x, type, [center]) % % With TYPE = {'r', 'c' or 'b'} for modulate along the row, or column or % both directions. % % CENTER secify the origin of modulation as floor(size(x)/2)+1+center % (default is [0, 0]) % % Part of the Nonsubsampled...
453b9ca9bab8c57b4c1ed9e2da25c0590ea24a24b15b75f949ad9b9f9b0fb885
MATLAB
882
31
function meta=set(meta,varargin) % SET Set Metablock properties from the specified object % and return the value. Property names are: % Run_mode, Line_list property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is n...
8f3d77ac7c1c6ac456b48eb15066e0490645259abc74501592758dfe2181ec8f
MATLAB
882
36
% Function used to determine how long breaks are and the sequences of % breaks % Updated: 08-30-2022 function [oneStart,oneLen,k1] = breakLengths(b1) % Initialize n = length(b1); oneStart = zeros(1,n); % Where breaks starts oneLen = zeros(1,n); % Length of break k1= 0; % Number of breaks inOne...
df42ade6253f303b07634af3a35a7ea47be73809682a5d9647071fbb91c14623
MATLAB
885
24
figure; %% Pup contact subplot('Position',[0.7 0.61 0.2 0.17]); shadedErrorBar([],mean_z_score_all_days_all_mice_pup_contact,{@mean,@stderrm},'k') yticks([0 1 2 3 4]);yticklabels({'0' '1' '2' '3' '4'});xticks([0 211 422 633 844 1055 1266 1477]);xticklabels({'-2' '-1' '0' '1' '2' '3' '4' '5'});xlim([0 1477]);ylim([-0....
c9b065b2cf94145d6c004e5cd964c0ae846823f085cf6d86ef49e93b795d2a77
MATLAB
890
49
%% a = imread('bg.tiff', 1); b = imread('rat.tiff', 1); %% a2 = wiener2(a, [7 7]); b2 = wiener2(b, [7 7]); dI = b2-a2; dI_thr = dI > 2^5; %% a2 = uint8(filter2(fspecial('average', 3), a)); b2 = uint8(filter2(fspecial('average', 3), b)); dI = b2-a2; dI_thr = dI > 2^5; %% a = b2 = frame_smoothed; a2 = bg_filt; %% sub...
ce8542c6e4b47ba51e5182cd6ab53e851dfaf9383d43040ed9ee9dd1dc48d43e
MATLAB
891
27
function conditionarray = makeConditionArray(DE,NDE,PS,NS) condition= table(... [DE NDE DE NDE DE DE DE DE DE DE]',... %eyes1 [PS PS NS NS PS PS PS PS PS PS]',... %tilt1 [1 1 1 1 1 0 1 0 1 0]',... %tiltmatch [0 0 0 0 0 0 1 1 1 1]',... %suppres...
501e5bd0d4ac80834dedfd75a553ffbd57c10496c6b658f0b6204d18c4abad26
MATLAB
892
27
function data = get_data(swp) % get_data(swp) returns an array of values that would be generated for % the given Sweep object according to it's STEP,range(SDATA,EDATA) and NUM_DATA. % data will hold NUM_DATA values between SDATA and EDATA. if swp.num_data==1 data=swp.sdata; return; end index=0:swp.num_data-1...
592d614c02c51369d483676ccc6b308503bdf84b8a5da86abb4601dda1aafbed
MATLAB
892
30
% GET_RELATIVE_LOCATION returns the relative location of the given value % within the range of possible values of the given component. % LOC=GET_RELATIVE_LOCATION(COMP,COMP_VAL) returns the relative location of % the given value (COMP_VAL) within the range of possible values of the % given component (COMP). function l...
f4fec20f7c533cb3416e2c39ba0cc21c021af9fb9f1fa8a77a76a5d416cf8ed5
MATLAB
892
28
classdef GapStimulus < Stimulus %GAPSTIMULUS is a Stimulus that represents a gap. % Input arguments: % id=0, % startDelay=0, % sec % target=Target.Yes_Reward, % 'duration', 0.016 % sec % Author: Lasse Osterhagen methods function this = GapStimulus(varargin) ...
3ab532a8045af7782cd86948558b41adeafe3b31045de4ac8297a83aa33b4a76
MATLAB
894
30
classdef NullStimulus < Stimulus %NULLSTIMULUS is the absence of a Stimulus. % Can be used as catch/sham trial. % Input arguments: % id=0, % startDelay=0, % sec % target=Target.Yes_Reward, % 'duration', 0.016 % sec % Author: Lasse Osterhagen methods function this = NullStimulus(va...
14a054079df3c7ef00539fb40de006fb826714f235ea9f5ce07265f6cd684a64
MATLAB
895
32
function [Z_MIP, phi_MIP] = MIP_Queyranne( probs, options) %----------------------------------------------------------------------- % FUNCTION: MIP_Queyranne.m % PURPOSE: Find the minimum information partition (MIP) using Queyranne's % algorithm % % INPUTS: % see MIP_search_probs % % OUTPUT: % Z_MIP: the eset...
71dff4c202db9fed741cbad4beb4c4f6c05bf7dfca8cb588bbda3daa664a98cf
MATLAB
897
25
function [labels, tags] = loadLabels_folder(path) % First we look for all TIFF files in the given path fileList = [dir(fullfile(path, '*.tiff'));... dir(fullfile(path, '*.tif'))]; if isempty(fileList) warning(['No TIFF files found in ', path]); end files = {fileList.name}'; ...
111b6f2df3b2928e6bff76a079fe82fe7ac97f24d8000013f54ddd7a909917df
MATLAB
900
24
function axes1=SLMfigureset_ftn_h(position_and_dimension) xrange = 1280; yrange = 1024; figure1=figure(999999999); clf('reset'); % set(gcf, 'Name','SLM figure horizontal','NumberTitle','on','Position',[1921 0 1024 1280]); colormap('gray(256)'); % set(gcf, 'Name','SLM figure horizontal','NumberTitle','on','O...
992c10175ff947cb8871e069d4ad80161cafc4298f71fdf720ba081c5ddfb5fe
MATLAB
908
26
function times = DT_add_snr_times_to_ttl_times(ttl_times, snr_times, ... log_folder) % JN 2020-05-04, 2020-05-10 if length(ttl_times) ~= length(snr_times) log_msg(log_folder, 'fit-ttl-snr-error', ... 'No mechanism for fitting Deuteron TTL with SnR times active') times = []; % JN 2020-05-04 ...
ab6756afff87f4343530d78431680d683693ddeb76bc67b7b7821953178b255e
MATLAB
908
33
function stateTransition_plot_Fig05(theHbT,theEMG,theLFP,specT,specF,theTitle,plotTime,plotNum) hbt_axis=[-5,0,-15,-30;15,15,5,10]; emg_axis=[-1,-2,-0.2,-1;0.2,0.2,1,3]; figure(plotNum+50); subplot(2,1,1); hold on; yyaxis left plot(plotTime,theHbT,'r') ylim([hbt_axis(1,plotNum),hbt_axis(2,plotNum)]); ylabel...
db164df5c305aa8de652d295db1a5abfe20e079b99cae4ad29e81f291564489f
MATLAB
910
36
function [I_Na, dm, dh_1, dh_2] = fast_na(V, m, h_1, h_2, E_Na, data) RTONF = data.RTONF; F = data.F; g_Na = 0.003; Na_o = data.Na_o; h = 0.635.*h_1 + 0.365.*h_2; if(abs(V + 44.4) < 0.0001) alpha_m = 460.*12.673; % The limit calculated L'Hôpital's rule else alpha_m = -460.*(V + 44.4)./(exp(-(V + 44.4)./12.67...
8f3713ae12e8d02197d41e30a45906109be1b7a2f4db92594af3eb1d93caf1ba
MATLAB
913
21
%save composite array to tif in results folder function save_array_to_tif(pipeline_data, point_name, new_array, img_type) % get point folder [~, point_folder] = fileparts(point_name); if strcmp(img_type, 'composites') % break apart path name to get general folder, use to get to results folder ...
e1633fba5681528d094cd88854c7fb0a28cb70e00c4e2c408d5ac061d255038c
MATLAB
915
31
%COOL Cyan-magenta colormap % % Examples: % map = cool; % map = cool(len); % B = cool(A); % B = cool(A, lims); % % Similar to MATLAB's cool function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array...
cb8da653de7659f660cc48a54700c025a7c51a3d269e72d863f12afc4f943256
MATLAB
917
33
acceptable_lead_in = 60; % identify valid times to start recording valid = flipud(tdt); valid = conv(valid, ones(acceptable_lead_in, 1)); valid = valid(1:size(tdt, 1)); valid = flipud(valid); valid = (valid > 0); % starts of songs starts = 1 + find(valid(2:end) & ~valid(1:(end-1))); ends = find(valid(1:(end-1)) & ~va...
635cf0058b3cde848ce5d7f03ab65e84cfd6bb3a5da62af8f151187c114599bd
MATLAB
918
30
function analyse_stack_sizes() % === Get the file name ==== base_dir = 'C:\logging_data\'; [filename, pathname] = uigetfile({'*.txt'}, 'Select Movie(or few...)', base_dir); if isequal(filename,0) || isequal(pathname,0) disp('User pressed cancel') else disp(['User selected ', ...
6edda6408e5f3f3a18b40dbbbf97e9f62e80176a37a4286f492c4f8e5594300e
MATLAB
918
46
% plot3line % last update: 14-Dec-2022 % Mohammad Shams <m.shams.ahmar@gmail.com> function h = plot3line(x,A,color,crop,kstd,marker,sz) switch nargin case 2 color = lines(1); crop = 0; marker = 0; case 3 crop = 0; marker = 0; case 5 marker = 0; end if isemp...
c84fd88b4748ecc119e35111ecdb542dfb8763b79b4edf4bee8e69b32d31d7a8
MATLAB
919
53
function reformatLamLabLFP(IDX) %% format the LFP (ch x time x trls) for each session and export flag_saveIDX = true; %% find the number of sessions for i = 1:size(IDX.allV1,2) sessions{i} = IDX.allV1(i).penetration; end individualSes = unique(sessions)'; %% For loop on session for i = 1:length(individualSes) ...
492f0058b92cd7860e53917a959fb819ae5215b15c5f7e085c1b1c9a49b75d42
MATLAB
924
34
function [T, paramF] = createSILblock(Told,paramFold,nstims) % nstims=33; type = cell(nstims, 1); type(:) = {'freq'}; type = categorical(type); speaker = ones(nstims,1)*3; samp_rate = ones(nstims,1)*192000; % trial_dur = ones(nstims,1)*70; % stime = ones(nstims,1)*10; % etime = ones(nstims,1)*60; trial_dur = ones(nsti...
da19dea1a7d4c2f26ac6f150fc2d0929c21082ec89bbeee20793a53d6c20b4e3
MATLAB
924
26
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is NEW_ENV synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. switch nargin case 4 params=varargin{:}; if ~(ise...
6c3d42f7ac01186db893319f848180f672a9576f4bd30c180539d93c0bde2179
MATLAB
925
36
%% larger and smaller delta-theta neurons % indices for neurons based on the difference of preferred and prior directions % Fig. 4, d-e clear; clc; load('pf_tar_dirs.mat'); pfDir = pfDir_A; % pfDir_A: monkey A, pfDir_B: monkey B tarDir = tarDir_A; % tarDir_A: monkey A, tarDir_B: monkey B percent = 0.3; % difference...
c77f2becdf328caabc1b200eb4dc267fb62966d6b764ac668d9bf028cf68a0e0
MATLAB
926
21
%save composite matrix to tif in results folder function save_array_to_tif(pipeline_data, point_name, new_array, img_type) % get point folder [~, point_folder] = fileparts(point_name); if strcmp(img_type, 'composites') % break apart path name to get general folder, use to get to results folder ...
637aa8c31be79ed96b8f52eec6c26bcaab550a225b710bbf309b91deacdc0aad
MATLAB
927
39
function line=remove_formula(line,comp_tag) % REMOVE_FORMULA removes a tag-name from the tag-name list of graphical % objects that contain formula as an input. % LINE=REMOVE_FORMULA(LINE,COMP_TAG) removes the given tag_name from the % tag-name list of the given line which is a list of graphical objects that % contain...
c17506998175db9f518bfa5498aa267a061a5431d3b4af0b84650bb0b94bf051
MATLAB
927
31
%AUTUMN Red-yellow colormap % % Examples: % map = autumn; % map = autumn(len); % B = autumn(A); % B = autumn(A, lims); % % Similar to MATLAB's autumn function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truec...
d4046afae40d9f6cd92569230432c13ffd68556ee4e8276efa7c3096f948b6b1
MATLAB
927
28
%% This script extracts the demographics of selected subjects and saves % in a table in the following order: subj-id, age, sex, handedness % Christina Stier, 2020/2022 % get selection of subjects load('subjectnames_final.mat') % get full list of all subjects available subjlist = importdata('participants.tsv'); su...
0667ea4b32cc8e508af47100e38cc1bdbbfccb8d8e74e585b44a1f7be3aacb88
MATLAB
929
31
%WINTER Blue-green colormap % % Examples: % map = winter; % map = winter(len); % B = winter(A); % B = winter(A, lims); % % Similar to MATLAB's winter function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truec...
20c9be0e4c73bf6fe455a5796907748009f58a67116620f75e378b2a67969bcd
MATLAB
929
22
function CLASSIFICATION_PERFORMANCE = get_classification_performance(pred_type,real_type,printflag) if printflag figure; set(gcf,'Position',[80.2000 112.2000 727.2000 624.0000]); cm=confusionchart(real_type,pred_type,'RowSummary','row-normalized','ColumnSummary','column-normalized')'; else cm....
55eb1dd4953e8a7275370f527174a93ea6c65b338633adbd1b10d4376237cb0b
MATLAB
930
24
function AO_plot_SNR_trigs(snr_times, output_folder) % Function that plots the four trigger types logged by SNR along single time axis. h_f = figure('position', [30, 550, 1050, 530], 'visible', 'off'); h_ax = axes(h_f); event_types = {'state', 'snd', 'cam', 'bhv', 'SNR file number'}; for i = 1:4 ...
ff0186a1e9b8688f1c63c3930916622bdc9678bae4ed146b5911780527bac367
MATLAB
931
31
%SPRING Magenta-yellow colormap % % Examples: % map = spring; % map = spring(len); % B = spring(A); % B = spring(A, lims); % % Similar to MATLAB's spring function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a t...
a523bf7080e395398d9e0775b912b813f3f7cdc68886f20eab980d3ff183e8f9
MATLAB
932
37
function [T, paramFile] = createFileRow(Told,paramFileold,srcdir,filenames,trial_dur,att,speaker,noabort) nstims = length(filenames); filename = cell(size(filenames)); for i = 1:length(filenames) filename(i) = {[srcdir filenames{i} '.wav']}; end type = cell(nstims, 1); type(:) = {'file'}; type = categorical(type); ...
2d8ce074b287492e1eda3482a12c3f6c1595007b3571aac19b999eddadb021cd
MATLAB
933
27
function DT_produce_csv_file(csv_fname, folders) if isfile(csv_fname) log_msg(folders.results, 'found-csv', ... sprintf('File %s exists, not overwriting', csv_fname)); else for i = 1:length(folders.logger_csv) % JN 2020-05-11 iterate over the candidate folders for the file csv_fname = f...
242bac6ff0d35235e1425c35028b2fa767db15a8e2ba40d5a0968fc545b4e544
MATLAB
935
31
%SUMMER Green-yellow colormap % % Examples: % map = summer; % map = summer(len); % B = summer(A); % B = summer(A, lims); % % Similar to MATLAB's summer function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a tru...
3884be9ce2cbde7a813cccbba9505dae603184f92dabee9aabbea452f00ad42e
MATLAB
935
35
function [T, paramF] = createFSblock(Told,paramFold,att) type = cell(370, 1); type(:) = {'freq'}; type = categorical(type); speaker = ones(370,1)*3; samp_rate = ones(370,1)*192000; trial_dur = ones(370,1)*500; stime = ones(370,1)*200; etime = ones(370,1)*250; ramp = ones(370,1)*5; % played = zeros(370,1); played = cel...
f3d4e84ddc6f4650aa8317a8ae77d55cb98ea1c23cceea0fa72b357dfbfa5f9a
MATLAB
938
41
function MI1 = MI1_Gauss(Cov_X,Z) %----------------------------------------------------------------------- % FUNCTION: MI_Gauss.m % PURPOSE: calculate Multi (Mutual) Information given covariance of data % % (Ay, 2001; Ay, 2015, Entropy; Barrett & Seth, 2011, PLoS Comp Biol) % % INPUTS: % Cov_X: covaria...
2e9c07724df9d20caf620ebdbd13e95d4392a31034033bf4a779cd9c715f3ca0
MATLAB
941
26
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is MTF synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. switch nargin case 4 params=varargin{:}; if ~(isempty...
90828f608f4e72405a98eb29ed04673bcb24171982e7b1592760da6861112ad7
MATLAB
944
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin; ...
d724d085c20582b6ea9a196eb1296d75b86fc1ee59535334614d6b6a9e131a43
MATLAB
944
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin; ...
6598639de7d45e55dfd24e616677f4ca3f12ab95809ff102f16785d1dd062723
MATLAB
945
32
function [start_trial_points,stime_points]=generate_timing_points(handles,line,trial_dur,circuit_samp_rate) stimlist = handles.stimlist; samp_rate=stimlist.T{line,'samp_rate'}; minimum_stime = stimlist.T{line,'stime'}; num_points=ceil(samp_rate/circuit_samp_rate)*1000; len=min(round(samp_rate*(minimum_stime/1000))+nu...
ee147aab15fc3bc39f80e70cb8abee59c253e29f12d4ca5916a7ab45aed5bbea
MATLAB
945
21
function [] = MIBItestBackgroundParameters(reuseFigure) global pipeline_data; point = pipeline_data.points.get('name', pipeline_data.background_point); countsAllSFiltCRSum = point.counts; labels = point.labels; capBgChannel = pipeline_data.capBgChannel; t = pipeline_data.t; gausRad = pi...
773ab9fb98c66d24e416d1aa06ac88a0d4c564674c034a02cab8fdbc63c88e60
MATLAB
947
23
function m_sig=add_to_comp_list(m_sig,comp_type,comp) % ADD_TO_COMP_LIST adds a component to the given Main Signal components % list % M_SIG=ADD_TO_COMP_LIST( M_SIG,COMP_TYPE,COMP) adds the given component % to the given Main Signal components list and the given component name to % the given Main Signal component nam...
eddf67c4f528edccc675d90cd9438a822fdb6cd70e6081c51aa71b12c7c9af14
MATLAB
947
31
function val = get(m_sig,prop_name) % GET Get Main_signal property from the specified object % and return the value. Property names are: % Name, Signal, Level_comp, STime_comp, ETime_comp, Ramp_comp, Envelope_list, % Num_of_env, Comp_list, Comp_list_str. if isa(prop_name,'char') index=strmatch(prop_name,m_sig.comp...
7a02b91ab07fb90a95facd1d546a06614288fac1ec446e051a2c4579c49b6468
MATLAB
948
30
%HSV2 Black to red variation of the hsv colormap % % Examples: % map = hsv2; % map = hsv2(len); % B = hsv2(A); % B = hsv2(A, lims); % % A variation of MATLAB's hsv colormap, which starts in black. % % The function can additionally be used to convert a real-valued array into % a truecolor array using...
a47ed31b48c46e0c7fbf6fa9f1d2eb3844bc349688500f7821888eeeae5ed0c2
MATLAB
948
30
function [out, groups] = funcByGroup(values, grouping, func) %FUNCBYGROUP apply a function to every group of values. % Arguments: % values - an array of all values % grouping - an array of the same size as values that specifies to which % group the value belongs % func - the function that should be applie...
2ef3d0830981667401ffac49756e52a725ccd55007c6cc3f79c8b8ff40e49345
MATLAB
950
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin; ...
c39136ddfe520b794eb087d16d09eeb080dc3c694aa31340538c58c9b04abdbc
MATLAB
950
29
function [I_Kto, dr, ds_1, ds_2, ds_3] = transient_outward_k(r, s_1, s_2, s_3, V, E_k) g_Kto = 50.02*10; I_Kto = 0.35.*g_Kto.*r.*(0.59.*s_1.^3 + 0.41.*s_2.^3).*(0.6.*s_3.^6 + 0.4).*(V - E_k); g_sus = 2.4; % Conductance of the sustained current [nS] E_sus = 70; % Reversal potential of the sustained current [mV] Isus =...
fd02f56bfa8533b2c33bf1e1050cca89acbae5b982a61899073769925f051d87
MATLAB
950
42
clc clear close all load stat_for_fig04D.mat %% figure('Units','normalized','OuterPosition',[.1 .1 .06 .13]) hold on plot_stats(thresholds,adjr2,'k'); ylabel('Adj R^2') xlabel({'o2o threshold wrt', 'chance performance (%)'}) % title('Two-Gaussian fit evaluation') set(gca,'YTick',0:.5:1) set(gca,'xtick',5:5:15) xlim...
c6de2037117d552775d8b610b9da2620f406965b93e2e8bbc7f889b22f742e30
MATLAB
952
27
function makeLaserGapThresholdExpFiles(subjectID) %MAKELASERGAPTHRESHOLDEXPFILES creates gap detection experiment files with % laser stimulation from fixed parameters. % Arguments: % subjectID - a string identifying the subject for which the session % files are constructed. % Author: Lasse Osterhagen rng...
2bb65e40a1961e34136aa1aede7c00d1945f32f25f91858190c66388d60ce570
MATLAB
954
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin; ...
889c0bf3127feabca01a2780be508fbe19bca167426b4474fc4f17829d0de0e7
MATLAB
954
40
% To plot a bar plot with errorbards indicating 95% confidence intervals % calculate the function plotBar(A) % A: cell or mat (repetition x category), comma separated! if isnumeric(A) for icol = 1:size(A,2) A_cell{icol} = A(:,icol); end A = A_cell; end ncat = numel(A); % number of cate...
9b507b3372793a015c164cbaf20cd65ef688970b6239a60cecec7f49ff4975e4
MATLAB
954
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin;...
11cfc57bf93b1f43c459505cd8e3127140aa2bb40a6657c4a264e7ec233920ae
MATLAB
958
41
classdef (Abstract) Stimulus < AudioObject %STIMULUS is the base class for stimuli. % Author: Lasse Osterhagen properties % Reward Target (Target.Yes_Reward, Target.Yes_NoReward, Target.No) target end methods function this = Stimulus(id, startDelay, duration, target) this.id = id; this.s...
658a25bdd6cc1a495714131bb925c5550f795c445ad5678fce4ee640b646afe0
MATLAB
958
41
function [h1, h2] = plot_dir (vX, vY, xPos, yPos) %function [h1, h2] = plot_dir (vX, vY) %Plotting x-y variables with direction indicating vector to the next element. %Example % vX = linspace(0,2*pi, 10)'; % vY = sin (vX); % plot_dir(vX, vY); rMag = 0.8; % Length of vector lenTime = length(vX); % Indices of ta...
6953c173109951df20dd8c5deac9bf100e5584856de17a13f511575801fc42f8
MATLAB
958
31
%COPPER Black-copper colormap % % Examples: % map = copper; % map = copper(len); % B = copper(A); % B = copper(A, lims); % % Similar to MATLAB's copper function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a tru...
1be033fbbf1bf8886ae3d68e4397eeaed65fdc0df861d630e4f05e0d944cbfc2
MATLAB
959
56
function DFF=fb_compute_dff(CA_DATA,varargin) %fb_select_roi selects an arbitrary number of roi's for plotting % % % % % per=2.5; baseline=3; nparams=length(varargin); if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(varargin{i}) end end DF...
a23817ba52038a755039f35960275c94cb42432197901449449feb7636a6e1e7
MATLAB
960
21
function [] = MIBItestBackgroundParameters_3(reuseFigure) global pipeline_data; point = pipeline_data.points.get('name', pipeline_data.background_point); countsAllSFiltCRSum = point.counts; labels = point.labels; capBgChannel = pipeline_data.capBgChannel; t = pipeline_data.thresholds; g...
0fe4f8831c77471125f55c02cf5756e5417b5ce306e06af256b735bd01e3fc0d
MATLAB
961
24
function [test_RECALL, test_PRECISION] = test_classification_performance(PERFORMANCE, PERFORMANCE_surrogate) % disp('RECALL: DIAGONAL ./ SUM TRUE PER TYPE'); test_RECALL.test_val=PERFORMANCE.meanRECALL; test_RECALL.mean=mean([PERFORMANCE_surrogate.meanRECALL],'omitnan'); test_RECALL.std=std([PERFORMANCE_surroga...
6a496534d81cc71245ee35c1fff1d15cda538c9ee9bee6bf392b50d6a8083dfa
MATLAB
961
33
function out = SLdshear(in,k,axis) %UNTITLED Summary of this function goes here % Detailed explanation goes here if k == 0 out = in; return; end rows = size(in,1); cols = size(in,2); out = zeros(size(in)); if axis == 1 for col = 1:cols out(:,col) = circshif...
6bc29ccd3e83ff6bb033c4c2f52b11afec835c120bd8539f06fa091fe0130dfc
MATLAB
962
31
%% % This function creates the feedforward input the goes into the non-spatial % model %% function [Ix1e, Ix1i, Ix2e, Ix2i] = ffwd_smooth_input(num_ffwd_inputs,... taux,dt,Nt,mxe,mxi,sigma_s) % Kx needs to be the sqrt of the desired auto-covariance % in the sense of convolutions, ie Kx*Kx=Ax...the math works! Kx=s...
55deb27ac0d281c281c9d0e64d8fa22fd3cef44e03103d54f19aaa7a4b88db69
MATLAB
965
36
function y=trapmf_mat(x,a,b,c,d) % Construction of trapezoid-shaped fuzzy membership functions % (Matrix Version) % %y=trapmf_mat(x,a,b,c,d) % % INPUT: % x: input value (number of matrix) % [a,b,c,d]: main points of the trapezoid % If b=c: triangle % If a=b: initial...