sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
22528988046e5475fd9cc2bcbf1ebf67c37ec0676acb96c0a3f00f6c09ebfc92
MATLAB
1,459
50
function plotArrayFileResults(AD) if isstring(AD) AD = load(ADfilename,'-mat'); end nS = AD.inputs.nS; nD = AD.inputs.nD; minRhoOpt = AD.inputs.minRhoOpt; maxRho = AD.inputs.maxRho; % %############################################################ %Head Model info %Load GM and scalp pos load([pathnameHeadModel '/G...
aee8b2ff052adfa6364d5ac5e921d3eb98d63e0dc5e725de473abff342a2c035
MATLAB
1,459
44
function [index, rank] = sqi_level_crossing(x, th1, th2, varargin) % sqi_level_crossing - Signal quality index based on the percentage of samples exceeding upper and lower thresholds. % % Usage: % [index, rank] = sqi_level_crossing(x, th1, th2, ranking_mode) % % Inputs: % x: Input signal matrix with dimensio...
00bb24fe577161ba09a9be0a2f7562af962e8efba431e62008f5c3b0daae5c0f
MATLAB
1,460
36
if exist('RoA_POS','var') aremerged=true; % Are there already colocated cells else aremerged=false; % Are there already colocated cells end [CM,ColorIndx]=Color_Selector(Names_Conditions); plot_cdf_cell(RoA_ALL,Names_Conditions,CM(ColorIndx,:)); xlabel('RoA') plot_cdf_cell(ISIs_ALL,Names_Conditions,CM(C...
3a370cffc15ca81b7b712aa9fac8987affa18fbd78b702a2f075a2809b1f03db
MATLAB
1,460
38
function plot_junction(ax,x,y,vector_angles) vector_angles = sort(vector_angles); angle_diffs = [diff(vector_angles), 2*pi - (vector_angles(end) - vector_angles(1))]; Alpha = 0.5; CM = [0.8,0,0 ; 0,0.8,0 ; 0,0,0.8 ; lines(5)]; CM = CM(1:length(vector_angles), :); [~, angle_diffs_sort_indices] = sor...
c7bcea75ec2559dbc29b6c489bfec15a5b071207903f5e978b118a4c775bc743
MATLAB
1,460
84
function [Montage,pos,lbl] = ReadSXYZ(fname) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License [fid,message] = fopen(fname,'rt'); if fid == -1 errordlg(message,'Read SXYZ File'); Montage = []; return; end l = fgets(fid); [params,pcount] = sscanf(l...
e2b0a25d37ac2c8e1c3ef7b954a7359c318982ad0ab789e19e8dd2ff26d87e75
MATLAB
1,460
64
% Test the instantaneous correlation of different signals % Reza Sameni clc clear; close all; N = 1000; fs = 1000; n = 0:N-1; x = sin(2*pi*n*10/fs); y = sin(2*pi*n*33/fs); z = [x y]; zz = z + .05*randn(size(z)); zz = [zz randn(1,1000) zz ]; % % % load sampledata x fs % % % zz = x(1,:); tau = 0:199; t = (0:length(zz...
0cf7d8ee5c84056a70b6e3095ad2bd773172c146d40d5cafaa66f192de4f7476
MATLAB
1,461
55
function plotAGDiff_MSPoI(AM,Lab_idx,NodeName,atlas,options,savepath,save) atlas_name = options.atlas{atlas}; %close all for reg = 1:length(AM)%3 f = figure;%(com); CF = AM{reg}; AM_diff = CF(:,:,2) - CF(:,:,1); % Pr = Lab_idx{gI}; if partition for each group Pr =...
47fc92650b2e4096788ad578e0ab0af63c974fc4582756bafc73d97d625291b9
MATLAB
1,461
45
% The script plots the neural and behavioural data contained in a .h5 file % of the repository in the form of a raster plot % authors: Francesco E. Vaccari % date: 10/2022 clear all; clc; close all; addpath('supportFunctions') currentFolder = pwd; parentFolder = fileparts(fileparts(currentFolder)); [filename,path_...
65c9e5ec4c716120f3f2087c5702645142fb56d9e879458c889dbaa79c7e359f
MATLAB
1,462
41
% function cluster_combineCoils(reconParsFile) load(reconParsFile) run([RETROMOCOBOX_PATH '/addRetroMoCoBoxToPath.m']); % run([MIRT_PATH '/setup.m']); addpath(SPM_PATH); tempDir = fileparts(reconParsFile); % tempDir itself wasn't actually saved explicitly before... all_ims = complex(zeros(Hxyz(1),Hxyz(2),Hxyz(3),nE...
629b26f3c8328152deb9fef37bc59c397e817b17d54675b310c6b651a10a25e1
MATLAB
1,464
43
pathnameLoad = '/Users/sabri/Documents/code/ArrayDesigner/ArrayDesigner/HeadModels/MNI152_LowRes/'; % Load GM surface mesh to get n of voxels load(fullfile(pathnameLoad,'GMSurfaceMesh.mat')) nVoxels = size(GMSurfaceMesh.node,1); % Read idx file - each row contains the number of voxels with significant % values for ea...
0ff980ecfc636bdfcab67d6d88618c3d39f107d120408647d72c01407813b095
MATLAB
1,466
50
%% Load initial state from data for the large network % Input: Inifile: Filename, string % N_E/I: Number of neurons used here. % EEDly, IEDly, EIDly: logical, if these delay mats will be used % Output: InE/I: Adjusted initial conditions for E/I cells % DlyMat: Delay Mats used function [InE, In...
2e4fccf884268ab561ac00b2343f1888db62471e4550fa39da074faf144cda4c
MATLAB
1,466
65
% test scatter plot assymetry effect on ICA % Reza Sameni, Copyright 2005 % clear; close all; t = [0:.001:16*pi 0]; N = length(t); %r = ceil(t/pi/2).*sin(2.001*t).^3;% + sin(5.00*t).^5;% + .01*rand(size(t)); % + sin(t) r = sin(2.00*t).^4;% + sin(5.00*t).^5;% + .01*rand(size(t)); % + sin(t) [x,y] = pol2ca...
e6716904fed2e2e78292ff22eb7e91827a9551acde8b6729717cbcce737172d7
MATLAB
1,467
39
function data = processRestOnsetOffset(data,params) %Process Rest Onset and Offset Data % % data = processRestOnsetOffset(data,params) % % Description: This function takes a data structure with velocity traces, % onset and offset indicies, and fiber photometry data and aligns % photometry to rest onset a...
163218b8aec45bed6f54104c6497c38779927a7600b85ef973e03582cd883f11
MATLAB
1,469
55
function boxplot_pairwise(y, colors) % y: 2D matrix (each dataset in each column) % colors: color to be used, N*3 matrix, each color in each row % example % y = rand(100,2); % one pair of y values % boxplot_pairwise(y); % y = {rand(100,2), rand(50, 2)+1}; % multiple pairs of y values % boxplot_pairwise(y); if narg...
b0b275fc8d14564518209ec1b5b89dbe4a33a02e2ac4088c86ce9ab7ec92fbc7
MATLAB
1,469
47
function angle = ideal_collar_angle(dim,N) %IDEAL_COLLAR_ANGLE The ideal angle for spherical collars of an EQ partition % %Syntax % angle = ideal_collar_angle(dim,N); % %Description % ANGLE = IDEAL_COLLAR_ANGLE(dim,N) sets ANGLE to the ideal angle for the % spherical collars of an EQ partition of the unit sphere S^dim...
ee23b148b228d6154d1476249e6fd1942b26de722aed157f36cfd58026983a25
MATLAB
1,470
49
function Stats = paired_ttest_topography(Data1, Data2, Chanlocs, CLims, StatParameters, PlotProps) % Stats = paired_ttest_topography(Data1, Data2, Chanlocs, CLims, StatParameters, PlotProps) % % plots the t-values (color) and significant channels (white dots) of % Data2 vs Data1 using chART plots. % Data are P x Ch mat...
c59aff63abf3e12a0638c46261d7b59f214d03f3a925ba9096290541871b821e
MATLAB
1,472
57
function [X,w,bin,fitin] = alasso(X,y,Xtest,ytest,alph,stnd,lam,gam,regp,parallel) %regp = 'largest'; % could also be smallest, largest, or middle if isempty(alph) alph = 0.001; % was 0.01 end if isempty(gam) gam = 1; end if isempty(stnd) stnd = true; end if isempty(lam) [~,~,lam] = defLam(X,y,alph,stnd...
cbac8148af85ff3eeece9ce99ba9ef4fb1c7c79e1bfbb6be29ef199c518a4359
MATLAB
1,472
57
function [yy, criterion] = PeriodicDeflDecompositionWDEN(dat, Itr, MM, T0, T1, TPTR, SORH, SCAL, NDEN, WNAME) % % [yy criterion] = PeriodicDeflDecompositionWDEN(dat, Itr, MM, T0, T1, TPTR, SORH, SCAL, NDEN, WNAME) % (maternal) cardiac signal supression by deflation using periodic component % analysis and wavelet shrink...
06781aa06864b60dc52a1d6cf673b33cb071edaf5afde5eb39dfbf05abb654f9
MATLAB
1,473
39
function data = JT_processRestOnsetOffset(data,params) %Process Rest Onset and Offset Data % % data = processRestOnsetOffset(data,params) % % Description: This function takes a data structure with velocity traces, % onset and offset indicies, and fiber photometry data and aligns % photometry to rest onse...
037a48209524193aa835a4bc04f2e2de186065621b56d5796a4fdefad64d27a0
MATLAB
1,475
58
function errorbar_with_fitcurve(x, y, curves,colors) % x: cell or 1D array, datapoints on the x axis % Y: cell or 2D array (dataset arranged as column), datapoints on the y % axis % colors: color to be used, N*3 matrix, each color in each row % example: % x = [1:20]'; % y = cell(1,2); % for i = 1:20 % y{1} = [y{1}...
19600c97a7dc869004aa47f830b60cdc9cb1c57f5b35dda29b07b0a1688cb75b
MATLAB
1,475
59
function fid_corr = LineShapeCorrect(fid,mConAmpCor,mSPhase,mT2used,sw,traf_flag) % Applies amp and phase corrections to fid from water only signal % Also applies traf filter to fid % Assumes files already added (or a single file) % FID data is dcy % Amplitude corr is mConAmpCor; phase correction (to be added)is...
1fb60aa8594c65f4744041320722e1e8646a11ccd8c31f7d70da570147b04438
MATLAB
1,476
41
function sampledWindows = getSampledWindows(hClust, sampledSpikes, sites, showRaw) %GETSAMPLEDWINDOWS % input: sampledSpikes, a vector of spike indices % input: sites, a vector of site indices % input: showRaw, bool, a flag use raw waveforms if true (else filtered) % output: sampledWindo...
bf7638de1897d45ce69bfe7e1e09b05a97321df7b59b7778432f7b8f89813e0e
MATLAB
1,476
70
%% Ch2 close all % clear all idx = 4; path = 'E:\data\DNAnanopore\030223\cell4_acsf_qx314'; filename = sprintf('230303_001.sealtest.%d.wcp', idx(1)); out=import_wcp(fullfile(path, filename),'debug'); n_channel = out.channel_no; n_recording = length(out.rec_index); dt = out.T(2)-out.T(1); % sample time in s Im...
23fd84457644748280b13ab5c78670f18f9e308e1bfe69bc3c49e628e3f93a3e
MATLAB
1,477
46
function S = metaToStruct(filename) %METATOSTRUCT read a SpikeGLX meta file and convert to struct [status, cmdout] = system(sprintf('file %s', filename)); % check given file is a text file if status == 0 assert(any(strfind(lower(cmdout), 'text')), '''%s'' is not a text file', filename); els...
5d11f54172b042773bfbc9df2e0504ca5db928e1fb03c56da29fa5999795326f
MATLAB
1,477
45
function info = mmil_csv2struct(fname,parseflag,separator,quote) %function info = mmil_csv2struct(fname,[parseflag],[separator],[quote]) % % Required Input: % fname: input file name % % Optional Input: % parseflag: [0|1] whether to parse strings for arrays and matrices % {default = 1} % separator: separator be...
b986ba22743b0a5c8307a3c72976cd07fdd2b9abab2810bfa5823d28fcac6d65
MATLAB
1,477
58
% Gets line from time accumlating function of activity % % CumCAG=p(1)+p(2)*T+W % Where: % p: linear fit coeficients % T: time in seconds [s] % W: residue % % Input % R: Matrix of activity (cells x frames) % fs: sampling frequency % TotalSum (optional) % Output % p(1)scalar slope of the line p(2): scalar y-in...
980e57cde74bf31269ff6d0d148298e0dbc53ff05ef60180b17357528d13079a
MATLAB
1,478
59
function Plot_AG_MSPoI(options,AM,Lab_idx,NodeName,atlas,ResPath,save) %gr = options.var_gr; gr = options.grlabel; atlas_name = options.atlas{atlas}; fg = 0; for gI = 1:2%length(gr) for Reg = 1:length(AM) fg = fg + 1; f = figure; CF = AM{Reg}(:,:,gI); ...
32af2639014eae481818a5f0740da97626c0a98cf652160e09e18b836051a1e1
MATLAB
1,479
55
function [NewDesign,iDesign,CondIndices,DoF2] = Ragu_SortOutWithinDesign(Design,TwoLevels) if (size(Design,1) == 1 || TwoLevels == false) % Make it a dummy two factorial if it isn't Design(2,:) = 1; end % Find the original labels OrgLabelsL1 = unique(Design(1,~isnan(Design(1,:)))); OrgLabelsL2 = unique(Design(2,...
3e8060bceeb93226f395f42a585055b9de8aaefcc66d27924088c143a54d9cdd
MATLAB
1,479
53
function playMovieCutout(movieCutout, traceCutout, cellOutline, neighborOutlines ) % resize movie cutout (was compressed to save memory) movieCutout = imresize(movieCutout,2); % set display params windowSpace = 20; windowTime = 20; waitTime = 1/(windowTime); % set color values ...
9497b6f5b24e1e0fec3ea6d2b3d7584af514f77c661626d3982640ac43a6822d
MATLAB
1,480
41
function spikeData = findPeaks(obj, spikeData) %FINDPEAKS Detect or import spike peaks samplesFilt = spikeData.samplesFilt; keepMe = spikeData.keepMe; spikeTimes = spikeData.spikeTimes; spikeSites = spikeData.spikeSites; siteThresh = spikeData.siteThresh; nPadPre = spikeData.nPadPre; nPa...
5512bfe2a60318d55b19358219d7a50a3852f019462fbd6954657581ade70cde
MATLAB
1,482
46
function A = getSensitivityMap(array,posScalp,nS,minRho,maxRho,pathnameHeadModel,pathnameWeights) %Load PMDF weights PMDFweighting = load(pathnameWeights); nD = length(array)-nS; srcs = array(1:nS); dets = array(nS+1:end); %Load PMDFs of the channels of the AD array pathnameMSHS = getMSHSpath(pathnameHeadModel); loa...
6ec7ba704d22fe5fc6d18e825d2dbee78c313bb4eea804b3223ed5c66f8d8989
MATLAB
1,484
51
function min_dist = point_set_min_dist(points) %POINT_SET_MIN_DIST Minimum distance between points of a point set % %Syntax % min_dist = point_set_min_dist(points); % %Description % MIN_DIST = POINT_SET_MIN_DIST(POINTS) sets MIN_DIST to be the minimum % Euclidean distance between points of the point set POINTS. % % PO...
c1b70fcee4586db74f8d3988a4223f4e94d122b36148d715cc9b7bb892e5adcf
MATLAB
1,486
41
function index = nearest_neighbor(x,vectors,maxdist,varargin) % function index = nearest_neigbor(x,vectors,maxdist,pointdist*,pointlimit*,k*) % x is a row vector % pointdist (optional) - vector of standard deviations % pointlimit (optional) - upper bound on number of points outside pointdist % k (optional) - number of ...
40b99af3f40e54504794d8190827333cd8f1b3d6b8e0772cf146828ed23d8154
MATLAB
1,489
50
function s = cart2polar2(x) %CART2POLAR2 Convert from Cartesian to spherical coordinates on sphere S^2 % %Syntax % s = cart2polar2(x); % %Description % S = CART2POLAR2(X) sets S to be the spherical polar coordinates of the points % represented by the Cartesian coordinates X: % S = [phi;theta]: phi in [0, 2*pi), theta i...
9ab96c7d4be6c92d11c1fe06816fd39ca50df78f0cb9945b2ccf7149bb32a0e9
MATLAB
1,492
45
function [choosecolor_SAVE] = photomplotColor(setupParam,numgroups) %% if nargin<2 numgroups = 0; end comparisonType = setupParam.comparisonType; if comparisonType == 1 choosecolor = {'k' '#61e15e' '#51c54f' '#41a940' '#328d32' '#227023' '#125414' '#023805'}; %green gradient elseif comparisonType == 2 ...
14745e1d5f3ad647d8e6fe8bc5f97e5a7583ff38aed9bda01ec352a1daf26670
MATLAB
1,493
31
function [kdata_simMotion, st] = apply_2DsimulatedMotion(kdata_in,mpars) [Nx, Ny] = size(kdata_in); Npars = size(mpars,2); alignMats = zeros(4,4,Npars); this_mpars = mpars; for iT = 1:Npars alignMats(1:3,1:3,iT) = euler2rmat(0,0,this_mpars(3,iT)); alignMats(1:2,4,iT) = this_mpars(1:2,iT); end alignMats(4,4,:) ...
5a29867832e9d13927b8c10ee9b0e65ad56c5acd97b0951db3f79fe749e867f4
MATLAB
1,493
74
%% Histamine firing function. % Units in events/h. % function f = fireha(t, i_factor) %Repeated stim. n=length(t); r = 150; repeat_time = 60*10; t_start = 5; t_flip = 7; t_end = 15; basal = 1; b = 2; max_f = 10; stim_boolean = 0; if stim_boolean == 0 for i=1:n f(i) = basal.*i_factor; end f(f...
6eee53bff0deec06a38277415894c6e0771bd3164a7730c42e33d3e97251817a
MATLAB
1,493
45
function data = processCC(data,params) %Process Cross-Correlations % % [data] = processCC(data,params) % % Description: This function is designed to process the cross correlation between fiber photometry % traces and velocity data. The parameters for the analysis are found in the params % structure, whi...
1a3c336a8233ae82b77aac54c263c6e4e0964e124ce90328c60ba0bdbcfaa050
MATLAB
1,494
28
constants; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Same growth for the primary tumor and the metastases %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SameGrowth.model = @(param, time) model_burden_nb_PT(... [param(1), param(2:3)],... % m...
5460c160382b48f5d21749aebcffdfc84e550593d746ca6f26eaa8bf20befec7
MATLAB
1,494
46
%% Reproduce Fig. 1e from deposited dataset % David Wolf, 11/2023 % %% load dataset clear; clc; % paths need to be updated load('C:\Users\David\Documents\GitHub\OXT-Wolf\data\Fig1_AON_data.mat'); addpath(genpath('C:\Users\David\Documents\GitHub\OXT-Wolf\')); % the data.(odor) contains the binned spike counts (100 ...
7aa0c04981bf8d763a6ba117ade121af88cc029d44735c21f25edc2f9b2ab833
MATLAB
1,494
65
function varargout = plot(varargin) % plot method for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: plot.m 7381 2018-07-25 10:27:54Z guillaume $ % if ishandle(varargin{1}) % ...
0e27b794368752e0ce06861b8d47b86d4d4958e28716596b7dfb756cb2352879
MATLAB
1,496
41
%% Sort the cells according to the sortWindow and graph function sortAllCellsGraphFunct(traces, sortWindow, clims, binLengthStart, binLengthEnd, behaviorName, treatment) % traces = allTracesNull; %data to analyze % sortWindow = [50 60]; %what sample window should use to sort cell activity, activity is averaged an...
983deffd42e7de75f20074368b211cf12bc56b0de2a103f2382669ce9add7a16
MATLAB
1,496
40
function Plot_Brains_AG_MSPoI_1b(FinalRepPar,nodes_name,nodes_coord,at,options) gr = options.grlabel; for n = 1:length(nodes_name) Name = nodes_name(n); NodeName(n,:) = string(Name); end %============== PLOT BRAINS==================== % TO save data cd /netapp/vol7_u923/SEME/SE...
9c15f61e5a9587ba9ab2265e1ca9e936dba7ad3e91f8d24cc98a1229588a2141
MATLAB
1,496
40
%plot_basline_per_clsuter_clsuters only for phb [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) %% NDs = [10 8 6 4 3 2 1]; if ~iscell(file) file{1} = file; end baselines = []; clusters = []; for i ...
00103e88234403362be875b2adbe2a3477026d17f82e800a82184c1c0fe0af02
MATLAB
1,497
63
function paths_out = fullfile(root,paths_in) %fullfile Appends paths to a root path % % paths_out = sl.dir.fullfile(root,paths_in) % % Performs the equivalent of fullfile() on each root/pathsIn pair. It % tries to accomplish this in the quickest way possible. % % Inputs: % ------- % root : (string), root p...
984c5824a0645df93c86c3940dea9669363c79e971d4b88dfd250b0792666c14
MATLAB
1,497
49
function [Signal, t] = eeg(AperiodicParameters, PeriodicParameters, ... Duration, SampleRate, WelchWindow, highpass, lowpass) arguments AperiodicParameters = struct(); PeriodicParameters = struct(); Duration = 20; SampleRate = 250; WelchWindow = 4; highpass = .8; lowpass = 45; end % Ape...
fa042733225faa74a9f9c1837be150454de3cfe0c0b13dffe86902947bc86020
MATLAB
1,498
41
% Model Multiclass SVM Classification binary complete % Input: % Xpca: Data matrix % ONEpca: Column i-th of Xpca % TWOpca: Column j-th of Xpca % Y: labels % template: Kernel SVM template % labelconditions: Cell of strings % Nsim: ...
6bd970d7cb405b398a814fc599b659936b365d0dba8c57c1bb8acb4e312d1b83
MATLAB
1,499
44
function [nrgSig_adapt_model,ts_adapt,sys,f] = adaptation_analysis(sigma,d,a,downsam,nTR) %sigma = noise param % d = adaptation param in equation of model % downsam = play around with downsampling data sys = StochasticWilsonWTA_Tash_Sigmoid_adapt(sigma,d,a); %change d params. as adaptati...
f29a61b2764b6fedf33de7d0c05be891afff481ae9d3c34683d9033b99c5f9ec
MATLAB
1,499
42
function Pixels_List = Order_Connected_Pixels(Im_BW,P0,P1) % This function gets a binary image and two [x,y] coordinates (P0,P1). % It returns an ordered list of the coordinates of the 1-pixels ("white"). % The ordering is according to the connectivity, starting from P0. % P1 is used for directionality to account...
597ea4fbbf4d0447ab8c9c2486c62c9c27972bda8fab9e064c460613c733d5d6
MATLAB
1,502
31
%-------------------------------------------------------- %HeRA default settings %-------------------------------------------------------- hera_def.pulsefile_extension = 'puls'; hera_def.prepeak = 5000; hera_def.prepeakdelay = 2; %Number of samples delay in peak detection of scanner hera_def.samplerate...
c646ac408304a6ef879c56bb40d71b7c2055d01a571cc727e0c03e9fa747e0a2
MATLAB
1,502
82
function A=readmda(fname) %READMDA - read the contents of a .mda file. MDA stands for %multi-dimensional array. % % See http://magland.github.io//articles/mda-format/ % % Syntax: A=readmda(fname) % % Inputs: % fname - path to the .mda file % % Outputs: % A - the multi-dimensional array % % Other m-files required:...
cfc6ccf7d1ef2951f459c4168c645d6f649b855bd36452724ebdb3f1173ef52d
MATLAB
1,502
46
% % Test program for phase shifting function. % % Dependencies: The baseline wander and ECG filtering toolboxes of the Open Source ECG Toolbox % % Open Source ECG Toolbox, version 1.0, November 2006 % Released under the GNU General Public License % Copyright (C) 2006 Reza Sameni % Sharif University of Technolo...
ddb743a4fdb89c6391e338f5b63c56610992bcbeba0f6b8d5cc2c02ab2e1ff29
MATLAB
1,502
52
function [icasig, W]=milca(x,P,kneig,algo,harm,finetune) % Mutual Information based Least Dependent Component Analysis %References: % H. Stogbauer, A. Kraskov, S. A. Astakhov, P.Grassberger, % Phys. Rev. E 70 (6) 066123, 2004 % A. Kraskov, H. Stogbauer, P. Grassberger, % Phys. Rev. E 69 (6) 066138, 2004 % Output...
22cde6051aeb054cb0ba097092c6795023168fcb779f67212c3c824b66573682
MATLAB
1,504
43
%% Finding df/f using linear regression - least square fitting model function [dF, baseline] = linregFP(iso,sig,prc) % Description: This function will find the baseline of a signal by applying % a linear least-squares fit between the two timeseries (that is, the % isosbestic control signal values were the independe...
80492d59749b0c1c322528f400da9f5a0168fe72217d5de21f9ddfdaeca5ba6d
MATLAB
1,504
38
function [positions, EXITFLAG] = fiducial_det_lsim(data, ecg_rpeaks_index, fs, varargin) % FIDUCIAL_DET_LSIM (DEPRECATED) ECG fiducial points detector based on LSIM % % [positions, EXITFLAG] = fiducial_det_lsim(data, ecg_rpeaks_index, fs, varargin) % % This function is deprecated and kept only for backward compa...
0ff4a4c879aa0ff5277b9078bf89eb593aceab839ab6cf177371e844c3dc8671
MATLAB
1,505
47
function [map, delay_bases, time_bases] = decide_bases(session, channel, unit, sigma) % Decide about resolution of bases % % Parameters % ---------- % - session: scalar % Session number with format: yymmdd % - channel: scalar % Channel number % - sigma: scalar % S...
5d162e309964e66c4b95ae33084e62642b730b42167a03b644d63e88ce269d14
MATLAB
1,505
49
function Bursts = classify_bursts_shape(Bursts) % categorizes bursts based on their average shape % Types: Sw = sawtooth, Mu = mu wave, NM = notched mu, Sq = square, Tr = % triangle, Sn = sinusoid % Part of Matcycle 2022, by Sophia Snipes. DRSYM_Threshold = .15; % this is deviation from .5 TPSYM_Threshold = .1; Square...
7e80c7e1f9f9485f8d4a8c86c168ce2fd392df1ea23f6fb31cf88676f7f34300
MATLAB
1,506
96
% Created By: Ashlee Liao (ashleel@andrew.cmu.edu) % Created: 17 February 2021 % Last Edited: 8 December 2022 % Last Edited By: V. Webster-Wood (vwebster@andrew.cmu.edu) % Run this file to set up some forces/parameters to complement % ModularAplysia_1282022_withSNS.slx %close all %clear all %clc %% Spring Parameters...
624e332bba3c50c89705074bd984e2ab18ac01e1709098d82aaeda42b30e5ce9
MATLAB
1,508
39
%% add togethter meny WF files clear clc [filename, 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) %% all_CTP = []; for i = 1:2:(length(filename)) load(filename{i}) 'exp_num' filename{i...
38d660a7489d03a57297d4837fbca230614e029aa6e6497f6f62915333b87cf2
MATLAB
1,510
62
function gym() gym = struct; gym.vertices = ... [0 0 0; 0 0 0.20000000298023224; 0 0 0.60500001907348633; 0 -0 1.0059999942779541; 0 -0 1.4049999713897705; 0 1.17 0; 0 1.17 0.20000199973583221; 0 1.17 0.60500001907348633; 0 1.17 1.00600019693374634; 0 1.17 1.4049999713897705; 0.600000023...
951a8e0b9418abcd94b766c0075bf34a0092058cb939446abc5a5a6a259aceb4
MATLAB
1,510
48
function hirarcial_ex(N, dont_use_pca, CTP, parameter_names, i, XT) % use hirarcial % Load the data matrix X % Normalize the data X = XT{:, N{i}}; X_norm = normalize(X); % Apply PCA to reduce dimensionality [coeff,score,latent] = pca(X_norm); % Find the most significant PCs cumulative_variance = cumsum(lat...
2ae2e43275f921c3a49503093dc9a62c04c2a4379488750ed18d8a68040bca6d
MATLAB
1,512
30
% reject_cnt() - works the same way as EEGLAB Plot - Channel activations (pop_eegplot) % except for saving the rejected period limits in a .mat file % with the same name as the original set % see 'winrej' parameter in eegplot.m % The original file r...
a213d467bac30477b0be73e80d5df7d8da43ce856a36fcc26c491bcc54e81b46
MATLAB
1,512
49
function sRes = sort(obj) %SORT Cluster detected spikes if isempty(obj.res) obj.loadFiles(); end obj.isSort = 1; if ~isfield(obj.res, 'spikeTimes') || isempty(obj.res.spikeTimes) error('no spikes to sort'); end if ~isfield(obj.res, 'spikeFeatures') dlgAns = questdlg...
be9fa4946f256bb859d986f419821d30d454eeb3457551628715b64ecc392f4e
MATLAB
1,512
50
function [trans_data] = prepare_data_task_decoding_iti(p, traces, evs, bvs, tis, speed_control) %% calc scale factors per subject for sub = 1:p.nSubjects all_tr = cat(2,traces{sub,:}); vars(sub) = nanstd(all_tr(:)); end scale_factors = 1./(vars / max(vars)); for sub = 1:p.nSubject...
e3379bfa777e1269b4e2720e676b9c35e38802504ff02589ab8bfb325e2a62f6
MATLAB
1,512
34
function WaterMarkTurn=WaterMark(WaterOnArray, WaterOffArray, StartTime, FinishTime, TurnMarkerTime, OneTurnTime) %StartTime‚©‚çFinishTime‚̊Ԃ́AÅ‰‚ÌTurnMarkerTime‚©‚çÅŒã‚ÌTurnMarkerTime‚܂ł̐…‚̂݊„‡‚ðŽZoB global DrName %WaterOnArray WaterOffArray StartTime FinishTime TurnMarkerTime OneTurnTime TurnMar...
5ed2af0e439cc2e673c8c9583ed69971248f108c866c00e7c3de2e42f2213ffe
MATLAB
1,514
40
function generatemaps(outfile,thr) % This function constructs multiple networks with varying parameters. For % each projection type, an adjacency matrix is created with. For various % threshold values, distance matrices are computed from this matrix. % % generatemaps(outfile, [thr]) % % Input: % outfile: file...
a1eae119904d7cc040c15bc15252b224acb744ada9f18e97af2c486dff19c4fd
MATLAB
1,515
47
function E=efficiency(G,local) %Global and local efficiency for binary undirected graph G. % %Eglob=efficiency(G); outputs the inverse distance matrix: the mean of this %matrix (excluding main diagonal) is equivalent to the global efficiency. % %Eloc=efficiency(G,1); outputs individual nodal local efficiency. %F...
973d510f013b1616eedd63b2bb8190045920ddce58956e4ca58a00edc80a46e5
MATLAB
1,516
44
% Funtion that estimates the coefficients of Auto Regressive Process % Input % XD: Matrix of signals: Signals x Samples % p: Order of Linear Predictor Coefficients (FIR-filter) % fs: sampling frequency @ Hz % L: Duration of Response in Seconds % taus_0: initial taus of the AR(p) proces...
8583504ff17a8a52a012a16728927d3c41afb451216d692d3ec3c7d7bc9b3c81
MATLAB
1,518
26
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f6\c') x = importdata("responsive_with_response_parameters_and_tags.mat") %% x1 = sortrows(x,"tag") x1 = x1(find(~isnan(x1.magnitude)),:) x1.struct_number = grp2idx(x1.tag); stats = mes1way(x1.magnitude,'eta2','group',x1.struct_number) %% ...
0436fe2eeb7ff5a2fbff4c33ef9850e611bdb41ad77c03b24e21319648087f27
MATLAB
1,519
55
function [lmxo,lmno,lms] = defLam(X,y,alpha,stnd,lmx,lmn,lamRatio,lst,ln,logPref) %logPref = 'smaller'; if isempty(stnd) stnd = true; end if isempty(lamRatio) lamRatio = 1e-4; end if isempty(lst) lst = 'log'; end if isempty(ln) ln = 100; end if ~isempty(X) && ~isempty(y) % if X and y are not empty we a...
1fd5a97a625e408a21dc9d228537b74b4940244450c1c60e7f9bf6897d5c6d19
MATLAB
1,519
33
% Funtion to get Odd Matrix from % Input % isSIGNALS: detected signals with Ca++ Transients Automatically % notSIGNALS: retected signals Automatically % Global Input % indxSIGNALSOK: true signals with Ca++ Transients % SIGNALS: Original Raw Data % Output % OddsMatrix: Cell Of Structure Matrix f...
67352b9a0444b7fe914c493cb009b633128ca4778401c2b9786209103edacefb
MATLAB
1,519
41
%% Plot Data clear all; [FPfiles,FPpath] = uigetfile('*.mat','Select FP Files to Analyze','MultiSelect','On'); if isempty(FPfiles) fprintf('No Files Selected'); else if (~iscell(FPfiles)) FPfiles = {FPfiles}; end nFiles = length(FPfiles); [analysisOpt,ind] = listdlg('PromptString',...
040c8652cccf7d18c1f63427da8ca19f7f85ed5036e940a4e2a65af1f8cf288f
MATLAB
1,520
39
function [ang, theta_min, theta_max, theta_mean, theta_med] = column_subspace_angle(A, B) % column_subspace_angle - Compute angle between the column subspaces of matrices A and B. % % Syntax: [ang, theta_min, theta_max, theta_mean, theta_med] = column_subspace_angle(A, B) % % Inputs: % A: Matrix A with dimensio...
561bc63c3a06c8afba56b0028137c19a9eafb50be7c15f6ca1b3dec04a1b325d
MATLAB
1,522
42
data = clusters.cluster_cells.cluster_2{15}.intensities; %% %bin and interpulate plot(data(1).psth.mean) %% for i = 1:clusters.num_of_cells(2) psth = clusters.cluster_cells.cluster_2{i}.intensities(1).psth.mean; interpulated_psth(i, :) = bin_psth(psth, 5); mximum_psth(i) = max(abs(interpulated_psth(i, :...
60daf3e78851764e6040480ad1a57e506aa3fad5df62caae04f04631151051cc
MATLAB
1,525
40
function y = tikhonov_regularization(x, diff_order_or_filter_coefs, lambda) % tikhonov_regularization - Tikhonov Regularization. % % Syntax: y = tikhonov_regularization(x, diff_order_or_filter_coefs, lambda) % % Inputs: % x: Input signal (Channels x Time). % diff_order_or_filter_coefs: Smoothness difference order (...
b2eba5dbba9f4c5123ede553695a2ead7458cd513e17b9a324cbe3f7afd0ac22
MATLAB
1,525
48
%load atlas annotation_volume_location = 'C:\Users\elyashivz\Documents\analyzing_slices\annotation_volume_10um_by_index.npy'; structure_tree_location = 'C:\Users\elyashivz\Documents\analyzing_slices\structure_tree_safe_2017.csv'; if ~exist('av','var') || ~exist('st','var') disp('loading reference atlas...') av...
dbad1e082faddcc7535b343cca7e11a929eb6ad3677234fbbb88e7e4650af948
MATLAB
1,525
64
% Sample code for testing naive maternal template subtraction technique % % Reza Sameni (C) % Email: rsameni@shirazu.ac.ir % Web: www.sameni.info % % Crated June 2018 clc; clear; close all; load('SampleFECGDaISy'); data = cell2mat(data); fs = cell2mat(fs); L = size(data, 1); N = size(data, 2); mref =...
8d9e4f7fe9f4aacf503409eecc9b0a53c86f3c810b477f2b3d6c97dd599f7c40
MATLAB
1,526
53
classdef (Hidden) handle_logger < handle % % Class: % adi.handle_logger % % This is hopefully a temporary class that logs open and close % operations. properties fid end methods %TODO: Make private function obj = handle_logger() %Ca...
8fd94071dfe9470f39326b8120475de7a5fa25d33be247afd1eccda96b2272c4
MATLAB
1,526
70
%% this script can be used to generate coarse alignment coordinates % we do this if the automatic alignment fails because there are % large scale rotations or translations %% load maps p = params_FC; sub = 4; % thisSub = 82 for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'minisc...
b9898f76d95b9259c3d8ee00a0f0225e47297470a8a437ee3a0bf9bec29d04d7
MATLAB
1,526
40
clear all, close all load time_data.mat %% Plot time data, with Membrane off-on-off nobio_range = (osc_sim.time > 0.2) & (osc_sim.time < 49.5); bio_range = (osc_sim.time > 49.5) & (osc_sim.time < 100); toxin_range = (osc_sim.time > 100); fig = figure(1); fig.Color = [1 1 1]; fig.Position = [0 10 600 450]; ...
ccfaba416fbcc8f89d8f01416b75e55ea9b66d35a27276cbd5ae939b5334008c
MATLAB
1,528
38
function adaptive_thresholding(stat_filename, mask_filename, spm_mat_file, con_index) % read the data (spmT and mask), call the Gamma-Gaussian Mixture code and % then apply this threshold to save the threasholded image with topo FDR at % q=0.05 % % FORMAT: adaptive_thresholding(stat_filename, mask_filename, spm_mat_fi...
5c3f271329f793dcc56656045cb8f3ed537792ac98357387dfe2c64ed0e65715
MATLAB
1,530
48
function [ output_args ] = runAlignment( p ) %ALIGNJOINT aligns cell maps of all sessions for each subject and saves %registration tform %% load maps for sub = 1:p.nSubjects for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'miniscope', ['subject' nu...
a1ae40f7fc458b2963ea7bbe9388973d3b80dc6449958a1bf8a45dbe5bdaf327
MATLAB
1,531
66
%root_dir = '/servernas/images2/romain/data/spectro/hipo/repro_study/fid_pos_nii'; anat_dir = '/home/romain/data/spectro/hipo/repro_study/anat'; coreg_inter=0; if coreg_inter jobs = {}; log_file='log_coreg.log'; d1 = get_subdir_regex(anat_dir,'HIPO_..$'); for nbses=1:2 if nbses==1 d2 = get_subdir_regex(anat...
3a528b1829b4895ae1ef961b3cd9306bd0fdc80d1a20feb82569b008f4192134
MATLAB
1,532
40
function [ nexFile ] = nexAddInterval( nexFile, intervalStarts, intervalEnds, name ) % [nexFile] = nexAddInterval( nexFile, intervalStarts, intervalEnds, name ) % -- adds an interval variable (series of intervals) to nexFile data structure % % INPUT: % nexFile - nex file data structure created in n...
f47055f28c65cdb0ee3d6697e12ec35c5d1891b78cfc5844898de2a4d93bae80
MATLAB
1,533
45
function Bursts = detect_bursts_all_channels(EEGBroadband, EEGNarrowbands, NarrowbandRanges, ... CriteriaSets, RunParallel, KeepTimepoints) arguments EEGBroadband struct EEGNarrowbands struct NarrowbandRanges struct CriteriaSets struct RunParallel logical = false KeepTimepoints = ones(1, siz...
54e4dd019f732b03349fafb0e7a7be37a0e7a15dd1566c96d576319d9dfe68ef
MATLAB
1,534
42
function [spikeTimes, spikeMat, tVec] = poissonSpikeGen(fr, tSim, nTrials) % Poisson process to simulate spike train % % [spikeTimes, spikeMat, tVec] = poissonSpikeGen(fr, tSim, nTrials) % % Description: This function uses Poisson process to % simulate spike trains that have characteristics close to real neurons...
8fd933cfc1ccd42739543cf3da5ea2e519e7aa9e5517fa116d6a0fb4597025ea
MATLAB
1,534
52
%clculate IR for LFP mkdir('LFP_ir') cd('LFP_ir') %% time = -2.999:0.001:16.001'; binsize = 1000; x = [15.400000000000000;14.900000000000000;14.400000000000000;13.900000000000000;12.900000000000000;11.400000000000000;9.400000000000000]; st = fieldnames(meanLFP); for i = 1:length(st) f1 = figure; f1.Position = ...
6905abcdeeef1f6352e737f59d711ada4b5976891fbb101004ed597c9efe59c3
MATLAB
1,535
49
function out = rst_dynamicdprime(data,quantile) % compute the dynamic d prime based on the vincentization of RT % data is a matrix of RT (column 1) hits (column2) and stimulus codes (column3) % quantile is the number of bin to do % out is the result % take stimulus info % --------------------- Stim = data(:,3); % s...
cc6ca2026c79e57db8d066853eb4b87c254016620aaa3065ec7a898ebe88952b
MATLAB
1,535
43
function [ecg, phi] = ecg_gen_gmm(phi, theta0, alpha, b, theta) % ecg_gen_gmm - Generate synthetic ECG using a Gaussian mixture model. % % Syntax: % [ecg, phi] = ecg_gen_gmm(phi, theta0, alpha, b, theta) % % Inputs: % phi: ECG phase calculated from real ECG. % theta0: Desired phase shift of the synthetic ...
53f9dfaf070a53f059bf2c7bb5f8babd7fdf56c9475f078e303f464caa11fdeb
MATLAB
1,537
70
%% this script can be used to generate coarse alignment coordinates % we do this if the automatic alignment fails because there are % large scale rotations or translations %% load maps clear p = params_2DAA; sub = 4; for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'miniscope', ['...
d3bb99a97216544ff4282236e7d36da17c85891a6c1ab673010ecf4c2fdc1533
MATLAB
1,537
43
clear all load data_oscillation.mat %% Current oscillation f = figure(1); f.Position(3:4) = [540 365]; lines_width = 1.5; ax1 = plot(i_sim.t-min(i_sim.t), i_sim.i,'Color','#F5266D','LineWidth',lines_width); hold on time_sel = i_meas.t > min(i_sim.t) & i_meas.t < max(i_sim.t); set(gca,'ColorOrderIndex',1) ...
da6d2a7a56568761e7f744729da24f2af1d84d009ae4647d93d8ad4aa64eb433
MATLAB
1,537
36
function correlationplots(h,data) %% Draw plots showing relative input distribution % autocorrelatemap() and crosscorrelatemaps() depend on this function. load('structures','groups'); axlabels1 = {data.label{1},'0.5','0','0.5',data.label{2}}; axlabels2 = {data.label{1},'0.75','0.5','0.25','0','0.25','0.5','0.75'...
4eb7d15ceb757dbd073042508a322717b709d9e17bc0219b438ad54b48e48a87
MATLAB
1,540
53
classdef DetectController < handle %DETECTCONTROLLER %% CONFIGURATION properties (SetObservable, Transient) hCfg; % Config object end properties (SetAccess=private) errMsg; isError; end properties (Access=private) importTimes; % spike times already...
94e10870bf5c27e8b81e62618b0e05017be0f0e486c7153c8b371dd81483881b
MATLAB
1,540
79
function [smoothedLabels,bf,org_l] = RaguSmoothLabels(V,M,b,lambda,start,stop) % function [l,org_l] = RaguSmoothLabels(V,M,b,lambda) % % Where V is the voltage vector(Ne x Nt) % M is the microstate vector(Nu x Ne) % b is the window size % lambda is the non-smoothness penalty factor (should be betwe...
54d68a9cdfab85852542d8eb743483e981d8fb67763f6c23f1f8d235f84227c9
MATLAB
1,541
80
function [FISRT LAST] = sortFirstLast(t_ECG,t_SPIKES,ind_SPIKES) % t_ECG=t_events, % t_SPIKES, % ind_SPIKES=1:length(t_SPIKES); t_CORTOpeak=t_SPIKES(ind_SPIKES)';%ECG_RESULTS.t_events; %BELT_Rpeak; t_LUNGOpeak=t_ECG;%t_maxima(1:end); N_ipol=50; %interpolation %RR interval rrint=[]; tint=[]; for i=1:length(t_CORT...
2315ce1cbb02ca7b22690b7c8ad5afde15dabfcbae81322780c0681983deb1d9
MATLAB
1,542
56
function result=rectify_shape(Rspimage, shape, COR_level, minvo, Rsp, Radi) wide=512; [I,J]=ind2sub([512,512],shape); mI=floor(mean(I)); mJ=floor(mean(J)); I1 = max(1,mI-Radi); centerX = mI-I1; I2 = min(wide,mI+Radi); J1 = max(1,mJ-Radi); centerY = mJ-J1; J2 = min(wide,...
e737448ac747d49c8f46243508d2611d6492a009512b963cc7c2c5bb29227925
MATLAB
1,542
60
function AG_MN = AG_MSpoI2(MSPoI,idxNE,idxEX,options) % This function compute the agreement matrix acros MSPoI, for each regime %% IF COMPUTING AG ACROSS ITERATIONS AND ACROSS SUBJECTS AG_MN = {}; for Reg = 1:length(MSPoI.MSPoI.Par) MLP = MSPoI.MSPoI.Par{Reg}; tot_fr = length(idxNE...
75e0bd25e1fe17372c7e375e2fd488548bf26fc7c44635a0b4c88f01cee88805
MATLAB
1,543
44
function ids = findexperiments(varargin) %% Find experiments with specific conditions % For example based on structure ID, strain or gender % % exp_id = findexperiments(Variable, Value, ...) % exp_id = findexperiments('all') % % Input: either 'all', or a list of Variable-Value pairs where: % Variable is an ex...
2c201c3341eca90847d2818ee5f59062320ea02de23ad9cad3b642b95e578b2d
MATLAB
1,545
72
%kalman filter of white white noise signals sample entropy clear all close all % Data Sampling Rate: 100 Hz fs = 100; % Generate white noise signals EEG1 = powernoise(0, 50000,'normalize',true); % Visualization of raw signals EEG1=EEG1'; lenofEEG1 = length(EEG1); tEEG = (1:length(EEG1))/fs; subplot(311) ...
86ad4ca965f6c4cc5c7d2ff99e3fc4830ca28223a19c080a5ad5e0764e4b278f
MATLAB
1,545
44
function success = compileCUDA(nvccPath) %COMPILECUDA Compile CUDA codes for JRCLUST gpuD = gpuDevice(1); if nargin < 1 if ispc() nvccPath = sprintf('"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v%0.1f\\bin\\nvcc.exe"', gpuD.ToolkitVersion); else [ecode, ou...