sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b4fffb686ca63f3f668f01886c2a9aeec01ddba27b5ef8bc417ab9e58b661e49
MATLAB
2,903
104
clc; clearvars; close all; T = readmatrix('source_data_file.xlsx','Sheet', 8); ConFoffon_before = T(1,2:7); ConFoffon_after = T(1,10:end); nostim_before = T(2,2:6); nostim_after = T(2,10:14); % Group data into a matrix: rows = groups, columns = subjects data = { ConFoffon_before, ConFoffon_after; nostim_befo...
1483b97192d0ab758b98a86f81bda2f3f4ceb0de965057b6a6bc40490ca83622
MATLAB
2,905
104
clc; clearvars; close all; T = readmatrix('source_data_file.xlsx','Sheet', 4); ConFon_before = T(1,2:7); ConFon_after = T(1,10:end); nostim_before = T(2,2:6); nostim_after = T(2,10:14); % Group data into a matrix: rows = groups, columns = subjects data = { ConFon_before, ConFon_after; nostim_before, nostim_...
3f48f7f2a1775522bf1190224b640da4216725cfd39edfa103420166f6d90818
MATLAB
2,906
72
%% demo_007 Legacy option conversion % Demo_007 demonstrate the use of psignifit 4 for users of the Wichmann & Hill (2001) "legacy-toolbox" psignifit 2.5. % % The bootstrap-based psignifit 2.5 toolbox allowed the user to change the % behaviour of the (constrained) ML-estimation, statistics and plots via a % list of opt...
f87fd50e3919c218f023c652e5626345ef3d88209c907eaab8dde113f9a608a1
MATLAB
2,907
81
%% Gergely Tarcsay, 2024 Ewell lab. Script to generate performance for the lesion experiments (Fig 1) close all warning('off','all') if ~exist("lesion_struct", "var") load ("G:\HPC lesion\LesionData.mat") end %get all days starting from day when passed ctrl = find(lesion_struct.details.Group == "c"); le...
45653bb18cc632a82a2b5237ae37e0bdb2bf538067a96620cf1d66be176fbd03
MATLAB
2,914
80
function [ feat_train, feat_test ] = CBIG_FC_FeatSel( FC_train, FC_test, y_train, threshold ) % [ feat_train, feat_test ] = CBIG_FC_FeatSel( FC_train, FC_test, y_vec, fold_index, threshold ) % % This function selects a subset of functional connectivity (FC) entries as % features for future predictive models. The sele...
62a26c0fd6cafbe493c3aec8d668db2145cffa327609a78ae736bfc308f20ab8
MATLAB
2,914
123
function outpict = imecho(inpict,nechoes,varargin) % IMECHO(INPICT, NECHOES, {OPTIONS}) % blends delayed frame copies with an image animation % % INPICT is a multiframe I/IA/RGB/RGBA image of any standard image class % NECHOES is the number of image copies to be blended % OPTIONS include the following key...
98d70611548da2eaf0eeeb02db473af61ce5bcbd3dd51974299e369e4cafac68
MATLAB
2,918
70
% Script to perform motion regression by fitting a GLM to each voxel time series using the six motion parameters % as regressors to remove motion-related variance. function S03_GLM_empty(subject, game) root_path = 'YOUR_DATA_PATH'; main_dir = strcat(subject, '/', game) ; sess_no = 5; GLM_name = 'GLM_empty';...
36843dd186182e54e6c1deb80d1216ef2d325b230cf4a310a07737ac6ee0ab2e
MATLAB
2,923
107
function allP = factor3(innum,varargin) % P = FACTOR3(N,{OPTIONS}) % Find the factor triples of an integer. This is useful for finding % the 3D geometries into which a given vector can be arranged, % for instance, when devectorizing images of unknown geometry. % % N is a positive scalar integer (not necessar...
a962044ad8c49e8e6dd87afc8705f8e1065e5231bc939d93d41660dd67b6a0ec
MATLAB
2,928
77
function [g,a,mu2]=ar1(x) %% AR1 - Allen and Smith AR(1) model estimation. % Syntax: [g,a,mu2]=ar1(x); % % INPUTS % x: time series (univariate). % % OUTPUTS % g: lag-one autocorrelation estimate. % a: noise variance estimate. % mu2: estimated square on the mean. % % AR1 is based on the approac...
f8bf92a053ebe47c25a1f458ea7a13b6e2ba6c6dbdbf37f0980901f50adc7994
MATLAB
2,930
83
% If handles is a matrix, columns will be interpreted as graphics for multiple selections function selector = plotDataSwitcher(handles, container, dataList, description) % Default arguments if nargin < 4 description = ''; end % Case for enabling multiple selections isMultiple ...
3824057aab0baff479b7f16c2ab5e09214e644bf25539f10d05cebd523e79700
MATLAB
2,932
72
%WAVE_BASES 1D Wavelet functions Morlet, Paul, or DOG % % [DAUGHTER,FOURIER_FACTOR,COI,DOFMIN] = ... % wave_bases(MOTHER,K,SCALE,PARAM); % % Computes the wavelet function as a function of Fourier frequency, % used for the wavelet transform in Fourier space. % (This program is called automatically by WAVELE...
0e3f24a9acda9d505b899a92c112900600183a32fad5093f92998092cc3bee4d
MATLAB
2,935
71
clear all;close all;clc; restoredefaultpath; addpath(genpath('/home/ajoshi/coding_ground/bfp/dev/gifti-1.6')); addpath(genpath('/home/ajoshi/coding_ground/svreg/src')); addpath(genpath('/home/ajoshi/coding_ground/svreg/3rdParty')); addpath(genpath('/big_disk/ajoshi/freesurfer/matlab')); %% Resample from one sphere to ...
479e34d5313705377b1eeeeb9df72f29a7fafb2ee8c554581d071a8b5bf2bf6c
MATLAB
2,939
61
function [TFR] = dtx_TFRtrials(cfg, Trialdata, force) % This file is part of EpiCode, see % http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details. % % EpiCode is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % ...
b26c80d29ff3236af65bd527a869ee2827b59e7438d59e0382f9787484c6d275
MATLAB
2,940
78
function fLocGroupAnalysis(sessions, clip, stc) % Automated group analysis of fMRI data from fLoc localizer experiment % using vistasoft functions (https://github.com/vistalab/vistasoft). If % there is an error, the code terminates the analysis of that session but % then continues on to the next session. % % INPUTS %...
db85e94dabe8fc4e0afddd3733463ed6c16130480869134db7f92beb44acc3f7
MATLAB
2,940
109
function outpict = dilatemargins(inpict,margins,se,varargin) % DILATEMARGINS(INPICT, MARGINS, SE, {OPTIONS}) % Performs selective dilation & erosion on lightest and darkest pixels. % % INPICT is an I/IA/RGB/RGBA image of any standard image class % MARGINS is a 1x2 vector specifying the width of black and wh...
5ade8ed2c29028b19dadeb56046212aee66a9f7571c402d5ece617d16603a0b0
MATLAB
2,948
83
% this script allows to convert .h5 to .nii files % dependencies: spm % @FIL UCL % written by Oliver Josephs % modifications for extra contrasts: Barbara Dymerska % select nr of contrasts to convert % 1 - magnitude, 2 - magnitude + phase, 3 - magnitude, phase, B1+ map nr_of_contrasts = 3 ; % select your h5 directorie...
cd88536528ff2954b8a596d6f71a94f95825ebce3889f1ba4f4600cf63d17573
MATLAB
2,953
92
function outpict = tonergb(inpict,Tr,Tg,Tb,Tsat,enforcement) % OUTPICT = TONERGB(INPICT,TR,TG,TB,TSAT,RANGETYPE) % Adjust image tone by adjusting RGB components relative to the % RGB and saturation distribution in an image. % % This is based on Iain Fergusson's GMIC tools. % https://github.com/dtschump/gmic-commun...
2a891edf611219a0b88a632fe76020bf6f5d4ea2bdb903f62b4dc790c204042e
MATLAB
2,954
67
% Constructs an array B that contains a subset of the specified indices in A for dimension dim. % % Suppose that A is of size n-by-m-by-k, and indices is of size n-by-1-by-k. Then the call % B = selectarray(A, 2, indices) % will produce a n-by-k array B where for each index i of the first dimension (rows) and eac...
c64d0ceb425768d86a594dc11c9cca521793f857f8e62efb8c2981860475e829
MATLAB
2,956
42
classdef activityMapParams % activityMapParams: This class holds the parameters needed to construct an activityMap object % Open activityMapParams.m to see what the parameters are and which need to be set properties % these need to be set before constructing an activityMap preLimit...
63354390d6d99a138b55cf8777eca97228ff40027cf41c5b1226cea0dc537a2b
MATLAB
2,958
76
function maskdots=computelinmask(nd, plotsize, xcenter, ycenter, lifetime, min_sp, max_sp, fr) %maskdots=computelinmask(nd, plotsize, xcenter, ycenter, lifetime, min_sp, max_sp, fr) % %Calculates the display dot matrix for a linear mask % %INPUTS %nd number of mask dots %plotsize %x...
9628527ba8339af73053ba04baccd660455cc20e75fae5c56a3386a425e0a098
MATLAB
2,958
74
clear all;close all;clc; restoredefaultpath; addpath(genpath('/home/ajoshi/coding_ground/bfp')); addpath(genpath('/home/ajoshi/coding_ground/svreg/src')); addpath(genpath('/home/ajoshi/coding_ground/movie1/subaxis')); p_dir_ref = '/big_disk/ajoshi/HCP_data/' cmap=bipolarcmapW(100,[-1.5,1.5],'linear','br') hemi = 'left...
92786d75470fc71f06e4e1db81ab1fbfe9c9bb1f2b3ecb38fbe331cd5f15e115
MATLAB
2,967
86
% % 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...
a18272fb2e03a7f11c84f05c7aec1e3d800c6b69d4a2722f66f89b762bc2129b
MATLAB
2,975
68
clear experiments = get_experiment_redux; fs = 32000; % from data save_data = 1; downsampling_factor = 32; % downsample for LFP analysis fs_LFP = fs / downsampling_factor; high_cut = fs / downsampling_factor / 2; % nyquist ExtractMode = 1; % extract from neuralynx into matlab threshold = 7; % threshold sharp waves de...
6ecca165524df6a15869bfc96613284ea84f72952bd6747cb9fe6b230c946d76
MATLAB
2,978
87
function [outpict TF] = histeqFB(inpict,varargin) % OUTPICT=HISTEQFB(INPICT,{NBINS}) % OUTPICT=HISTEQFB(INPICT,{HGRAM}) % [OUTPICT TF]=HISTEQFB( ... ) % Adjust the contrast of an image such that its intensity distribution conforms to that described % by a given histogram. If no histogram is given explicitly,...
e173da507bb0a55ca8b7127d7c9c87275d638c0e509fb9d8b134f81fe5d766cd
MATLAB
2,982
86
classdef varMenus < handle & dynamicprops properties extra_room = 75; length_slider = 375; width_slider = 15; left_slider = 160; bott_slider = 40; left_str = 50; curr_left_str = 0; min_left_str = 90; ...
11505fbb12634f8a6c4a2ffaa25b727f8b64ab33470c4a1ddb8a85c01ae8fe74
MATLAB
2,983
65
function [trialinfo,circuspath] = writemicroforspykingcircus(cfg, MuseStruct_micro) fname_output = fullfile(cfg.datasavedir,[cfg.prefix,'single_pattern_',cfg.label,'_SC_trialinfo.mat']); if exist(fname_output,'file') && cfg.force == false fprintf('Loading trialinfo: %s \n',fname_output); load(fname_output...
d6daef69d6856da1b146f5458eff9eede5b89ffe2b1df70488a7b63a896bec88
MATLAB
2,983
87
% ACCUMSTATS Output combined arithmetic mean and variance of all arguments % % Inputs % ======== % nSamples : Number of samples used to compute the mean and variance of each input argument. If % only one entry is provided, the same nSamples is assumed for each input. % dim : Dim...
d2040701eaeb7a62e175e20c19ba007378496156ce31a8d6b84f3e63023aaa10
MATLAB
2,984
102
function [spE,sEp,prior_pd,post_pd] = spm_prf_get_ppd(PRF,xy,idx,nsamp) % Sample from the prior (or posterior) of a pRF model and run samples % through the likelihood, to give the prior (or posterior) predictive % density (PPD). % % PRF - estimated PRF % xy - coordinates in stimulus space to sample % idx - ind...
2c382af70e237a1daaf801c41a563cf2a8203a47aee6e0efc14efcf0118db752
MATLAB
2,990
90
function clickPlot(im, mask, R, tbl, count, O) imsize = size(im.(O{1})); spotRow = table2array(tbl(:, 5)); spotCol = table2array(tbl(:, 6)); nSpots = size(spotCol, 1); figure('Name','spotspotcheck','NumberTitle','off','units', 'normalized', 'position', [0 0 1 1]); ax = imagesc(im.(O{1})); s...
84f33d973252269b0f8537f2a001059262c9ec12349870720a43eb459a2bd3d7
MATLAB
2,992
94
clear close %% PLOTTING lwd = 0.2; % Vs, Ca_pc lwd2 = 0.7; % I_ast figure; t = tiledlayout(7,26,'TileSpacing', 'compact','Padding','tight'); PATH = './../Systems/Pyramid_astro/transients/'; % FIG. 2b fileNames = {'1_IPeq_02', '2_IPeq_02', '3_IPeq_02', '4_IPeq_02', '5_IPeq_02', '6_IPeq_02', '7_IPeq_02'}; tlims = [0...
313c04616d6dbf6e5b4806a6ff931824a4ffcf2c497a0c8fbe3a2baefde85e0b
MATLAB
2,993
89
function next = cosine_filter(input,W) disp("Cosine filter setup...") function cosFilter = CosineFilter(N, w, symmetric) %************************************************************************** % profile goes from 1 to 0 over some specified width. The square of the % cosi...
20dac830ffad7cf36580c98ed825b541bfab2ff9ae4e80d7be541a5347019f79
MATLAB
2,994
119
function outpict = meanlines(inpict,dim,mode) % MEANLINES(INPICT, DIM, {MODE}) % Returns an image wherein all pixels in row or column vectors have % the mean, max, or min values in corresponding vectors of INPICT. % Can be used for shading or shifting images. % % INPICT is an I/RGB image of any ...
321772533867dab64264d5923577efab921396394c779cb11187ca7aa9a8c3b6
MATLAB
3,000
100
addpath( genpath('/usr/share/fsl/5.0/etc/matlab')); %% Reading Files clear all tic; seg=read_avw('T1w_acpc_dc_restore_brain_seg.nii.gz'); wm=read_avw('T1w_acpc_dc_restore_brain_pve_2.nii.gz'); gm=read_avw('T1w_acpc_dc_restore_brain_pve_1.nii.gz'); csf=read_avw('T1w_acpc_dc_restore_brain_pve_0.nii.gz'); t1t2=read_avw(...
5b98b716ad997e795f1f2cd4aaa6d04739f75c3db5230e83222c81f91a44766d
MATLAB
3,007
42
classdef activityMapParams % activityMapParams: This class holds the parameters needed to construct an activityMap object % Open activityMapParams.m to see what the parameters are and which need to be set properties % these need to be set before constructing an activityMap preLimit...
5313611e16913c16ae44de943f86099a9d9850ecbc246d549a17828a22dad9a3
MATLAB
3,009
122
function [tosquare,quad,tosquare2,quad2,D]=nt_qca02(x,npcs,nsmooth) %[tosquare,quad,tosquare2,quad2,D]=nt_qca02(x,npcs,nsmooth) - maximize induced power using quadratic component analysis % % tosquare: matrix to most reproducible induced component % quad: most reproducible quadratic component % tosquare2: matrix to ...
bb5ea3c6876c857ad668cbdd65124b5d35fe5a92e92d629a9835c6025a372444
MATLAB
3,011
63
function [hist_count, bin_center, hist_count_total, bin_center_total] = histcParzen(x, x_range, nbins, win_width, nthreads) % Computes parzen window estimate of the histogram of input data. The histogram bins are uniformly % spaced in the specified x_range. Cubic B-spline window with variable width is used as the parze...
92ff6b4364266c2c0dc1b6c4b2740339014e838bbd7a78f899e6d7ed74f7bca2
MATLAB
3,012
101
function [BS,bs_name,attysflag] = getBSdata(BSfolder) %usage [BS,bs_name,attysflag] = getBSdata(BSfolder) % BS folder -> insert the path of the folder up to the subject code as in 'C:\Users\Post_Box\AG06\' % Output the BSData in struct and the corresponding starttimes % BS.triggers contains the voltage values corr...
e66bf563c5516f3d4a7c413964b8d551a191bebf0978fe5174ed55b2b1417fd3
MATLAB
3,014
44
function pptwrite(data, fname, check) %pptwrite(data, fname, check) % % writes the data created by runtrials_single, runtrials_double, % or runtrials_ident (completed trials variable) into an ascii file. % If check is set to 1, existing files will not be overwritten % and a warning will be issued. % %INPUTS ...
f2c8262052b7f7acb9c79f9b601bb3e07f6798da3ea535cf2da0cfa3a3f0d700
MATLAB
3,020
88
%FilterLFP - Filter the local field potentials, e.g. in the theta band. % % Filter the local field potentials using a cheby2 filter. % % USAGE % % filtered = FilterLFP(lfp,<options>) % % lfp local field potentials, list of (t,v1,v2,v3...) tuples % <options> optional list of property-value pair...
44376a3e0c4e13aa856da6ac81b1f219b669452958e95aa0f2bce022d6c4c5eb
MATLAB
3,027
129
%% % xbar(data, 'Legend', {'x', 'y', ...}, [... legend options ...]) % xbar(x, h, 'Legend', {'x', 'y', ...}, [... legend options ...]) % xbar({u, xU, yU}, data, ...) % function [handles] = xbar(varargin) % Parse input config narginchk(1, inf); if iscell(varargin{1}) [units, xUnit, yUnit] = g...
187c311fcbb7caac72b9dce538b0192b2a657ffc42f14070dc86c64e531aea20
MATLAB
3,035
87
function [fwhm1,fwhm2] = mwave(meanwave,si,varargin) % [fwhm1,fwhm2] = mwave(meanwave,si,varargin) % computes the widths of the first and second response peaks of % the spike waveform (full width at half maximum) % % ARGUMENTS % meanwave required - vector containing the mean spike waveform % si required - s...
a4f292674c0007f19710084205e888d52b3cf50063363fc41153e53a6c10f55f
MATLAB
3,044
108
function z=nt_double2int(x,param) %nt_double2int() - recode/decode double as integer to save space % % z=nt_double2int(x,intsize): recode double as integer % z: coded data % x: data to code (matrix or array of matrices) % intsize: [default: 'int16'] % % x=nt_double2int(z,indices): decode back to double % x: dec...
8e21205463457b33a3f8cc6b5c9cd55fc7f158a8ad1ec2a67d16319194c6c84d
MATLAB
3,048
100
function plotdata_stim_trial(cfg,dat_micro, dat_macro) % select data for plotting if ~strcmp(cfg.frequency,'all') selfreq = cfg.markers.Frequency == cfg.frequency; else selfreq = ones(height(cfg.markers),1); end if ~strcmp(cfg.current,'all') selamp = cfg.markers.Current == cfg.current; else selamp = ...
08827a2be4a2e581d45d222cd8ed868b06eea14da166ec603d08175de2e30154
MATLAB
3,052
135
function y=nt_cell2mat(x) %y=nt_cell2mat(x) - convert cell matrix of nD matrices to (n+1)D matrix % % y: (n+1)-dimension matrix % % x: cell matrix of matrices % % Similar to matlab's cell2mat() but much more flexible. % % If matrices in x are of different dimensions or sizes, the result is % based on the largest di...
06ec3e8066fbf54c2a986561e5b287851b4df4f7701c0d2cb2bd8cb838006dd8
MATLAB
3,057
130
load data/MGB_FR.mat MGB_FR MGB_FR_laser = MGB_FR; load ../PV_SOM_inh/TRN_recip/data/MGB_FR.mat MGB_FR MGB_FR_recip = MGB_FR; load ../GJ_PV_SOM/PV_SOM_inh/TRN_recip/data/MGB_FR.mat MGB_FR MGB_FR_gj = MGB_FR; load ../recip_div_TRN_inh/data/MGB_FR.mat MGB_FR MGB_FR_div = MGB_FR; load ../recip_div_TRN_wSOMlat_in...
6111832442e9a30e723fefd51bd271ebf0aa542aca44f43418e842f52170f61f
MATLAB
3,057
99
% % 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...
6843285e053f060a72feb018bb0fb1daa413caa420aa1c8e2f057b09802b81a3
MATLAB
3,057
67
function p = CBIG_corrected_resampled_ttest(accuracy_vec, portion, threshold) % p = CBIG_corrected_resampled_ttest(accuracy_vec, portion, threshold) % % This function tests whether an accuracy vector (obtained from cross-validation) % is statistically different from a threshold. The accuracy vector can also % repres...
6df38c20f7129cb72d9eca0f5c75ede7aef8eea0c381e20027992fd466a17689
MATLAB
3,066
89
function text2spectrogram(instring,outpath,textheight,textlocation,alteraspect,volume,blursize) % IM2SPECTROGRAM(INSTRING, OUTPATH, {HEIGHT}, {LOCATION}, {ALTERASPECT}, {PADBAR}, {VOLUME}, {BLURSIZE}) % use inverse short-time Fourier transform to encode a text string as a marquee in audio spectra % Output...
1c0744db3227d44ccc3619ce5464980dcbb595d549bc175a06497e062f3c5125
MATLAB
3,067
116
function [a, varargout] = rwLCA(x, phi, thrtype, eta, gamma_val, maxIters, group_cell, varargin) % test for number of required parametres if (nargin-length(varargin)) ~= 7 error('Wrong number of required parameters'); end % set the defaults for the optional parameters compute_mse = 0; % read the optional paramete...
6a288f8a46aa6405a0ff30484371d33e3c8336582d0285fb75d776e6bae48bec
MATLAB
3,067
82
%% function [kernel] = kdeBhattacharyya(alpha, beta, varargin) %----- Sanity check for format of input narginchk(3, inf); example = varargin{1}; nDims = numel(varargin); nComponents = size(example, 1); nData = size(example, 2); if nComponents > 100 w...
a75e27163dca92ff9780081f5c4c068d6ac1977a22cd186748c1abb18c1643b7
MATLAB
3,067
86
function out = effprint(effects, effectType) %% Interpret effect sizes of a certain types in terms of 'small', 'medium' %% and 'large' according to Cohen's rule of thumb. % Source: Cohen, J. 1988. Statistical Power Analysis for the Behavioral % Sciences. Vol. 2nd. Hillsdale, New Jersey: Lawrence Erlbaum Associates. % ...
ec4b7d4d0add9aede9fbe6a41dca6a363e27a1c3e285efc3aaadfa1c8b9d387e
MATLAB
3,069
118
function I = cmi_ggg_vec(x, y, z, biascorrect, demeaned) % CMI_GGG Conditional Mutual information (CMI) between two Gaussian variables % conditioned on a third % % I = cmi_ggg(x,y,z) returns the CMI between two (possibly multidimensional) % Gassian variables, x and y, conditioned on a third, z, with bias cor...
c537c18a84e127a36fa7e01e4f089589bd8fb802222e9c6aca0b3700d9a70f0e
MATLAB
3,071
81
function out = Pyramid_only out{1} = @init; out{2} = @fun_eval; out{3} = []; out{4} = []; out{5} = []; out{6} = []; out{7} = []; out{8} = []; out{9} = []; % -------------------------------------------------------------------------- function dydt = fun_eval(t,kmrgd,par_Is,par_Id,par_gsd,par_gCa,par_p) gKCa_h=15; C_h=3;...
f0790101ae569a8f1350cbba301ecefedefaef42dafe3ca0610d9af7419c2763
MATLAB
3,083
86
function cohSpikeLFP(suffix) % WAVELET ANALYSIS % Determine phase consistency between LFP and spikes over the frequency % spectrum. LFPs are decomposed with the wavelet transform. % % Read parameters Params = read_params(suffix); freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1; ...
d651bda8adbebb590fe5ae3aa758e5019d4266dc36c9b4df6dc8a6a85e3e7c4b
MATLAB
3,086
79
function nlx2DAT(animal, experiments, channels, broken_channels, folder2save, common_average_reference) % by Mattia 8.11.18 based on https://github.com/kwikteam/klusta/issues/48 % Convert .nlx files to .dat: % - Estimate chunksize for the data (max allowed by memory) % - Copy data from server to local disk % - Write ...
51f16ac2426f2724ef9a9a4d6e4edf01d74efd7f0482a79feabeeb70ba2b8940
MATLAB
3,089
104
function [y_final,SEM_final,x] = bar_plots_OPS_results(final_ind1,final_ind2,position_analysis,DI2,variable,fig_title,groups_legend,y_label) % [y_final,SEM_final,x] = bar_plots_OPS_results(final_ind1,final_ind2,position_analysis,DI2,variable,fig_title,groups_legend,y_label) % plot rm ANOVA results for OPS data % % ...
dbf66c6554841d3e7832f08b7b7a91713c60e5108e2f047ade16d7c103f3c98c
MATLAB
3,092
72
function CoherenceStuff = ... getCoherence(LFP1, LFP2, fs, win_length, overlap, nfft, ... folder2save, animal_name, repeatCalc, save_data) % calculates Coherency and Coherence as in Nolte et al., 2004 % by Mattia, 01/21, adapted from a script of Joachim and Sebastian % inputs: - signal & 2: two signal b...
41fb8bc01299d28b68b24edf0e4fac48f9d99dea8e41ca9595aa51ea19ec80bc
MATLAB
3,098
123
%% function [position] = findhelper(array, inReverse, varargin) narginchk(3, inf); sequence = 1:numel(array); % Special case with index range as input if numel(varargin) > 1 ... && ~islogical(varargin{end}) ... && isnumeric(varargin{end}) select ...
87789d02b5e2a9b404c30d85817b98dbb68a945d362e2e2db71a60fdf3c71b36
MATLAB
3,098
88
function plotSwitcher(figureHandles, monitor, varargin) % Default arguments if nargin < 1 figureHandles = findall(0, 'Type', 'figure', 'Visible', 'on'); end if nargin < 2 monitor = -1; end if isempty(figureHandles) return; end % Create GUI guiWidth ...
58efe7ccb2ae001ba428e08cffb98f63a6fd077320139c38e91bd133161c55ff
MATLAB
3,107
91
% ALIGNFIGS Align all figures to a common position on screen % % Inputs % ======== % figHandle : a list of figure handles to align % displacement : [left, bottom, width, height] % resize : min, max % alignment : North, South, East, West % monitor : monitor index that fi...
0a3dc18f796e18667bad275453a6d3a87a33da534ad999cd0464061d65e873e9
MATLAB
3,110
75
function pinv_sens = morse_calc_pinv(ref, PPIparams) %************************************************************************** % % morse_calc_pinv % input ref: data for sensitivity estimation [RO, PE1, PE2, N_coils] % PPIparams: parameters of the acceleration % % output pinv_sens: image...
b176e9e6c55cecbec76a488aa8c372b8fc2bb0c6ace84cb8e48da14d4385f6ce
MATLAB
3,114
62
function hspike_spike_cluster(ipatient) %% Analysis script for SLURM cluster % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % %% Add path restoredefaultpath if isunix addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hspike/ addpath /network/lustre/iss01/charpier/ana...
fc1ac70c88d2e9d54140480b578a89fcc6af1eb46704b45833572544acd4740a
MATLAB
3,119
74
% example script on how to detect oscillations in discontinuous signal % using: % - normalized squared signal (NSS) % - thresholding the baseline % - merging neighboring events % - thresholding the peaks (absolute and relative) - the absolute part is the % main difference with the old version. The specific of this ...
b36c643e58aea4c67aa8762347057d8828e7718007b3bdbc1cb568a2dad5fbb1
MATLAB
3,121
90
function writeMuseMarkerfile_Brainvision(MuseStruct, fname) % WRITEMUSEMARKERFILE writes markerfiles for Muse from Brainvision data format. % use as % function writeMuseMarkers(MuseStructt, fname) % % The input structure can be read by readMuseMarkers.m, and edited before % writing it back into the Muse file. % Thi...
c67a7d636fde5b93e6e4d391dedabe747daa159e9cda85a0a69e3c140fb0e86d
MATLAB
3,121
84
function writeMuseMarkers(MuseStruct) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function writeMuseMarkers(MuseStruct) % % Crawls and searches through patient- and recording-directories and % writes markerfiles for Muse. The input structure can be read by % readMuseMarkers.m, and edi...
c984ee0a4f6a9de5b81214d9196ed8a68ad80f4ad8e5bec7cf0a3e7a11fc5b54
MATLAB
3,124
91
function [offsets, xmin, xmax, ymin, ymax, biggestMapIndex] = registerImages(images) % Takes cell array, each cell is a 2d or 3d image % Usage: % [offsets, xmin, xmax, ymin, ymax, biggestMapIndex] = registerImages(images) % Inputs: % images: a cell array, each cell is a 2d or >2d image % the dimensions of the cell ar...
2e622c2b409c17e43d78c561e200c0b80eb9f84216f53fb75bf9205896a061f4
MATLAB
3,127
76
function [erp_data, indx] = generate_erp_data(EEG_integrals_am, EEG_integrals_nam,participant, indx, erp_data, options) %% Calculates ERP per participant % % **Usage:** [all_data] = generate_erp_data(EEG1_i, EEG1_d,participant, indx, all_data) % % Input(s): % - EEG1_i = EEG struct with epoched integral data % - EEG...
30dfa9dca27b50744cbed6ad58285b8c21656d29c1bda8a91b5e39a81756fc3d
MATLAB
3,135
120
function outpict = bicoloradapt(inpict,missingch) % BICOLORADAPT(INPICT, MISSINGCHANNEL) % Emulates the effect of long-term use of a crt monitor with % a missing cathode amplifier, where sensory adaptation tends to % relate the secondary color as a new white point. Also includes % background glow from the pres...
df748a3d56b09c6155b795e3b0614d8a3667f2fd7dc082f69989b92efcec16ba
MATLAB
3,136
70
function [rotated_subset_members nct_subset_rotated]=nct_analysis_subset_rotated(A,T,rho,x0,xf,subset_ids,perm_id) % function computes control energy and stability for two states within an % task, when a subset of regions is as a network prohibited from control % Sebastian Markett (2022), % using code from Urs Bra...
50f674e5bedf95242c3ca54be54bef5aa0bb285b528aa86c8f689a3b68308e6a
MATLAB
3,138
84
function theta = getStandardParameters(theta,type,widthalpha) %function theta = getStandardParameters(theta,type,[widthalpha]) % this function transforms a parameter given in threshold, width to a % standard parameterization for comparison purposes % % theta = parameter % type = Name of the Sigmoid % % if you changed ...
6eaa73fc2b574540a0e146d487e85f00cd20ea88195c5099a936400c162e9572
MATLAB
3,143
111
%% Pierce's criterion for rejecting outliers. % Adapted from https://r-forge.r-project.org/R/?group_id=1473 function [accept, reject] = peirceCriterion(v, sdv, m) %% if nargin < 2 sdv = std(v); end if nargin < 3 m = 1; end v = v(:); %% lenv = numel(v); mo1 = lenv-1; ...
f226144b8524e0e76770d02c91d24cfc69b40043e190f41160b31fda6681cf0c
MATLAB
3,148
78
function [fun,varargout] = bilin_fun(S, Y, A, h, D, opt) % function [fun,varargout] = bilin_fun(S, Y, A, h, D, opt) % % Function to calculate function value and gradiet for a bilinear % function. % % 2018 - Adam Charles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% S = reshape(S(:),[...
b9f68a3707f3d1649223cb4b731f4e64825ae5c63c73cd4ba0b779d21cb3e73e
MATLAB
3,155
73
%% CREATEHEADERCOMMENT Parses the current document pane for the first function definition, and generates comment text suitable for documenting the use of this function. % % This code is not meant to be used standalone, but as an insertion function provided to % EditorMacro(). One easy way to use this is to insert...
3c2f99b04c3242fcf9fe64337ca824d04515966d94927190f5618f60949c90c7
MATLAB
3,168
95
function plotTimeCourses(cfg,dat_micro,dat_macro) for imarker = 1 : size(cfg.name,2) fig = figure; for ifile = 1 : size(cfg.plot.fname{imarker},2) cfgtemp = []; cfgtemp.dataset = cfg.plot.fname{imarker}{ifile}; hdr = ft_read_header...
ca6a77be0e152ecf8b53367f9e878b21ef7a520ffb905cab055fbba7ee1090ed
MATLAB
3,168
126
function outpict = despeckle(varargin) % OUTPICT=DESPECKLE(INPICT,MINSIZE,{MODE},{CONN}) % Removal of small features in a binary image by connected group size. Depending % on the settings, this is equivalent to group-size-based image opening or closing. % % INPICT is a binary image. Multichannel and multifr...
f6d2098fcf7bf9acc5c81472ca570a5b250cbdc2a995b2d7ab74937d3c317001
MATLAB
3,170
80
function varargout = call_func_for_all_participants(path,save_path,f, options) %% Calls a function for all the participants (reads the EEG struct of the participant) % % **Usage:** [] = call_func_for_all_participants(path,save_path,f, options) % % Input(s): % - path = path to raw data % - save_path = path to save ...
d118c6141a7394d455d0ac15d12fbf0aa6a6457cb296fa3d8916ae6c8ac92148
MATLAB
3,173
95
function matchPursuitLFP(suffix) % LFP POWER % % Output: % Power Matrix (trial type x freq x time). % Data is written to a text file. Each row is a time series of power for % a given frequency and trial type. Rows are grouped in blocks of trial type, % with each row being the next frequency. % % AUTHOR: Charle...
519c022948974c95f385f56378824b5a1921b7e10a66dfe1f496a08346c9ee39
MATLAB
3,174
96
function plotsModelfit(res) %function plotsModelfit(res) % plots some standard plots, meant to help you judge whether there are % systematic deviations from the model. % % These are the same plots as presented in psignifit 2 for this purpose. % % The deviance bootstrap samples plot is generated with getDeviance, i.e. %...
5a76ca9b8c256e81201b7299e98c1a72146e7ad22388f227e7d8583215700530
MATLAB
3,174
71
clear all;close all;clc; restoredefaultpath; addpath(genpath('/ImagePTE1/ajoshi/code_farm/bfp/dev/gifti-1.6')); addpath(genpath('/ImagePTE1/ajoshi/code_farm/svreg/src')); addpath(genpath('/ImagePTE1/ajoshi/code_farm/svreg/3rdParty')); addpath(genpath('/big_disk/ajoshi/freesurfer/matlab')); %% Resample from one sphere ...
5b4182f41c93b1735331eb264038f104084778c7acfbbc611c17578ce4e762d3
MATLAB
3,174
81
function [fun,varargout] = bilin_fun(S, Y, A, h, D, opt) % function [fun,varargout] = bilin_fun(S, Y, A, h, D, opt) % % Function to calculate function value and gradient % % 2018 - Adam Charles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% S = reshape(S(:),[size(Y,1), size(A,1)]); ...
f11ba3ab16aded8b680b78603f7e4f286609d9cc7f04cc1f4eef82fbb6aa778e
MATLAB
3,176
68
% 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('/home/ajoshi/coding_ground/svreg')); addpath(genpath('../')); load LBO_right LBOr=LBO; load LBO_left ids={'sub18604','sn4055','sub08224','sub05676','sn8133','tr4...
6b5ac5142cc2450e97c342c6072a1dd3ffd64bebc64b01c6c60d9206aa6f8a37
MATLAB
3,190
93
function [copyHandle] = copyGraphics(sourceHandle, targetHandle, positionType, offset, scaleFactor, units) % COPYGRAPHICS Copies a graphical object with smarter preservation of % properties. %----- Basic copy function copyHandle = copyobj(sourceHandle, targetHandle); for iObj =...
d01adbe1badbadfa3247b122dfb547043f31988fbf127a3267c9e1c301570614
MATLAB
3,199
107
% main_gene_surrogate.m load(strcat(projectRoot,"/data/processed/surrogate_genes_org.mat")); surrogateGeneMatrices = permute(surrogate_genes,[2,3,1]); clear surrogate_genes %% Calculate Moran's I %{ surrogateGeneMoransIMatrix = SpatialAutocorrelationCalculator.calculateMoransIMatrix_forSurrogates(... surrogateG...
2a9d30a0bd19b6c3c06e74b5d8703d05cbf902e6495983602b7b631d6dd58165
MATLAB
3,200
81
% wrapping function analyze rate overlap function [All,Cohort, Individual] = WrapRateOverlap(workdir, discrimination) All.ROS = []; All.RewROS = []; All.OutROS = []; All.RewDist = []; All.RZID = []; All.Pref = []; All.MeanRate = []; All.N_events= []; All.Size = []; All.NFields = []; Cohort.ROS = ...
2e5ce16ca23d7dde6b8282f161dc72d009a45869a385f35f20b8920ac4f842eb
MATLAB
3,202
71
function [out_nii, file_out] = fixBSheader(hdr_src_file, infile, output_file) % A hack for (inconsistent) headers of BrainSuite/SVReg files. If input files, hdr_src_file and % infile, overlay correctly in BrainSuite then this function modifies header of infile such that it % is consistent with the hdr_src_file and stil...
97ec3a2f6fc0f449c5b7a93a60cecbdbadcedf17603956dac52c1a9eea38a9f2
MATLAB
3,205
77
classdef PairDataCCAAnalysisModel % PairDataCCAAnalysisModel % Performs CCA analysis and computes Wiring PI in a single workflow. properties CCAResultsData CCAResults % Stores CCAResults object WiringPIPairsData WiringPIPairs % Stores WiringPIResults object Rec...
22a0bc2d29c018f91ff4a27a42a61716a2939bea072038c669b0322e5281a0e9
MATLAB
3,206
68
function [trialinfo,circuspath] = writemicroforspykingcircus(cfg, MuseStruct_micro) fname_output = fullfile(cfg.datasavedir,[cfg.prefix,'single_pattern_',cfg.label,'_SC_trialinfo.mat']); if exist(fname_output,'file') && cfg.force == false fprintf('Loading trialinfo: %s \n',fname_output); load(fname_output...
ac32ed73892394850c39838cc195a6c678a1c6f0d886fc23f8460f0942e2120c
MATLAB
3,212
86
function [img_1_mask, results_1] = process_images(files, biom_1, results_folder, repeat_name) %% Process the images to create and save masks for further analysis %%G&B colormaps [r_colormap,g_colormap,b_colormap, y_colormap] = create_rgb_colormaps(); %% Plot settings color_map = [0,0,1]; transparency = 0.5; ...
238e894be0f2d5cfcfd04cb3c536f1892063e0d567482ea69bc035885b38ccc9
MATLAB
3,215
68
function unit_features = getSpikeFeatures(waveform) % by Mattia 01.19 % this functions extracts waveform features that should be useful for % distinguishing PYR from IN. Not yet there in neonatal mice, but it should % work for juvenile/adult. % input : waveform (thought for the output of klusta, not everything might %...
d13595188e52bfac3bfcddad916a891e9e66ebca7b6fb22673cb145ada11da70
MATLAB
3,215
82
function [img_1_mask, results_1] = process_images(files, biom_1, biom_folder, repeat_name, biom_set_folder) %% Process the images to create and save masks for further analysis %%G&B colormaps [r_colormap,g_colormap,b_colormap, y_colormap] = create_rgb_colormaps(); %% Plot settings color_map = [0,0,1]; transp...
46d15144ae710c0a384e2cfd3584bade42805be6835b86c52ea79cde6c3ff3ad
MATLAB
3,218
86
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% dictionary_learn_script.m % This scrips it an example script for basic sparse dictionary learning % based on the Olshausen and Field, 1997 paper 'Sparse Coding with...
7cfc6b8a1fbe5dfe1320d25419233114089158a576a623d085af33e501ff93e0
MATLAB
3,222
91
function [result, montageDims] = stackToMontage(stack, varargin) % STACKTOMONTAGE: Turn a 3D stack into a montage % Behaves the same as Matlab's builtin montage function in % the mode montage(I) except it doesn't display the function % % Usage: % [montage, montageDims] = stackToMontage(stack, numRows, numCols) % st...
19ced5840d07e71e56dceea78b3ab6fdd90e582d8c306d0497329734ac9888f2
MATLAB
3,233
82
function timeSpikeLFP(suffix) % TIME SPIKE LFP - Spike triggered average of LFP. % % Read parameters file Params = read_params(suffix); time_start = Params.time_1; time_end = Params.time_2; pass_band = [Params.freq_start_1, Params.freq_end_1, Params.freq_step_1]; if not(all(pass_band >...
b2bf65f62bb9f01dbe1427870c907a4670c17b29c6fcc008ecd58ed3606bf1af
MATLAB
3,235
89
function writeMuseMarkerfile(MuseStruct, fname) % WRITEMUSEMARKERFILE writes markerfiles for Muse. % use as % function writeMuseMarkers(MuseStructt, fname) % % The input structure can be read by readMuseMarkers.m, and edited before % writing it back into the Muse file. % This file is part of EpiCode, see % http://w...
ece30c8549494ecaca63e8647ea7387627485d308f8b2aa2afee4a67540aa240
MATLAB
3,236
75
% 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...
01ae2235a3d0d6af6a1a17497aaae2b060051bfb211afa0aeaad19617ca6d228
MATLAB
3,238
73
function SUAdata = getRampSpikeMatrix(experiment, save_data, repeatCalc, ... folder2save, folderSM, folder4stim_props) % by Mattia 10/20 % create a spike matrix (actually a tensor) for ramp classic stimulations % this script arbitrarily divides the 9s stim period in pre % (3s) stim (3s), taking into account the (...
01a3f1c7b6a3d1fc3d3204628a704d359504ba6f22c161cddafa098fb67e8708
MATLAB
3,242
127
function [ data ] = load_untouch_eig_gz(file, workdir) % Loads .eig file to nii structure. Each voxel has 12 elements which follows following eig % structure: % [v1.x v1.y v1.z v2.x v2.y v2.z v3.x v3.y v3.z l1 l2 l3] % % v1, v2, v3 are eignvectors and l1, l2, l3 are eigenvalues, in sorted order. % % Also se...
856dca9def02851e2d940a9a1b4920c689d4f7181327915ceb352378e7cc3e43
MATLAB
3,247
113
function mask = rangemask(inpict,channel,range,compmode) % RANGEMASK(INPICT, CHANNELS, RANGE, {COMPMODE}) % returns a 2-D logical map of all pixels in INPICT specified via % a set of channel value ranges. This is similar in purpose to % MULTIMASK() or FINDPIXELS(), but it is much simpler to use % ...
e1ba392c02d46abe36161bd69ed84086b5c8cfe212504ce5864edb9c5f7b15c6
MATLAB
3,247
60
% ------------------------------------------------------------------------------------------------- % (c) 2025 Leon F. Heffer, David J. Sly, James B. Fallon, Rick Minter, Rebecca C. Felsheim, % Mathias Dietz and Stephen J. O’Leary. % % This file is part of a repository that contains the data originally recorded by He...
a3533951df493e088608a4d01325e869af2a2afcb3587f23ea42ed836169bbe6
MATLAB
3,250
79
function [MuseStruct] = readMuseMarker(name_mrk) % READMUSEMARKER extracts marker timings (time and samples) created by Muse. % use as % [MuseStruct] = readMuseMarker(name_mrk) % % with help (code) from Jean-Didier Lemarechal & Craig Richter % This file is part of EpiCode, see % http://www.github.com/stephenwhit...