sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ed7b9ee29f43d248306079e60267a8827590ebdafda49dbf75171ad35a483cd4
MATLAB
588
26
function b2 = FitVMLikelihood(data) %% choose initial parameters [mu, k, p] = MixedVonMisesFit(data); p1 = p; p2 = 1-p; p3 = 0; b = [mu; k; p1; p2; p3]; %% fit data options = optimoptions('fminunc', 'GradObj', 'on'); b2 = fminunc(@(b) VMMix_logF(data, b), b, options); %% plot fit % figure; % plot histogram numBins...
020350882bb57250ece16cee1214af70f8d78eb4d44c74695133a282add53318
MATLAB
589
20
function p = MD_unipdf(x, a, b) % _ % Probability Density Function for a Continuous Uniform Distribution % FORMAT p = MD_unipdf(x, a, b) % % x - an N x 1 vector of values (domain: a <= x_i <= b) % a - a scalar, the lower end of the uniform distribution % b - a scalar, the upper end of the uniform distribut...
02c66e42da3f087d306fc12a16cf6a490c7048371f773fbee291bd3bfdd35091
MATLAB
589
24
function PrairieLinkPlayer() % Lloyd Russell 2017 % displays the raw data saved by PraireLinkRawDataStream for quick inspection % choose file [FileName, PathName] = uigetfile('*.bin'); FullPath = [PathName filesep FileName]; cd(PathName) % read data data = PrairieLink_ReadRawFile(FullPath); NumFrames = siz...
d483100961026d65bdc9aa5863fb74ff442337af3030ee16ba916f9310aee09d
MATLAB
589
18
sources_table = abannotate_get_sources; parcellated_data_path = 'pls_ukb_bootstrap_schaefer100_df.csv' parcellated_data = csvread(parcellated_data_path); opt.n_nulls = 1000; opt.atlas = 'Schaefer' opt.phenotype_data = parcellated_data; opt.GCEA.correlation_method = 'Spearman' % Cell type analysis opt.analysis_name ...
b5e36702ed9573c40e0a1a79713613ca6bbf13784043b2e6b92cb69b0293cf12
MATLAB
590
22
function [x] = shuffle_channels( x ) % *WAVE* % % SHUFFLE CHANNELS randomizes the spatial position of channels in a % datacube, so that any spatial autocorrelation % is destroyed while leaving the temporal % structure intact % % INPUT: ...
06d98fbe0cb1707e551cbd0dfe8ae120a6ff7df1cc4fa0cf18a4814436f0526d
MATLAB
592
20
function [r,p_val] = NB_corr(data,raster_params,directions, ind) spikes =[]; RTs =[]; boolFail = [data.trials.fail]; [~,match_d] = getDirections (data); % substract RT average in direction to reduce directional variance for d = 1:length(directions) inx = intersect(ind, find ((~boolFail)... & match_d == dir...
a63631cbbeeba1d8215e72573e816b7900ecf2656ba135a37e23ebc11aa2ba10
MATLAB
592
18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Authors : CHATENET Louis % Date : 24/05/2018 % Updated : 30/05/2018 % Version : V2.0 % % Description : AMPA current calculation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Isyn, r] = IsynAMPA3(dt...
c9136d0cad38afa572f816722e3e16e26938b474f918bff9839e8f6ff2b9fc4c
MATLAB
592
36
function [eigvec, eigval, eigval_full] = eig1(A, c, isMax, isSym) if nargin < 2 c = size(A,1); isMax = 1; isSym = 1; elseif c > size(A,1) c = size(A,1); end; if nargin < 3 isMax = 1; isSym = 1; end; if nargin < 4 isSym = 1; end; if isSym == 1 A = max(A,A'); end; ...
9de5a41a2825f1baa0aac3dcc5d60a1054e7a24c0a4b498b17671a9c688dcde2
MATLAB
593
22
function cluster_frequency_rejection_211021(folder_address,rec_leng) cap_freq=10; max_clus_size=cap_freq*rec_leng; cd(folder_address) times_dir=dir('times_*.mat'); times_name=string({times_dir.name}); for i=1:length(times_name) load(times_name(i)) num_classes=max(cluster_class(:,1)); for j=1:num_classes ...
ab2ddfbd4d8436da3c011bcada56030c4db3785314d09f45625aa3e4a36992e0
MATLAB
593
17
function plot_handles = assignColorsToLines(plot_handles, color_map_matrix, color_field_name) % this will work with bar handles if the color field name is provided % ('FaceColor') if size(color_map_matrix, 1) < length(plot_handles) error('color map matrix should be a Nx3 matrix of rgb colors, with N >= length(plot_...
cd8f2270f20601b287440ae570ee729df793370cd2dd6dfdeb0b8eba7f47aaaf
MATLAB
593
43
function [bias1] = CrossCorrBias2(Sdata, nbins, binsize) n_cells = length(Sdata); bias = ones(n_cells,n_cells) * NaN; for i = 1:n_cells for j = 1:i-1 [Crp{i,j}, B] = CrossCorr(Data(Sdata{i}), Data(Sdata{j}),... binsize, nbins); if(sum(Crp{i,j}) == 0) birp = 0; else birp = ...
0f85186f0f5de94b5eaa1c0e654638b0c6ab2f04a155317338ae6e3169830c46
MATLAB
594
21
function [old_dirs,old_stps,Hdiag] = lbfgsUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) ys = y'*s; if ys > 1e-10 numCorrections = size(old_dirs,2); if numCorrections < corrections % Full Update old_dirs(:,numCorrections+1) = s; old_stps(:,numCorrections+1) = y; else %...
a52eec970d285aff33b50a679123f5722cbb999252eaac6f5bcb2c9d6186155b
MATLAB
594
21
function [rho,phi] = cart2poln(data) % [rho,phi] = cart2poln(DATA) % transforms the p samples of cartesian N-dimensional data (Data is a p-by-n matrix) into spherical coordinates (N-sphere) % rho is a vector of length p, phi a matrix of angular values of size p x n-1 % Adrien Peyrache, 2013 squared = data.*data; N...
5987a9052168b75688ebadd635b5dafbf4909cfe8f4e311b2f54ef47023bda92
MATLAB
595
17
% Equivalent to typing 'summarize(subj)'. For lazy people. % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % information. % % The Princeton MVPA toolbox is avail...
dd9c9ec015e0372a746c203bf7ffc8fa19d1f86e6f6a1eab0b4726fb3845b591
MATLAB
598
20
raster_params.allign_to = 'cue'; raster_params.cue_time = 500; raster_params.time_before = 300; raster_params.time_after = 700; raster_params.smoothing_margins = 0; raster_params.bin_size = 10; raster_params.plot_cell = 1; %% cells that are simple random noise for t = 1:length(data1.trials) data1.trials(t).spi...
d10bab1da2d8600b47884c8e59361bbccd5890ea63264e490bbac63ee38f6161
MATLAB
599
25
function dirNode(treeHandle, topFolder, varargin) % DIRNODE generate parent node and walk subfolders (1 level) to create % child nodes to parent node treeHandle % % VARARGIN % context menu: Open % % $Author: Peng Li % $Date: Mar. 22, 2021 % % root node [~, f] = fileparts(topFolder); rnode...
3a0365ef47d0b1e344afbafb0972d8f279e8c06011ed5201606ef0e3a345a53e
MATLAB
600
18
% figure for IZ param ranges ranges=[0.62 0.98; 0.004 0.005; -23.77 11.69; 3 119; 118 131; -62.65 -58.53; ... -43.6 -43.52; 7.85 11.48; -52.68 -49.52]; for i=1:9 r1=ranges(i,1); r2=ranges(i,2); data_range = linspace(r1, r2, 10); s_plot = subplot(9, 1, i); plot(s_plot,data_range,1) %xlim([r1 r2...
4acb562911bf82a688282c9137705978b45638913158f849aae4bfeaa6abe554
MATLAB
600
35
function r = Rate(S0,varargin) % Returns a vector containing the time of the last event of each tsd % % USAGE: % eno = Start(tsa,is) % % INPUTS: % tsa - a tsdArray % is - an intervalSet % % OUTPUT: % eno - an vector of time % copyright (c) 2009 Adrien Peyrache adrien.peyrache@gmail.com r = [...
0bf1ffc2a2495932e4fb7e9c9d9a964110a6bee6a453b7ff9e6005c1a9bacd4c
MATLAB
601
25
function [ripTsd ripEp] = LoadRipples(fbasename,varargin); % Load ripple times from a .sts.RIPPLES file % % USAGE: % [ripTsd ripEp] = LoadRipples(fbasename); % % INPUT: % fbasename: session file basename % % OUTPUT: % ripTsd: a tsd of ripple times % ripEp: a intervalSet of ripple events (beginnings and en...
522efc8de22a7bae8dc1958aa4918aea07595ac73ee7b72c3a74cfda7a62eba4
MATLAB
601
10
function add_scale_bars(ax,quantity_xaxis,quantity_yaxis,shift_from_origin) %x scale bar: disp(['x scale bar is ' num2str(quantity_xaxis)]); annotation('line',[ax.Position(1) ax.Position(1)+(quantity_xaxis*ax.Position(3))/range(ax.XLim)]-shift_from_origin,[ax.Position(2) ax.Position(2)]-shift_from_origin,'...
1fca852a7c9c30de9a17020f9e2a559657b870c1245780ee533255fe5642be98
MATLAB
602
26
function [xf] = generate_damped_sin( dt, T, frequency, tau, phase_angle ) % *WAVE* % % GENERATE DAMPED SINE WAVE TEST DATA generates a simple test damped sine wave for % use with the functions in WAVE % % % INPUT % dt - timestep % T - epoch length (s) % frequency - frequen...
3f1544fd6003ce715c970fa965cd612cabc5c81bc5c144ea657ab8c6d52ad5e3
MATLAB
602
21
function y = linef(lambda, fn, x, d, varargin) %LINEF Calculate function value along a line. % % Description % LINEF(LAMBDA, FN, X, D) calculates the value of the function FN at % the point X+LAMBDA*D. Here X is a row vector and LAMBDA is a scalar. % % LINEF(LAMBDA, FN, X, D, P1, P2, ...) allows additional arguments t...
7613b16172d73b2da81927242eeaf6ebc679137ea13e92e1157fdf608cff8b13
MATLAB
602
19
function [z] = cellcat(dim, x, y) % [Z] = CELLCAT(DIM, X, Y) outputs cell-array Z with the same dimensionality as X and Y % Each cell in Z contains a concatenation of the corresponding arrays in X and Y, % along dimension DIM % % X (and Y) should be linear cell-array(s) of matrices for which the number of rows (if di...
5b72bb44b5ab356735f622cc32274b9f89374c01dabde40129ce8acd0d66299b
MATLAB
604
18
function start_eyetracker(Experiment) if strcmp(Experiment.Mode.eyetracking,'Yes') % start recording eye position (preceded by a short pause so that % the tracker can finish the mode transition) % The paramerters for the 'StartRecording' call controls the % file_samples, file_events, link_sample...
f78d209015f16b9913c6f7c998d12b14a2f24e0696a96daeec0029218e1f5e86
MATLAB
604
28
function [xo] = notch_filter_matrix(x, f1, f2, filter_order, Fs) % *WAVE* % % NOTCH FILTER notch filter a datacube between frequencies f1 and f2 % % INPUT: % x - datacube (r,c,t) % f1 - low frequency for notch % f2 - high frequency % filter_order - filter order ( x2 for bandpass filter ) % Fs - sampling frequency ...
9f1c83d4d77a74050bae255dcb72731044ad7a8d0c37aa59f329dc02a024e8c6
MATLAB
605
29
function [allBins, Std_mean, Std_median] = VF_weighted_Std(Quiver) % input Quiver to weigh the std (column 9) by the occupancy in each bin % (column 7) % output for weighted average and median std % output for all std values for new histogram plot if isempty(Quiver) == 0 Std = Quiver(:,9); Occ = Quiv...
a0cf42c5460b44ef4def74af069f91f16dfa2a857f7ec7e812c72aec8771ad47
MATLAB
605
28
%% Run PLS analysis %% %% Read in data and functions workdir=''; addpath(genpath('/dagher/dagher11/filip/Obesity_maps/scripts/')); addpath(genpath('/dagher/dagher11/filip/Obesity_maps/data/')); addpath(genpath('/dagher/dagher11/filip/Obesity_maps/data_old/')); BMI='UKBB_CT_DKT_LHRH'; nsynth='Nsynth_DKT_thickness_LHR...
25cfbd318b355a8dad3cb81e29b301af87f3620c99fb268773f1e9d378a0388e
MATLAB
606
25
function s = times(a,b) % Overload of the .* operator % % USAGE: % s = times(a,b) % % the .* operaetor is defined to return a tsd with same timestamps and % data that are the difference of the data. Returns error if timestamps of the % two object don't coincide % copyright (c) 2004 Francesco P. Bat...
106bede143a9d04a118690f10272e171cc78cae28e0698f8ef618277f5e35b5e
MATLAB
608
23
function [c] = sompak(net) %SOMPAK Combines node weights into one weights matrix. % % Description % C = SOMPAK(NET) takes a SOM data structure NET and combines the node % weights into a matrix of centres C where each row represents the node % vector. % % The ordering of the parameters in W is defined by the indexing of...
70d77cf77232bb085154e30296b3ef663ff19411b7b2d9234ef2d473e8da03a1
MATLAB
610
17
function CalculateDifferenceImage(exportFolder, diffImageParams, origImage, smoothImage) % Params corrThresh = diffImageParams.corrThresh; % Calculate Difference Image % corrPeaks = GetCorrPeaks(smoothImage, corrThresh); corrPeaks = 3 + zeros(30, 1); origDiffImage = CreateFinalImage(origImage, corrPeaks); smoothDiffIm...
a7fe517d5ba0c5ea09080cd52d6b2bb8ffdf38de2a5d701e897235e70a71dd77
MATLAB
610
36
function C = ReactCC(X, Y) % C = ReactCC(X, Y) % % coompute the correlation coefficient between matching columns in the % matrices X and Y, taking care of NaNs if any(size(X) ~= size(Y)) error('X and Y must have same size'); end mk = zeros(size(X)); mk(find(isnan(X .* Y))) = NaN; X = X + mk; Y = ...
f90e6b4c9364748eabf5694346aa845f65047666eeca5e184c924777dcd4c71c
MATLAB
610
39
function r = MatrixCorrCoef(A, B) % r = MatrixCorrCoef(A, B) % % Computes the correlation coefficient between the vectors of the % off-diagonal elements of the square matrices A and B % INPUTS % A, B: two square matrices of the same size % OUTPUTS % r: the correlation coefficient % batta 2000 [N, N1] = size(A); if ...
1453648eb79af7bf66fa0c2aaa0d569c5bcdb37131f6fcef49211f9bc14439b2
MATLAB
611
15
function [sectionPaths, sectionNames, sectionRootFolder] = s3GetAllSlidesOfSubject(subjectPath) %This function returns all slides owned by a subject sectionRootFolder = awsModifyPathForCompetability([subjectPath '/Slides/']); [sectionNames, sectionPaths] = awsls(sectionRootFolder); isFolder = cellfun(@(x)(contain...
6eb8816d6c6aa3184405931d5b837caf749340934bf32b9b21b02873df57ef61
MATLAB
611
18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Authors : BEAUBOIS Romain % Date : 30/03/2020 % Updated : 30/03/2020 % Version : V2.0 % % Description : GABAa current calculation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Isyn, r] = IsynGABAa3(...
bb31d97874fd9105edfee3535c07574a68d70b93ea52856f56b58462e8f28589
MATLAB
612
28
function [cmds, errs, msgs] = gitSubmodulesUpdate(repo, options, preview) cmds = {}; currdir = pwd; if ~exist('repo','var') || isempty(repo) repo = [pwd, '/']; end if ~exist('options','var') options = 'init'; end if ~exist('preview','var') preview = false; end repoFull = filesepStandard_startup(repo,'fu...
bf684cdb84c5d7ca7f665076d65e30d1ac69c7c7eb66db7aefaa7068afcf7cc6
MATLAB
612
23
function boxplot_r_jin(Perm_r,corr_r,Ylabel,pic_size,output_path) figure; [B,I] = sort(corr_r(:,1),'ascend'); Perm_r_new = Perm_r(I,:); Ylabel_new = Ylabel(I) boxplot(Perm_r_new','Orientation','horizontal','Whisker',3,'color',[137 137 137]/255) set(gca,'FontSize',18); set(gca,'LineWidth',3); set(findobj(gca,'type','l...
333e0943f4e6b9ebcff8caa246b65d5f228c85961e4d84c843cd6665afadab55
MATLAB
615
14
function decoding_out = RFEselect_test(labels_test,vectors_test,cfg,model) switch lower(cfg.decoding.method) case 'classification' [predicted_labels accuracy decision_values] = svmpredict(labels_test,vectors_test,model,cfg.decoding.test.classification.model_parameters); case 'regression' ...
47c5d1667fe4390408e82d3e80326fb7a3ff708f38aac58adfb8cf55732f78ee
MATLAB
615
26
function [bsResult] = bootstrap_analysis(data,n1,repeatNum) %BOOTSTRAP_ANALYSIS ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % ´Ë´¦ÏÔʾÏêϸ˵Ã÷ % if ndims(data) > 1 % disp('Input data for bootstrap analysis must have only 1 dimension!') % return % end if nargin < 3 repeatNum = 1000; end bsResult.repeatNum...
a7f888ce3d98c172526c5428ea8c2a4abf5ccc1cf769f56c7ebe383ff8550b62
MATLAB
615
17
function filtered_exptracelist=merge_and_filter_short_links_s(tracklist,segmentlists_time,segmentlists,length_filter,tmax_local) fet=1; filtered_exptracelist=[]; for tracklist_id=1:numel(tracklist) new_track=NaN.*ones(1,tmax_local); for segment_id=tracklist{tracklist_id} start_time=(segmentlists...
cf342f9831c9d386c9a88e305b900c52295b641caff3a42b92e7780053552f41
MATLAB
615
17
function filtered_exptracelist=merge_and_filter_short_links(tracklist,segmentlists_time,segmentlists,length_filter) global maxtime fet=1; filtered_exptracelist=[]; for tracklist_id=1:numel(tracklist) new_track=NaN.*ones(1,maxtime); for segment_id=tracklist{tracklist_id} start_time=(segmentlists_t...
5437a0f74a718a92277540e87f25654b85f6d91ffaa0c54b0ec84530e03cc95c
MATLAB
616
16
function [LABELS] = MultiLineLabels(LabelMatrix) %MultiLineLabels takes a cell array of labels (columns are different %labels, rows will be different lines of the labels) and converts it into %individual labels BaseString = '%s'; AdditionalString = '\\newline%s'; AddStringRep = repmat(AdditionalString, 1, size(...
9c6eb9bc863d11003a177d0ef0d0a1269298f7dc52cf37faf4e13bcb40bb77fe
MATLAB
617
24
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'SNR'}; req_params.num_trials = 50; req_params.ID = 4000:5000; req_params.task = {'choice|saccade_8_dir_75and25|pursuit_8_dir_75and25'}; lines = findLinesInDB(task_info, req_params); median(...
2d004396099415c83f3075f2990ddc7d9f82d47ca4756a7a523bca86c8f28cc6
MATLAB
618
29
function h = histp(x, xmin, xmax, nbins) %HISTP Histogram estimate of 1-dimensional probability distribution. % % Description % % HISTP(X, XMIN, XMAX, NBINS) takes a column vector X of data values % and generates a normalized histogram plot of the distribution. The % histogram has NBINS bins lying in the range XMIN t...
6590eb36315babdeff5968dde15c57b1f34ad71b18a3d12c13a446e719c5dd29
MATLAB
618
19
function [selected_Traj, sample_idx] = SubsampleTraj(Traj, k) % subsamples the same number k of trajectories for each session % if there are less than k traj in the session it will take all trajs numTrials = size(Traj,1); if numTrials < k selected_Traj = Traj; sample_i...
91c83370ebba860a3c6e010aebde40a61bbe94c2990e8fa128723935edc04591
MATLAB
618
24
function [logalpha1,loglik1] = VBHMMforward(v,phghm,ph1,logOutput) T = size(v,2); H = size(logOutput,1); logalpha1 = zeros(H,T); for h = 1:H logalpha1(h,1) = logOutput(h,1) + log(ph1(h)) +1e-100; % eps end for t = 2:T phatvgh1 = zeros(H,1); for h = 1:H phatvgh1(h) = exp(logOutput(h,t)) + 1e-100;...
0543269184ea99feab662ca1b82bd5eebd1d1265942847ceaa9db21e52439dc0
MATLAB
622
26
function [states, stateCell] = estimateStatesByVitterbi(data,model,logOutProbs) Wa = model.Wa; Wa = Wa'; K = size(Wa,1); Aest = Wa./repmat(sum(Wa,2),1,K); Aest = Aest'; Wpi = model.Wpi; piest = Wpi./sum(Wpi); nSubjs = length(data); states = []; for ns = 1:nSubjs [M,T] = size(data{ns}); pvgh = zeros(K,T); ...
2925a39538f2c9cc39082d2cd296a7164bd54efd4bc2dd59c8e42e10fb9218a6
MATLAB
623
30
function combineFiles(filepathname) [~, savename] = fileparts(filepathname); PFs = 0:.1:1; clear E K1 K0 K2 for ii = 1:length(PFs) try D = load(fullfile(filepathname, sprintf('%s_%gPF.mat', savename, PFs(ii)))); catch continue; end K1(ii) = D.K1; K0(ii) = D.K0; K2(ii) = D...
6fa2909f699f6bf3ef10790134b1505655125e1438a10f10ce42a2a77f021fa9
MATLAB
623
23
function net = somunpak(net, w) %SOMUNPAK Replaces node weights in SOM. % % Description % NET = SOMUNPAK(NET, W) takes a SOM data structure NET and weight % matrix W (each node represented by a row) and puts the nodes back % into the multi-dimensional array NET.MAP. % % The ordering of the parameters in W is defined by...
57fe2b15fef9a18c90e684f38ba559a0bc3ce752f88834f1ae01ac8c1f0852b4
MATLAB
624
14
%% %% Script to load spike firing times for a cell %% c_ts: firing times, root.cel_x{1,1}: spike x coordinates, %% root.cel_y{1,1}: spike y coordinates %% reference: https://github.com/hasselmonians/CMBHOME/wiki/Tutorial-2:-Apply-an-epoch-and-get-theta-signal %% function pos=load_and_format_spikes(file_to_reformat...
9a485c165355aab440440f82e40961be64128f1765aa43eaca86858edcf53497
MATLAB
624
29
function L = CrossValidationSpatialCheck(S,lambda,x1,x2,X,Y,ep) nbEp = 10; epV = regIntervals(ep,nbEp); L = zeros(nbEp,1); for ii=1:nbEp ix = (1:nbEp); ix(ii)=[]; testEp = epV{ii}; trainingEp = epV{ix(1)}; for jj=2:nbEp-1 trainingEp = union(trainingEp,epV{ix(jj)}); trainingEp...
6a75dc401b89158da08850967ede263208e06d0e22e890ad00d1c6067c33fa79
MATLAB
625
16
% @author Farad Khoyratee % @date 16 Apr 2019 % @copyright % SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com> % SPDX-License-Identifier: GPL-3.0-or-later function simplified_rV2= simplified_rV2(v, rpre, dt) inf = (2^-1)*tanh(-(2^-6 + 2^-7)*v-1.404)+0.5193; % tau = ((-0...
4f24c6395296bade0213f7c26a004331c4614e23eeae37f9747fa492b9585b6c
MATLAB
626
35
function t = compatible_ts(tsa, tsb, tl) % Tells whether two tsd's have the same timestamps, within relative tolerance % % USAGE: % t = compatible_ts(tsa, tsb, tol) % % INPUTS: % tsa,tsb: two tsd to compare % tol: tolerance (default 0) % % OUPUTS: % t: scalar value % % copyright (c) 2004 France...
f2e1e41e2a448758501d947774f0c9a439df679dced2d5e0f93d4ea8b1f80de1
MATLAB
626
28
function PoSubPaper_GetTCxcorrs load(fullfile('Analysis','HdTuning_moveEp')); smoothTC = 3; % smoothing of tuning curves (3 used in Duszkiewicz et al., 2024) hAll = hAll(:,:,smoothTC+1); if size(hAll,1) > 360 hAll = hAll(1:end-1,:); end [bins,totC] = size(hAll); allPairs = nchoosek(1:totC,2); % calc...
16ac952077c37d6cd1f6d2d9825ae8ce55cb7a92cf9439ef3ae98bdf60631dc0
MATLAB
627
28
function [xo] = bandpass_filter_matrix(x, f1, f2, filter_order, Fs) % *WAVE* % % BANDPASS FILTER MATRIX filter a matrix between frequencies f1 and f2 % % INPUT: % x - matrix (r,t) % f1 - low-frequency cutoff % f2 - high-frequency cutoff % filter_order - filter order (N.B. doubled for forward-reverse filter) % Fs - sa...
64f55f13cdc47b320dc52eb7f692a01232851166496586459b5b286b58973a78
MATLAB
629
22
function plottracks_s global ax global text_spot_num global framenum global A_time_s global plotted_neurons global neurons_tmp_unsorted_s a=1; try delete(plotted_neurons); end plotted_neurons=[]; for i=1:numel(A_time_s{framenum}) if ~isempty(A_time_s{framenum}(i).color) hold on pl...
bc5c45dae2e0e432bd4d03c5a75263e63600fda3296a849a7b29ae291b289850
MATLAB
630
31
function s = vertcat(a, b, varargin); % Vertical concatenation of TSDs (overload of the [a; b] operator) % % USAGE: % tso = vertcat(tsa, tsb, ...) % % arguments must be all tsd, the cat function is used % copyright (c) 2004 Francesco P. Battaglia % This software is released under the GNU GPL % www.g...
c8dff001feef67f7f8e46e1032bf691c5a1c673d7d27a9234381456698809e8f
MATLAB
630
21
%returns timestamps of trials in a cell array % %stimuliTimestamps: first column is begin timestamp, second column is end %timestamp of trial % %returns a cell array of trials % %urut/may04 function [trials, indsAll, indsOrigPerTrial] = getTimestampsOfTrials(timestampsOfCell, stimuliTimestamps ) timestampsOfCell = tim...
6cc7f37ddddab8cbaff11ac16e99ee41d0159cc7157b28d8987f02dc2a2f4cc1
MATLAB
631
24
function run_all_unittests() % Call this function to execute all unit tests contained in this % subfolder. global FAIL_COUNT FAIL_COUNT = 0; path = fileparts(mfilename('fullpath')); % Find all other unit tests in unittest subfolder unittests = dir([path filesep 'unittest_*.m']); % Execture every unit test for uu=1:...
a2c7935344fed3e3b67bbd47d980bf38ddb41d2c9a0397b697686f26e0f854d6
MATLAB
631
21
% reshape index from (chn x cond x conc) to just chn % mlList is list of all (chn x cond x cond) and can be found in dcAvg.measurementList % give list of conds, find all chn indx and conc belonging to cond list function [reshapeIdx] = reshapeIdxByCond(condList,numConds,mlList) numConc = 3; numChns = size(mlList,2)/(...
ba5cd2f828cb032c83de730fb0c3af4a546251097aa28c6e160460d59aa641dd
MATLAB
631
16
function ml = GetMeasurementList(handles) global maingui ml = []; datatype = GetDatatype(handles); if datatype == maingui.buttonVals.RAW || datatype == maingui.buttonVals.OD ml = maingui.dataTree.currElem.GetMeasurementList('matrix', 1, 'raw'); elseif datatype == maingui.buttonVals.CONC ml = maingui.dat...
8b3c21fdfec23fa7886fe51b3c2fc604f3ba5fb873bca581cd56b16391cdac4e
MATLAB
632
30
function [activitymap2] = activity_map3(activitymap1,opt) %ACTIVITY_MAP2 ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % Generate mean activity maps for multiple neurons, with peaks in % temporal sequence % Opt == 1, peak values are normalized to 1 % Opt == 0, peak values are not normalized [M1,B1] = max(activitymap1,[],2...
8532e9ea355f184739245cb1159c00c2e3d54d663e064dc14158960d508ae32e
MATLAB
633
19
function analyse_behavior(p) % Analyse the behavioral data of the MRI experiment by fitting a von Mises % mixture model (vMMM) on the response errors. The main parameter of % interest is the 'kappa'-parameter, which controls the dispersion of the % fitted distribution and is therefore a measure of beahvioral precision...
e63639ca7644ad28e9e32b233f167c6cadc74ce8264bc9a26a88dea5813d5652
MATLAB
633
16
writeNPY(FL_CAM.times, 'fl_cam.npy') writeNPY(Lft_ex.values, 'lft_ex.npy') writeNPY(Lft_PPL.values, 'lft_ppl.npy') writeNPY(Lft_whsk.values, 'lft_whisk.npy') %writeNPY(Lick.values, 'lick.npy') writeNPY(LPup_FC.times, 'lpup_fc.npy') writeNPY(NI_PZO.values, 'ni_pzo.npy') writeNPY(P_diode.values, 'p_diode.npy') wr...
0382c9df7ca84271fc5756ac6c76d046b290f07a26214a6a86eb01076be73cbe
MATLAB
634
30
function [activitymap2] = activity_map2(activitymap1,opt) %ACTIVITY_MAP2 ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % Generate mean activity maps for multiple neurons, with peaks in % temporal sequence % Opt == 0, peak values are normalized to 1 % Opt == 1, peak values are not normalized [M1,B1] = max(activitymap1,[],2...
2102850fc1e3515a09019c7c35869b6ae7ced0cb3c1dc2abfd51345026aebeea
MATLAB
634
19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Authors : CHATENET Louis % Date : 24/05/2018 % Updated : 30/05/2018 % Version : V2.0 % % Description : AMPA current calculation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Isyn, r, T] = IsynAMPAV...
3f59d7f1c6232061eb3acfd16bb2f2946d54040de74ee9e7514b24400db6a220
MATLAB
634
20
function wasSet = setVariblesFromJenkins() % This function looks in the base workspace for varibles that where set by % Jenkins. These vaibles have the name "name_" (underscore at the end), and % set name = name_ % returns true if any varible was set, false otherwise. % This is a non trivial implementation, but it...
8fbcf9e2f8de4535572fb556ead23889a383d78056200beb8deca0ad61f978cc
MATLAB
634
22
function H = toHsv(data,occ,varargin) % H = toHsv(data,occ) % transforms matrix data into HSV image where brightness codes for values of the occ matrix % data and occ are required to be of the same size % H = toHsv(data,occ,[minVal maxVal]) % will normalize the values of 'data' matrix in the boundaries define by [minV...
c02276be516317ac142cf1edaa60305757345f0d24dc5da762b28a9b1bdc902c
MATLAB
634
28
function [modRatio, prefPh, offSet, sse]= CosineFit(phase,linVar) [estimates, model] = fitPhase(phase,linVar); [sse, fitCurve] = model(estimates); prefPh = estimates(3); modRatio = estimates(2)/estimates(1); offSet = estimates(1); end function [estimates, model] = fitPhase(xdata, ydata) start_point = rand(1, 3); ...
128d926fa99905d3402975d881a7cea4804bc5eeadcc80074604792a589ceaa7
MATLAB
635
16
%writeNPY(FL_CAM.times, 'fl_cam.npy') %writeNPY(Lft_ex.values, 'lft_ex.npy') writeNPY(Lft_PPL.values, 'lft_ppl.npy') writeNPY(Lft_Wsk.values, 'lft_whisk.npy') writeNPY(Lick.values, 'lick.npy') writeNPY(LPupFC.times, 'lpup_fc.npy') %writeNPY(NI_PZO.values, 'ni_pzo.npy') writeNPY(P_diode.values, 'p_diode.npy') %w...
342730f72efe2f23063d7c736d73c13c884b170ebec63fc6ffebae5e3ed943bf
MATLAB
635
23
% Sample Bullseye Creation % Create the AHA 17-segment bullseye figure; c = createBullseye([0 0.5 1 0; 0.5 1 4 45; 1 1.5 6 0; 1.5 2 6 0]); set(c,'Color','k','LineWidth',2) % Example 1 of filling the bullseye, vector by vector fillBullseye(rand(4,1),0.5,1,-45,315); fillBullseye([0.25 0.35 0.25 1 0.25 0.5],1,...
72e235254b3064f29ce48a1c7760c0eab7564501e077e572df8524cc600a1234
MATLAB
635
23
function [thickavg, thickstd] = read_fs_thickness(fname) % Read the ROUJ cortical thickness from Freesurfer output stat file. % USE: [thickavg, thichstd] = read_fs_thickness(fname) fid = fopen(fname,'r'); linenum = 53; C = textscan(fid,'%s',1,'delimiter','\n', 'headerlines',linenum-1); c = (C{1,1}); c = c{1}; X = spli...
73573542ff889663dc8b6e0dca7b746c364b646c19a8e357305a23245dfa5e3b
MATLAB
636
22
function phi = angular_error(u, v) % PHI = ANGULAR_ERROR(U, V) % % Compute the pointwise angular error between two velocity fields. U and V % are supposed to be arrays of dimensions MxNx2. PHI is given in degrees. % % Author: Gunnar Farnebäck % Computer Vision Laboratory % Linköping University, Sweden ...
88445a9604c9195e1140f9d8f380ed4e2fd60b7ad2c9f67a885d7e4bf789ed77
MATLAB
636
24
function [response,ind,ts] = data2response(data,epoch) BIN_SIZE = 50; raster_params.time_before = 399; raster_params.time_after = 1200; raster_params.smoothing_margins = 0; raster_params.align_to = epoch; boolFail = [data.trials.fail] | ~[data.trials.previous_completed]; if strcmp(data.info.task,'choice') boo...
e63e7d46c89ce9fe36dd1493ddc8fbc661199ae2c4aa99a72bebd2ab0a1b1668
MATLAB
636
27
function L = SpkTrainValuation(S,f,r) % L = SpkTrainValuation(S,f,t,r) % % computes log-likelihood of spike train S with intensity function f. % INPUTS: % S: spike timings during test epoch % f: a tsd describing the predicted intensity function during test epoch % r: average firing rate during training ep...
66771d53e2f3df2f64209c1432cb991b9b92bcf2b99fb9f85cf1241bdae74980
MATLAB
637
36
function [tmp, mu] = covml(dat, nu, flag) if nargin<3 flag = 0; % flag = 0: subtract mean % flag = 1: scatter only end if nargin<2 nu = 1; % parameter for weighting function end [k, nobs] = size(dat); datorig = dat; if ~flag mu = mean(dat,2)*ones(1,nobs); error('not yet implemented'); else mu ...
1106cf85e7c77e0fd0f0ccdc51cf97c31cbfbbd7c44a38449fa5c9dbccd5e6bd
MATLAB
638
27
function s = rdivide(a,b) % Overload of the ./ operator for two tsd objects % % USAGE: % tso = rdivide(tsa,tsb) % % the ./ operaetor is defined to return a tsd with same timestamps and % data that are the ratio of the data. Returns error if timestamps of the % two object don't coincide % copyright (...
4a228178bd371019a1c44d1692c642dff4c548cc314445c0634e45d1fcc469aa
MATLAB
638
29
function convertpickles(varargin) % convert fodlers and subfolders of pickles to mat files % lloyd russell 2016 % select main directory if ~numel(varargin) directory = uigetdir(); else directory = varargin{1}; end % build file list filelist = glob([directory filesep '**' filesep '*.pkl']); num_files = numel(...
499d4db65bfe4f21244c29b897465d646c6c43e488273bdecb8cc4698241e172
MATLAB
641
19
function analyse_questionnaire(p) % Load the data of the Vividness of Visual Imagery questionnaire (Marks, % 1975) used for recruitment and plot the distribution of VVIQ scores. The % upper and lower quartile of the distribution (marked in the plot) where % used as recruitment pools for the strong and weak imagery gro...
d19bac686034a1a797af4615918a213eea8aedb569eb0d3ec353669d2767db94
MATLAB
641
27
function [c] = cellcovshift(x, shift, dim, flag) % [C] = CELLCOVSHIFT(X, SHIFT, DIM) computes the covariance, across all cells % in x along the dimension dim. % % X should be linear cell-array(s) of matrices for which the size in at % least one of the dimensions is be the same for all cells if nargin<4 flag = 1...
26d2b815aaa9ecf952676db2ef5ee647fde149709ddc68992ef47c8da4428702
MATLAB
643
22
function [split_stack] = split_stack(stack,nPlanes) % Vectorised method [nRows,nCols,nSlices] = size(stack); slicesPerPlane = floor(nSlices/nPlanes); nSlices = slicesPerPlane*nPlanes; idcs = reshape(reshape([1:nSlices],nPlanes,slicesPerPlane)',[],1); split_stack = stack(:,:,idcs); split_stack = reshape(split...
6fec9843ff21450f91e34c9efce8a610a87772aea3a8cdd281c27ef0468c3f67
MATLAB
643
24
function [kden,N,K] = density_dir(CIJ) % DENSITY_DIR Density % % kden = density_dir(CIJ); % [kden,N,K] = density_dir(CIJ); % % Density is the fraction of present connections to possible connections. % % Input: CIJ, directed (weighted/binary) connection matrix % % Output: kden, d...
80752b67ccf5394641b58747964bf70bbf3704408204921c098bccd61f7bfcdf
MATLAB
643
21
function [Cells] = significance_determine(DataOriginal,DataShf,thr) %SIGNIFICANCE_DETERMINE ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % DataOriginal mustbe n * 1 matrix % DataShf mustbe n * repeatNum matrix % Default threshold 1.65 if nargin <= 2 thr = 1.65; end d1 = ndims(DataShf); data_mean =...
35d12074a29deb219efc972df903aee25e3083b82d7ad482ac6d3de66e74847c
MATLAB
644
21
function accOut = calibAcc(accIn, para) %CALIDACC calibrate accelerometer data based on input parameters % % INPUTS % ACCIN: 3-D accelerometer data, unit g, N by 3 matrix % PARA: Parameters for calibration % 2 by 3 matrix % -----...
ad91dda80a387ffe376e79cd428777c045e44bbde81c5e0f5d685764f9d68f0a
MATLAB
644
18
writeNPY(FL_CAM.times, 'fl_cam.npy') writeNPY(Lft_ex.values, 'lft_ex.npy') writeNPY(Lft_PPL.values, 'lft_ppl.npy') writeNPY(Lft_whsk.values, 'lft_whisk.npy') writeNPY(Lick.times, 'lick.npy') writeNPY(LPup_FC.times, 'lpup_fc.npy') writeNPY(NI_PZO.values, 'ni_pzo.npy') writeNPY(P_diode.values, 'p_diode.npy') writ...
0bb8b74020ab07a09a1b341f7122b4b145930a51ec7e51e2d4160b83ad71c584
MATLAB
645
19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Authors : CHATENET Louis % Date : 24/05/2018 % Updated : 30/05/2018 % Version : V2.0 % % Description : GABAa current calculation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Isyn, r] = IsynGABAa2(d...
1700b9ea06ddfd89fd5eda95a60184e5cd4b631424a97593c9c730e53c7c47e0
MATLAB
645
17
function [estimates, model] = 1overXfit(xdata, ydata) % Call fminsearch with a random starting point. start_point = rand(1, 2); model = @expfun; estimates = fminsearch(model, start_point); % expfun accepts curve parameters as inputs, and outputs sse, % the sum of squares error for A * exp(-lambda * xdata) - ydata, % a...
3a34c3d7970ba89a9b3c397c5ab2c2ff078da884bc1db8383c8a5413e0451544
MATLAB
645
26
%% Run PLS analysis %% %% Read in data and functions workdir=''; addpath(genpath('/dagher/dagher11/filip/Obesity_maps/scripts/')); addpath(genpath('/dagher/dagher11/filip/Obesity_maps/data/')); BMI='ABCD_CT_DKT_LH'; expr='ABCDbrainspanall'; % aba_limited_expression for UKBB and HCPA, ABCD_brainspan for ABCD, HCP_brai...
4dd2b006a9ff49c3a23bc84df38c9b8b261aa1999fd94f6a2476600343fd8350
MATLAB
645
19
function p = min_quadform(Qtot) % P = MIN_QUADFORM(Qtot) % % Minimize quadratic forms according to equations 6.20 -- 6.24 in % Gunnar Farnebäck's thesis "Polynomial Expansion for Orientation and % Motion Estimation". % % Qtot - A collection of quadratic forms, having the size % HEIGTH x WIDTH x N x N. % % ...
701218864f1a668fad1490b0230d265d4d0c41bcdc59598cb55e8154d1271788
MATLAB
645
23
function x_dot = interneuron(x,K,gNa,gK,gL,C,ENa,EK,EL,I) % SOURCE: https://doi.org/10.1023/A:1008841325921 N = length(x)/3; V = x(1:N); h = x(N+1:2*N); n = x(2*N+1:end); m = 1 ./ (1+exp(-0.08*(V+26))); hinf = 1 ./ (1+exp(0.13*(V+38))); tauh = 0.6 ./ (1+exp(-0.12*(V+6...
c259170d8a3c0ec2690140776d4cd9d23c3575bd7f087fc08b509969ba189ae7
MATLAB
645
25
function modes = gtmlmode(net, data) %GTMLMODE Mode responsibility for data in a GTM. % % Description % MODES = GTMLMODE(NET, DATA) takes a GTM structure NET, and computes % the modes of the responsibility distributions for each data point in % DATA. These will always lie at one of the latent space sample points % N...
7b501208a5d2eec4d74a9bfb531ff65721b916bd75670d911f0e2cae642e4f15
MATLAB
646
30
% 加载预训练模型 load('trainedSVMModel.mat'); load('TRCSPFilters.mat'); % 参数设置 fs = 250; windowLength = 1 * fs; buffer = zeros(windowLength, nChannels); while true newData = getNewEEGData(); processRealTimeData(newData); end function processRealTimeData(newData) buffer = [...
a113c675caff71e433e608213cedb17c65f42c54fed3873f4f88e85d47080dc4
MATLAB
646
36
function p = bootstrapTTest(x,y) % https://www.youtube.com/watch?v=N4ZQQqyIf6k&ab_channel=StatQuestwithJoshStarmer REPEATS = 10000; t_stat = @(x) mean(x)/(std(x)/sqrt((length(x)))); if nargin==1 scores = x; else scores = x-y; end inx_nan = find(isnan(scores)); if ~isempty(inx_nan) disp(['Remove ' num2...
089d81de9bea2bf1731597072feb6962bdf9a3cbe80f3cfdf1f18000ba3f0d0f
MATLAB
648
31
function A = shift(O, shift, TimeUnits) % Shifts intervalSet % % USAGE: % A = shift(A, shift, TimeUnits) % % INPUTS: % A - an intervalSet object % shift - the time to shift the intervalSet of % TimeUnits - the time units of shift % copyright (c) 2004 Francesco P. Battaglia % This software is relea...
11e0ba476a1d878b9837aae93d04cb6aa74b3051e43d246ffb7a7304f76d50a8
MATLAB
648
33
function is = timeSpan(tsa, TimeUnits) % Returns interval spanning the duration of a TSD % % USAGE % is = timeSpan(tsa) % % INPUTS: % tsa - a tsd object % TimeUnits - the time units for the result % % OUTPUT: % is - intervalSet containing the timestamp % copyright (c) 2004 Francesco P. ...
2651e125a7fa4a0231df809c507af527c3488517a765b208ddac99f82528062f
MATLAB
648
32
function [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(y,s,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex) ys = y'*s; skipped = 0; corrections = size(S,2); if ys > 1e-10 if lbfgs_end < corrections lbfgs_end = lbfgs_end+1; if lbfgs_start ~= 1 if lbfgs_start == corrections lbfgs_start = 1; else lb...
4173c67c0854547eb3d22fb10ec5a4794c04d64e81d5850dd7e7bb91780d28a7
MATLAB
648
23
function [n] = count(x) % Returns the number of non-zero values in X % % N = COUNT(X) % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % information. % % The Pri...
ae150a68b16da2bf475ef56df41cda7a4feb98715c3e54ef31b79863fdb00b8f
MATLAB
650
34
function O = subsasgn(O, S, B) % v = subsref(O, S) deals with { } assignments % % O{k} = B assigns the value B to key k. If key not existing item will % be created % copyright (c) 2004 Francesco P. Battaglia % This software is released under the GNU GPL % www.gnu.org/copyleft/gpl.html if ~strcmp(S.type,...
546114b7d5fef1a380bbae14f717e5ce62795391c086ef6bfc4c570200b1630d
MATLAB
651
21
%% Create timeseries for turbulence clear all data_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/preprocessing/hc_tp1_sch400/'; input_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs_sch400/'; fnames=dir(data_path); fnames=fnames(~ismember({fnames.name},{'.','..'})); for s=1:12 load(...
c3ca2c9dedaf40651542cb94fd3d2e17e607051093a1627c2e408cb9eeda27f7
MATLAB
651
20
function refreshPrimarySleep(this, actigraphy) % REFRESHPRIMARYSLEEP Update primary sleep elements from ACTIGRAPHY % % $Author: Peng Li % $Date: Feb 29, 2026 % ax = actigraphy.actiAxis; ptH = actigraphy.Decoration.YAdjust; delete(findobj(ax, 'Tag', 'PrimaryLine')); delete(findobj(ax, 'Tag', 'PrimaryT...
cb71fd1d026fd4529c9c14c642bb8d96718e581c058e2bc44db115cf5875ed71
MATLAB
651
21
%% Create timeseries for turbulence clear all data_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/preprocessing/hc_tp2_sch400/'; input_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs_sch400/'; fnames=dir(data_path); fnames=fnames(~ismember({fnames.name},{'.','..'})); for s=1:12 load(...