sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
405d0609f1544b80c32809856a240fcc2d3d0e01b386aac42ae6be80292a1eca
MATLAB
1,283
43
% test function for Generalized Singular Value Decomposition % % Open Source Electrophysiological Toolbox, version 3.14, June 2019 % Released under the GNU General Public License % Copyright (C) 2019 Reza Sameni % reza.sameni@gmail.com % This program is free software; you can redistribute it and/or modify it % under ...
0aca666d972ec61cb61511f2a13d61eee3c080ca7187b4bda36d7f921992ed4b
MATLAB
1,285
47
function distance = euclidean_dist(x,y) %EUCLIDEAN_DIST Euclidean distance between two points in Cartesian coordinates % %Syntax % distance = euclidean_dist(x,y); % %Description % DISTANCE = EUCLIDEAN_DIST(X,Y) sets DISTANCE to be the Euclidean distance % between the two points X and Y. % % The arguments X and Y must b...
b43f9e6815952f9a781a87c57d8b5ab5d75e097d95372d92cbe0a26a2ff39d62
MATLAB
1,286
64
function [o no]=get_subdir_regex(indir,reg_ex,varargin) if ~exist('indir'), indir=pwd;end if ~exist('reg_ex'), reg_ex=('graphically');end if length(varargin)>0 o = get_subdir_regex(indir,reg_ex); for ka=1:length(varargin) o = get_subdir_regex(o,varargin{ka}); end return end if ~iscell(indir), indir={indi...
2a6d535a9da283de2e0c586c26c72d3b167ae1be84cf91da43a1229d0070ad4c
MATLAB
1,287
32
%function [mrVpp1, mrVpp2] = getSpikeCov(sampledSpikes, iSite) function [mrVpp1, mrVpp2] = getSpikeCov(hClust, sampledSpikes, iSite) %GETSPIKECOV Compute covariance feature for a subset of spikes hCfg = hClust.hCfg; spikeSites = hClust.spikeSites; spikesFilt = hClust.spikesFilt; nSpikes = numel(sam...
eb38823d59024926df6cee4bd0e837d89ddd081ece65bfec2473e36fe67adea0
MATLAB
1,288
39
function y = bp_filter_complex_ma_fixed_tap(x, w0, N) % bp_filter_complex_ma_fixed_tap - Complex frequency domain first-order % moving average bandpass filter with a fixed tap % % y = bp_filter_complex_ma_fixed_tap(x, w0, N) % A complex domain moving average bandpass filter. % % Inputs: % x: input data...
f0647b9ad177c5ff1c5dd7e1e8b72d54289ff72ff2dbd0982147e272208e26df
MATLAB
1,291
40
function EEG = remove_noise(EEG, Cuts_Filepath) % from EEGLAB structured data, looks for corresponding .mat file where % manual scoring of noise output was saved (in /Cleaning/Cuts/) as a TMPREJ % array, which is a n x (2+3+ # channels) matrix. The first two columns are % the start and end timepoints of the artefact. ...
141e245043fbaed2901cdd6b31164d869c4b0a3487f47e625b44227c00e3c718
MATLAB
1,292
28
function [proj1, proj2, proj3] = pcProjectSpikes(sampledWindows, prVecs1, prVecs2, prVecs3) %PCPROJECTSPIKES Project selected spikes onto 1st, 2nd, 3rd principal components % input: sampledWindows is nSamples x nSpikes x nSites % input: prVecs{1,2,3} is nSamples x nSites % output: proj{1,2,3} is...
aa9310dd3a588396ef1308d4869d36a7f6dd22aee7c7aed93cf61c1f87fcb028
MATLAB
1,292
50
%datasetName = 'MNIST'; datasetName = 'CIFAR'; %datasetName = 'CIFAR-100'; %datasetName = 'SVHN'; kWorkspaceFolder = fullfile('/media/sergeyd/OS/Users/sergeyd/Workspaces', datasetName); errfile = fullfile(kWorkspaceFolder, 'final-last', 'noise0.2.mat'); load(errfile, 'errors', 'stdev'); clear LineSpec; LineSpec{1} =...
a9cce336e672cb9864494a44939401cc8fd01b783e9a8b751b61be46cdc4533a
MATLAB
1,293
42
function [SIGNALS,r,H,W,RADroi,fs]=FluorescenceSignalsCSV(NumberofSplits,FN,PathName,r) RADroi={}; %% Load Data ********************************************************* % For each CONDITION and VIDEO [X,fs]=readdeltaFzero([PathName,FN{1}]); [C,F]=size(X); if C>F X=X'; [C,F]=size(X); disp('Transposed to Cel...
4b2f545dbf9151de76105692fdf6b3941bbc4fe3a21e52de8b8ec184b0d8fc1f
MATLAB
1,295
45
function area = area_of_collar(dim, a_top, a_bot) %AREA_OF_COLLAR Area of spherical collar % %Syntax % area = area_of_collar(dim, a_top, a_bot); % %Description % AREA = AREA_OF_COLLAR(dim, A_TOP, A_BOT) sets AREA to be the area of % an S^dim spherical collar specified by A_TOP, A_BOT, where % A_TOP is top (smaller) sp...
ff597405841336b45f9809df2c3b4541aac347adff5063e9f2c4405e208d7574
MATLAB
1,295
54
function lambda = findlambda(X,numspikes,fs) %FINDLAMBDA get thresholding parameter for specified number of spikes % % Input parameters: % X : SocialSparsity neighborhood % numspikes : Number of spikes % fs : Sampling frequency % % % Description: % findlamda(X,numspikes,fs) fi...
3997e3c61c0ed5f97c7c572e5d0bb93ded92f836dd14e3d9efc3dc9c5e4024e8
MATLAB
1,296
33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script simulates the effect of different doses and duration of neoadjuvant treatment % on primary and secondary tumor kinetics % It generates the plots of Figure 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
94f2fb8b98e38596a82723f34d0f10593e6ce48ed9149f593f69e78338abfd8a
MATLAB
1,297
52
function [links,weights]=minimal_spanning_tree(d) % [links,weights]=minimal_spanning_tree(distance_matrix/weights) % % Prim's algorithm for constructing the Minimal-Spanning Tree (MST) % from a given symmetric distance/similarity matrix %The input matrix must be a mapping from weight to distance. For % ins...
384032d9b7e68ace912345826b311b8c1e669a3dec5151134a0a9b49d561472a
MATLAB
1,298
43
function [BurstMask, ReferenceMask] = mask_bursts(EEGData, Bursts) % creates a matrix the size of the data in EEG, with values of the data % only during the bursts BurstMask = nan(size(EEGData)); % identify location of bursts if isfield(Bursts, 'ClusterStart') Starts = [Bursts.ClusterStarts]; Ends = [Bursts.C...
b37a1b7a625e6927b3e5f714f10d3bbe0f675802f5e3823b9a17adfe3645b50b
MATLAB
1,300
51
function fname = abcd_check_eprime_encoding(fname,outdir,forceflag) %function fname = abcd_check_eprime_encoding(fname,[outdir],[forceflag]) % % Purpose: check whether eprime file is plain text or unicode UTF-16 % and if so, convert to ASCII % % Required parameters: % fname: full path name of eprime output file % %...
2c66fdca7544a6c5dafbac2a1c1d75c0430c25a04414c14111c77cec280d6d1d
MATLAB
1,301
52
function out = euler2rmat(phi, theta, psi) if nargin==1 eMat = phi; nT = size(eMat,2); else nT = 1; end out = zeros(3,3,nT); for iT = 1:nT if nT > 1 phi = eMat(1,iT)*pi/180; theta = eMat(2,iT)*pi/180; psi = eMat(3,iT)*pi/180; else phi = phi*pi/180; theta = theta*pi/180; ...
c0eb26002354ba57907608f57f4bb08ad7c566aa898879ed999934354f5a9890
MATLAB
1,301
48
function output_path = createFolderIfNoExist(varargin) %createIfNecessary: Creates a folder if it doesn't exist % % This function creates a folder if it does not exist. In addition it can % be used to: % - construct the path of the folder % - construct the path to a file, ensuring that the folder path t...
54ae4ca0065c57653b4b50932220e0ad316d0733f8e987a6b425ee0681318a8a
MATLAB
1,304
39
clear all % this script contains code to reproduce Figure 1f %% load data % drag and drop corresponding file (S1 Data) %% data content description % IHC contains GFAP fluorescence values across various cortical ROIs % column 1: animal id % column 2: ROI location (slide) % column 3: GFAP fluroescence ...
89beac0d3b33c04304283ac05ecf0ca73b38abb6df8189aa46461ae165d69009
MATLAB
1,304
46
%Threshold setting and selection of the sufficient correlations for the visualisation clear row clear col clear source clear target %% eliminates self connections for t = 1 : length(cross) cross(t,t) = 0; end %% eliminate NaN values cross(find(isnan(cross)))=0; %% REMOVE ARTEFACTED CHANNELS % artefacted_channels...
ecb7631cce092d638c8304fe89242cc8178f09354473e67b6cd34f0fac10a9e4
MATLAB
1,304
41
function md = info() %INFO Get JRCLUST repository metadata fid = fopen(fullfile(jrclust.utils.basedir(), 'json', 'jrc.json'), 'r', 'n', 'UTF-8'); fstr = fread(fid, '*char')'; fclose(fid); md = jsondecode(fstr); hash = gitHash(); if ~isempty(hash) md.version.commitHash = hash; e...
18ca8391c16005802e04dfab4f780f73810b197415517b753e279526eac73bb9
MATLAB
1,306
35
function h = CorrCoefFig(FrETemp, FrITemp, mVETemp, mVITemp) h = figure('Name','Correlation'); subplot 231; scatter(FrETemp, mVETemp, 0.1, 'r.','MarkerFaceAlpha',.2,'MarkerEdgeAlpha',.2); Corr1 = corrcoef(FrETemp, mVETemp); title(sprintf('Corr = %.2f', Corr1(2,1))) xlabel('FrE');ylabel('mVE') subplot 232; scatter(...
b2ad01248ff83f474336e30fcd77082f055a6d1c0fcbeb210131f727ed8cb981
MATLAB
1,306
34
function [FiltData, Filter] = lowpass_filter(Data, SampleRate, PassbandFrequency, ... StopbandFrequency, DesignMethod, PassbandRipple, StopbandAttenuation) arguments Data SampleRate (1, 1) {mustBePositive} PassbandFrequency (1, 1) {mustBePositive} StopbandFrequency (1, 1) {mustBePositive} = Passband...
8becaaf00ea0168d742aa7245bc1a0ed6bd3880fda5f19d5680c6287446f54b2
MATLAB
1,308
39
function auto_min_vent(app) if ~isnan(app.settings.channel_idx.res_flow) if isempty(find(contains(vertcat(app.data.name),'min. vent.'))) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.res_flow); t= ts(1):ts(1):ts(2); sig_p = data; sig_p(sig_p<0) = 0; sig_n = d...
6a31d3245ea4d8daee165a117460522a5ed7759d74ff22d080db64d8b5e5e3ba
MATLAB
1,309
54
function update_signal_popup(app) %UPATE_SIGNAL_POPUP updates the selection options for all popup menues %for the selection of specific signals. to be called after calulation of %derived signals % Detailed explanation goes here if ~isempty(app.data) name = vertcat(app.data.name); if length(app.data) < 2 ...
8df5a50203a65dc60c872fc65c2557ab1ad3720026a256f9d02ef7d2452987f5
MATLAB
1,309
62
p = params_2DAA; fpath = fullfile(p.processed_data_dir,'filters.mat'); load(fpath,'filters') sub = 1; %% randIdx = randperm(size(filters{sub},3)); fr1 = max(filters{sub}(:,:,randIdx(1:10)),[],3); fr2 = max(filters{sub}(:,:,randIdx(11:20)),[],3); fr_fil1 = apply_lowpass(p,fr1); fr_fil2 = apply_lowpass(p,fr2); %% p =...
bc7e7ff13643fd5eb885502c6ffa78cc5da57fb1295e6e4f017e42ec28822bd7
MATLAB
1,309
35
function [absS_out,F_out,msT_out,nsamp_window_out,nsamp_frame_advance_out] = ... my_specgram(y,msToffset,fs,ms_framespec,nfft,yes_preemph,yes_plot) % function [[absS],[F],[msT],[nsamp_window],[nsamp_frame_advance]] = ... % my_specgram(y,msToffset,fs,ms_framespec,nfft,yes_preemph,yes_plot) if nargin < 2 || isem...
54cfc3d907737e7e2bab86dc638b1573906e6527787983fae82818f1352bf581
MATLAB
1,310
48
% Expand a multiple-scan NIFTI file into multiple single-scan NIFTI files % % Usage: expand_nii_scan(multi_scan_filename, [img_idx], [path_to_save]) % % NIFTI data format can be found on: http://nifti.nimh.nih.gov % % - Jimmy Shen (jimmy@rotman-baycrest.on.ca) % function expand_nii_scan(filename, img_idx, newpath) ...
e4982181fed711ad9d1adc8f0fcd4c6c580101865562d4570ea83410b9518144
MATLAB
1,310
54
% 1-d example of leslie greengard's gaussian kernel-based nufft % (type 2) R = 4; % oversampling ratio Msp = 12; % spreading parameter - the number of neighbors to spread % to in each direction M = 512; % dimension of uniform grid on which we evaluate nufft tau = 1/M/M*pi/R/(R-0.5)*Msp; Mr = R*M; % precompu...
e2c5699e4c50d73905f180ace5e69f9856a74e73ecd8abb654a520ccde295422
MATLAB
1,311
47
function [currenttitle_SAVE] = photomplotTitle(ST,plotvarname) if contains(ST,'Raw') currenttitle.ST = 'Raw'; elseif contains(ST,'Recentered') currenttitle.ST = 'Re-Centered'; elseif contains(ST,'DecayAdj') if contains(ST,'Exp') currenttitle.ST = 'Reference Adjusted (Exp Fit)'; elseif contains...
51a8660e4a20dfe96e5d6f8cd64bac30e2da5225ec01c2b5db1c19a7fb08a636
MATLAB
1,312
48
function mergeSelected(obj) %MERGESELECTED Merge a pair of clusters if obj.isWorking jrclust.utils.qMsgBox('An operation is in progress.'); return; end if numel(obj.selected) < 2 return; end iCluster = min(obj.selected); jCluster = max(obj.selected); obj.isWork...
f1321e4c0b5fad3baba5b9a4eef56b1b87ab8a8ec99aeeb7663d0b65e04d2091
MATLAB
1,313
39
%This script calculates the percentiles of each cell in order to extract a %baseline for behavioral data when running hte averageAllCellsFunction %script. function [baseline] = calculatePercentileBaselineFunct(data, threshold, raw) % data = mouseData; % threshold = 25; %what percentile should be used as the cuto...
13f152c83699329bb809c8d793bfa5dc190b378318da69e72a4da3674c9f2ef1
MATLAB
1,315
78
function [T2b T2csf Ab Acsf sujet] = find_T2_hipo(fi) int_field = 'integral_real_fit_all'; int_field = 'integral_fid_abs'; int_field = 'integral_fid_cor_abs'; do_plot=1 for k = 1:(length(fi)/8) tk=1; for tt = ((k-1)*8+1):k*8 T2(tk,k) = getfield(fi(tt),int_field); TE(tk,k) = fi(tt).TE./1000; sujet{k}...
7d02f5cb40521dfb154f80141f9397ae38820d8557e5e3aad737851e48bb501b
MATLAB
1,315
43
function [peaks, r] = peak_det_matched_filter_robust(ref, fs, h, fmax, varargin) % peak_det_matched_filter_robust: R-peak detector based on a matched filter % % Syntax: [peaks, r] = peak_det_matched_filter_robust(ref, fs, h, fmax, itr) % % Inputs: % ref: Vector of input data. % fs: Sampling rate. % h: ...
f57c1734604ab9d729b1c37969f41fa1ef53f81bbcfdb1f1ae65e80ba3d9f935
MATLAB
1,315
45
%% venn diagram % create the relevant table clear clc [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% total = []; early = []; late = []; late_ir = []; ear...
c4a909b068d00ff82855daafbda4245d926192521434778881c48589e7e3770c
MATLAB
1,316
39
function my_colormap(cmap_spec,yes_reversed,thresh_gray,max_gray) % function my_colormap([cmap_spec],[yes_reversed],[thresh_gray],[max_gray]) if nargin < 1 || isempty(cmap_spec), cmap_spec = 'default'; end if nargin < 2 || isempty(yes_reversed), yes_reversed = 0; end if nargin < 3 || isempty(thresh_gray), thresh_gray ...
feef462f084b92b7369f40b09e97adfdd4907d03df05e24fc96c51af89df3f10
MATLAB
1,317
35
% Funtion that read list of coordinates only from Nth row % Text files UTF-8 w/BOM (Byte Order Mark). % Input % N: row where coordinates starts % Output % XY: coordintas x and y columns function XY = readXYfromCSV(filename,startRow) delimiter = ','; % startRow = 2; endRow = inf; XY=[]; %% Format string for each li...
8d868df020cf90b2d32dfbf8b021fa8cd9135470ba2db1acdbc5856b0abdcc53
MATLAB
1,318
39
function restoreHistory(obj, entryIndex) %RESTOREHISTORY Restore a position in hClust history if entryIndex <= obj.hClust.nEdits if isprop(obj.hCfg, 'testRun') && obj.hCfg.testRun dlgAns = 'Yes'; else qstring = 'This operation is irreversible. Continue?'; dlgA...
390ce0ed9635626f64225ded1d77cc002b30d39d62df763db041b92c5ad635fa
MATLAB
1,321
60
% An implementation of Jacobi's algorithm for symmetric matrix % diagonalization: The classical Jacobi algorithm. % Ref: Golub, Gene H., and Charles F. Van Loan. Matrix computations. % JHU Press, 1996, Sec 8.4 % % Reza Sameni 3/1/2019 % email: reza.sameni@gmail.com % function testJacobiDiagonalization02 clc; clear; clo...
40faec838f7309e6808e70b924bae831139ecdfd85f9e0bd3f268af30723e4ab
MATLAB
1,322
47
function ob = subsasgn(ob, sub, arg) %function ob = subsasgn(ob, sub, arg) % method for "ob.sub = arg" etc. % caution: reassigning dimensions (.idim .odim .imask .omask) is dangerous! if ~streq(sub(1).type, '.') fail('only "ob.field = value" is supported') end % trick: for struct.sub = object % e.g., A.arg.field = ...
e52871b4a0a53b7ddf75e1569a8b79bf684ed6ba09b9c72dd62c88a8428bdaa0
MATLAB
1,324
50
function []=mnl_CumulativePlot(varargin) %mnl_CumulativePlot is designed to plot cumulative distribution plots of %multiple groups to compare the differences in the spread of the data. %Inputs %The data needs to be arranged into different columns - the sorting is %done automatically (This is Name1 and Name2) cmap=col...
1a6b4c672065542159e1c61be6f798f79abbc4d9bcd7dcaa160778b79573ca8b
MATLAB
1,325
42
function cost = van_rossum(st1,st2,tau,Fs) %van_rossum - Get van rossum spike distance cost % % Usage: % [cost] = van_rossum(st1,st2,tau,Fs) % % Description: This function takes two spike trains as an input, % convolves them with an exponential kernel to obtain a continuous % representation of th...
2a37080a354d08debd6fca53170ae3178bd010987beb5953e515ccd29cb9b50f
MATLAB
1,325
50
function []=mnl_CumulativePlot3(varargin) %mnl_CumulativePlot is designed to plot cumulative distribution plots of %multiple groups to compare the differences in the spread of the data. %Inputs %The data needs to be arranged into different columns - the sorting is %done automatically (This is Name1 and Name2) cmap=co...
b510de92d2b28fafac3e7ec4cfa625cac19902d17546c25439a41295c40b7774
MATLAB
1,327
49
function [proj_a,proj_e,ve,d_primes] = project_tavs_onto_coding_dims(dims,av_trials,err_trials) n_dims = size(dims,2); % concat a and e trial averages to build coding space t_avs_a = nanmean(av_trials,3); t_avs_e = nanmean(err_trials,3); y_ld = cat(2,t_avs_a,t_avs_e)'; y_ld = y_ld - me...
80d60d788ecc8b35a5f543c6c7bd580a6101d7fb595f2e9f83d00fcd6d530822
MATLAB
1,328
60
% Sample code for active noise cancellation from ECG signals % % Reza Sameni (C) % Email: rsameni@shirazu.ac.ir % Web: www.sameni.info % % Created May 2007 % Modified June 2018 clc; clear; close all; load('SampleECG128Hz'); fs = 128; ECG = y(:,2)'; N = length(ECG); n = (0:N-1); % Adding noise rr = ...
1638963208b3189557f4b6a55d100bd6f1ecc0cab750c854479ab43417e94e86
MATLAB
1,329
33
clc;clear; load 'gradient1-3 data' load 'subject information' nsubs = 1790; network = importdata('von Economo index'); withinDispersion = zeros(1790,1533); withinDispersion_mean = zeros(7,1790); %% %**********************************************step1 : Caculate Within Dispersion for i = 1:nsubs fo...
406d841855336334ad5b135e5ae4fc449b8e6b2ecfcaac314f1ca130cea06113
MATLAB
1,330
38
function [RTStruct, Means, Quantile99, Quantile01] = assemble_reaction_times(Trials, Participants, Sessions, SessionLabels) % from a table of all trials, gets reaction times into struct needed for % overlapping flame plot. % Sessions can be either a structure, like Struct.BL = {'BaselinePre', % 'BaselinePost'}; or just...
c87b0903619d3e2055b0daf8b2a48ac97c030e3d5f6293cc00241f6de8633cb6
MATLAB
1,330
29
function data = data_dsRateDivisible(data) %Validate whether signal is divisible by downsampling rate, will be false %if wavesurfer crashed during recording % % data = data_dsRateDivisible(data) % % Anya Krok, September 2022 % thisLength = length(data.acq.time); % Length of signal that was acquired ...
125280d381c6081e734b76778b291cdcb51275f9eca9c954af88243209f2b2db
MATLAB
1,332
27
% 测试文件夹中所有的CPL或者XPL图片 clc clear load E:\SemanticSegmentation_Scale\CPL\GTruth_Revolve_1433.mat; load E:\SemanticSegmentation_Scale\Results\CPL_ResNet50_Class_No_Attention\trainedNet_resnet50.mat; InputPicBG='E:\CPL_XPL_MULI\A\*.png';% 背景原图的存放位置里的tif文件 InputPicPath='E:\CPL_XPL_MULI\A\';% 背景原图的存放位置 SavePathName='E...
49f7dce63d86798f6f964f41cbda372c0c2fbd9bc024b27dc2e70bbfb1e0340a
MATLAB
1,332
38
function eventMat = alignTrace2Event(trace,eventTimes,tBefore,tAfter,nSamp) %alignTrace2Event - Align time series traces to event times % % Usage: % eventMat = alignTrace2Event(trace,eventTimes,tBefore,tAfter,nSamp) % % Description: This function creates a matrix of time series data % aligned to even...
9147ecff627ffc41ec06841893fc6b1643edd4f764820e9bd9aaef2cd7931ac5
MATLAB
1,332
52
function [ Vec,eigval ] = PLDA(Data,Labels,Alpha,nPLDA) %Penalized LDA % Detailed explanation goes here %Input: %Data = The data matrix each column represents one sample %Labels= Labels corresponding the data matrix %Alpha = The weight of PCA in (LDA+Alpha*PCA); %nPLDA = Number of PLDA directions %Output: %PLDA:...
fae6efd77470d257276c9d381ce59fcf3c781c8a777721f0b2d8aa2cf5960c83
MATLAB
1,332
33
% Wrapper script to turn parcellation files into FreeSurfer annotation % files. Then you can calculate surface area of parcellations! % % Assumes ind_parcellation output from Kong2019 CBIG pipeline. % Written by M. Peterson, Nielsen Brain and Behavior Lab %To run: % 1. Claim computing resources using salloc (ex: `sa...
46d0e2b2008bf8027ac46949c568362dd1e2c73d074ac6a9a243466fa8fd409b
MATLAB
1,333
72
function med = circ_median(alpha,dim) % % med = circ_median(alpha) % Computes the median direction for circular data. % % Input: % alpha sample of angles in radians % [dim compute along this dimension, default is 1, must % be either 1 or 2 for circ_median] % % Output: % mu median directio...
debd04112d7dc422c5f796d394080d66384618bc34da442e5ba6eae4bd72257a
MATLAB
1,333
30
function [samplesOut, keepMe] = filterSamples(obj, samplesIn, samplesPre, samplesPost) %FILTERSAMPLES Denoise and filter raw samples, apply CAR samplesIn = [samplesPre; samplesIn; samplesPost]; if obj.hCfg.fftThresh > 0 samplesIn = jrclust.filters.fftClean(samplesIn, obj.hCfg.fftThresh, obj.hCfg); ...
449af2cdaf0e213b8b1a174652915da984da455e9737bedef3def7bfa9c0c8ef
MATLAB
1,334
52
function ss = outer_sum(xx,yy) %|function ss = outer_sum(xx,yy) %| %| compute an "outer sum" x + y' %| that is analogous to the "outer product" x * y' %| %| in %| xx [nx 1] %| yy [1 ny] %| more generally: xx [(dim)] + yy [L,1] -> xx [(dim) LL] %| out %| ss [nx ny] ss(i,j) = xx(i) + yy(j) %| %| Copyright 2001, Jeff F...
bdb13fec8979550adbe06c7e33fb2be34607c86761e145913825d596040cc13d
MATLAB
1,335
48
function output = XxRotate3D(inArray, angle, zx_aspratio, varargin) %rotate3D rotate a 3D array by "angle" around the 1st dimension (y axis) % angle: angle in degrees to be rotated; in terms of physical geometry % zx_aspratio: ratio of z step size over x-y pixel size % [Ny, Nx, Nz] = size(inArray); % inArray = imr...
1c4c78465eb917af7eb07f21c50923ba5fbaf312dcdf86af84383789787756b2
MATLAB
1,336
40
function my_colormap(cmap_spec,yes_reversed,thresh_gray,max_gray) % function my_colormap([cmap_spec],[yes_reversed],[thresh_gray],[max_gray]) if nargin < 1 || isempty(cmap_spec), cmap_spec = 'default'; end if nargin < 2 || isempty(yes_reversed), yes_reversed = 0; end if nargin < 3 || isempty(thresh_gray), thresh_gray ...
64064c65689a7a6156a58301a44b6f917fbeaa14c596568c611498af6a17c28a
MATLAB
1,336
37
%number of cross validation iterations function cross_validation_script(features,label) T = 1000; %number of cross-validation iterations %cluster for j = 1:T [accuracy, kappa, sensitivity, specificity, w, alpha, actual, predicted] = PLDA_knn_CV(features, label+2, 1, 3,'features', j); %run this on the ...
7ef0f9d8bf54ac3bc2ffc15fe99e984279b2b929b887a55d9969bcba33f168e8
MATLAB
1,337
66
function [vtx, vty, vtz] = dipolefangrid(rx,ry,rz,theta_t) sizr = size(rx); % GRIDS % Get back R and unit vectors from passed grid R = sqrt(rx.^2 + ry.^2 + rz.^2); %calculate |r| at each point %getting normal vectors erx = rx./R; ery = ry./R; erz = rz./R; %Get theta and phi for each point in grid theta = acos(rz./...
7573ccaad7969292d81757a8bb54c0903c6318682ed5f7ae936ae6c5cc865441
MATLAB
1,339
43
function outTable = flexibleTableRead(filename) %% Notes % this function is designed primarily for csv files produced by bonsai % datatype is assumed to be numeric except for the last column which is % assumed to be a timestmap % filename = 'X:\ibn-vision\DATA\SUBJECTS\M23002\SDTraining\230313\TrialParams2023-03-13T...
63f4b0c00431096ca44aef1aad4bdc248525fb326502d78a95d7795cde9dbd52
MATLAB
1,340
44
classdef (Hidden) mat_file_h < handle % % Class: % adi.mat_file_h properties m %Handle to the file. end methods function obj = mat_file_h(file_path,varargin) % % obj = adi.mat_file_h(file_path,varargin) % % Optional I...
ad32a409ac5ba4e6e1b58e5c4aa1fc1e6e18a6be0208443260bee379fe19bd4d
MATLAB
1,342
42
% plots the distribution of confidence values for each eye and each % participant so I can chose which eye to use for each recording. Ideally, % each histogram should show mostly 1s, and some 0s. The more uniform the % distrinution, the worst the eye quality. In a csv, save which eye had the % best distribution. cle...
88bc2f16a23ae9a20d9d1445ddbefda1e6cd7939354d038933f570ef576799e3
MATLAB
1,343
51
function MSPoI_analysis2(AG,Par,idxNE,idxEX,options,atlas,Nbr_Regim,respath) atlas_name = options.atlas{atlas}; DiffAG_All = []; DiffAG_pos = []; DiffAG_neg = []; Total_sim = [];Dis = []; for rg = 1:Nbr_Regim All_P = Par.MSPoI.Par{rg}; for gI = 1:2%gr ...
70017de800609ba184cbed64740bec395c7a9f4cee2cd315fcc2208b51fa565f
MATLAB
1,344
55
function ob = Gblock(ob, nblock, varargin) %function ob = Gblock(ob, nblock, varargin) %| %| Create "block" fatrix (blocks of rows) for block-based methods like OSEM %| option: %| 'idiag' [idim] optional input diagonal scaling matrix %| 'odiag' [odim] optional output diagonal scaling matrix arg.idiag = []; arg.odiag ...
087b609647d2b0d7894685343d703f283d0f7beac8eaf07585369622143de55a
MATLAB
1,345
51
function Fourierfunction(CCresultDrinkOn) %UNTITLED2 ‚±‚̊֐”‚ÌŠT—v‚ð‚±‚±‚É‹Lq % Ú×à–¾‚ð‚±‚±‚É‹Lq global fname tfile TotalTime ADon figWon MaxADon MaxZ MaxA1Rt_count render bin=500; % M=mean(CCresultDrinkOn); if render == 1 figWon=figure; subplot(2,1,1); plot(linspace(1,2000,bin),CCresultD...
3c243c12e314f4ccea72d840a66bbb9efc7528e71cbf9394e8270bd80b17a538
MATLAB
1,347
44
function coeff = eq_vertex_diam_coeff(dim,N) %EQ_VERTEX_DIAM_COEFF Coefficient of maximum vertex diameter of EQ partition % %Syntax % coeff = eq_vertex_diam_coeff(dim,N); % %Description % COEFF = EQ_VERTEX_DIAM_COEFF(dim,N) does the following: % 1) uses the recursive zonal equal area sphere partitioning algorithm to ...
7a44a89566944bf43ea698a9b4ceb12a7bb4e02acac115708fc629ed3dcb5707
MATLAB
1,347
41
% Function to extract general features of the raster % Input % R: Matrix of the Raster of dims: Cell x Frames % Output % Descriptive Features: % Descriptive.AN: Active Neurons % Descriptive.eAC % of Active Cells % Descriptive.DurAc Time of Activity (minutes) % Descriptive.CAG ...
9de4524e5ecf14f675156a20b36f2fd3dfcda9d5d5736221159e3f244890f16a
MATLAB
1,348
33
function spike_res_out = sel_spikes(spike_res_in, ts, burst_ints) %SEL_SPIKES Summary of this function goes here % Detailed explanation goes here spike_res_in.use_spikes = []; spike_res_out = spike_res_in; ts_msna = ts(1) : ts(1) : ts(2); spike_res_out.use_spikes(1:length(spike_res_in.spike_idx),1) = ones(size(spi...
4fa3ba23f1d74b158831d82ba772de9388d26d0a33fe31202db8700d332870e5
MATLAB
1,349
43
function power_without_bursts(DataBroadband, SampleRate, Bursts, CleanTimepoints) arguments DataBroadband SampleRate Bursts CleanTimepoints = ones(size(DataBroadband)); end DataBroadband(~CleanTimepoints) = nan; % plot power spectrum of channel [PowerBroadband, Frequencies] = cycy.utils.compute_power(DataBroadband, S...
93b16464738ddd6f0a6e407d679a72b4f96c300969d3e2b82923cd564f1ff86a
MATLAB
1,349
38
function [mean_proj,dim_vars,dim_ves] = ... analyze_dims_over_sessions_iti(p,av_trials_all,err_trials_all,trans_data_all,trans_data_err_all,dims,q,trial_idx_ses) n_dims = size(dims,2); % analyze summary dims over sessions % - calc mean projections for a and e per session % - quantify VE usi...
bbfb47016366d82cc2f8b8409342c301028c165274ff4a2cfe2bb046a1a37c7f
MATLAB
1,349
37
function [Xroi, unROI, id] = roiBin(X,roi) % Gets the mean of roi voxels as defined in unROI within the X matrix of % brain data. % % Inputs------------------------------------------------------------------ % X: brain data, where rows are subjects and columns are features or % voxels. Here, we assume the val...
dba053c5625ce57bc5f2799c84bb5faf6b89d4e4b8333c1b563e378b481213db
MATLAB
1,351
36
function [test_indices, train_indices] = crossvalpartitionDBP(N, n_folds) % crossvalpartitionDBP: Partition data into training and testing sets for cross-validation. % % INPUTS: % - N: Total number of data points. % - n_folds: Number of cross-validation folds. % % OUTPUTS: % - test_indices: ...
e336fd8dc19b799c63c6879ad97818c2beb179413f7fd44404e0b33adeb22190
MATLAB
1,351
52
function mnl_PlotClustersFromMultipleClusters(efPxTrace,Cmap,FinalClusterIDs) figure('Name','Clusters Per Section') szT=length(efPxTrace); ImNum=nan(szT,1); for i=1:szT ImNum(i)=efPxTrace(i).ImageNum; end nCol=max(ImNum); for i=1:szT subplot(1,nCol,ImNum(i)) Scale=efPxTrace(i).Scale; TracePoints=efPxTra...
d1c36d9bda90f826b2d49c0c8fd7395e05a55ca0baffdf209b7c3f08993e160b
MATLAB
1,352
41
function []=mnl_TracesChannelMIPs_TracesAndSomas(dim,efPxTrace,Somas,BkgMean,MaxValues) %function that creates normalised MIPs for each channel based on the values %from the trace extraction % Inputs % dim - dimensions of the original image [x y c z] % data - the image matrix % BkgMean - the background values to sub...
d64132b0728352fbf47c788b82b1d77ab0f33ccff78ebd685b550672d9d8e31f
MATLAB
1,353
48
% rotate (and flip ICs) % varargin: Mirind: true for flip, false for not flip % Abanden the move for every field: just do one field at a time. function [LDEequvUse] = HCRot_Rec(LDEequv,rotID,N_HCOutX,N_HCOutY,NPixX,NPixY, varargin) if ~isempty(varargin) Mirind = varargin{1}; else Mirind = false; end if Mirind ...
4c8d15a54e44531cba5ea1f2bd005eff25c6538e78a417c77226921d63d6030e
MATLAB
1,355
48
function [Data,Scale,dim,metadata]=mnl_Load4Dimage %Function to load the image, and relevant OME metadata using bfopen % Outputs % Data - The image as a matrix (x*y*c*z) % Scale - the size of a voxel (x*y*z) % dim - the dimensions of the image % metadata - the OME metadata file=bfopen; series1=file{1, 1}; metadata=fil...
87aeff595ecf1183bd4038c83a62aed31c590c40cf6e777abd5503a631ef88df
MATLAB
1,355
50
function gscatter3b(x,y,z,group,clr,sym,siz,doleg,xnam,ynam,znam) %GSCATTER3B 3D Scatter plot with grouping variable % gscatter3(x,y,z,group,clr,sym,siz,doleg,xnam,ynam,znam) % Designed to work in the exactly same fashion as statistics toolbox's % gscatter. Differently from GSCATTER3, this function requires t...
977fb494e8f53c76324803cc1b88a94793d042ed1481579dcac145da402fe81e
MATLAB
1,355
39
function targetcount(h,data) %% Draw bar plot with number of structures targeted % autocorrelatemap() and crosscorrelatemaps() depend on this function. load('structures','groups'); subplot(h); % Create plot with double y-axes ax = plotyy(0,0,0,0); hold(ax(1),'on'); hold(ax(2),'on'); gr = length(groups.name);...
6b1efaec2a161b8eb6c8fa7e1d1c67fa0124053a76aeddb3fc5f67debd7bba1c
MATLAB
1,357
36
function Modo=SelectMode() %% Initialize Figure global Modo; Modo='none'; fprintf('\n>>Select FinderSpiker mode:') IntroFig=figure('DockCOntrols','off','MenuBar','none', 'NumberTitle',... 'off','ToolBar','none','Units','normalized','Position',... [0.3 0.3 0.4 0.25],'Name','FinderSpiker.CalciumImaging','Visible'...
7427be721c42848bfe80c62ed32575996be742f29cdba0a69c8e35d159a4eb7a
MATLAB
1,358
35
function R = rotation_matrix_3d(theta_x, theta_y, theta_z) % rotation_matrix_3d - Generate a 3D rotation matrix. % % Syntax: % R = rotation_matrix_3d(theta_x, theta_y, theta_z) % % Inputs: % theta_x: Rotation angle around the x-axis or in y-z plane (in radians) % theta_y: Rotation angle around the y-axis ...
888e1b5e3a5a0a85c8f484a542caa15e466dba5a27eb28214a00e807a1cc6132
MATLAB
1,358
33
function [ ripple_info, lfp_st, ripple_st ] = ripple_detection_single_dataset( data_st ) % Usage: % [ ripple_info, lfp_st, ripple_st ] = ripple_detection_single_dataset( data_st ) % Input: % data_st bipolar signals from hippocampus % % Output: % ripple_info ripple timing of each channel stored in ...
8adcdc4e3a5d75ad9df9ded3edc1ab4edb7e3e96b54eaec3c97e1f101eb3c32b
MATLAB
1,358
41
function splitCluster(obj, iCluster, unitPart) %SPLITCLUSTER Split off a cluster given retained spikes if obj.isWorking jrclust.utils.qMsgBox('An operation is in progress.'); return; end if isempty(unitPart) || ~iscell(unitPart) || any(cellfun(@isempty, unitPart)) return; ...
8d070683de86900c4645e9b9843ca23f80965afe25ce8fa8828c37d40000c46c
MATLAB
1,359
63
function R = rot3(axis, angle) %ROT3 R^3 rotation about a coordinate axis % %Syntax % R = rot3(axis, angle); % %Description % R = ROT3(AXIS, ANGLE) sets R to be the 3 by 3 rotation matrix corresponding to % AXIS and ANGLE. Use this to create rotation matrices from Euler angles. % % AXIS must be 1, 2, or 3. % ANGLE must...
71beae2e786179a437b39730093dc166e7ffc9bba6b329a0edc8cbe1c745a1c6
MATLAB
1,362
52
function rotation = s2_offset(points_1) %S2_OFFSET Experimental offset rotation of S^2 % %Syntax % rotation = s2_offset(points_1); % %Description % ROTATION = S2_OFFSET(POINTS_1) sets ROTATION to be an R^3 rotation matrix which % rotates the north pole of S^2 to a point specified by the points of POINTS_1. % % POINTS_1...
8d46b113785ce0d5cf0ccf087ee04421924c18e93778eea8428fb0a81627ddf5
MATLAB
1,362
56
function []=mnl_MakeMaxNormalisedMIPs(Data,n) sz=size(Data); NumChan=sz(3); NumStacks=sz(4); NumVx=sz(1)*sz(2)*NumStacks; for i=1:NumChan %Make a single z stack for the colour tData=nan(sz(1),sz(2),sz(4)); for j=1:sz(4) tData(:,:,j)=Data(:,:,i,j); end %Find the Nth percentile Data2=resh...
998b93eeb806cb8776357f13264c624ed881b776cb0ee42513c8a49dcb144276
MATLAB
1,363
38
function [binary w] = threshold_pro(w, p) % proportional thresholding % % This function "thresholds" the connectivity matrix by preserving a % proportion p (0<p<1) of the strongest weights. All other weights, and % all weights on the main diagonal (self-self connections) are set to 0. % %INPUTS: W = we...
d520fd92f9495f8b6d9e632381d4a7c6d2e68ee5e28459c089469984b3e097a7
MATLAB
1,364
47
function [avgc,maxc,nc] = macromap(map,nodes) % Create a network based on connectivity between hyperstructures, e.g. % isocortex, hypothalamus, etc. Projection values are either the mean % (avgc) or max (maxc) of connections between two groups, or the number of % connections (nc). % % [avgc,maxc,nc] = macromap(m...
32027ec04d4a3f8fdc9594150e69e0efb036987700ced8d87b5b0b7b96d50c19
MATLAB
1,365
27
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f2\n') x = importdata("IE_cells.mat") %% x1 = x; x1 = sortrows(x1,"main_structure") x1.struct_number = grp2idx(x1.main_structure); stats = mes1way(x1.response,'eta2','group',x1.struct_number) %% post hoc %% IL vs PL stats = mes(x1.response...
4357ae9be3e8c594633f9019609770f67798c21e64c219f8c5858dc06f50fa00
MATLAB
1,366
41
function Plot_continuous_data(xf_detect, sr_sub,handles) % Function that plot the segment of continuous data. % It will try to plot a minute, maximun. detect = handles.par.detection; stdmin = handles.par.stdmin; stdmax = handles.par.stdmax; lx = length(xf_detect); noise_std_detect = median(abs(xf_detect))/0.6745; ...
b96d6af494de5865968090c881f7c80c351c38bbfb6c8e06622c6cdb49cad3f7
MATLAB
1,366
38
function offset = circle_offset(n_top,n_bot,extra_twist) %CIRCLE_OFFSET Try to maximize minimum distance of center points for S^2 collars % % Given n_top and n_bot, calculate an offset. % % The values n_top and n_bot represent the numbers of % equally spaced points on two overlapping circles. % The offset is given in ...
268b2b4054f2847097798c426688f5a8626b5fa244e6fa7597e18a71f0a96d7d
MATLAB
1,367
41
function [spikeWindows, spikeTimes] = CARRealign(obj, spikeWindows, samplesIn, spikeTimes, neighbors) %CARREALIGN Realign spike peaks after applying local CAR if ~strcmpi(obj.hCfg.getOr('vcSpkRef', 'nmean'), 'nmean') return; end % find where true peaks are not in the correct place after applyin...
a4ba48c40a6c2b4dccfa7f1622c6866d090dc153566abdbb898abff107908d78
MATLAB
1,369
35
function trialTimes = loadTrialFile(trialFile) %LOADTRIALFILE Import trial times (in seconds) trialTimes = []; if ~exist(trialFile,'file') warning('%s does not exist.',trialFile); return end try [~, ~, ext] = fileparts(trialFile); if strcmpi(ext, '.mat') % use the fir...
022ff9f3f84efc1e5024e5e41ab0f5aaefaa0eaa0ebecaec6c12db949ad78247
MATLAB
1,370
46
function [ filters, traces ] = run_pca_ica( p,M ) %RUNPCAICA performs signal extraction using PCA and ICA %% PCA % perform mean subtraction for optimal PCA performance inputMean = mean(M(:)); inputMean = cast(inputMean,class(M)); M = bsxfun(@minus,M,inputMean); [height, width, num_frames...
3fad2d5a75a25ce78c6e3cd64056122ca211e23c6ddc91496041c8edbdfa25a2
MATLAB
1,370
51
function[x,nu,xp,yp] = rst_density_hist(data,units) % simply function returning the density histogram % function adapted from the computational statistics toolbox % http://www.pi-sigma.info % % INPUT = data - vector of data to plot % = 'units' - label for the x axis % OUPUT x = values of each bin % nu = ...
e7346ea6bc31fb5dc4421b2c92c8098996ea300787ee39bc2ec2bf37501d4537
MATLAB
1,372
34
function [data] = processCamera (data, params) %Created By: Anya Krok %Created On: 29 April 2021 %Description: T-Lab specific code for processing camera trigger %signal into general T-Lab data structure % % [data] = processCamera (data, params) % % INPUT % 'data' - T-Lab data file with data.acq.Fs and dat...
03f951106e721ca5af1095d13081b9ee7c06d00c9d590b3c7482875d4eaa1ba1
MATLAB
1,373
52
function Cxy = Find_CB_Center(Workspace1) % Convert to BW and do opening & closing: I1 = im2bw(Workspace1.Image0,Workspace1.Parameters(1).Cell_Body(1).BW_Threshold); sec = strel('disk',ceil(Workspace1.Parameters(1).Cell_Body(1).Open_Close_Disk/Workspace1.User_Input.Scale_Factor)); % sec = strel('disk',5); % TODO:...
350525b682c899dd609821aa0005c7747de41fc391a8ee3db68b35c1019ee984
MATLAB
1,373
41
function [Subfolders, Datasets] = raw_data_paths(DataPath, TemplateFolder, isFullPath, IgnoreFolders) % DataPath should indicate the folder where all the datasets are. % TemplateFolder indicates the name of the folder that has the template % folder structure. % isFullPath is a boolean indicating whether to include the ...
f31d2daba2aa60ad7a1fc0a39eff06edc7e4029887e9bec6cd3aedfbd9ac23db
MATLAB
1,373
52
function [b b0] = circ_skewness(alpha, w, dim) % [b b0] = circ_skewness(alpha,w,dim) % Calculates a measure of angular skewness. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] % [dim statistic computed along this dimension, 1] % % If dim argument i...
9baa54ef58e162be3c541852513adcfcc83833e88a5264c04dabb19c1acc1e40
MATLAB
1,374
38
function [blcorr, bltitre] = CREX_TF_baseline(activity, bline, choice) % Function to carry out baseline correction method of choice on the % time-frequency data for a single electrode. % activity => post-stimulus time-frequency matrix (frequencyXtime). This % could be the mean over all trials or a single trial. % bline...
94e09af3c1134679ebace081cada39c846099cf4414d97e678af1816df49c0eb
MATLAB
1,375
31
function [snr_median, snr_mean, mean_beat, median_beat, stacked_beats, noise_mean, noise_median] = events_snr(data, peak_indexes, beat_length, running_avg_len) stacked_beats = event_stacker(data, peak_indexes, beat_length); if nargin <= 3 [mean_beat, ~, median_beat, ~] = robust_weighted_average(stacked_beats); ...
82ba94959d0a0ede11a6c6218c4672896f60365e45aedb538f9f7232ebe98b3b
MATLAB
1,378
56
function [sm_data] = gaussian_smooth_1d(data,sig,windur) %1d gaussian smoothing function %inputs: % data: vector to be smoothed % sig: sigma of gaussian kernel % windur: number of sigma to extend kernel in either direction %outputs: % sm_data: smoothed data if nargin > 2 kern_length = windur; ...