sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a24fd6e2c483b45e519254c05586f866ae40a0879386e5be36a28e5a2c487758
MATLAB
1,944
64
function walkerdots = mdComputePositions(md2D, markers, tw, speed, xcenterw, ycenterw, fr, invert); %walkerdots = mdComputePositions(md2D, markers, tw, speed, xcenterw, ycenterw, fr) % %Computes the array of dots to draw as the current frame of the walker. %Loops walker when we get to the end of the md data set % %INP...
945dd5c272bf0ced74caa85d1d20ce0f6fb60ad3aa854896f20af15d35ccedbd
MATLAB
1,947
50
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
07fe7ea421accff50153f0c43d076cfec0d03d143028254360e222c73ce3a435
MATLAB
1,951
56
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
9c60a787800ea0ada9d617c66f57ec8043082a1d4bf8cf620c141ee5188fd6d1
MATLAB
1,951
40
% Demo for emmeans clear all % load data load carbig t = table(Acceleration, Cylinders, Displacement, Horsepower, cellstr(Mfg), Model_Year, MPG, cellstr(Origin), Weight,... 'VariableNames',{'acc','cyl','disp','hp','mfg','year','mpg','orig','wgt'}); % predict MPG but interested in Origin differences so make fixed ...
fb09037685396aad8a5a8d2cd047dd638ea247e3bc67b6336f841ae98f040d3a
MATLAB
1,952
57
function orders = make_orders(num_conds, trials_per_cond, num_orders, train) % Generates counterbalanced order of conditions. % Written by KGS Lab % Edited by AS 8/2014 num_trials = num_conds * trials_per_cond; if ~train % IBC Change: training session % check that num_conds is a factor of trials_per_cond if (...
7d21d3ec745af64ff1546b5611d885e73180b83ae3a65572ca4a2b7f81072dee
MATLAB
1,954
50
% Generate an n-by-d matrix R of random numbers sampled from a multivariate normal distribution, % which will have the desired empirical mean and covariance, i.e.: % mean(R,1) == mu % cov(R) == sigma a d-by-d matrix % % From https://stats.stackexchange.com/questions/120179/generating-data-with-a-giv...
57eaf91fc30e3a204af4e633d167269b090f2a4fa65248f85f83f8d76d299f4f
MATLAB
1,955
40
%% Demo 11 - Binomial GLMM (binary outcome, logit link) % A binary outcome has a mean that is a probability bounded between 0 and 1, so a % gaussian model is invalid - a binomial GLMM with a logit link is the right tool. % Shown on the bacteria dataset (MASS): presence/absence of H. influenzae in 50 % children measured...
085dce864e631018da1ac8db44341d2bd72f1f7accff47a5fa64a6c985f9d363
MATLAB
1,958
68
%% % Unpacks x without need for temporary variables. Note that it is % possible to request less than the total number of available elements. % [a, b, ...] = unpack({a, b, ...}) % [a, b, ...] = unpack(struct('a',...,'b',...)) % function [varargout] = unpack(x, fieldOrder) %----- Cell input if ...
114c792d3f31694930ac56fa87daadf45db632b11186f5b2b033a6db897ceb75
MATLAB
1,958
54
function [shifted, nshift] = alignXcorr(input, maxiter) % ALIGNXCORR determines shifts according to xcorr aligment with average % % use as % [shifted, nshift] = alignXcorr(input,maxiter) % % This file is part of EpiCode, see % http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details. % % EpiCod...
5a1438e5c8399fcc2423a0006e288eaf4dd90c15613cff4d2b6dc5442762d901
MATLAB
1,959
52
classdef HoldoutResultsSummary % HoldoutResultsSummary % Aggregates summary statistics across multiple HoldoutAnalysisUnit objects. properties TrainAllCorrelations % [numSplits x numComponents] matrix TrainMeanCorrelation % [1 x numComponents] vector TrainAllAUCs_ROC ...
8ebab810c52e5ce7971fbd5ce35ab07d23b4dda68b9b794ef1bed7113ace7863
MATLAB
1,959
94
function out = ghm(g,h,varargin) % GH = GHM(X,Y,{OPTIONS}) % Calculate the geometric-harmonic mean (GHM) of the absolute values % of two variables. Optionally, calculate the weighted GHM % % X,Y are of any numeric class or size (must be the same size) % OPTIONS includes the key-value pairs: % 'weight...
88d1e9ca0960aa27b658c84a192af87b8cf14cdaf6153ee01290fc3660abcc52
MATLAB
1,961
72
% Clear the workspace clear; clc; close all; % === 1. Read Excel Data === filename = 'hankou/luoshan.xlsx'; sheet = 1; data = readtable(filename, 'Sheet', sheet); years = data.Year; months = data.Month; runoff = data.Runoff; % === 2. Construct Time Vector === time = years + (months - 1)/12; train_pe...
53f1428013d6c5a459e54174ab1e950bb5a59b5acebeabeae4f3c42e1962eb79
MATLAB
1,962
48
function Borders=setBorders(options) % automatically set borders on the parameters based on were you sampled. %function Borders=setBorders(data,options) % this function sets borders on the parameter values of a given function % automaically % % It sets: -the threshold to be within the range of the data +/- 50% % ...
27d310ce984994c94ed3c24a684e6f06bad7318341fa1e178b0fff56523dc757
MATLAB
1,963
42
% This file is a helper function. It takes grayordinates for the volume % part from one sample cifti file. They grayordinates are specified in 2mm % MNI space. They are transferred to the BCI space. For this purpose, first % we coregistred BrainSuiteAtlas1 to BCI atlas and then used the svreg map. clear all;close all;c...
3156f10e2a9d82b59b03b6a6e01f29afbd1098fa382f5b27764b71ff103f05a1
MATLAB
1,963
45
% ‘Optimizer’ %% clc clear close all %% %% Fun_name=“F5”; % Function name of test functions: “F1” to “F23” SearchAgents=30; % Function name of Pelicans (INFOpulation members) Max_iterations=1000; % maximum iteration count for Fun_name [lowerbound,upperbound,dimen...
53f7ee7ee232ab264e0bcaaae16d4f8315349f7ae7baa5b78b994c2182387e26
MATLAB
1,965
48
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
a720853f7bb9bb35db61141553207d58e92f4802119bcf7b6160ca4490e888ca
MATLAB
1,968
71
classdef ByteStream < handle properties (GetAccess = public, Dependent) bytes end properties (Access = private) total_bytes uint64 segments end methods function self = ByteStream() self.segments = gadgetron.lib.list(self.cre...
3d5f7b687d8033f0af0e3f5963afd82d76bd98ee2d1edb5a957a9c9d7f78f6b5
MATLAB
1,971
65
function [d,dt]=formatts(d) % % Usage: [d,dt]=formatts(d) % % Helper function for CWT,XWT,WTC % % Brings a timeseries into a shape so that it has two columns: [time, value]. % % % (C) Aslak Grinsted 2002-2014 % http://www.glaciology.net/wavelet-coherence % --------------------------------------------------------------...
de852fddbaf8d55df7a0bc68e9d3352325f2968f1a6ee796f891fea5decb6b6c
MATLAB
1,971
66
function [count,prop,countC] = countSpots_centroid(BW, R, tbl, posPath) count = []; prop = []; countC = []; O = fieldnames(BW); nSpots = size(tbl, 1); disp([num2str(nSpots),' Visium spots detected']) disp('Building spot grid') crow = round(table2array(tbl(:, 5))); ccol = round(table2array(...
0ecd2613f86f9f28d1b83577f9b0f228999c45a142dbc3ef8a16049499efc3eb
MATLAB
1,973
52
function [theta, beta] = CBIG_AuthorTopic_EstimateParams(params) % [theta, beta] = CBIG_AuthorTopic_EstimateParams(params) % % Compute estimates of the author-topic model's parameters (theta and % beta) using the current estimate of the parameters of the variational % distribution produced by the Collapsed Variational ...
087a877362a0eae7f49105e2f5fe154d5c32d5d55157353061542e629adeb6ce
MATLAB
1,974
81
function plot_select_pairs_fig3A3B4A4B(path_extract, seizure, time_idx, plot_duration, filtered) % On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy % Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano % DOI: https://doi.org/10.7554/eLife.101859 % Plots select pairs of seizures w...
945b91443b7906458d23b8daf8d831f7b74dd210e036813fe06a6e2966538f0e
MATLAB
1,975
84
function [hh,ii]=nt_iplot(name) %[hh,ii]=nt_iplot(fname) - plot data file based on index % % hh, ii: header info and index % % name: file name % % nt_iplot(name): just plot the data, mean removed % % See nt_index. % % NoiseTools nt_greetings; if nargin<1 || isempty(name); error('!'); end % check 'name' if ~isc...
fe1d8b53ce52b433a2f6058d2be3d8f7d58eec26344e7862318b7c91f1e2a9e8
MATLAB
1,975
74
%% function [] = democolor(makePastel, maps, picture) if nargin < 1 makePastel = false; end if nargin < 2 maps = { 'hydrangea' ... , 'terrain' ... , 'fade' ... , 'hot2' ... , 'cold2' ... , 'g...
78881e0355d562a865c135582c89dc31ba8f775a892d297e4053dc0f5f962191
MATLAB
1,977
73
function nt_bsplot(x,w,style,abscissa,zeroflag,rmsflag) %nt_bsplot(x,sds,style,abscissa,zeroflag,rmsflag) - plot average with bootstrap standard deviation % % x: data to plot (time * trials, or time * 1 * trials) % w: weights % style: 'zerobased' (default) or 'meanbased' % abscissa: use this vector as plot's abscis...
f07b4ff6456a495e8af779dcceb46c9bd72f457e55c180888d9095acab5bb890
MATLAB
1,978
82
function varargout = addaxisplot(varargin) %ADDAXISPLOT adds a plot to an axis. % % handle_to_plots = addaxisplot(x,y,axis_number,...); % % See also % ADDAXIS, ADDAXISLABEL, AA_SPLOT % get current axis cah = gca; % axh = get(cah,'userdata'); axh = getaddaxisdata(cah,'axisdata'); if ...
f969440ea7b8c078ed7c0090e522970fc3b95f9f7a78327e24459a302898ca31
MATLAB
1,978
44
% This example script computes spike-tiling coefficient as described in % Cutts et al., 2014 Jneuro. This parameter is a measure of pairwise correlation % between pairs of spike trains. Importantly for development, it is unbiased by % firing rate (standard correlation strongly overestimates correlations between % pai...
ca57c9cf21e7f42cf5102b905b15f17947960a716539e4a49edc9af33a0e7408
MATLAB
1,979
120
function demo_sigstar % demo function for sigstar % % function demo_sigstar % % No input or output arguments. % % % rows=2; cols=3; clf subplot(rows,cols,1) barData=[2,1.2,1.9,1,2,3]; H=bar(barData); set(H,'FaceColor',[0.5,1,0.5]) groups={[3,6],[1,2],[5,4]}; %overlay random data hold on for ii=1:length(barData)...
de2901dd16e5c13e51cb94da086198e8e46d4a47aeded4374ffcbc07340dbbe3
MATLAB
1,979
51
% This is a sample main file that reads two grayordinate fmri files generated by bfp and outputs the synced files. clc;clear all;close all; addpath(genpath('../')); g1=load('/NCAdisk/SCD_structural_analysis/BOLD_study/SCD_BOLDdata/ACTL004/func/ACTL004_rest_bold.32k.GOrd.filt.mat'); g2=load('/home/sychoi/Dropbox/SCD/A...
f7c01eadc2c4c26b7b9cb452bc5397c35d147f06cc43407b6cbe5f606515c431
MATLAB
1,982
61
function gen_brainordinates_alff(BSTDir, anatbasename, fmribasename,measure) % Measure could be 'ALFF', 'ALFF_Z', or 'fALFF_Z' %bfp_out,subid,'func',[subid,'_',sessionid sub_mri = [anatbasename, '.bfc.nii.gz']; subfmri = [fmribasename,'_',measure,'2standard.nii.gz']; if ~isfile(subfmri) fprintf('File doesn''t exis...
a78b1edfdf1b7e7a61cabf154cf71ab5119b73461537d2c5ecaa36369874262f
MATLAB
1,984
70
function y_hat = CBIG_regress_X_from_y_test(y, X, beta, X_train_mean) % y_hat = CBIG_regress_X_from_y_test(y, X, beta, X_train_mean) % % This function applies the regression coefficients "beta" generated from % the training set (see CBIG_regress_X_from_y_train.m) to regress the % nuisance variables X from the target ...
7b179fd06d8d6ff1e43b1b3031cd51638d32bc7140360e4bd1d24f6c0b9e52b3
MATLAB
1,985
90
function [C,idx]=nt_xxcorr(A,B,centerflag) %[C,idx]=nt_xxcorr(A,B,centerflag) - true normalized unbiased cross-correlation function % % C: normalized unbiased cross-correlation function % idx: index of largest extremum. % % A: first column vector % B: second column vector (nsamples < A) % centerflag: if true pad...
593f5a0686959c1359fbcbd38531f7bc3cf57e3f3b2b0d3aa4b281af42a9a53b
MATLAB
1,986
75
close all load([pwd '/init_data/var_combos.mat'],'var_combos','var_vectors'); numPerBlock = 1000; [lpp, ~] = size(var_combos); maxNumBlocks = ceil(lpp/numPerBlock); n_totalVars = length(var_combos)/length(var_vectors{1}); Sim_results = []; for i = 1:maxNumBlocks resultsi = load([pwd '/result/Sim_results' nu...
5f9662af2bfa5aae2a4a4e8e12a3bc39250c1ca07cd3826f89fe087d35f76132
MATLAB
1,990
58
%% main script to create field analysis gui input and calculate spatial information main_path = "G:\"; rootdir = strcat(main_path,\CA1 miniscope data"); % change this according to your path addpath(strcat(main_path, "Discrimination 2025 CodeBase\Spatial remapping\SpatialRemapping")) workdir_d = [strcat(rootdir,...
25258fa908fe825b46f11ec2c4f30367f887a05f42344e18a43fb591bb016cbe
MATLAB
1,992
53
function Tcoeff = getTCstimSingleLags(animal_name, ... spike_matrix, lags, repeat_calc, save_data, output_folder, stim_period, clusters) %% By Mattia 01.20 % just a wrapper for any spike-tiling coefficient function % it is used in the example script "MainSpikeTilingCoefficient.m" % inputs: % - animal_name (strin...
994e6da21a907b45fff1bdac0ae1521b9152fc4aa8112996079ab7b9bda569de
MATLAB
1,995
51
%% Function to apply field mask on each map function [Summary_tbl, FieldMap_full, FieldMap_sess] = ApplyMask(maps, fields) field_counter = 1; [N_cells, N_session] = size(maps.ActivityRate_sess); FieldMap_full = cell(N_cells,1); FieldMap_sess = cell(N_cells, N_session); field_ID = []; cell_ID = []; FieldSize = [...
4bddf6def1b2871934e54176da4423ad7f82a46e33fa01a90455705ca92b4f91
MATLAB
1,997
61
function [delta, theta, alpha, beta, gamma, broad_1, broad_2] = compute_bands(signals, fs) % signals: Matrix of input signals (each column is a signal) % fs: Sampling frequency num_signals = size(signals, 2); params.tapers = [3, 5]; % Define frequency band edges (in Hz) edges = [0, 4; 4, 8; 8...
2d4f75ff2ec3f65ccb89a9c6bacabe6d6e71f5a3a172128fbf86a85cbe5a4b92
MATLAB
1,998
79
dim = 128; dim_kernel = 5; num_th = 11; num_sc = 10; pad = (dim_kernel-1)/2; mp = zeros(num_th, num_sc); mp1 = zeros(num_th, num_sc); cn_act = zeros(num_th, num_sc); cn_no_act = zeros(num_th, num_sc); Jaccard = zeros(num_th, num_sc); KL = zeros(num_th, num_sc); JS = zeros(num_th, num_sc); RMSE = zeros(n...
9f2b52698e2c3bfe1084dfeec8492c8aec6211c9af1e63d7fa2366de9578fedc
MATLAB
1,998
66
%% ======================================================================== % Analysis_IOI.m % Intrinsic Optical Imaging pipeline: % 1) Normalize data % 2) Rearrange frames by cycle phase % 3) PCA + Indicator Function method % 4) Reconstruct cleaned data % 5) FFT retinotopy maps (phase + amplitude) % =...
3830e7663989e4b24c61878ff91addeb38083cddfc621c428da9528aad42196c
MATLAB
1,999
58
function Happ = bilin_Hessfun(x, lambda, S, Y, A, h, opt) % function [fun,varargout] = bilin_Hessfun(S, Y, A, h, D, opt) % % Function to calculate hessian multiplication function % for 'HessianMultiplyFcn' % % % calculate Hessians % First term dS 2*vec((H^T*H)*S*(A*A^T)) = 2*kron((A*A^T),(H^T*H)) % Second term dS...
792b6f13c1c00530a0b74a09fb94483f6e98bf15090581ffa1774904c5564a87
MATLAB
2,001
46
function dtx_spikes_writeSC(ipatient) if ispc addpath \\lexport\iss01.charpier\analyses\lgi1\Git-Paul\fieldtrip; addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\projects\dtx')); addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\external')); addpath (gen...
433d006e1b0eb2fd10c42e90a79652d1d60c7393564cb85163eff9f559445439
MATLAB
2,002
44
function preictal_spikes_slurm_joblist %find config script : addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\projects\preictal')); config = preictal_setparams; sc_version = '1.0.8'; fname = fullfile(config{1}.datasavedir,'preictal_slurm_job_list.txt'); fid = fopen(fname,'w'); for iel...
4c03085b927392d3805a8e17ce8cbb88fac63635a6f081c081ef0ceee5d62497
MATLAB
2,003
42
function bytes = encode_image_headers(headers) nheaders = numel(headers.version); bytes = zeros(198, nheaders, 'int8'); function bytes = byte_view(array, width) bytes = reshape( ... typecast(squeeze(reshape(array, 1, [])), 'int8'), ... width, [] ... ); end ...
fdb99edf0ab8a2967dc67cd55b11184cfe24c10ef384106f943d5aa554cd50a8
MATLAB
2,005
66
function I = gcmi_mixture_cd(x, y, Ym) % GCMI_MIXTURE_CD Gaussian-Copula Mutual Information between a continuous and a % discrete variable in bits calculated from a Gaussian mixture % % The Gaussian mixture is fit using robust measures of location (median) and % scale (median absolute deviation) for each...
07cb68734db0f2154e5ecfa1c8c775a812624439f2077bfcd3bb8168de8c6e04
MATLAB
2,006
80
function outpict = zblend(inframes,mask) % ZBLEND(INFRAMES,MASK) % use a mask to blend between multiple images in a 4-D array % % INFRAMES is a 4-D image array (I/IA or RGB/RGBA) % MASK is an image representing depth in the image stack % can be a single image (I or RGB) % can also be defined...
2cf33fdcacd4b013a1940b12015709751345c498274c98bdefc713a6b0eb1ba5
MATLAB
2,009
39
function [devianceResiduals,deviance,samples_deviance,samples_devianceResiduals] = getDeviance(result,Nsamples) %function [devianceResiduals,deviance,samples_deviance,samples_devianceResiduals] = getDeviance(result,Nsamples) % This function calculates the observed deviance from the model. % % If you ask for more than ...
f6ca48d21c51a882b3c27f3f25786bcc2857e0b8752fc9ddde33d0fcd77fde5f
MATLAB
2,018
84
function [Xt, Yt, Zt, maxk]=filter_PFs(Xt, Yt, Zt, maxk, smoothwind,stype, addwall, rtips, mode) J=length(maxk); % add arificial MT-wall part if addwall>0 wallsize=addwall; Xwall=0.0001*ones(wallsize,length(maxk)); if mode == 1 Ywall=0.0001*ones(wallsize,length(maxk)); end Zwall=[]; ...
ce8551d28e5634614aacd027c43841c1294d1d79de9a5d4b424676850c2c86bb
MATLAB
2,026
45
function spike_matrix = getMUASpikeMatrix(animal_name, ... resultsMUA, output_folder, save_data, repeatCalc, area) % by Mattia 03.21 % computes spike_matrix with 1ms resolution, starting from the output of % detected MUA timestamps (e.g. when no SUA is available/needed) % if you would like to have all your MUA s...
32a3e1c6340a06d26f0833799a4dde52b5a0e2b855c568ba1666fc5a82f44c37
MATLAB
2,027
39
%function startup % on startup setup the java class path for the stuff here set(0,'defaultaxesfontsize',14); % sets up path to use usb2 java classes disp 'setting up java classpath for jAER interfacing' % here=fileparts(mfilename('fullpath')); % % jars are up and down from us % p=[here,'\host\java\']; % javaa...
90a3d6bec9988c85695af0aafc62c02d212e0b4bf5ad9198fc983a0a9ffadac0
MATLAB
2,027
75
function [cfg, LFP] = alignTemplates(cfg, LFP) cfg.orientation = ft_getopt(cfg, 'orientation', 'landscape'); t = [-0.15 0.10]; % t-zero LFPs fig = figure; papersize = 800; set(fig, 'PaperPositionMode', 'auto'); if strcmp(cfg.orientation, 'landscape') set(fig, 'position', [20 -60 papersize*sqrt(2) paper...
bc73ceff816d9f8b0b7a1d48e613120f82c529d220d8e2bc822ad9433386bc1f
MATLAB
2,029
57
function [Params] = read_params(suffix); % Reads parameters passed by grab % param_file = ['Parameters', suffix]; if ~isfile(param_file) error('Params file does not exist!!') end fid = fopen(param_file); data_lines = textscan(fid,'%s','Delimiter','\n'); fclose(fid); if numel(data_lines{1}) ~= 3 error('Expecti...
fefd73d2ff9790879531de097cfbd8881313a50266e7d31a1f50e9e78ef7a907
MATLAB
2,029
63
function featval = moving_window_feature_calculation (input_data, fs, winLen, winDisp, featFn, varargs) % On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy % Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano % DOI: https://doi.org/10.7554/eLife.101859 % Function Purpose Calcula...
5e6f374b6c719b1e7f6c3d343b5f936da6bbe487e7bcbe201cfacb24afe682c2
MATLAB
2,031
53
function createBAT(animals, BATfolder, PRMfolder) % by Mattia. creates the lynux script that you can use to run clustering on % all your files. % INPUT: % animals - see main script, you can easily rewrite it with % experiments if this suits better your needs % BATfolder - string, where yo...
9b258c13ce308fb6211278d8e3722f9a46162840ff1919699d632ef007101bea
MATLAB
2,031
48
function recon_data = read_recon_data(socket) recon_data = gadgetron.types.ReconData(read_recon_bits(socket)); end function recon_bits = read_recon_bits(socket) n_recon_bits = read(socket, 1, 'uint64'); recon_bits = arrayfun(@(~) read_recon_bit(socket), 1:n_recon_bits); end function recon_bit = read_recon...
3748c57f13eefb4d4e4d1e6b90f82f64b110c075f598980272bb7b31f60d3cc3
MATLAB
2,033
43
%% function to count events - 2nd version when maps and eventXY has the same cells included only%% Function to count Ca events in individual fields function [EventCounter, FieldEventTime, FieldEventPercentage] = CountFieldEvents_MisMatch(FieldMap_full, onset, p) EventCounter = []; FieldEventTime = {}; FieldEventP...
dd3c82ce7fd218142ab317759cae446af5763daaf6b68be0ad84253442641097
MATLAB
2,034
76
function outpict = colorbalance(inpict,K,preserve) % OUTPICT = COLORBALANCE(INPICT,K,{PRESERVE}) % Shift the color balance of an image. This is based on the legacy GIMP tools. % % INPICT is an RGB/RGBA image of any standard image class. % Multiframe images are supported. % K is the parameter array. This is a 3...
ebbb4b140f1a4290f2be83884f03dcc9bfe05e36d4067d07ceae1da743dacfde
MATLAB
2,034
27
function KCresponse = calculateKCresponse(MBmodel, PNactivity) %% refers to the spiking/output activity of KCs, incorporating APL inhibition and spiking thresholds % expects MBmodel to have the weighted connectivity matrix PNtoKC, alpha % (APL gain) and C_theta (scaling for thresholds). PNactivity expected to % be M-by...
2042fabc45e4e4a0e0ea29e6a762b6af73b6a6a28794bb7084d3b48116de3cfe
MATLAB
2,043
67
% use mc_untidst_wouter_dante.m % ATTENTION: this program is needed to remomve NAN values from the to GRE % registered MASK: % STEP1a: Do Coreg.Estimate Reslice in SPM (with % GRE(Reference),Anat(Source), and Mask(Other) % STEP1b: before using mc_undist_wouter_dante.m: here. clear % addpaths addpath('/fmri/apps/spm5'...
629ef82af82627b98996c169fe9c4ecf1d50476016427903ffc6478b9e3b6acb
MATLAB
2,043
79
function c = bipolarcmapW(varargin) % Returns an approx. bipolar colormap centered at zero (in cRange). Zero % maps to white. % % method is type of interpolation to be used. It can be % ['sigmoid'], 'linear', 'quadratic', or 'cubic' % % colors is the color combination to be used for +ve and -ve part. It can be % ...
2bd7e747a4ad3fd80c4d6261ae0fc63b6e22f6476ce9d9d52e962d5577ac5f57
MATLAB
2,047
60
function tform = get_electrode_positions(datarun,epi_image) % get transormation matrix from fgp_array image to matlab electrode % locations % usage: tform = get_electrode_positions(datarun,epi_image) % % arguments: datarun - datarun structure % epi_image - array_GFP image % % outputs: tform - ...
8c51ba35e386cc0e87ac74b8ca19a7d7d5322c8c9e24e7f9a05455dfbbe27efa
MATLAB
2,050
46
function plotInterictalPeaksV2(Number,IIA_batchResults) length = size(IIA_batchResults{Number, 1}.OriginalSignal); threshold = zeros(length(:,1),1); for point = 1:length(:,1) threshold(point,1)=IIA_batchResults{Number, 1}.threshold; end thresholdMatrix = [IIA_batchResults{Number, 1}.OriginalSignal(:,1) threshold]...
f5a313a2407c4cb8641f0b163c23b97df8d6ab28381c8843898960106244f3bc
MATLAB
2,052
79
function [outpict,varargout] = imreadort(fname) % OUTPICT = IMREADORT(FILENAME) % [OUTPICT MAP ALPHA] = IMREADORT(FILENAME) % Read an image from an image file and reorient it based on % available EXIF metadata. If no orientation tag exists, % image will be returned as-is. % % While this tool is intended for use...
6bc5664a9cf220101162863d3018ced9402ee0fc19fe3ff356b4ab4396a22a66
MATLAB
2,053
42
%% wrapping function for gui input and spatial info score function SpatialInfo = Wrap_SI(workdir,discrimination) SpatialInfo.Individual = cell(length(workdir),1); SpatialInfo.Cohort = {[]; []}; SpatialInfo.All = []; filterSize = 1.5; framerate =30; for f = 1:length(workdir) clearvars -except SpatialInfo...
a9b2668651ee55fc89836c0a6aba644069dddb1ab3057480decc3d22947ee266
MATLAB
2,056
80
close all; clear all; clc addpath(genpath('/data/code/matlab')); prepOutput; %%%% PARAMETERS %%%% % Database database{1} = '/data/coord/tyr/tyrunits'; database{2} = '/data/coord/zen/zenunits'; % Data files dataDir1 = '../data/cohLFP_TestJustPrintComplex'; dataDir2 = '../data/cohLFP/_old2/500ms_5Hz_Target'; % Displ...
d4b5edc52a2f18963856c0a255799df9cd08fdfc101263f5f2546ac519e9ed0a
MATLAB
2,057
60
function [ ] = generatePRT( PRTParameters , PRTConditions , runName , outputFolder ) %outputFolder = fullfile(pwd,'PRTs_AF'); if ~exist(outputFolder,'dir') mkdir(outputFolder); end outputFileName = [ runName '.prt']; % --- Create new file using parameters prtFile = fopen( fullfile(outputFolder,outputFileName)...
d68546be500f72d05a35bd5a0bea1f8e528ad07f5b71f2ffa971883c540198ac
MATLAB
2,060
52
function [slope, intercept] = getLFPslope(power_spectrum, freq, freq4slope, to_plot) %% Calculate power law decay exponent (1/f slope) % By Mattia, based on Gao et al., 2017: Inferring synaptic excitation/inhibition balance from field potentials. % INPUTS: % power_spectrum: ´ vector of LFP power as e.g. in the o...
2fb4c442623bbba06be6cf8bb89be32b15c29bc944d0014985a86b1e0b145750
MATLAB
2,062
33
function handles = whiskerplot(boxQuantiles) %% Default arguments if nargin < 2 || isempty(boxQuantiles) boxQuantiles = [0.09 0.25 0.5 0.75 0.91]; end %% Plots combined across layers levels = accumfun(2, @(x) quantile(x,cfg.boxQuantiles)', shapeVar{iVar}(iLayer,:)...
35fbe68b056fad2feb8c0db7239a2bf5905be983c36e833cf5c3f2cdc58abf9b
MATLAB
2,062
66
function outpict = joinalpha(outpict,alpha) % OUTPICT = JOINALPHA(INPICT,ALPHA) % Concatenate color and alpha channels as split using splitalpha(). % If the given image already has alpha content, mix it with the new alpha. % % INPICT is an I/IA/RGB/RGBA/RGBAAA image of any standard image class % ALPHA is an I/RGB ...
5dd1889d761b81feb5debaaf4fb5a1e99d808f0b5da3ebede928b3e5e04889b9
MATLAB
2,067
73
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
b0a0b6e120a7fdde2512435477b843da472331dcd8fdb049d552a11141be1369
MATLAB
2,067
46
function priors = getStandardPriors(options) % sets the standard Priors % function priors = getStandardPriors(data,options) % The priors set here are the ones used if the user does supply own priors. % Thus this functions constitutes a way to change the priors permanently % note here that the priors here are not normal...
d4666a77fdf1028ff282a8ec18eb8ad9f9c60a3c4f93f411a5f312c1c7dcb277
MATLAB
2,067
73
function [CMI I] = gccmi_ccd(x, y, z, Zm) % GCCMI_CCD Gaussian-Copula CMI between 2 continuous variables conditioned on % a discrete variable. % [CMI I] = gccmi_ccd(x,y,z,Zm) returns the CMI between two (possibly % multidimensional) continuous variables, x and y, conditioned on a third % discrete vari...
a94233de80492482e55bb8d923c6c139d4bd5bd8c624b6914062c74e5c2f692e
MATLAB
2,069
56
function [AG03EEG11] = importfile_dateBS(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % AG03EEG11 = IMPORTFILE(FILENAME) Reads data from text file FILENAME for % the default selection. % % AG03EEG11 = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads data from rows % ...
afcef18ed9d6aacf176b92cda690408b9f9ac3be085241e61286df5959bdc9c7
MATLAB
2,070
76
%% function to calculate heading direction relative to the most northern corner of the maze function [HDir, Rew, RefPoint, rotXY, theta] = GetHeadingDirection(XY, event, filtSize) [RefPoint, rotXY, theta, Rew] = GetReferencePoint(XY,event); % calculate heading-direction filt_XY(:,1) = movmean(rotXY(:,1), filtSi...
3f9cd9a7e57523d983c78e926467ef6f2756e29b6217639b78a6e6bf5840b60b
MATLAB
2,072
55
function [fcnName, inputs, outputs, varLength, isInside] = parseFunctionSignature(hDocument) %% Find the function definition indicated by the document's caret position % If the user has placed the caret just before a function definition (i.e. only separated by % whitespace), then use that function; oth...
bcae54a73cfbfb54dbdf17c9c096924d47a241355f9b9300549b2e639390211d
MATLAB
2,072
68
function H0 = kbcontrasts_wald(fitmodel, emm, L) % Hypothesis testing using Wald t/Z-tests on specified joint coefficients % (i.e. on input contrasts) % Copyright 2019, J. Hartman, Cornell University % % written using Matlab version R2016a % 2023-09-29: Modified by Kim Boström to have the output structure also % incl...
2b45debf8ab4d23de584361e29f50d6a66d2d7afd6ca68e7c89b1a9ebb910a57
MATLAB
2,073
54
% RNDORTHOGONALMATRIX Generate a random m-by-n matrix R with orthogonal columns, i.e. R^T R = I. % % Inputs % ======== % sz : The desired size of the output matrix, i.e. [m n ...] where additional indepdently % generated slices (3rd and higher dimensions) can also be requested. % A : An op...
7ca93d62f7854bfee2f73e10606bc337c81a7fc946d6d75b057bc05c8613aceb
MATLAB
2,087
67
function [] = plim(varargin) % PLIM Plot limits setting function. %----- Input parsing narginchk(1, inf); handle = []; iArg = 1; axisRange = cell(1, 3); numRanges = 0; while iArg <= nargin && ~ischar(varargin{iArg}) if ishandletype(varargin{iArg}, 'axes')...
8409008ca3886bb32cbc82a90e17e7385b563061b234928742434f99879f9c14
MATLAB
2,087
44
function PPIparams = get_PPI_params(header) PPIparams.measID = header.measurementInformation.measurementID; PPIparams.accPE = header.encoding.parallelImaging.accelerationFactor.kspace_encoding_step_1; PPIparams.acc3D = header.encoding.parallelImaging.accelerationFactor.kspace_encoding_step_2; lUserParamValues = [he...
2db44ed7c6bc0b493eadd281c77e20ed15823865e5fbb0d15db6905b525117c7
MATLAB
2,088
69
function [counts centers] = imhistFB(inpict,varargin) % [COUNTS BINCENTERS]=IMHISTFB(INPICT,{NBINS}) % Calculates the histogram counts for an image. If called with no output arguments, a stem plot % will be generated for visualization. % % This is a passthrough to the IPT function imhist(), with an internal f...
76ba06cd4e08a8c5911cf7b1b0f8b35ff9a2ea0a70f4fe881e63aadc2c323850
MATLAB
2,088
79
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2016 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
e576c8a776087e229d2cb46d3ad3b3bb91709bf8ab4de54c2d9935cbbee041be
MATLAB
2,091
67
function patches = construct_patches(sizY,siz,overlap,min_size) % constructs the coordinates of the different patches for batch processing % INPUTS % sizY: size of input data (excluding time dimension) % siz: size of each patch (default: [32,32,4], if third spatial dimension is present) % overlap: a...
8e993e03ed1ab4813d2fc61c88d15300ae9069a46d84f63573a6f9bc98827fdd
MATLAB
2,094
68
function C = C_matrix_2D(x, varargin) % Function that calculates the C matrix. % % Input parameters: % --x: N1 x N2 x Nc Nyquist-sampled k-space data, where N1 and % N2 are the data dimensions, and Nc is the number of % channels in the array. % % --tau: Param...
c8d53788fc35bf2f91f1874d08af6284be52bdbfc0eecc9935bda690b667d957
MATLAB
2,094
61
function dummyPRF = cpm_dummy_prf(U, options, TR, nscans) % % cpm_dummy_prf, creates a PRF struct using only inputs, options and number of % samples. Mostly a utility tool for simulations. % % U - Experimental stimulus timing (see spm_prf_analyse.m for details). % options - struct including options, most important...
3667d79209f10df01869a0adcd90a7c1a198c93f222a2c5821d4dc8ab9cf59ad
MATLAB
2,098
58
%% Gergely Tarcsay, 2024. Assign camera frames to different behaviorally relevant states function [States, TrialFrames] = AssignFramesToStates(event, v, v_thresh) % assign frames whether mouse is running (1) r resting (0) States.Run= v > v_thresh; States.Context = zeros(length(v),1); % 1 or 2; not assigned (tr...
5154c8a470052ec5cc42f75975d0bbcde6a658acb8b3fccf107302814071fa59
MATLAB
2,098
59
function [D, S, graphK] = combineDictionaryPatches(RESULTS, n_patches, patches, sizY, K) fprintf('Combining results from different patches... \n'); cnt = 0; d = prod(sizY(1:end-1)); S = sparse(d,n_patches*K); MASK = zeros(sizY(1:end-1)); for i = 1:n_patches patch_lin_idx = patch_to_linear(patches{i}, sizY)...
fdb087d077b5ee91efc3efd4be78fb3e67a392ee81a9fac2c6656d147aa866c1
MATLAB
2,098
45
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
71ba7b3e0ab0180c14790b0bb80bb8afe8d3afcde9eec76fe879137079eae32f
MATLAB
2,100
43
function dtx_spikes_slurm_joblist %find config script : addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\projects\dtx')); config = dtx_spikes_setparams; sc_version = '1.0.1_dev'; fname = fullfile(config{1}.datasavedir,'dtx_slurm_job_list.txt'); fid = fopen(fname,'w'); for ipatient = 1:size(c...
75f4525f21b022eb31861839eb251c73375547e7c67a31ba2e019298e89f22ca
MATLAB
2,101
31
function setpaths restoredefaultpath if isunix addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/git/fieldtrip addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hspike/ addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/shared/ add...
cc234f803d89b6fe544bd68865c0836912741e3242f8e00035881b3f72506248
MATLAB
2,104
63
function outpict = rotateds(inpict,numframes,blurcycles,shiftcycles,maxblur,maxshift,shiftphase) % ROTATEDS(INPICT, NUMFRAMES, BLURCYCLES, SHIFTCYCLES, {MAXBLUR}, {MAXSHIFT}, {SHIFTPHASE}) % cyclically shifts the rows and columns of each channel in INPICT while simultaneously % performing cyclic spatial ...
fbe0366369cd050993d690800c30bf9b6e2d15a1cbd25d672496e424875c76dd
MATLAB
2,105
97
function outpict = brline(outsize,vertices) % MASK = BRLINE(OUTSIZE,VERTICES) % A simple tool to draw a non-antialiased polyline as a logical image. % This is fairly crude Bresenham line tool, but I'm considering this as % a placeholder. I hope to someday replace xwline() and brline() both when % I get aro...
3ad2d81ccf3613dd4388efebfa6e1ed789060c51738b0e548da095eae3b3f49e
MATLAB
2,109
69
function [A B] = matchframes(A,B,varargin) % [A B] = MATCHFRAMES(A,B,{EXPANSIONMODE}) % Given two potentially multiframe images, expand single-frame inputs % as necessary when framecounts mismatch. % % A,B are images of any class, geometry or channel arrangement. % If framecounts differ, the shorter image will...
ac44a7107d69391aae48070b15899645e263e79518f2706089bc60a075b44c3b
MATLAB
2,111
84
%% % plot function [x,y,f] = CEC2005_plot(func_name) [lb,ub,dim,fobj]=Get_CEC2005_details(func_name); switch func_name case 'F1' x=-100:2:100; y=x; %[-100,100] case 'F2' x=-10:0.1:10; y=x; %[-10,10] case 'F3' x=-100:2:100; y=x; %[-100,100] case 'F4' x=-100...
6920735af81c9e22905302806e50e9401ab25a5c979c9368fefbdd3fb2968b66
MATLAB
2,116
89
function [y,z,mask]=nt_eyeblink(x,eyechans,nremove,sr) %[y,z,mask]=nt_eyeblink(x,eyechans,nremove) - project out eyeblinks % % y: clean data % z: eyeblink components % mask: mask used to weight eyeblink intervals % % x: data to clean (time X channels) % eyechans: ocular channel numbers, or eog signals % nremove: ...
9854135d5c180768ba9ffebfa7858fc4548b2efabd265a79e913303d2189bb0c
MATLAB
2,117
66
function trials = CreateTrials(walkerindex, walkerdir, walkerori, walkercoh, masktype, maskdir, maskori, maskcoh, rep) %Randomization of trials ran = 2; %in blocks %rep = 4; %Prepare trials tr = 1; for l=1:rep for m=1:size(walkerindex,2) for n = 1:size(walkerdir,2) for o = 1:size(wa...
9b5530f0c0d4c2bfd797e62531a3ec17977379c7fb206fdd9ad12d2ab56ad4f2
MATLAB
2,119
54
function plot_ei_over_epi(data, cid, im2, tform, varargin) % map cells over epi image % usage: plot_ei_over_epi(data,reachr_id,im2,tform, opt) % % arguments: data - datarun structure % cid - id for plotting % epi_image - array-GFP image % tform - transformation matrix (LO...
4d8ed30c8dac50cee664496bc47de78fd6fcc309cd94e6910678fb88b25b828d
MATLAB
2,123
55
function [distance_maxs, distance_mins, maxs, mins, types] = find_nearest_distances(all_2_find,latencies, taps) %% Find nearest predicted peak before and after all taps or predictions % % **Usage:** [distance_maxs, distance_mins, maxs, mins, types] = find_nearest_distances(all_2_find,latencies,taps) % % Input(s): % -...
f169668d0a5a470dfbbdbe204770e5207a8fd8e7c9773518ab502c84ff707c04
MATLAB
2,123
52
Alpha Evolution: A simple and powerful optimisation algorithm to advance optimisation beyond metaphors **************************************************************************** ***************************** % ‘Optimizer’ %% clc clear close all %% %% Fun_name=“F8”; % Function names: “F1” to “F23” Se...
b18e23c3fbc2c9f138e53e5c403901f562c4ec362f2f891619794477f6ad9ab3
MATLAB
2,127
76
function out = orddither(img,ksize,cmode) % ORDDITHER(INPICT, {KSIZE}, {COLORMODE}) % multilevel ordered dither inspired by Cris Luengo's blog posts % http://www.crisluengo.net/index.php/archives/355 % and by work from others % % INPICT is a 2-D intensity image % KSIZE is the size of the Bayer coeffic...
082ba131f10127ab97054c2eb438f53ddd75d475d62753d3b4dba8168c602cff
MATLAB
2,129
47
Alpha Evolution: A simple and powerful optimisation algorithm to advance optimisation beyond metaphors ********************************************************************************* ************************ % ‘Optimizer’ %% clc clear close all %% %% Fun_name=“F6”; % Function name of test functions: “F...
87094bfe271cf8eb2e44a9f38dc6c81c190cc09244391493f0c4067a4ce18aa0
MATLAB
2,131
56
function Y = adjustAutocorr(X, aFcn, nFFT, nParams) if nargin < 4 || isempty(nParams) nParams = size(aFcn,1) - 1; end outSize = size(X); X = remould(X,3); %% Original autocorrelation Xacorr = fastAutocorr(X, [], nFFT); Xa...
5473254e509636644689f369f03a78fe7a4da706eb960d770ccbb4619c493c3f
MATLAB
2,132
73
%% Gergely Tarcsay, 2022. Function to parse data into individual trials and get timestamp when mouse triggered the hidden zone. function [TrialStart, TrialStop, ZoneTriggered, context] = ParseTrials(event) flags = event{:,1}; %loop on flags to find the beginning of the the trials, get the indicies in %the...