sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ee110ad41dfc859ec440c32ccff0c322c2dd40559442a9925890a7a3a7b31886
MATLAB
1,140
38
addpath('C:\home\Data\4AshO') D = spm_eeg_load() MNI_roi = [40 -20 40]; trans = D.inv{1}.forward.fromMNI; head_roi_ctf = spm_eeg_inv_transform_points(trans,MNI_roi); % CTF co-ordinates fid = D.fiducials; fid = ft_convert_units(fid, 'm'); %Mc = spm_eeg_inv_headcoordinates(fid.fid....
0b04baec092a375c1bee72fb2c6a1a5182e40ab486758eae8bb9045172f72a39
MATLAB
1,141
41
function all_results = pSVR_load_results(p, suffix) % function all_results = pSVR_load_results(p) % % Load pSVR results of all participants. % % Input: % - p: Structure with analysis parameters. % - suffix: Suffix to append to the filename. % % Output: % - all_results: structure with result measures of all parti...
95535d05c19aeae848ab0e266a52821513dd13e28db8e1a26e229e819afe2f86
MATLAB
1,141
44
function datwrite(filename, x, t) %DATWRITE Write data to ascii file. % % Description % % DATWRITE(FILENAME, X, T) takes a matrix X of input vectors and a % matrix T of target vectors and writes them to an ascii file named % FILENAME. The file format is as follows: the first row contains the % string NIN followed by th...
ec55d2f2119cfbc728fdfa74abac38b362b775a66b9b5d7ba98858d3723f895f
MATLAB
1,141
35
function updateQA(slidePath) % Update QA structure with missing fileds % Written at Oct 10, 2020. %% Load Data if ~exist('slidePath','var') slidePath = [s3SubjectPath('16','LE') 'Slides/Slide07_Section01/']; end slideConfigPath = [slidePath 'SlideConfig.json']; slideConfigJson = awsReadJSON(slideConfigPat...
1e05cbece1a89d1d6ccafb4a538e3135006ad64cac0055243416accafb533897
MATLAB
1,143
28
%% Create timeseries for turbulence clear all addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Turbulence/TBI_turbulence_current_code') %code path data_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/preprocessing/tbi_sch1000/'; input_path='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs_sch1000...
20f67e584114a3ea2780135247529f8048fcea57786660bd4a886da64ef2e6bf
MATLAB
1,143
42
function [newpat] = apply_zscore(pat, varargin) % Z-score a pattern. % % [NEWPAT] = APPLY_ZSCORE(PAT, ...) % % Used in conjuction with apply_to_runs.m. Z-scores a given % pattern. % % Arguments: % % USE_MVPA_VER (optional, default = false) Use the MVPA toolbox's % zscoring instead of Mathworks, if you lack the statis...
7d967a6f9d93cb20f8c48648c8aa1f5c5123bb3d75adb07f47bb6ad72d0ca675
MATLAB
1,145
33
function [g, gdata, gprior] = mlpgrad(net, x, t) %MLPGRAD Evaluate gradient of error function for 2-layer network. % % Description % G = MLPGRAD(NET, X, T) takes a network data structure NET together % with a matrix X of input vectors and a matrix T of target vectors, % and evaluates the gradient G of the error functi...
ee82b261070255c1393b987917847005afbe9da4e0b2624b224972b4ca4abef8
MATLAB
1,145
59
function PhaseMap = PhaseMap(X,Y,ph) %peyrache 2007, beta times = Range(ph); phase = Data(ph); [occH, xbin, ybin] = hist2d(Data(X), Data(Y), 200, 200); PhaseMap = zeros(length(xbin),length(ybin)); phH = zeros(length(xbin),length(ybin)); for j=1:length(ph) t = times(j); x = Data(Restrict(X,t)); y = Data(Restric...
5df6342d48d9957f807feca4b323150401ed18100d6fd47d397fbb4b581625da
MATLAB
1,146
37
function [subjectPaths,subjectNames] = s3GetAllSubjectsInLib(lib) % Get path to all subjects in lib, don't specify lib to use the default % If lib is cell, will get all subjects in all libs described in the cells. if ~exist('lib','var') lib = ''; end %% Nested calls if iscell(lib) subjectPaths = [];...
aecbcf7780d4c4c27445319a3f5ff1ca2628572207815240729365f71e344295
MATLAB
1,146
52
function [x,mx,sx] = standardise(x,dim,lim) % X = STANDARDISE(X, DIM) computes the zscore of a matrix along dimension dim % has similar functionality as the stats-toolbox's zscore function % Copyright (C) 2009, Jan-Mathijs Schoffelen % % Subversion does not use the Log keyword, use 'svn log <filename>' or 'svn -v log...
744f390a9872d7f48d89f0e5351cf5ffd0bdf62983c1ea88f78e522f16ec65ed
MATLAB
1,148
42
function [subj] = remove_group(subj,objtype,groupname) % Removes an entire group's worth of objects permanently % % [SUBJ] = REMOVE_GROUP(SUBJ,OBJTYPE,GROUPNAME) % % Will delete the objects from the SUBJ cell array - NOT RECOMMENDED % License: %===================================================================== % %...
c1bb6edc2a56ff953c0cf5ab03114fb6756ec502761b72120af51b85d51afce0
MATLAB
1,148
31
function [First_PostStim_PeakFrame] = Peak3STD(FluorescenceTrace,StimFrame, BaselinePeriod) %Peak3STD finds the frame of the 1st peak greater than or equal to 3STD %above the baseline mean following a stimulation % Michelle Cahill 20211005 % FluorescenceTrace: % StimFrame: a number n. Find the first peak at o...
4735b35879380deeccc95bb264ecfd544b070c80f44cddb2c5d8280966c84487
MATLAB
1,149
44
function [triplets_freq, triples_table] = spike_triplets(S, time_span) %% [triplets_freq, triples_table] = spike_triplets(S, time_span) % % computes a frequency table for all the spike triplets that occur % within time_span % INPUTS: % S: a cell array of ts objects, containing spike trains % time_span: the maximum d...
d9ae3d34e8228313d62df72d03bf0994c7161f555af33f8301087f91c00b905c
MATLAB
1,149
39
% *WAVE* % % INSTANTANEOUS FREQUENCY TEST unit test for the instantaneous frequency % calculation % 13 january 2016 % clear all; clc %#ok<CLSCR> % parameters dt = .001; T = 1; frequency = 3; phase_angle = 0; % generate data time = dt:dt:T; xf = cos( 2*pi*frequency*time + phase_angle ); % analytic signa...
e8a9c764888e65be9f19ad1b404a9b30f5235d4570edd11cde7a9447a1a2cd49
MATLAB
1,149
43
function [ind] = vec2ind_inclrest(vec) % Like vec2ind, but deals differently with 0s % % [IND] = VEC2IND_INCLREST(VEC) % % See the builtin VEC2IND function for more information. This takes % in a matrix, and tells you where the 1 is for every column. % % Useful for figuring out which condition is active in your binary...
e68033b7f0fc3567c872f9f843967c167584bec4051afe54ceeca245c08092d7
MATLAB
1,151
41
function [y] = ste(x,dim) % Calculate the standard error of the mean for X. % % [Y] = STE(X,DIM) % % Matlab doesn't have a standard error function, but it's easy % enough to calculate. ste(x) = std(x)/sqrt(n) where n is the % number of samples. % % If you don't specify DIM, it will run on the first % non-singleton dim...
094cd7108b98949c76c3a9e1406c7d4560a5de309856ee35084166f5d2008047
MATLAB
1,152
53
function R = cat(varargin) % Concatenates IntervalSet objects % % USAGE % R = cat(O1, O2, ..., On, shift) % % INPUTS: % O1, O2, ..., On - intervalSet objects to be concatenated % shift - (optional) a ts object of times each intervalSet object get shifted of % before merging % % OUTPUT: % R - ...
366bddbfa4beb2189e3c7bcc5b1dff58f4820c34a7a7c3633491f75554bd409f
MATLAB
1,152
44
function is = thresholdIntervals(tsa, thr, varargin) % Returns intervals in which a TSD is above (below) threshold % % USAGE: % is = thresholdIntervals(tsa, thr, OptionName, OptionValue) % % INPUTS: % tsa - a tsd object % thr - a threshold value % % OUTPUTS: % is - the intervalSet of the times...
8ab7cc46b06f34b40db4015508664c2f3e02ab9a2f4feca3f269e29b70d6225c
MATLAB
1,152
41
function gfcd(subj, varargin) dire='/abcd_collection3165/derivatives/abcd-hcp-pipeline/'; cifti=cifti_read([dire subj '/ses-baselineYear1Arm1/func/' subj '_ses-baselineYear1Arm1_task-' task '_bold_desc-filtered_timeseries.dtseries.nii']); s=size(cifti.cdata); censor=load([dire subj '/ses-baselineYear1Arm1/func/' sub...
87e1571853f05d3eaa16aaa8c9e44a7a2a028b8af4866568490ecaf217481378
MATLAB
1,154
49
%% CLEAR AND INITIALIZE clear close all clc source_dir = 'E:\NAS_SD\SuiviClient\Triffilieff\AnnaRoman\DataAnna\Traitement DOX'; dest_dir = 'E:\NAS_SD\SuiviClient\Triffilieff\AnnaRoman\DataAnna\Traitement_DOX_'; if ~exist(dest_dir) mkdir(dest_dir) end listing = dir([source_dir filesep '*.avi']) for i=3:size(lis...
8d544c47e78680873c9e89d30770c99ec1258c91f0190167bb415325a5a884d6
MATLAB
1,155
25
function [tpr, tot] = match_neurons_with_correspondences(neurons_identified, correspondences) % Iterate through each neuron name tot = length(neurons_identified.name); tp = 0; for i = 1:length(neurons_identified.name) currentName = neurons_identified.name{i}{1}; % Search through th...
52a59785a30c469e1bbbe3a8bb1ff3d61203026299918fc700cf7f6aca728912
MATLAB
1,156
34
function histologyInstructionsEmptyDistanceFromFullFaceToOCTOrigin(subjectPath) % This function finds places where distance from full face to oct origin is % empty in histology instructions and fill up the gap such that distance is % such that center slice will be at OCT center. % Written at Feb 28, 2020. if ~ex...
9ab1591e1b8f304cdd02bbf7660aebc1d305d95f6a36ecbb4b93a33b6028004a
MATLAB
1,160
47
function [v] = var(x, normalizeflag, dim, flag) % [V] = VAR(X, NORMALIZEFLAG, DIM, FLAG) computes the variance, % across all cells in x along the dimension dim. Normalizeflag = 1 normalizes % by N, normalizeflag = [] or 0 normalizes by N-1. % % X should be an linear cell-array of matrices for which the size in at %...
e7e21eaccbc3ed6ae39d74cc41055d274315f6adf811aea6d4add5cf5bf0614b
MATLAB
1,160
35
function this = isivAnalysis(this) %ISIVANALYSIS Perform nonparametric ISIV analysis on an ACTI object % % $Author: Peng Li % $Date: Jun 15, 2020 % period = this.ISIVInfo.PeriodInHour; epoch = this.Epoch / 60; % in min cycle = this.ISIVInfo.FixedCycles; x = this.Data; x(this.GapSeries) = nan; ...
41768e72245a49fabe1247be69303d7a4c227fff560b1ba08dd017ea0f095328
MATLAB
1,161
40
function g = glmderiv(net, x) %GLMDERIV Evaluate derivatives of GLM outputs with respect to weights. % % Description % G = GLMDERIV(NET, X) takes a network data structure NET and a matrix % of input vectors X and returns a three-index matrix mat{g} whose I, % J, K element contains the derivative of network output K wi...
5e59481d783ffa1a16c16efc13d5e74db1045d0d20f893003693f3ffca110447
MATLAB
1,161
51
function up_idx = eventedgefinder(data,threshold,fs,minStateLength,mingap,up,Num) if size(data,2)==1;data=data';end Wn = [(4000/(fs/2))]; [B,A] = butter(2,Wn); data = filtfilt(B,A,data); switch up case 1 A=find(data>threshold); idx= find(diff(A)~=1); start_idx = [1 idx+1]; end_id...
d4a27ddb7d31bdfa9ed2ec97749b9e40f8aade19325a565d2595f759dd691148
MATLAB
1,161
47
function g = mlpderiv(net, x) %MLPDERIV Evaluate derivatives of network outputs with respect to weights. % % Description % G = MLPDERIV(NET, X) takes a network data structure NET and a matrix % of input vectors X and returns a three-index matrix G whose I, J, K % element contains the derivative of network output K with...
f60613d0907e8cdc973da43e6cc8b78bce5298161e54d27b48459281b366b7b9
MATLAB
1,161
31
function cdf_plot(val, linecolors, XLABEL, TITLE, LEGEND_LABELS) % cdf_plot takes an array of values and calculates the cumulative % probability of that parameter. MC 20201217 % val: 1xn cell array of where each column of the cell array holds the % values to calculate the CDF for a single condition % linecolors: n...
15996c7e9da9bbfff2a608e3e0410388cb389015d1658d30704e48d98398fee9
MATLAB
1,162
40
function recomputeSlideAlignment(slidePath) % This function recomputes slide alignment % Written at Jan 25, 2020. %% Load Data if ~exist('slidePath','var') slidePath = [s3SubjectPath('04','LE') 'Slides/Slide03_Section02/']; end slideConfigJsonPath = [slidePath 'SlideConfig.json']; jj = awsReadJSON(sli...
672e8fc556b1901a6f042031e807ab72e255b967fbceaf302993264530c8e82b
MATLAB
1,162
48
function MatNew = transSegGap(MatOld, Length) %TRANSSEGGAP Transform a matrix of segment/gap to a matrix of gap/segment % % Length specifies the total points of the corresponding signal % % $Author: Peng Li, Ph.D. % MBP, Div Sleep Med, BWH &HMS % $Date: May 4, 2016 % $Modif.: Feb 28, 2017 % ...
b6f3abdcfe1fb7ef62587d3185efb06e17c2f4e8f65dd11143de4dfb5b2f5b40
MATLAB
1,162
35
function z = findzero(v,varargin) % FINDZERO finds vector of zerocrossings in a velocity-vector % Synopsis % out = findzero(v,threshold,window) % Description % findzero(v) takes a velocity vector and searches for all zerocrossings % If a movement stops (like in tapping, the zero-crossing is looked at as two: % a...
9657a3111640912a24be308bdc644fd3d99a6947953f38e87075aa8f81f1fb0b
MATLAB
1,164
46
function [matches] = find_group(subj,objtype,groupname) % Returns a list of names of objects from this group % % [MATCHES] = FIND_GROUP(SUBJ,OBJTYPE,GROUPNAME) % % Returns a cell array of the names of all objects within SUBJ of % OBJTYPE object type that belong to group GROUPNAME % % Returns no names if groupname is e...
7834d7cf2a9b03e87ab9a955c5ce044c4b10c587bd22cdf193fb6e3eb318c4a9
MATLAB
1,165
54
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -90:dt:50; l_V = length(Vmem); %% Matrix Initialization T = zeros(1, l_V); T_erro...
292860877189379bd3d4ded31acc7a10c0a9a8bfff5f1d682154a37a03c7cb54
MATLAB
1,167
40
function phases = splitDataToPhases(subjectNames) % INPUTS: % subjectNames - cell array with subject names % % OUTPUTS: % phases - can be 0 train, 1 test % Subject in training set % LC,LD,LE,LF, Begining of LG - chronologically these are the first samples. % LG-4x and LG-5x seems to fail often, so we add ...
6ffcb75efa6811273eee261c041d4854914101c97e3a877f6235133cc3838e83
MATLAB
1,167
32
function [xdx, xdy, ydx, ydy] = jacobian_matrix2d(vectorField) % JACOBIAND_MATRIX2D Estimates the elements of the jacobian matrix % % function [xdx xdy ydx ydy] = jacobian_matrix2d(vectorField) % % INPUT ARGUMENTS % vectorField - Vectorfield to estimate the Jacobian for % % OPTIONAL INPUT ARGUMENTS % N/A % % OUTP...
7d71f706373cfb940243a7a15afc20a93c11115372241d86aeb921ad64657666
MATLAB
1,167
34
function net = netunpak(net, w) %NETUNPAK Separates weights vector into weight and bias matrices. % % Description % NET = NETUNPAK(NET, W) takes an net network data structure NET and a % weight vector W, and returns a network data structure identical to % the input network, except that the componenet weight matrices ...
13f35d8cd2501d1ba382e203cac109e2eb5394244312d9e88a03d041d0b17ac5
MATLAB
1,169
34
function popGeometry_plotSignalNoiseAxes2D(data, NperGroup, fBoundLine, signalVector_toUse, noiseVector1) s1 = scatter( data(1:NperGroup,1), data(1:NperGroup,2),[],[244 225 129]/255,'filled'); hold on s2 = scatter( data(NperGroup+1:end,1), data(NperGroup+1:end,2), [],[223 159 207]/255,'filled'); % plot decision boun...
1c66f9f67281cccc64b117cfb212b38526f35c3d68f6ae591449388b755eac87
MATLAB
1,169
31
function axh = PlotTS(S, varargin) opt_varargin = varargin; defined_options = dictArray({ { 'MarkerSize', {5, {'numeric'}}}, { 'Marker', {'k.', {'char'} } }, { 'OffsetShift', {1, {'numeric'} } }, ...
ba8dcb3f00b943bec8692f9d620c37e02afedcddbbdeb27a6b2308ac9f6218e0
MATLAB
1,169
57
function shadePlot(x,y,e,color, alpha, Linewidth) %plots line with shaded area. Inputs x, y, and e(i.e., error) %need to be vectors of the same length. Color is [R G B]. if nargin == 4 alpha = 0.5; Linewidth = 1; elseif nargin == 5 Linewidth = 1; end %transpose input vectors if necessary [nX...
6f534c295986bb9cd5e66a3c0ae3f2a354dde5222a701c11f5d40830043baa5f
MATLAB
1,170
52
function in = inInterval(O, tsa, varargin) % Tells whether points are contained in intervalSet (TODO) % % TODO: overlap with the belong function? % % % in = inInterval(O, tsa, OptionName, OptionValue, ...) % % the data of the returned timestamp count the number of intervals in the % intervalSet containing the poi...
a28222f407e65cd525fabddc8533e10b8529b9e2176ae2f4936bc3a30b258dc1
MATLAB
1,170
46
function [varargout] = bin_makeCorrIm(num_planes) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here ds_fac = 10; if nargin < 1 num_planes = 1; end [f,d] = uigetfile({'*.bin' '.tif'},'Select movie'); mov = ImReader([d filesep f]); stack = split_stack(mov,num_planes); [nRo...
c91c22c7b8b6157d30404a6ec67df56338b481282091d753f51eeef1cb1952f5
MATLAB
1,170
39
function logs2labels(p) for i_sub = 1:numel(p.subjects) % Get subject ID sub_id = p.subjects(i_sub); % Get subject ID as string sub_str = num2str(i_sub,'%02i'); try % Get name of output file label_dir = fullfile(p.dirs.data, 'analysis', ['sub-' sub_str], 'labels'); if exist(fullfile(la...
18f2e31448bf76e8e5b198287fcdcde65f7078f9befbb3d4f22edcb09eb5d8cb
MATLAB
1,172
21
function model = lda_train(labels_train,data_train,cfg) if isstruct(data_train), error('This method requires training vectors in data_train directly. Probably a kernel was passed method is use. This method does not support kernel methods. Check if cfg.decoding.method = ''classification'' '), end switch lower(cfg....
868327348367e2fd934672f355d7f189f2cb1bc255d5012c2c72c2a92f9fcf53
MATLAB
1,173
32
function t = tensorprodc(varargin) % Do the heavy lifting for tensorprod.m. You can call this function directly % but you had better know exactly what you do since it's implemented as a C % mex function with no error checking whatsoever. If you make a mistake % the whole Matlab process might crash. % % If you do call...
3711001b1137579e216fb51991b762b1278c6d8bcedbe359da32ef1d5a8e4e3c
MATLAB
1,174
47
function lat = rateChangeControl(data,trailInxArray,curGroup,epoch,plotOption) NUM_SETS = 8; partitions = getNonOverlappingPartions(trailInxArray,NUM_SETS); % get baseline baseline_params.SD = 20; baseline_params.align_to = epoch; baseline_params.time_before = 500; baseline_params.time_after = 0; baseline_params.sm...
a647890658d9e62fd04045d35dff44dba95f49f1944dc4b5bc16cc15cabb30f9
MATLAB
1,175
31
%{ Copyright (C) 2023 N. Suhas Jagannathan This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed i...
cd456030dd640ff43053a3b304944867f6fc2c3e80df5b27509e1eb33e24051f
MATLAB
1,175
28
function [ALIGNED_TRACES, AlignOnset2Frame] = AlignTraces_20211203(TRACES,OnsetFrame) %AlignTraces_20211203 takes a matrix of fluorescence traces and the frame of %some stimulus for each sample. Individual traces are aligned to the frame %of the stimulus % Michelle Cahill 20211203 % TRACES: matrix of fluorescence...
d38b5e2b9c2ed0c675f31a9f6365c823926d552bf944bc2c415a5e9aa806259e
MATLAB
1,176
32
function boris_data = load_boris_aggregated_data(filepath, camera_TTL_raising_times) % This function take a path to a boris csv file and return the headers % of the columns in header_raw as well as all the data eventTable = readtable(filepath,'Filetype','text','Delimiter','\t'); tableSize = size(eventTable,1); timeGa...
31e31cbf11e4055c4000d06c41aa98b04591223cde409be99bccfd6a92b8f64a
MATLAB
1,177
31
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This code was generated to plot the enrichment results % % Jin Liu % 2022-8-11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = p...
a7e3b6571bc59d23b089526ba153f93ed44fe872ee096d469bdf91c5d6969560
MATLAB
1,177
38
function hf_basefit = plotBaselineResultsPair(K, I, conds, tts, head, target, hevel, PC, light, sines) % Plot JR data & model before learning & get error % Use with a pair of inputs K e.g. K1([1 11]) I.impulse_or_closedloop = 0; % Check with closed loop % Plot data hf_basefit = figure; xpos_offset = [0 .1 .1 .2 .2]; ...
e7b57ad6448dbbef071ef8f1b75cba281d637a26749eb8827f69bb27edd15ff6
MATLAB
1,181
50
function [fh, rasterAx] = Raster(S, TStart, TEnd, varargin) font_name = 'Arial'; font_size = 10; font_weight = 'bold'; line_width = 2; opt_varargin = varargin; defined_options = dictArray({ { 'BinSize', {10, {'numeric'}}}, {'LineWidth', {1, {'numeric'} } }, ...
9cccb30cb8482ff581ee32e1e9c05714bb5b848dc1e64c27f4501e722b3b608e
MATLAB
1,182
62
function [M,dt] = JPETH(T1,T2,Tref,bin,win,varargin) % USAGE: % [C,B] = JPETH(T1,T2,Tref,bin,win,options) % % T1,T2 : tsd from whom JPETH are drawn % TRef : tsd represneting the common reference for T1,T2 % bin : larger of bins (in ms) % win : numbers of bins % Option: % 'LastSpk' : take for T2 only the nearest even...
555d4fdb21256bf88de97d2c2887840355f49f9c5d2e13376f220e788466ae09
MATLAB
1,183
54
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -90:dt:50; l_V = length(Vmem); %% Matrix Initialization Bv = zeros(1, l_V); Bv_er...
930216269c9b625cf2795483b8fe4d4ca70154180e9dfea1fa4b47b6f190e6c6
MATLAB
1,187
45
function [wx,g]=winsample(x,percent) % function [wx,g]=winsample(x,percent) % returns the winsorized sample of x as wx % returns number of winsorized observations at each tail of sample as g % x must be a vector % percent must be between 0 and 100; the function converts the lower and % upper extreme g values of x to x...
18e0bd0d4c821cf628268ba23f5f100b884d24d61a2021ac01db37680610c08c
MATLAB
1,188
39
load leadfield L = cat(2,leadfield.leadfield{:}); L1 = L(:,1:2:end); L2 = L(:,2:2:end); cd ~/matlab/misc C = vol2connmat(leadfield,6); C = C(leadfield.inside,leadfield.inside); inside = find(leadfield.inside); % this is good enough to get the maximum correlation of neighbour leadfield % components (although the opt...
60b97d72d7dac5736b3a63019b1eb7b1134e9b4f71278dfe9301fbc53a502617
MATLAB
1,188
32
function boris_data = load_boris_aggregated_data(filepath, camera_TTL_raising_times) % This function take a path to a boris csv file and return the headers % of the columns in header_raw as well as all the data eventTable = readtable(filepath,'Filetype','text','Delimiter','\t'); tableSize = size(eventTable,1); timeGa...
ab54b375846a3d22bda09a94ae30b5560f76893870bcb0171b07c81a434424d9
MATLAB
1,188
32
% % plot raster and PSTH with multiple alignment points % % prepares the data appropriately and then calls plotSpikeRasterMain % %urut/MPI/may11 % function spikesToPlotAll = plotSpikeRaster_multiple( spikesOfGrp, offsets, limitRange ) %offsets: offset to previous group, in s %limitRange: one row for each group, from...
ac23837339ef49bf44d60de6ba75ec6bb7aa3c824aad3b39734f6a1c26bb408e
MATLAB
1,188
38
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = 'PC|CRB'; req_params.task = 'saccade_8_dir_75and25'; req_params.ID = 4000:5000; req_params.num_trials = 50; req_params.remove_question_marks = 1; lines = findLinesInDB (task_info, req_params); cells = findPa...
dd485aa97430ace76fc4cb8cfc639fa195ff07e513b23e762e849a7f7f697e11
MATLAB
1,188
43
%% Plots V4 noise correlations (MI) in cue epoch at cued and cue-opposite locations %% Code load('V4_rsc_MI.mat') cue_onset_win = [500 2500]; epoch = num2str(cue_onset_win(1))+"_to_"+num2str(cue_onset_win(2)); plot_flag = 1; % to plot or not to plot for bin_flag = 12 % > 5 spikes/s geometric mean trial_typ...
13900699aff8cb4d1409f6fdd710120166189b80e54451b009e0bbb47513c684
MATLAB
1,189
38
function [trimmedMean,g]=tm(x,percent) % % function [trimmedMean,g]=tm(x,percent) % % Returns the trimmed mean of x as trimmedMean. % returns number of winsorized observations at each tail of sample as g % x must be a vector % percent must be a number between 0 and 100 % The trimmed mean is calculated from x after drop...
83dda5832f503ecf4f2ee2725fb67c1d9ad87cdd3fdb897bb408241528938faa
MATLAB
1,189
42
function [fig, traces] = plotThr(Thr,uMF,mice,Color,LineStyle) % PLOTTHR plots the threshold of the mice against modulation frequencies % if nargin < 5; LineStyle = []; end if nargin < 4; Color = []; end freqLim = [2, 4000]; thrLim = [-33, 0]; fig = gcf; ax = gca; if (~isempty(Color)) ...
074d5e7452ffd9c5ba705819248e7e9dff4ff7b7b02c03ea6aaeb258607bb8f2
MATLAB
1,190
27
% @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_mV3= simplified_mV3(v, mpre, dt, Vt) % minf = 0.5029*tanh(1.942+0.075*v)+0.4972; % minf = (0.00...
abe8c6be4be55530559f4ebe01c3d7b91b3faae4574d2ac610a338d48a5561cf
MATLAB
1,190
46
function [pairs_freq, pairs_table, pairs_ts] = ... spike_pairs(S, time_span, on_same_tet) %% [pairs_freq, pairs_table] = spike_pairs(S, time_span) % % computes a frequency table for all the spike pairs that occur % within time_span % INPUTS: % S: a cell aray of ts objects, containing spike trains % time_span: t...
e6333b80eeaf72f13b48a8da545c00b9f5f0a21bbbe6e7f012568c0785a20411
MATLAB
1,192
45
function [subj] = set_group_as_matrix(subj,objtype,name,mat,varargin) % [SUBJ] = SET_GROUP_AS_MATRIX(SUBJ,OBJTYPE,NAME,MAT, ...) % % Use DUPLICATE_GROUP, grab the GROUP_MAT, modify it, and then % SET_GROUP_AS_MATRIX. % % xxx - i couldn't decide on an elegant way to deal with the members = find_group_single(subj,obj...
599d316cdf5cc6470a7e3e4f0ec770978da882f5d3a0b1fcce8e777f85a37a23
MATLAB
1,193
68
function snirf = TsvFile2Snirf(src, dst, option) snirf = SnirfClass(); % Parse args if nargin==0 return end if ~exist('dst','var') dst = ''; end if ~exist('option','var') option = 'nofile'; end if ischar(src) tsv = readTsv(src); else tsv = src; src = ''; end if isempty(tsv) return; end if...
cfb8dec62293ecfaf8d0d2f464eb86139d370f7720c380cefebcdf0428c41aa9
MATLAB
1,194
38
function field = field_composition(field, N) % function field = field_composition(field, N) % % N compositions of the provided field. % % INPUT ARGUMENTS % field - Field to compose % N - Number of compositions to perform % % OPTIONAL INPUT ARGUMENTS % N/A % % OUTPUT ARGUMENTS % field - Composed field % Copyrigh...
465d82e4d6c588a7edef060226ce68d88fd933ba38a32943742dba73d3dddd3b
MATLAB
1,195
44
%% Create spectograph of raw data from a directory input for WELLS % source: http://www-users.med.cornell.edu/~jdvicto/pdfs/pubo08.pdf %incomplete program clear clc parent_dir="D:\Brewer lab data\HFS\No Stim\Wells_5SD_500maxSD"; cd(parent_dir) spike_dyn=load('well_spike_dynamics_table_nostim.mat'); spike_dyn=spike_dy...
6323446361f60e8cbb17ec4b9e8dd7bf1c9314dd88658fb3b2842a9797294090
MATLAB
1,195
32
function [C_theta, C_bin ] = center_of_mass(data,binNum) %Compute Center of Mass in circular tracks % data - binned neuronal activity of one cell, single column or row array % data - must be N *1 or 1 * N array % binNum - N % C_theta - theta position of COM reported as radius values, ranging from 0 to 2*pi % ...
d54699beb3236a3c41c44af01fcae47f91c7000494dc6ab787f66334820c9896
MATLAB
1,195
34
function [labels_psvr, labels_rad, missing] = pSVR_prepare_labels(labels) % function [labels_psvr, labels_rad, missing] = pSVR_prepare_labels(labels) % % Prepare orientation labels for pSVR reconstruction. Labels are converted % from degrees to radians and then converted into their sine- and cosine % components which...
98e50866caf2dfbc4be6dc076353b81f07888eebde61634a322b0856f3dac2f1
MATLAB
1,196
36
%Produce aggregated ied table with variables of interest, and perform %Poisson generalized linear mixed effects model. % %Different sections of this script produce statistical analysis for the %effect of flicker on interictal epileptiform discharge counts. % %Script is designed to run in sections; see the comment head...
c4eb2f7470e74ece8d2557691d2bf8d8615e90b9c61e9a323835637caaa0926e
MATLAB
1,196
54
function [lower,upper] = bootstrap_percentile(x, varargin) dim = ft_getopt(varargin, 'dim', []); nboot = ft_getopt(varargin, 'nboot', 1000); alpha = ft_getopt(varargin, 'alpha', 0.05); est = ft_getopt(varargin, 'est', 'trimmean'); if isempty(dim) dim = find(size(x)>1,1,'first'); end if ndims(x)>2 error('at...
fd8daac017b91c9210ac84acd0932cb792f099a8fb5478881b6dc9366307ec51
MATLAB
1,198
39
function [sd] = cellstd(x, dim, flag) % [M] = CELLSTD(X, DIM, FLAG) computes the standard deviation, across all cells in x along % the dimension dim, normalising by the total number of samples % % X should be an linear cell-array of matrices for which the size in at % least one of the dimensions should be the same...
0785af2de1943d4fee544958552ea003aa72a4765ef1735d008f2e8b3d97733b
MATLAB
1,200
41
function [v,c] = ldareg(x,y,gamma) % [v,c] = ldapca(x,y,gamma) % Implements regularized fisher's linear discriminant analysis % % x - N input samples [N,D] % y - N binary labels {0,1} % gamma - shrinkage constant [0,1] [N,D]=size(x); x=x'; % for each class of trials compute mean and covariance tmpi = find(y); N1=le...
70c0d02af52e1684c1706853b036a8bd9043cb7ba1546269d2372cf29826748e
MATLAB
1,200
39
function [val] = get_objsubfield(subj,objtype,objname,fieldname,subfieldname) % Returns the subfield for this object % % [VAL] = GET_SUBFIELD(SUBJ,OBJTYPE,OBJNAME,FIELDNAME,SUBFIELDNAME) % % For instance, if you wanted to know which function created a % particular object: % % function_used = get_objsubfield(subj,'pa...
ef9d981d280d34762c6c1a24d32c88d211975d904dc8b293b32366a59dcbc716
MATLAB
1,201
35
function A=imresize3d(V,scale,tsize,ntype,npad) % This function resizes a 3D image volume to new dimensions % Vnew = imresize3d(V,scale,nsize,ntype,npad); % % inputs, % V: The input image volume % scale: scaling factor, when used set tsize to []; % nsize: new dimensions, when used set scale to []; % ntype: Type...
8208e22474956ef1fbdbd4d7f2ce1b9dc78b9798d6ccc71ab4328a7887fc9699
MATLAB
1,203
43
function [y, b] = ME_preproc(y, b, c) % _ % Data Pre-Processing for a von Mises Mixture Model % FORMAT [y, b] = ME_preproc(y, b) % % y - an N x 1 vector of angles (domain: -pi <= y_i <= +pi) % b - a scalar, the systematic error (usually mildly positive) % c - a logical, indicating mean-centering (true by d...
e66c9946166b3d12d74eab093f5a0a5fb283b7d5245cc160df8f18f4497c2f64
MATLAB
1,203
42
function crit=get_criterion_for_avgLR(theta,ang,ctab,LR_Mean) syms x for loc = 1:4 cnt = 1; % d' for angles with invalid trials for iAng = 1:length(ang{2}) d(iAng,:) = theta(cnt:cnt+3); cnt = cnt+4; end % d' for angles with only valid trials for iAng = length(ang{2})...
78ff29e69a5f0964ad5097698d19e4cb01168c9f8c85bd604d8f7cda42e3edcf
MATLAB
1,204
58
function [] = test_mem3() % This is to test how well matlab will deal with memory for set_object disp('Clearing and packing'); clear all pack subj.patterns{1}.mat = zeros(64,64,34,1000); objcell = subj.patterns; %disp('About to start mem_control'); %tic %objcell = mem_control(objcell); %subj.patterns = objcell; %to...
7a22a6b39cd20c62c56477d305b64a4d0c1f003225443a4cb018deb90f7b70b9
MATLAB
1,204
53
function [tout, N] = classify(tsa, is, col) % Breaks a TSD object in many tsds according to the value of data % % USAGE: % [tout, N] = classify(tsa, is, col) % % INPUTS: % tsa - a tsd object, with at most two-dimensional data % is - an intervalSet containing the limits for the data: data falling in ...
0b2e41854987947eb123b0ad8be289f84657435dd5f3c6e42eb055cfab56fbd5
MATLAB
1,205
47
function [results] = add_results_history(results,hist_str,displayme) % Adds a line to the results.header.history field % % [RESULTS] = ADD_RESULTS_HISTORY(RESULTS,HIST_STR,[DISPLAYME]) % % Also creates the header field if it doesn't exist % % DISPLAYME (optional, default = false). If true, the HIST_STR gets % echoed t...
10bd72d38b66e79a73744ea05f048df78d3f7c740ec8553a8e458638d5e6e6bf
MATLAB
1,205
41
function xr = fss_sim_pSVR(x, Y, r) % Prepare multitarget labels x_sin = sin(x-pi); x_cos = cos(x-pi); label = mat2cell([x_sin, x_cos], ones(numel(x),1)); % Define TDT variables chunk = sort(repmat(1:r,1,numel(x)/r))'; passed_data = []; results = []; % Set up cfg cfg = decoding_defaults; cfg.analysis = 'wholebrain';...
a1dd86a782ea4a389fe57c78c074da34b7351c4a4d8787f6611ff7095b7cc087
MATLAB
1,207
39
function net = rbfsetbf(net, options, x) %RBFSETBF Set basis functions of RBF from data. % % Description % NET = RBFSETBF(NET, OPTIONS, X) sets the basis functions of the RBF % network NET so that they model the unconditional density of the % dataset X. This is done by training a GMM with spherical covariances % using...
6bff2507d7db6971c83007ad5a1901184ac55d8547406aa7a47969d15a31ba94
MATLAB
1,209
45
function [acts scratch] = test_svm(testpats,testtargs,scratch) % Testing function for SVM % % [ACTS SCRATCH] = TEST_SVM(TESTPATS,TESTTARGS,SCRATCH) % % This is the testing function that fits with TRAIN_SVM. See that % for more info % % This is part of the Princeton MVPA toolbox, released under the % GPL. See http://ww...
33bddb4c497675c65705799df1bf67b7cd60fc9fe456f3aab5ccffdf72d47b8b
MATLAB
1,211
31
function FigureA_NoImages(fileExportFolder, FigureAParams, imageA, vxMat, vyMat, relMat, thetaInDegrees, thetaInRadians) xIdxA = FigureAParams.xIdx; yIdxA = FigureAParams.yIdx; imageAmasks = cell(1, length(xIdxA)); imageAshow = cell(1, length(xIdxA)); vxMatShowA = cell(1, length(xIdxA)); vyMatShowA = cell(1, length(xId...
c9895257ca76a23cf1972734a9c4f37af46efce04a40389db16a7cc38eb2992f
MATLAB
1,211
47
% test converting points to velocity then back to points x = [195.096333105737,194.955405196334,194.663678022051,194.215017373334,193.670286789166,193.133919589554,192.693213797366,192.357493645630,192.040205689616,191.599972385252]; y = [268.171978535190,267.272809375070,266.584601060447,266.071771201756,265.84192012...
4392306cb8b2e4be25c7317bdce6083d5be209a5976838df4231e0073e3c0bf4
MATLAB
1,215
29
function [ t1, t2, t3 ] = PointsMaxCurvature_4CoE_V2( Coefficients ) %% PointsMaxCurvature Find the frames of maximum curvature for a trace fit %with a sigmoid curve (see createFit_sigmoid20210816) as described in %Fedchyshyn and Wang, 2007. JPhysiology 581.2(581-602) % Set the fourth derivative of the sigmoid eq...
02ad1d4e168cc306971f64e8e61acd60a7708c231b02bda434b547c74ddc9c11
MATLAB
1,216
51
function [F, df1, df2] = rmanova(x, percent) % RMANOVA(X, PERCENT) performs a repeated-measures anova Omnibus test % on the trimmed means, according to Wilcox section 8.1 % % Input arguments: % x = data matrix N observations x M repetitions % percent = the amount of trimming if nargin<2, percent = 0.2; end %...
b3ec82423c4f91ccd20bf229388f5c37e379a3ef59481e03014dc9e856e8024f
MATLAB
1,219
43
function [obj] = get_object(subj,objtype,objname) % Return the entire object. % % [OBJ] = GET_OBJECT(SUBJ,OBJTYPE,OBJNAME) % % Can often be useful for peering inside a particular object. For % instance, to view its innards of a pattern called 'epi_z', just % type: % % get_object(subj,'pattern','epi_z') % % Technical...
35b9af9285acd9d3c96be79467d38e5c8a8c2ee68f84b8cda71f8bcec0987d31
MATLAB
1,220
41
function [xvals, yvals, color] = hintmat(w); %HINTMAT Evaluates the coordinates of the patches for a Hinton diagram. % % Description % [xvals, yvals, color] = hintmat(w) % takes a matrix W and returns coordinates XVALS, YVALS for the % patches comrising the Hinton diagram, together with a vector COLOR % labelling the...
78137ce0a524f23f9639e5bd0f445dbe0348f6d62c077ace5a0565f0c4d0df31
MATLAB
1,220
41
function spacePETH = RasterSpace(S, phiG, TStart, TEnd, varargin) opt_varargin = varargin; defined_options = dictArray({ { 'RasterFraction', {0.7, {'numeric'}} } { 'BinSize', {10, {'numeric'}}}, {'LineWidth', {1, {'numeric'} } }, ...
88d95625fd1f3305d1dcfedc8c8b54caac18398a9da5d9115f95d9e9696a5194
MATLAB
1,221
37
function g = mlpbkp(net, x, z, deltas) %MLPBKP Backpropagate gradient of error function for 2-layer network. % % Description % G = MLPBKP(NET, X, Z, DELTAS) takes a network data structure NET % together with a matrix X of input vectors, a matrix Z of hidden unit % activations, and a matrix DELTAS of the gradient of t...
f1c4f7a1e1c93c84fe0850dc364dca0b073013e442f2cd13e9b38498fb0f5cde
MATLAB
1,224
39
function [varargout]=create_anat_model(fs_outputdir,anat_names_array) %get atlas and set some parameters for mask: atlas = ft_read_atlas([fs_outputdir '/mri/aparc+aseg.mgz']); atlas.coordsys = 'ras'; cfg1 = []; cfg1.inputcoord = 'ras'; cfg1.atlas = atlas; %set some...
4e05994f6263ee6056f574762aa7ab044d4525e73504fe1934800c97e2fc2288
MATLAB
1,225
42
function [effectSizes, ts, low, pVals] = effectSizeInTimeBin(data,epoch,varargin) MINIMAL_RATE_IN_BIN = 0.001; low=0; p = inputParser; defaultPrevOut = false; addOptional(p,'prevOut',defaultPrevOut,@islogical); defaultVelocity = false; addOptional(p,'velocityInsteadReward',defaultVelocity,@islogical); defaultNumCorr...
637faf5c60cd8acea2131d475c0f4b4396cf02f27c9bd46f1fb62072c4f3bd11
MATLAB
1,225
57
clc clear cd 'G:\Fiber_Photometry\2022-123_D2CRE_D2GLUN2B_mPFC\2022-123_ANALYSIS_Script-V2\FR_Basline_indiv_-3k-05k--13k\2022-123_D2CRE_D2GLUN2B_mPFC_FR1-RL1_1secLPCS_ANALYSIS\RESULTS' A=load('L1_press_IL3.mat'); %load le fichier .mat d'un Event/Group (par exemple, si tri en Event/Group/Session) B=load('L1_press_S...
32ef765a0abbcfaa41f00bf0a9160f4d1b29608f0e19e88ad34681df06de7e82
MATLAB
1,226
48
function T = makeTikhonov(n, type, mask) % n can either be the matrix length, or for 0th order, can be a vector of % weights % mask: mask out transitions if ~exist('type','var') type = 0; end if length(n)==1 weights = ones(n,1); else weights = n; n = length(weights); end % Make tikhonov matrix % Sum ...
4b614c810e1031d0629549da96cd6f75e5a9efd00c5ca3770fde8446e3b3bfee
MATLAB
1,226
50
function [occupancy_map_sec,activity_map] = getActivityMap(x, y, dff_synchronized, bin_size, max_image_size_pix, video_freq_Hz) % return an occupancy map in sec, the time spend in each bin % (a square of bin_size^2 pixels in the video frame occupancy_map = nan(max_image_size_pix/bin_size); activity_map...
db3f3cafd31ea904adaec3f62e8da733228a0829d68515ef8d0a400990e6c6e3
MATLAB
1,226
52
function adj_p = fdr_bh(pvals, method) s=size(pvals); if (length(s)>2) || s(1)>1 [p_sorted, sort_ids]=sort(reshape(pvals,1,prod(s))); else %p-values are already a row vector [p_sorted, sort_ids]=sort(pvals); end [~, unsort_ids]=sort(sort_ids); %indexes to return p_sorted to pvals order m=length(p...
5f00ef7e923d9b9209751dd5fb73ab7b8dfb530cdd857bda05204748e3643628
MATLAB
1,227
46
function width = fwhm(x,y) % function width = fwhm(x,y) % % Full-Width at Half-Maximum (FWHM) of the waveform y(x) % and its polarity. % The FWHM result in 'width' will be in units of 'x' % % % Rev 1.2, April 2006 (Patrick Egan) y = y / max(y); N = length(y); lev50 = 0.5; if y(1) < lev50 % find inde...
ccb231bdf22d51b805c59c9f0f73b861d8afa4e903f74b6cdd1b2cf9e781eedd
MATLAB
1,227
35
function h = CenteredNamedFigure(figname,figSize) %CenteredNamedFigure Create and center a figure on the screen % h = CenteredNamedFigure(figname,figSize) % %History % % 7/26/2002 bds wrote CenteredNamedSquareFigure as part of matwave package, D.R.Williams' lab % 8/18/2002 bds removed square requirement-- pass...
de0418db751531ff30c7c9a53660a9afa03c38cf20d6aae74d8ef786cd326c58
MATLAB
1,229
33
function [d, dStd, t] = GetDataTimeSeries(handles) global maingui d = []; dStd = []; t = []; showStdErr = GetShowStdErrEnabled(handles); datatype = GetDatatype(handles); if datatype == maingui.buttonVals.RAW d = maingui.dataTree.currElem.GetDataTimeSeries(); t = maingui.dataTree.currElem.Get...