sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
1780160cca6916aba3c0fec8b6c64c3e049926e9e5604cc084b2e3455c7970c4
MATLAB
4,671
111
function out = Pyramid_astro_threshold_Is_impulse out{1} = @init; out{2} = @fun_eval; out{3} = []; out{4} = []; out{5} = []; out{6} = []; out{7} = []; out{8} = []; out{9} = []; out{10}= @Iast; out{11}= @ip_fback; % -------------------------------------------------------------------------- function dydt = fun_eval(t,km...
d2d6c609b87db5488480c5e98ffa6056899556febd6e10e0079a8b6cd95d58bb
MATLAB
4,674
131
function MBmodel = optimiseMBparams_homeostaticExcitation(MBmodel, PNactivity) %% this is the "blue model" DEBUG = true; sigmoid_factor = 1.; Sigmoid_derivative = @(x) exp(-x./sigmoid_factor)./((1.+exp(-x./sigmoid_factor)).^2) ; Sigmoid = @(x) 1./(1.+exp(-x./sigmoid_factor)) ; n = MBmodel.nKCs; m = MBmodel.nPNs; the...
f99815d1e1dd58deb2ad34545fe447a10dc760c38ff7a8262aec46b565c1985f
MATLAB
4,688
119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 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...
73bd9908c7a14b9c15e8f32c11ca4f777bab1a034c2a12b5ab90bca293421ba2
MATLAB
4,695
173
function outpict = picdynamics(inpict,G,linetime,rangemode,mode) % PICDYNAMICS(INPICT, {G}, {RANGEMODE}, {MODE}) % performs LTI system response simulation on the rows of INPICT % used with imblend() to effect analog crt drive defect emulation % % INPICT is a single-frame image of any standard image clas...
de8e32e25b644691876c044755c6bdaf6d912b00dc5f6f98dc9f1dea7f4d8444
MATLAB
4,695
96
%% LME analysis for first two bins cd D:\ES_data_Hannah\for_stats temp = dir('*'); % assuming 3 directories for i=1:length(temp) if temp(i).isdir == 1 & length(temp(i).name) > 3 cd(temp(i).name) load for_stats.mat load for_stats_expquarter.mat load for_stats_subject.mat ...
083547fb035931206aa20a4754f1556563357e2117f37f9d11a319a8e5268e78
MATLAB
4,697
133
function[stats] = simple_Wilcoxon_test_analysis(save_path,grouping_variable,group_names,dependent_variable,y_label,fig_title,fig_name) fontsize_text = 16; fontsize_title = 20; order_v = {char(group_names(1)),char(group_names(2))}; grouping_variable = categorical(table2array(grouping_variable),order_v); depen...
7552ab5a22f1d6dd4795e8ef5db5b48d0b4ae298d028e4b9f4a217aa1f7ccf15
MATLAB
4,702
154
function [outnii, outFile] = add_qform(dataIn, outFile, force_flag) % Adds qform (Quaternion) parameters to nifti header. The parameters are defined to match sform % matrix. This function is intended to be used with NIFTI1 files/structs with NIFTI1_XFORM_CODE set % to NIFTI_XFORM_SCANNER_ANAT (sform_code = 1; qform_cod...
d4b163fc45f312844980a68b5c1f16d7281bea82af3e3641df536531931f5054
MATLAB
4,707
102
function [S,t,f,Serr]=mtspecgramc(data,movingwin,params) % Multi-taper time-frequency spectrum - continuous process % % Usage: % [S,t,f,Serr]=mtspecgramc(data,movingwin,params) % Input: % Note units have to be consistent. Thus, if movingwin is in seconds, Fs % has to be in Hz. see chronux.m for more information. % ...
b3ad4796297324fd0dbb4c1b9f24f0bec65fb3444e3c6e9f1497380bc6902e20
MATLAB
4,711
140
function outpict = addborder(inpict,width,varargin) % ADDBORDER(INPICT, {WIDTH}, {COLOR}, {KEYS}) % ADDBORDER(INPICT, {WIDTH}, {EDGETYPE}) % Add a colored border to an image. I find that the syntax and flexibility % makes addborder far more convenient than PADARRAY. % % INPICT is an I/IA/RGB/RGBA/R...
34cdc4ea2597aedf3de9776ab88fdae2767d73c959234a9c3841d6f031eccfb3
MATLAB
4,717
85
function wrong_markers = verifymarkers(cfg, MuseStruct) % Use as : % wrong_markers = verifymarkers(cfg, MuseStruct) % % verifymarkers check the marker list for the 2 kinds of Muse markers : % - for "one-off" markers, it verifies that there are no __START__ markers % associated % - for start/end markers, it ...
596661b56b25506bac9c2b88c0db6378b4a6c7a740281559e2a11d0f3e7bf839
MATLAB
4,724
129
function result=psignifitCore(data,options) % this is the Core processing of psignifit, call the frontend psignifit! %function result=psignifitCore(data,options) % Data nx3 matrix with values [x, percCorrect, NTrials] % % sigmoid should be a handle to a function, which accepts % X,parameters as inputs and gives back a ...
1b35f05320757793843f20d5e5f143beb95fb86dbf6c48c106e95e3bcc553297
MATLAB
4,738
93
function data=rmlinesc(data,params,p,plt,f0) % removes significant sine waves from data (continuous data). % % Usage: data=rmlinesc(data,params,p,plt,f0) % % Inputs: % Note that units of Fs, fpass have to be consistent. % data (data in [N,C] i.e. time x channels/trials or a single vector) - required. % ...
183f6d0aca9ff3ec72e3219e6ef1ff29602540d0598885a3ac1b643a2be3db4b
MATLAB
4,744
137
function [FFT] = FFTtrials(cfg, force, LFP) % % Use as : % [FFT] = FFTtrials(cfg, force, LFP) % % The LFP argument is optional. If LFP is not in the input, then it is % loaded with the function readLFP.m. % % This file is part of EpiCode, see % http://www.github.com/stephenwhitmarsh/EpiCode for documentation...
b3fce2ebfabbea2c3b09cce322cd6420d8a3bb8c3f8d09899a81d1d1183226bf
MATLAB
4,764
148
classdef OpenExLive < handle %OpenExLive TDT online data streamer. % obj = OpenExLive() connects to TTank server and opens currently % recording block in Workbench % % obj.data reference to all available data from block % obj.update get latest data from current block % obj.TT ...
2c9568e55b607b76364f5ea4af8409b5f4684309c0be5083d316fd577231cb48
MATLAB
4,769
90
function [ColorPalette] = ColorScheme(num) %% Color Scheme % Liz's Color Palette % Purple: 8338EC [131, 56, 236] % Yellow: FFBE0B [255, 190, 11] % Orange: FB5607 [251, 86, 7] % Magenta: FF006E [255, 0, 110] % Pink: FF9DA4 [255, 157, 164] % Electric purple: F700FF [247, 0, 255] % Blue: 0080FF [0, 128, 255]...
7ef711463282ff8b41e6687dbe277ef679200ffd95c3b415f885bacc97a2dd47
MATLAB
4,769
130
function sub_fold = CBIG_cross_validation_data_split( subject_list, family_csv, ... subject_header, family_header, num_folds, seed, outdir, delimiter ) % sub_fold = CBIG_cross_validation_data_split( subject_list, family_csv, ... % subject_header, family_header, num_folds, seed, outdir, delimiter ) % % This fu...
61babfc32850e08bc02de1bc48c79e74dc992b01e2bc6d51c85a1a0d3a12febf
MATLAB
4,771
157
%% TIFFSAVE() Saves a TIFF stack. % % Usage: % tiffsave(outputPath, image, tags) % % tags should be a struct; if it has more than one item, the first one will % be used as a template. % function tiffsave(outputPath, image, varargin) % Parse optional arguments iArg = 1; if ~is...
7669dbf1614f99a2c13fc06f6535afc917e54e966e499a3c1f7f1025df0924a0
MATLAB
4,775
124
function [vertices, faces] = fs_read_surf(fname) % freesurfer_read_surf - FreeSurfer I/O function to read a surface file % % !!! Modified by D. S. Schwarzkopf (15/09/2012) - removed output messages !!! % % [vertices, faces] = freesurfer_read_surf(fname) % % Reads the vertex coordinates (mm) and face lists from...
3aa4b75802bb723441eeb05a0102986817657aaaaac9b5b9fbeadc4e417791e3
MATLAB
4,776
161
function mpict = linedither(inpict,varargin) % LINEDITHER(INPICT, {OPTIONS}) % Quirky multilevel dither consisting of variable density line segments % As the purpose of this function is image degradation, accuracy is moot. % % INPICT is a 2-D intensity image. RGB images will be converted to grayscale. ...
a9afa3ab756a170527f2c2f8329fde3e190acad82af9ff0f1b79a8a0c1764a0d
MATLAB
4,789
104
function [S,t,f,R,Serr]=mtspecgrampb(data,movingwin,params,fscorr) % Multi-taper time-frequency spectrum - binned point process % % Usage: % % [S,t,f,R,Serr]=mtspecgrampb(data,movingwin,params,fscorr) % Input: % data (in form samples x channels/trials or single vector) -- required % movingwin ...
82e73b87cff78558c922d5df2caaa6f39b719d47e4b775c6083310001fdf3a21
MATLAB
4,795
152
function [S] = mt_dtft_gram(lfps, fs, time_window, time_step, freq, TW, n_tapers) % MULTI-TAPER DISCRETE-TIME-FOURIER-TRANSFORM SPECTROGRAM: % Compute a time-frequency plot using a DTFT with a multipaer method. % % Input: % lfps = lfp signals (trials x samples) % fs = lfp sampling rate (kHz). % ti...
5a083cd3efb8d823a068e0478c0a923c049e810b6a688c971af4e504c8848ed6
MATLAB
4,805
186
function outpict = randlines(size,dim,varargin) % RANDLINES(SIZE, DIM, {OPTIONS}) % generates image fields of random lines of various type % % SIZE is a 2-element vector specifying the output image dimensions % DIM specifies the line orientation % 1 produces vertical stripes % 2 produces horizont...
133c59ecb7d4ea4fbce345661680a48fd4de9534117f6cf65fa4ab31c0bdd33e
MATLAB
4,807
101
function [datafit,Amps,freqs,Fval,sig]=fitlinesc(data,params,p,plt,f0) % fits significant sine waves to data (continuous data). % % Usage: [datafit,Amps,freqs,Fval,sig]=fitlinesc(data,params,p,plt,f0) % % Inputs: % Note that units of Fs, fpass have to be consistent. % data (data in [N,C] i.e. time x cha...
92d28d38a3c664e0f5e73eadcddfe2594d628ab8a7f4d4bc5d65a8d22fc3692d
MATLAB
4,815
123
function phasePairLFP(suffix) % Phase Pair LFP: % LFP-LFP Pairwise Phase Consistency % % Read parameters Params = read_params(suffix); freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1; time_window = Params.time_1; time_step = time_window / 4; TW = Params.freq_star...
9327c4b513d0f8524bd6fcf04ede0c463324d123909990b97da2976c2a4a084a
MATLAB
4,816
145
function [O_new,Spacing]=refine_grid(O_trans,Spacing,sizeI) % Refine image transformation grid of 1D b-splines with use of spliting matrix % % Msplit=(1/8)*[4 4 0 0; % 1 6 1 0; % 0 4 4 0; % 0 1 6 1; % 0 0 4 4]; % % [O_new,Spacing] = r...
c50887d5e43ab19a50a91f3b9da295663f0daaa19b2e2f923ddddee836d506dd
MATLAB
4,820
156
function [outpict T] = histeqtool(inpict,mode,varargin) % OUTPICT = HISTEQTOOL(INPICT,MODE,{EXTRAARGS}) % [OUTPICT TF] = HISTEQTOOL(INPICT,MODE,{EXTRAARGS}) % Simple wrapper tool for histeqFB() and adapthisteqFB() for simplified use % on both I and RGB images. This makes it simpler to apply these tools to % ...
6de5ddc7be7a684128c42b1c0caae10c959698ea783554a6225c298804b37260
MATLAB
4,821
115
function kernel = CBIG_crossvalid_kernel_with_scale(data_KbyS1, data_KbyS2, index_S1, index_S2, type, scale) % kernel = CBIG_crossvalid_kernel_with_scale(data_KbyS1, data_KbyS2, index_S1, index_S2, type, scale) % % This function calculates the kernel matrix between subjects from two sets % (e.g. training set and tes...
cc8b112c932954db60ef26fd2843f04e15a5f1117caf7d4b9fbf8a3a1e0d0408
MATLAB
4,821
104
function [S,t,f,R,Serr]=mtspecgrampt(data,movingwin,params,fscorr) % Multi-taper time-frequency spectrum - point process times % % Usage: % % [S,t,f,R,Serr]=mtspecgrampt(data,movingwin,params,fscorr) % Input: % data (structure array of spike times with dimension channels/trials; % also ...
a4c61e75b2deb9988f7a2dd266441ca753b539807a19dffebcdbda7aeaf8c0bf
MATLAB
4,822
94
function Handle=getSigmoidHandle(options) % creates a function handle to a specific sigmoid %function Handle=getSigmoidHandle(options) % This function creates a function handle to the sigmoid specified by its % name in options.sigmoidName. % Additional parameter is the options.widthalpha which specifies the % scaling ...
7c6358bb0120f92293eaaacf9ee8b26aa8f413a07d40186293bb11375ef63d65
MATLAB
4,830
137
function nt_idx_disp(name,field,explainflag) %nt_idx_disp(name,field,explainflag) - display contents of index file % % name: name of file % field: field to display in detail % explainflag: if true, explain contents of each field % % NoiseTools nt_greetings; if nargin<1; name=pwd; end if nargin<2; field=[]; end if n...
8a8c0018b15462d8c8a6d5283fc29df29be385524b6dc50a6fbd872d71f00332
MATLAB
4,834
135
function[OPS_dataset_pos] = format_OPS_results(settings,pos_idx,phase) % [OPS_dataset_pos] = format_OPS_results(settings,pos_idx,phase) % Summarises OPS results in a table % % inputs: % settings - Analysis and experimental settings % pos_idx - Position number to analyse % phase - 'test' or 'training' % % out...
c203d9012baafdb1beeeaf6c2c76e8f8310b6fac8b7259fffbaa22f169b18636
MATLAB
4,834
134
function [TFR] = TFRtrials(cfg, force, Trialdata) % 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 % the...
4c165c18ab9d7702653100b922120328b11242e2ef0b05c53f3a71474c0b396f
MATLAB
4,836
139
function [confC,phistd,Cerr]=coherr(C,J1,J2,err,trialave,numsp1,numsp2) % Function to compute lower and upper confidence intervals on the coherency % given the tapered fourier transforms, errchk, trialave. % % Usage: [confC,phistd,Cerr]=coherr(C,J1,J2,err,trialave,numsp1,numsp2) % Inputs: % C - coherence % J1,J2 -...
0fbf9bc79d82a75ea155c804903da9b0403ec97b498a58e01ca1e48f6b784d10
MATLAB
4,855
170
%% Zoom into the specified region of a given axes % focus() % focus(precision) % focus([min, max], [axis = 'x']) % focus([xMin, xMax], [yMin, yMax]) % focus(handle, ...) % function [varargout] = focus(varargin) %----- Default values handles = []; precision = 2; %----- ...
00d025bcb50c3ef265defdaffe1c2ced90cb8f03333d154c8abf51099c3a3baf
MATLAB
4,859
103
function [sens, regu, noise_cov] = morse_estimate_sensitivities(ref, PAD, PPIparams) %************************************************************************** % % morse_estimate_sensitivities % input ref: data for sensitivity estimation post apodisation % [RO, PE1, PE2, N_coils] % ...
da5d999bb3e459ccef532350662c6c6814e5bf36ca257d571632be9c38fd5943
MATLAB
4,878
135
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2019 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 % modi...
bb7373a7aa77ee4f744b5a7fbe923b2fe082d0e0ce486dd560268533cad598b4
MATLAB
4,907
113
function [ancova_models,indx_all] = generate_ancova_spectral_data(EEG_integrals_am,EEG_integrals_nam, participant, indx_all, ancova_models, options) %% Creates a placeholder cell with the datasets of all participants for plotting of results % % **Usage:** [all_data,indx] = generate_spectral_data(EEG_integrals_am,EEG_in...
4b81f8c43e5fb9773c2837c3b8417259ee9fd24e503b93c38581da28a5b8829a
MATLAB
4,922
124
function [newPhi, newVarBound] = ... CBIG_AuthorTopic_ComputeVariationalTerm__N_tc(params, newPhi, ... newVarBound, varBoundFlag) % [newPhi, newVarBound] = ... % CBIG_AuthorTopic_ComputeVariationalTerm__N_tc(params, newPhi, ... % newVarBound, varBoundFlag) % % Compute the expectation and variance of the count N_{.t...
005c45549bc9a679f656f3162a094d335cafdb0020157f789581cbcd1ce1bc9a
MATLAB
4,923
88
%% Setting parameters function [config] = seg_setparams(config) if ismac error('Platform not supported') elseif isunix rootpath_analysis = '/network/lustre/iss01/charpier/analyses/stephen.whitmarsh'; rootpath_data = '/network/lustre/iss01/epimicro/patients/raw'; os = 'unix'; ...
ec13c516f1c41f5aee0e899f5918f00d13febf6c1df5b0cb727cb60988cfc02a
MATLAB
4,923
136
function MBmodel = optimiseMBparams_homeostaticThreshold(MBmodel, PNactivity) %% this is the "magenta model" DEBUG = true; % sigmoid_factor = -0.9; % Sigmoid_derivative = @(x) exp(-sigmoid_factor.*x)./((1.+exp(-sigmoid_factor.*x)).^2) ; % Sigmoid = @(x) 1./(1.+exp(-sigmoid_factor.*x)) ; sigmoid_factor = 1.; Sigmoid_der...
47a30d282803e1c809e06060ae4c9ede4b9b26afc1d84844578288547e013bf0
MATLAB
4,924
153
function A = catstruct(varargin) % CATSTRUCT Concatenate or merge structures with different fieldnames % X = CATSTRUCT(S1,S2,S3,...) merges the structures S1, S2, S3 ... % into one new structure X. X contains all fields present in the various % structures. An example: % % A.name = 'Me' ; % B.income = 99...
4b161d10931bba79415504666effffb94d1d2269a9ea8f3433a141b0c3d20aeb
MATLAB
4,944
122
function [y_resid_perfold] = CBIG_crossvalid_regress_covariates_from_y( ... y_in, regressors, sub_fold, outdir, outstem) % [y_resid_perfold] = CBIG_crossvalid_regress_covariates_from_y( ... % y_in, regressors, sub_fold, outdir, outstem) % % This function regress the "regressors" from the target variables "y_i...
5247449348ea8c8f2149063195661a3e20391fd87a38b74edf255330b19811fe
MATLAB
4,952
134
function data = TDTdigitalfilter(data, STREAM, FC, varargin) %TDTDIGITALFILTER applies a digital filter to continuous data % data = TDTdigitalfilter(DATA, STREAM, FC, 'parameter', 'value', ... ), % where DATA is the output of TDTbin2mat, STREAM is the name of the % stream store to filter, FC is the cutoff freque...
004c8028a4769ad73ca5e564734c5a2037f48820e542de3a90023c3fe784fc10
MATLAB
4,958
147
function [trajectory, trials] = cpm_td_learning(freeparams, fixedparams, data) % Simulation configs, file for handling of paths to toolboxes. % --------------------------------------------------------------------- % Copyright (C) 2023 Simon R. Steinkamp, Iyadh Chaker % This program is free software: you...
ae0cac2040604311f1b6d8a9def4690151f45ab0be9261389ee762febb6e36ed
MATLAB
4,962
133
function [y] = CBIG_read_y_from_csv( csv_files, subject_header, y_names, y_types, subject_list, outname, delimiter ) % [y] = CBIG_read_y_from_csv( csv_files, subject_header, y_names, y_types, subject_list, outname, delimiter ) % % This function reads y (i.e. the target variables to predict, e.g. % behaviors, disease ...
f63a040abc01651d2b322a68710c737286def186d021ae2f5580b6c3bfbb608b
MATLAB
4,979
154
function S07_layer_x_cross_validation(subject, game, DQN, reg_parameter) root_path = 'YOUR_DATA_PATH'; main_dir = strcat(subject, '/', game) ; sess_no = 5; GLM_name = 'GLMs_Layer_x'; lambda_seq = reg_parameter; load(strcat(root_path, main_dir, '/GLMs/GLM_empty/SPM.mat')); beta_template_nii = load_nii(strcat(root_...
090b8809e66332539b486e76543fab324fc18acd810ce401578024fb879aad73
MATLAB
4,983
219
function outpict = displace(inpict,amount,varargin) % DISPLACE(INPICT, AMOUNT, {OPTIONS}) % Apply pixel displacement map(s) % % INPICT is an I/RGB image of any standard image class % AMOUNT is a 2-element vector specifying maximal displacements % for X and Y directions ([maxx maxy]) % OPTIONS are ke...
a8a800d920f0b9db536ecb8557973b2edf5ed33c5d48337d056cec9a2075ff92
MATLAB
5,018
96
%% Euclidian distance for hierarchical clustering % eucD = pdist(LFP_concatinated_z,'seuclidean'); % eucD = pdist(shifted_clean_z,@naneucdist); % method to allow nans % % [Y,stress,disparities] = mdscale(eucD,3,'Criterion','sstress'); ...
fe7e978f2c4dee825c131648b2c80b6b1d15d31508c012da966997e522dab086
MATLAB
5,018
171
% % 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...
8cc47aaa394a82b4b0df66938d51fdfc5c314d52bf75d32e0b70eef114d60d25
MATLAB
5,019
160
function outpict = morphops(inpict,se,mode) % OUTPICT=MORPHOPS(INPICT,SE,MODE) % Perform the selected morphological operation on an image. % % This is a passthrough to the IPT functions imdilate(), imerode(), imopen(), imclose(), % imtophat(), and imbothat(), with internal fallback implementations to help r...
98b02ec0a7bb0730f95333a941daefbefbc36035dbb58174ddedd8fa662242cc
MATLAB
5,036
161
function Srf = spm_prf_import_surface(glm_dir, struct_img, surf_dir, hemi) % Imports Freesurfer surfaces to Matlab (SamSrf format) % % glm_dir - directory containing SPM.mat % struct_img - filename of the subject's structural MRI % surf_dir - directory containing Freesurfer surfaces % hemi - ...
4943346ad9fdab0c58aa15734b62e4c24c74370594811d60e92c6170075dee85
MATLAB
5,037
114
function [micromed_markers, stim_micro_aligned] = alignstimdata(cfg,varargin) if nargin > 0 if nargin > 1 micromed_markers = varargin{1}; markerdat_micro = varargin{2}; end else fprintf('Not enough input arguments!'); end fname_output = fullfile(cfg.datasavedir,'aligned_stim_marke...
dc5167eb9c41375d24ae9a2e43012556b72d19958f5f93338dd8980fb9405a1a
MATLAB
5,052
150
% This script provides a synthetic max-statistics example for the optimized % C++ MEX implementation of continuous/continuous mutual information. % % The direct native entrypoint is: % I = info_cc_slice_cpp(X, Xdim, Y, Ntrl, Nthread) % % This script uses cell mode - cells are delimited by %% lines and can % be run wi...
4ffcbc5adadb642d2f417f9e376e53a08b14451d9bd973572e53ff15cc0af176
MATLAB
5,072
169
clear close %% SETTING run('./../init.m') hls = Pyramid_only; f = hls{2}; OPTIONS = odeset('RelTol',1e-6); dt = 0.01; transient = 3000; % transient period T = 3300; % total timespan length t = 0:dt:T; IC = [-60,-60,0.5,0.9,0.001,0.01,0.06,0.01]; % initial conditions %% GRID % Load fold curve PATH = './.....
9298753870c2bbbbda4d4d61de14c4eada158e43d23d3b432fc7402e17b70ccf
MATLAB
5,074
193
function y=nt_mfilt(x,M,B,A,expand) %y=nt_mfilt(x,M,B,A,expand) - multichannel filter % % y: filtered data % % x: data to filter (time X channel) % M: multichannel impulse response (ichannel X ochannel X lag) % B, A: bank of filters % expand: if true output 3D matrix, one band per page (else add) % % Output is ...
2deacd1f85455b982d0fa4fa4ab1cadab323786e71a7ff738fe7f3da1756787b
MATLAB
5,086
207
% Load NIFTI header extension after its header is loaded using load_nii_hdr. % % Usage: ext = load_nii_ext(filename) % % filename - NIFTI file name. % % Returned values: % % ext - Structure of NIFTI header extension, which includes num_ext, % and all the extended header sections in the header extension. % ...
6b8019ad1ec1945ff478fbaeb20998b4e9e5f1230114f32d3449d59352bce2d3
MATLAB
5,088
147
function varargout = imcropFB(varargin) % OUTPICT=IMCROPFB(INPICT,RECT) % OUTPICT=IMCROPFB(X,Y,INPICT,RECT) % Crop an image array. % % This is a passthrough to the IPT function imcrop(), with an internal % fallback implementation to help remove the dependency of MIMT tools on the % Image Processing Toolbo...
f78d02bea2222709f229ad258c6d04b6be71c386cde99151a90af0e028fae147
MATLAB
5,098
164
function [p,h,p_3d,h_3d,lme] = stats_SAP(results_folder, results_to_plot, biom_1, biom_2, biom_set_folder,name, coloc) alldata = 0; shapiro = 0; % to check for normality and deide on the test accordingly mixed_effects = 1; rem_outliers = 1; tech_rep = 0; AB =1; nonparam = 0; % to impose non parametric test t_test = ...
15f8db072afc2068623172bcf1fd7673f926ad6deba804674e7dcc54536cc082
MATLAB
5,099
143
function CBIG_compute_multiKRR_PFM(feature_file, multiKRR_dir, sub_fold_file, score_ind, outstem, outdir) % CBIG_compute_multiKRR_PFM(feature_file, multiKRR_dir, sub_fold_file, score_ind, outstem, outdir) % % This function computes the predictive network features of multi-kernel % ridge regression (under <CBIG_CODE_DI...
4e117476627e7f49bfe8dd16bd8135a92b532cbbd77f4761fd28eef503aa04d8
MATLAB
5,100
87
%% change dir %% cd ~/Projects/pacman/behavioral_analyses/matlab_helpers %% BJH021 table bjh21 = load('~/Projects/knight_server/remote/WashU/data/_VERA/VERA_BJH021/BJH021_MNI_brain.mat') bjh21_table = table(repmat({'BJH021'}, length(bjh21.electrodeNames), 1), bjh21.electrodeNames, bjh21.tala.electrodes(:,1), bjh21.ta...
b54024b2d2bd25d7a40a1998aed90d57cfa7c9e1466cf8c54a6aa2999b5dc893
MATLAB
5,109
160
%% FP_Part1.m % % Fiber Photometry Analysis - Part 1 % % It is recommended that users read through the documentation in full % prior to using this analysis. This applies to each section in the code % % All outputs are accessed through the structure element "FP" in the % MATLAB ...
41242cdb1347d2aea0439d1a49b81fc958febf35fc813c8aad96097aa19491a7
MATLAB
5,122
125
function [psth trialspx] = mpsth(spxtimes,trigtimes,varargin) % [psth trialspx] = mpsth(spxtimes,trigtimes,varargin) % function generates a peri-stimulus time histogram (psth) with time base in column 1 and histogram in column 2 % in addition, function returns spike timestamps relative to trigger times % IMPORTANT: all...
5a7ee473830b874ac438f3ced80ddc231faa2908c790385661995c2327e8c38d
MATLAB
5,123
152
function G = G_matrices_3D(kCal, N1, N2, N3, tau, U, varargin) % Function that calculates the G(x) matrices directly without calculating % H(x) first. % % Input parameters: % --kCal: N1_cal x N2_cal x N3_cal x Nc block of calibration data, % where N1_cal, N2_cal, and N3_cal are the dimensio...
7c62a2fa350bc2d8a0d917c82cfbc65ed6118915b3814c8682d5bac66e83e371
MATLAB
5,130
98
% done for rodents 1 to 7 % writemusemarkerfiles do not work for brainvision data (because there is an other format of Muse marker file (.vmrk)) % config = dtx_setparams_probe_spikes; config = wod_setparams; pat_list = 4:length(config); torename = {};%{'Baseline_Start', 'Analysis_Start'}; %{old1, new1; old2, new2;...
483e8c27924e7b70355b96a0ea078ac08055b3e846eab0f75596b1c3c0eb4cf0
MATLAB
5,136
146
function varargout=wt(d,varargin) %% Continous Wavelet Transform % Creates a figure of wavelet power in units of % normalized variance. % % USAGE: [wave,period,scale,coi,sig95]=wt(d[,params]) % % d: a time series % wave: the wavelet transform of d % period: a vector of "Fourier" periods associated with wave % scale: a ...
6f8c5f5e81aee3e665d6099d8a5f6f2df2b3070bd39ae7a9e56c8e0114de155d
MATLAB
5,143
143
% Pipeline to analyse OPS data %% % Author: Maria Garcia - 31/05/2024 (V1) clear all close all settings.experiment = "TI_AD-Hipp2"; % Either "TI_AD-Hipp2" or "pilot" %% Define steps to run %%%%%%% Test steps %%%%%%% detect_object = 1; analyse_OPS_data = 1; format_OPS_data = 1; get_OPS_graphs = 1; %%%...
89241eecc35672c809b9805790c324f2c479ff8b2a8d0738f2850cbf05d4852a
MATLAB
5,146
205
function [fft_data,varargout] = TDTfft(data, channel, varargin) %TDTFFT performs a frequency analysis of the data stream % [fft_data, fft_freq] = TDTfft(DATA, CHANNEL), where DATA is a stream % from the output of TDT2mat and CHANNEL is an integer. % % fft_data contains power spectrum array % fft_freq co...
faed1b8f65cd90af815a22d4610d77ea865eb4cecb1c194e0e7eb9f8b1677999
MATLAB
5,149
157
function [results_col] = compute_colocalisation(mask_1, mask_2, biom_1, biom_2,fname, repeat, results_folder) close_figs = 1; coloc_per_cell = 1; count_coloc = 0; %% Load image % fpath = fullfile(files(idx).folder, files(idx).name); % biom_ch_1 = find_channel_img(biom_1); % % [img_1] = load_channel_images(fpath, biom...
cb0283481b2cd807a5e738cad7e5d13fbcfbf72d852ce605c712579f22bc44d7
MATLAB
5,157
141
function [vol1_new, vol2_new, X_grid, Y_grid, Z_grid, res, G_new] = reslice_vol_same_grid(v1, v2, res, method, outFile1, outFile2, gz) % Reslice/Resamples v1 and v2 on the same grid point. (v1, v2 should be registered together) % v1, v2 - nii structure or nifti file % res - resolution in mm of target output image % ...
71d5ed8ff7a48d180bfe18b6123b8d4b6865f1dacbbb37090d78d1fa404dbc2b
MATLAB
5,159
175
function kbboxplot(paramArray, varargin) % KBBOXPLOT - Draws multiple stylized boxplots with explicitly defined parameters, % mimicking the style of MATLAB's boxchart. % % Inputs: % paramArray - struct array, each with fields: % bottomWhisker, bottomBox, bottomNotch, median, % topNotch, topBox...
6910d6c6b8e9dce44327cf86745d3091bf2dfb86a42e28f18b96faab897cc41d
MATLAB
5,166
196
function varargout=shadedErrorBar(x,y,errBar,varargin) % generate continuous error bar area around a line plot % % function H=shadedErrorBar(x,y,errBar, ...) % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color is chosen automatically. % % % Inputs (required) % x - vec...
c29ec0e191b14dd1f5f0f75d22836f81cf9c2f92912f66d4113cbdbd68dd4540
MATLAB
5,186
130
% % 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...
f4a05c0b7a5769be2563d3fe0db95fda120ed02fb716ff71c064008f75bbf164
MATLAB
5,207
132
function [newPhi, newVarBound] = ... CBIG_AuthorTopic_ComputeVariationalTerm__N_cv(params, newPhi, ... newVarBound, varBoundFlag) % [newPhi, newVarBound] = ... % CBIG_AuthorTopic_ComputeVariationalTerm__N_cv(params, newPhi, ... % newVarBound, varBoundFlag) % % Compute the expectation and variance of the count %...
15e76df546d5d83e5d92dd8778b0c6b61fa4e6462d64f9b618b961a6620e456e
MATLAB
5,216
120
function [sdf kernel] = msdf(psth,ftype,w,varargin) % [sdf kernel] = msdf(psth,ftype,w,varargin) % make spike density function % filters a psth generated from mpsth with a Gaussian or exponential kernel to yield an SDF % note: bin size of psth should be 1 ms! % % MANDATORY ARGUMENTS % psth 2-column vector with ti...
c4f6b9abcf5ec192e66e7e8589b839326c1e96edfd9a893a6b22423165bc006f
MATLAB
5,216
157
function wtcsig=wtcsignif(mccount,ar1,dt,n,pad,dj,s0,j1,mother,cutoff) % Wavelet Coherence Significance Calculation (Monte Carlo) % % wtcsig=wtcsignif(mccount,ar1,dt,n,pad,dj,s0,j1,mother,cutoff) % % mccount: number of time series generations in the monte carlo run (the greater the better) % ar1: a vector containing th...
0d815659580f13c74a98a9d4d094f7bae7d86d3023b6e49a2dd4dccf13508b15
MATLAB
5,226
113
function [session, init_params] = preprocessingParams(session, clip, stc) % Generate data structures of vistasoft parameters for preprocessing % % INPUTS % 1) session: name of session to analyze (string) % 2) clip: number of TRs to clip from beginnning of each run (int) % 3) stc: flag controlling slice time correction ...
34211f17eca4a44e9d2e21a8bcbf134887774c340c332f58e2467360ec799ddc
MATLAB
5,226
151
function outpict = rgb2husl(inpict,varargin) % RGB2HUSL(INPICT,{MODE}) % converts an RGB input image to HUSL (human-friendly HSL), which is an adaptation % of LCH with normalized chroma. This is particularly useful for tasks such as % avoiding out-of-gamut values when rotating hue at high chroma. ...
1c775bb9fb80965a7c50c1e5f6acd43db9d625a39150f585be22ba3a68f90a04
MATLAB
5,235
143
function write_brainvision_eeg(filename, hdr, dat, event) % WRITE_BRAINVISION_EEG exports continuous EEG data to a BrainVision *.eeg % and corresponding *.vhdr file. The samples in the exported file are % multiplexed and stored in ieee-le float32 format. % % Use as % write_brainvision_eeg(filename, hdr, dat, evt) % ...
8c3e814f3b2df04a92feb72a9eb6c90104da77821d52f2ccd9b24e4a3ffc6aea
MATLAB
5,235
91
function [dat_micro] = readMicroFs(cfg,MuseStruct_micro) fname = fullfile(cfg.datasavedir,['data_aligned_microFs_',cfg.label,'.mat']); if exist(fname,'file') && cfg.force == false fprintf('Loading precomputed data: %s \n',fname); load(fname,'dat_micro'); else trialcount = 1; % to have a continuo...
67af5f3ed76790d85b70be09d9833ff55a4e0727f0e8ac2a0c562fd294cefc03
MATLAB
5,239
146
function outpict = genknit(bgcolor,rowcolors,nloops,varargin) % OUTPICT = GENKNIT(BGCOLOR,FGCOLOR,NLOOPS,{OPTIONS}) % A novelty function to generate images of interlocking (knit) curves. % This was originally written to answer a forum question and really doesn't have % much purpose beyond demonstrating compositing...
bf93f5f7a3c26e58ec83b131fcdfcee1f65eaa4fd30c61fda6fe3f2cfc955855
MATLAB
5,240
97
%% main script to identify cells that are tuned to heading-direction % define folders folders = strings(9,2); rootdir = "G:\CA1 miniscope data\"; folders(:,1) = ["\M119\TrainingD11\" "\M120\TrainingD11\" "\M292\TrainingD6\" "\M319\TrainingD7\" "\M210\TrainingD17\" ... "\M231\TrainingD9\" "\M314\Training_Sep...
d6f4fa0a2cb72c31f58650b972fe9edf9e83115a5bfb8748e46797c40465c616
MATLAB
5,242
91
function [dat_micro] = readMicroFs_spikes(cfg,MuseStruct_micro) fname = fullfile(cfg.datasavedir,['data_aligned_microFs_',cfg.label,'.mat']); if exist(fname,'file') && cfg.force == false fprintf('Loading precomputed data: %s \n',fname); load(fname,'dat_micro'); else trialcount = 1; % to have a c...
b88720e76aeb0ebc687a5f4793b32260c789fd158556da8a8165c0a5c36c8f24
MATLAB
5,245
142
function [y,idx,w]=nt_tsr_nodemean(x,ref,shifts,wx,wref,keep,thresh) %[y,idx,w]=nt_tsr_nodemean(x,ref,shifts,wx,wref,keep,thresh) - time-shift regression (TSPCA) % % y: denoised data % idx: x(idx) is aligned with y % w: weights applied by tsr % % x: data to denoise (time * channels * trials) % ref: reference (ti...
020c61e1dd12896236230e91ab890640df677e81a7b5d0499bbf7380f8e62d76
MATLAB
5,246
141
% % 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...
0cc0b8f80a7c76dedfcdf5e21dd1f37c806f1aff62e875715270b690a0d33f43
MATLAB
5,246
177
function y=nt_sparse_filter(x,T,A) %y=nt_sparse_filter(x,T,A) - convolve multichannel data with sparse impulse response % % y: result % % x: data to convolve (columnwise) % T: times of non-zero samples of IR (can be fractionnary) % A: amplitude of non-zero samples of IR (default: all 1) % % T and A together describ...
8aa92fe5b8edc7d14155a12ee7fbb8156885f0441d4bbb2542d8db8af2413063
MATLAB
5,247
80
function [config] = hspike_setparams_temp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [config] = hspike_setparams % % This function outputs all the settings of a study, to be defined below % % Note the consideration of the operating system, because the pointers to % the file server is...
8c336c445c7769fb761f70cacdd78969b67c5d2d4db64c2d5c915f3368e66991
MATLAB
5,251
154
function CBIG_AuthorTopic_PreprocessExpDataFromText(textDataPath, ... dataDir, binarySmoothKernelRad) % CBIG_AuthorTopic_PreprocessExpDataFromText(textDataPath, ... % dataDir, binarySmoothKernelRad) % % Preprocess data of activation foci's locations in text form: write the % activation foci into 3D brain images a...
e9bbe7e06c86a70715a95713f1b42d83462126c0d7bc475a298604ed7cbb431a
MATLAB
5,251
151
function [dz,vdz,Adz]=two_group_test_spectrum(J1,J2,p,plt,f) % function [dz,vdz,Adz]=two_group_test_spectrum(J1,J2,p,plt,f) % Test the null hypothesis (H0) that data sets J1, J2 in % two conditions c1,c2 have equal population spectrum % % Usage: % [dz,vdz,Adz]=two_sample_test_spectrum(J1,J2,p) % % Inputs: % J1 taper...
3ebc43020ae923213f20b2bcdd2ef1135d63a4f9e91cf51cd7f457c165a38c49
MATLAB
5,256
155
% This script provides a synthetic max-statistics example for the optimized % C++ MEX implementation of continuous/discrete mutual information. % % The direct native entrypoint is: % I = info_cd_slice_cpp(X, Xdim, Y, Ym, Ntrl, Nthread) % % This script uses cell mode - cells are delimited by %% lines and can % be run ...
0f4a120d1785cbc39ee69757018412c77d42778c4441a56f3fcc8a933f1f557f
MATLAB
5,270
81
%----------------------------------------------------------------------- % Job saved on 10-Oct-2023 00:29:53 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- load('tmp_workspace_correlate_varA_varB...
20790cc2d778d074342060470a51c1c65d94412a33a922e988fc51da4c87a93f
MATLAB
5,278
82
%----------------------------------------------------------------------- % Job saved on 10-Oct-2023 00:29:53 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- load('tmp_workspace_correlate_varA_varB...
fc8d3245315c10e43ce1ca5cf99f53077342095b0558ba694a9b833e6b9fcf10
MATLAB
5,279
120
classdef Brain3DStructureVisualizer % Brain3DStructureVisualizer % Static methods for visualizing 3D brain structures and spatial data. methods (Static) function [hAx] = imageBrainRegionalValuesIn3D(regionalValueVector,brainSpace3D,brainRegionInfo,options) arguments reg...
b1bd4e37d2da92bf3013e306eb0076a952d1f5e6d5ccaab84107df8cfd982c29
MATLAB
5,280
196
function [legend_h,object_h,plot_h,text_strings] = legappend(newStrings,varargin) %LEGAPPEND appends new entries to the end of a legend by deleting the %current legend and recreating a new, similar legend. % %% Syntax % % legappend('new legend entry') % legappend('new entry 1','new entry 2',...,'new entry N') % le...
e57880fef1f72b13d6defe2ec0fbac85d65726693b2b10585b13fecc0cb996c1
MATLAB
5,299
171
function legend_curate(labels, varargin) % This function will set the appropriate color, text color, box positions, % location, background etc. in a legend based on user input. % % Required parameter: % labels : legend names % % Optional parameters: % markertype : the marker type ('*...
7f25a6633d4a2a1a2ad4e67429632e7b446bc9f7c38d71c708b118fcbfb92f08
MATLAB
5,314
130
function MuseStruct_concat = concatenateMuseMarkers(cfg, MuseStruct, force) % % Use as : % MuseStruct_concat = concatenateMuseMarkers(cfg, MuseStruct, force) % % concatenateMuseMarkers concatenate Muse markers over all the directories. % This file is part of EpiCode, see % http://www.github.com/stephenwhitmar...
baba8115f5724d7d4e552c148a116484b18ecec3f1dc7627a256cd6c244c3397
MATLAB
5,314
190
% Connecting parallel pool c = parcluster; parpool(c, 14); if not(isfolder('init_data')) % % Create a unique RNG stream if using poissonP or constructConnections/GJ sc = parallel.pool.Constant(RandStream('Threefry','seed','shuffle')); seed = sc.Value.Seed; %} %Sim variables var_rep = 1:150; var_pv_prob = 0:0.2:1; v...
596b4aa40046cd15895d4bfb13e29f92db875f37cf11860665127e49d7a19918
MATLAB
5,321
106
function [S, iA] = singleGaussNeuroInfer(tau_vec, mov_vec, D, lambda_val, TOL, nonneg, S, varargin) %function S = singleGaussNeuroInfer(tau_vec, mov_vec, D, lambda_val, TOL, nonneg, S, varargin) % S = singleGaussNeuroInfer(tau_vec, mov_vec, D, lambda_val, TOL) % % Use MPC to solve the weighted LASSO problem for a sin...
ed9ab6c3862a7094c78ba023c1ae36a3f575b86cbdf536988ea9b43820b3ad64
MATLAB
5,344
144
function varargout = spm_prf_fcn_template(P,M,U,varargin) % Template pRF response function. This example models neuronal % activity as a scaled version of the inputs: % % z(t) = alpha * u(t) % % Where alpha is a parameter estimated from the data. % % % Inputs: % % P - parameter structure % M - model structur...
165d4dd7339c7edf378e25c422dfd2e529926a60bb73f2286c3595ed815c3aa2
MATLAB
5,362
192
% Connecting parallel pool c = parcluster; parpool(c, 14); if not(isfolder('init_data')) % % Create a unique RNG stream if using poissonP or constructConnections/GJ sc = parallel.pool.Constant(RandStream('Threefry','seed','shuffle')); seed = sc.Value.Seed; %} %Sim variables var_rep = 1:150; var_pv_prob = 0:0.2:1; v...
dafdae5a4965827d3a05f8249623cdb4b7680c042dca64c046ae4819108cb6c2
MATLAB
5,369
104
% edit_Markerfiles.m if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\projects\dtx')); addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\shared')); elseif isunix addpath(genpath('/network/lustre/iss01/charpier/analyses/lgi1/Git-Paul/EpiCode/projects/...