sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
0cafb9c2547772c591c9014d8c56d52f8a770fc207762f6f3571a79965f8da65
MATLAB
4,061
101
classdef NullModelAnalysisUnit_GeneSurrogate % Holds and executes a single null model analysis, leveraging ConnectomeAnalysisRunner properties AnalysisRunner ConnectomeAnalysisRunner WiringPISimilarity end methods function obj = NullModelAnalysisUnit_GeneSurrogate(surrogateGene...
8ef2ec08fd66cd4c51a69566615ba76b94ac17788704543d7201f84527dd60ba
MATLAB
4,070
125
function outpict = imfilterFB(inpict,fk,varargin) % OUTPICT=IMFILTERFB(INPICT,FK,{OPTIONS}) % Filter an image using a specified filter kernel. % % This is mostly a passthrough to the IPT function imfilter(), with an internal % fallback implementation to help remove the dependency of MIMT tools on the % Imag...
292fcc9df4b938f139aa40127410bd37c220c66182b1e0e28191c3209f7789b4
MATLAB
4,078
160
% % 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...
29e5b3a98e98c01212db4a2e56754aebf2d52c4ebc5947167a8fbe5f1202f86f
MATLAB
4,084
68
function [SFC, medSFC, freq] = getSpikeFieldCoherence(LFP, MUA, fs, fsMUA, threshold, windowLength, nfft, maxFreq) % by Mattia: computes Spike Filed Coherence (SFC) and median SFC. % based on this paper from Pascal Friese https://goo.gl/quC115 % %% input: % LFP : entire signal % ...
8377dfe331abbc740e9639303160eacf3f6a0bd981f02f11165d22b987ae1a3c
MATLAB
4,084
104
function [intervals] = inter_trial_intervals(cfg, MuseStruct, force) %% Make overview of data as segmented by markers aligned to (first) peak binwidths = [1, 1, 0.25, 1, 1, 0.25, 1, 0.25]; binlimits = [60, 60, 15, 60, 60, 15, 60, 15]; fname = fullfile(cfg.datasavedir, [cfg.prefix,'timings_intervals.mat']); if nargin...
c64df16aaa4489969e79f7e4a561038b2ce630d53e828873565734bdab9d5cf1
MATLAB
4,087
106
function [spike_LFP] = spikeLFP(cfg, MuseStruct, SpikeRaw, force) fname = fullfile(cfg.datasavedir,[cfg.prefix,'spike_LFP.mat']); if exist(fname,'file') && force == false fprintf('************************************\n'); fprintf('*** Loading precomputed spike-LFP data ***\n'); fprintf('*****************...
1033909786f43e74adceb5353dba01a28306b252f43d5de53b6dad53200f2ddf
MATLAB
4,092
89
function SUAdata = getRipplesSUAspiketimes(experiment, RespArea, save_data, repeatCalc) % by Mattia % get SUA spike times with respect to ripples % usual inputs if strcmp(RespArea, 'HP') folder2save = 'Q:\Personal\Mattia\SharpProject\results\ripples SUA\'; folderSUAspiketimes = 'Q:\Personal\Mattia\SharpProject...
fc6775c073267583c9af8ee1387fc2129072f6df9ba44bebf02b50cf6e9244b3
MATLAB
4,097
124
function outpict = imresizeFB(inpict,scale0,varargin) % OUTPICT=IMRESIZEFB(INPICT,SCALE,{METHOD},{OPTIONS}) % Resize an image array. % % This is a passthrough to the IPT function imresize(), with an internal % fallback implementation to help remove the dependency of MIMT tools on the % Image Processing Tool...
dfbfb9314228b7b248f6ca9298b360cd9ada0dc626c1cbf917831df14c6ef42a
MATLAB
4,117
187
function [c, colors] = bipolarcmapB(m, cRange, method, colors, method_param) % Returns an approx. bipolar colormap centered at zero (in cRange). Zero % maps to black. % % method is type of interpolation to be used. It can be % ['sigmoid'], 'linear', 'quadratic', or 'cubic' % % method_param defines the parameter for...
1bf32f4398f80236e787ff4995f98e8f2776971e39481c6222842667db1ebb58
MATLAB
4,130
107
function out = Pyramid_astro out{1} = @init; out{2} = @fun_eval; out{3} = []; out{4} = []; out{5} = []; out{6} = []; out{7} = []; out{8} = []; out{9} = []; out{10}= @Ia; % -------------------------------------------------------------------------- function dydt = fun_eval(t,kmrgd,par_Is,par_Id,par_gsd,par_gCa,par_p,par...
219eda63a2b5082db5f25cded8c728f36bf11533ccda20fa3d855a2c170b5d95
MATLAB
4,130
109
function coef_vals = multi_infer(dictionary_n, x_im, infer_type, opts) % coef_vals = multi_l1ls(dictionary_n, x_im, infer_type, opts) % % Function to perform inference on a multitude of test vectors. The % inference algorithm given by infer_type is run on each column of x_im % with repect to dictionary_n. % % Inputs:...
adc0e09c223b9bb5ced3e5c564db0b0631faae7257ea429a5d7e1d992ec43d7e
MATLAB
4,137
110
%% main script for mismatch analysis - use only correct trials framerate = 30; filterSize = 1.5; MaxRZRadius = 5; main_path = "C:\Users\ewell\Desktop\TestCodeGitHub\"; % change this only rootdir = strings(2,1); rootdir(1) = strcat(main_path, "\Discrimination 2025 data\CA1 miniscope data\"); rootdir(2) = ...
510a02ab5e2b44535b92356bff378e28ea4dd9cb46f51dc6c29bc0af48470627
MATLAB
4,147
120
function outpict = gbcam(inpict,cmode,upscale) % OUTPICT = GBCAM(INPICT,{CMODE},{SCALE}) % Emulate the appearance of a photo taken with a Nintendo GameBoy camera. % % Images are centered, scaled, and cropped to fit the output frame. If you want % your image located differently, prepare it accordingly. % % You m...
adb4839ea5d4d66d4828ff7f697aed201a4e58944d084d90b120c3c7f2810503
MATLAB
4,148
113
%% Resamples f(t) by computing the average in bins of width deltaT aligned to t0 (t0 is constrained to be a bin center). % % Syntax: % [binnedF, tCenters, t0Index] = binnedResample(t, f, t0, deltaT, [fLo = f(1)], [fHi = f(end)]) % t is assumed to be monotonic. % % The average f(t) is computed in each bin by li...
bd7077e0ee3086ff88ef97caf2ce90a74b399392a979e891c672bbbd91af701c
MATLAB
4,148
127
function auxiliary_td() % Creates auxiliary plots for TD learning % --------------------------------------------------------------------- % Copyright (C) 2024 Simon R. Steinkamp % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public Lice...
bbb7a75e7503d6ad1dc4736df2648a4fe920b2ddd3490ec8f083ed7f8a74605d
MATLAB
4,150
96
% main_script.m %% Startup clear; clc; startup_SPERRFY; % path setting %% Load data main_import_processed_data; % import data (.mat) main_data_preparation; main_parameter_setting; %% Run main data analysis rng(1) mouseConnectomeDataAnalysis = ConnectomeAnalysisRunner(connectomeMatrix, geneExprLevels,crossInfo, .....
3bda33be60815ae9c9f04211bd8263addef8799679ea7a8316c6ab8228bd519b
MATLAB
4,159
120
%% PCA for weighted datasets, as adapted from Delchambre 2015. % % Delchambre, L. "Weighted Principal Component Analysis: A Weighted Covariance Eigendecomposition % Approach." Monthly Notices of the Royal Astronomical Society 446, no. 4 (February 1, 2015): % 3545–55. doi:10.1093/mnras/stu2219 % % Function d...
c1df03de4e4928e170ce66009e21777269c3ea989635e9dd7eb7b3d45122b9b8
MATLAB
4,160
78
function [all_predictions_read] = read_predictions(participant, path_saved_predictions) %% Prepare data for training. % Reads the predictions, of the bs_to_tap models, saved as h5 file, % for all files from one participant % % **Usage:** [all_predictions_read] = read_predictions(participant, path_saved_predictions) % %...
bc4139504059b04e18eeb89254bbf48a1da2d0da6c35cb4f0697b4f7c5e4c3e5
MATLAB
4,163
123
function [y,yy]=nt_zapline(x,fline,nremove,p,plotflag) %[y,yy]=nt_zapline(x,fline,nremove,p,plotflag) - remove power line artifact % % y: denoised data % yy: artifact % % x: data % fline: line frequency (normalized to sr) % nremove: number of components to remove [default: 1] % p: additional parameters: % p.nf...
67998878054d8911d128f0081889d4c10cf11bc3ba8a9c7e91438cb3e30d3953
MATLAB
4,168
93
%% demonstration.m %% Startup clear; clc; startup_SPERRFY; % path setting %% Data Preparation main_import_processed_data; % import processed data (.mat) main_data_preparation; % make basic objects for analysis %% % Figure 3a f3a = FigMaker.imageConnectionMatrix_MRColorLabels(connectomeMatrix,crossInfo); %% Paramet...
d9b27374b5f3f44c9cdbb98a0840789d787f78bdfba3dce41484768124136e18
MATLAB
4,170
134
%clear all; load([pwd '/init_data/var_combos.mat'],'var_combos','var_names'); load([pwd '/init_data/var_vectors.mat'],'var_vectors'); namesOfNeurons = {'TRN_PV','TRN_SOM',... 'TC_MGB','TC_HO'}; num_rows=4; num_col=1; numPerBlock = 1000; [lpp, ~] = size(var_combos); maxNumBlocks = ceil(lpp/numPer...
c4e41dca6828378f234dd71fc3d60996108400840c514e52e09e6ea4a633831b
MATLAB
4,171
134
%clear all; load([pwd '/init_data/var_combos.mat'],'var_combos','var_names'); load([pwd '/init_data/var_vectors.mat'],'var_vectors'); namesOfNeurons = {'TRN_PV','TRN_SOM',... 'TC_MGB','TC_HO'}; num_rows=4; num_col=1; numPerBlock = 1000; [lpp, ~] = size(var_combos); maxNumBlocks = ceil(lpp/numPer...
1fe9f7d6bd862ece4b3881e37057c19853d9b17d2db21581c8b001f9e4a86e21
MATLAB
4,177
124
function tileCoef = getSTTC(N1v, N2v, dtv, Time, spike_times_1, spike_times_2) %sttc calculates the spike timing tiling coefficient % Originally written in C by Cutts and Eglen % https://github.com/CCutts/Detecting_pairwise_correlations_in_spike_trains/blob/master/spike_time_tiling_coefficient.c % See their 2014 ...
882e5404306643b54d85e3737ef1047a8eef00efbdf6406faac0024e32c926fa
MATLAB
4,181
87
function [cfg, MuseStruct_new] = PET_add_interIED_epochs(cfg, MuseStruct_orig, markername, toi, include_startend_of_file) % Define periods between two successive markers MuseStruct_new = MuseStruct_orig; cfg.interIEDtrials_maxlength = ft_getopt(cfg, 'interIEDtrials_maxlength', Inf); for ipart = 1 : size(MuseStruct_or...
bd72c0012f8da3ec98fe984e94b0d326ef74782d5e07135cd3a77c83fb217da7
MATLAB
4,185
97
function [lh_rot, rh_rot] = CBIG_spin_test_rotation_surf(mesh, num_rotations, seed, sym_flag) % [lh_rot, rh_rot] = CBIG_spin_test_rotation_surf(mesh, num_rotations, seed) % % This function is used to compute the new vertex points of the left and right % hemisphere after rotation, relative to the original vertex points ...
0303d2a43b8203287444d6b7a8bd31fcb0f68fb9b9d2cac45c8be93afdc842c0
MATLAB
4,213
108
function [data] = CBIG_read_1header_from_Ncsv( csv_files, subject_header, subjects, data_header, data_type, delimiter ) % [data] = CBIG_read_1header_from_Ncsv( csv_files, subject_header, subjects, data_header, data_type, delimiter ) % % Given a header name and multiple CSV files, this function find which CSV % file t...
a3b02aa4db8a15cf2ca5e30970cdea60fa930b3be878a54fc7d90dc838c81c56
MATLAB
4,214
123
function Result = ini2struct(FileName) %========================================================================== % Author: Andriy Nych ( nych.andriy@gmail.com ) % Version: 733341.4155741782200 %========================================================================== % % INI = ini2struct(FileName) % % This...
694870b477f5e1ee4d83c26d19722eadd4208a6b303ef70851799515ce0f3881
MATLAB
4,217
145
function [B S stat] = GraphSC(X, W, num_bases, alpha, beta, num_iters, Binit, pars) % Graph regularized sparse coding algorithms % % minimize_B,S 0.5*||X - B*S||^2 + alpha*Tr(SLS') + beta*sum(abs(S(:))) % subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1) % % Notation: % X: data matrix, each column is...
e0a43ba01b56ed1aa2feb2165b1009ff6194e30deb0d9e11004a2a5f713c1e53
MATLAB
4,219
89
%% main script to detect onsets and split them based on rest/run and ctxt. Gergely Tarcsay, 2025. To run this properly, make sure that the main_path is set. %% input data: output of minian (.nc file containing spatial and temporal information for each unit); dlc processed position that contains miniscope frame timesta...
1c80a48389dd44f3a6946cb678dd10da3ee6a6d703ddbdfd41cb7de9712554e9
MATLAB
4,235
128
function outpict = imtile(inpict,tiling,varargin) % OUTPICT=IMTILE(INPICT,TILING,{OPTIONS}) % Take a 4D image stack and rearrange the individual frames % into a single-frame image using a rectangular tiling. % % MIMT imtile() creates a name conflict with IPT imtile(). I created MIMT imtile() % ...
daa492cc1f20ede623e3854973b79fc82ba66f520e91e230acddd54070379e32
MATLAB
4,237
111
function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatc(data,win,params) % Multi-taper cross-spectral matrix - another routine, allows for multiple trials and channels % Does not do confidence intervals. Also this routine always averages over trials - continuous process % % Usage: % % [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMat...
7be1cd794fd2b9fc34364879daa5816ae87eab96b126e6428a66c28ed2cd8014
MATLAB
4,242
115
function [DG_point,DG_accepted,DG_line_image,outer_points,inner_points,hilus_points]=trace_DG_outline(settings,images_all,composite_img,roi_names,roi_idx,roi_fname,magnification,roi_subfolder) %%% Trace DG outline - Version 4 %%% DG_accepted=0; % set(0, 'DefaultFigurePosition', settings.screen_pos); nuclear_image...
90f2634498b863620fd2c71aaf2766ee1b8b6886e65ad3c7687604418e011a4b
MATLAB
4,244
127
function bwMask = multiROI(figHandle, axHandle) % multiROI: Interactively specify 2D freehand ROI % % Overlays an imfreehand ROI on an image. % Gives the ability to tweak the ROI by adding and % subtracting regions as needed, while updating % the ROI boundaries as an overlay on the image. % Returns a logical matri...
768b5fd59fbdb5882d929b6a6941c13acf096fb38c3dd3672112bf39055d9366
MATLAB
4,246
80
function [isSignificant,adjusted_pvals,alpha]= bonferroni_holm(pvals,optional_alpha) %% bonferroni_holm, bonferroni_holm(pvals), bonferroni_holm(pvals, alpha); % Corrects for testing multiple hypotheses. % This method is more powerful, but less conservative than the Bonferroni method. % Fixed so that ad...
96e7bb7a044ad02d4692b59d71dfe5e0f67d8117b5760a83008b91422a8a9c33
MATLAB
4,267
156
function [outmask,varargout] = pickblob(inmask,points,varargin) % OUTMASK = PICKBLOB(INMASK,POINTS,{OPTIONS}) % [OUTMASK LIDX FIDX] = PICKBLOB(...) % Given a binarized image and one or more sets of points in the image, % return a mask describing the blobs which contain the points. % % INMASK is typically ...
3ac4eeb8c8e73769233cd1527dd2990b1e620c0dc70b77656f6d49518412dc39
MATLAB
4,273
131
% Written by Andrew Lin % This script processes multiple movies all with the same odor timing, % saves the activity maps, and calls the map-display function % 1. Read info on which files, bkgnd signal etc. from user-created text % file. % 2. Call activityMap to get map % 3. Save all the maps in an array % save to .mat...
6d9530e8759eeffa7a41ed258935015e6dfe054849d047f4165c7261b0ce78fa
MATLAB
4,276
140
function outpict = randspots(s,numspots,spotbounds,spotopacity,shape,fill) % RANDSPOTS(SIZE, NUMSPOTS, SPOTBOUNDS, SPOTOPACITY, SHAPE, {FILL}) % returns an image littered with spots of randomly selected % location, size, and opacity % % SIZE is a vector specifying the output image size % may be 2-...
df4acd61460a2f9494905c3091c2279c193bf3535217fac4e0d2cb142a8cf223
MATLAB
4,291
117
function [roi,roi_accepted,images_all,composite_img,roi_fname,settings]=rotate_roi(settings,angle_accepted,roi_names,images_all,composite_img,rectangle_roi_subfolder,roi_idx,idx,mouse_name) %%% Rotate ROI - Version 2 (MGG) %%% roi_accepted = 1; % set(0, 'DefaultFigurePosition', settings.screen_pos); if angle_ac...
5fbd7a0cbc259b87eaf20fcff17d8c93745aa7847810604a5b4326b12024e02f
MATLAB
4,295
125
function Result = ini2struct(FileName) %========================================================================== % Author: Andriy Nych ( nych.andriy@gmail.com ) % Version: 733341.4155741782200 %========================================================================== % % INI = ini2struct(FileName) % % This...
4edd1fdbf4135ef5cafc2ad17136541e0c056bdaa13456d5c986779dfbdb2a36
MATLAB
4,303
144
function [data_all] = ft_read_neuralynx_interp(fname) % FT_READ_NEURALYNX_INTERP reads a cell-array of NCS files and performs interpolation % and gap-filling of the timestamp axis to correct for potentially different offsets % across channels, and potential gaps within the recordings. All samples are being % read out....
693fb97d700b4dfdf79136285732e005a41f283124534d4916b995afa4a956b3
MATLAB
4,311
105
function [TFR] = doTFRcontinuous(cfg,MuseStruct,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 % ...
9dfa880a0fdfdbe156290f31b7f1ac1f37f0457a0993f76148d7b4f62528952f
MATLAB
4,327
118
function fMRI_epicorr_t1based_bfp(epi_filename, ref_filename, fmri,t1,config) % epi_filename: input epi file % ref_filename: reference epi volume that will be used for correction % fmri: fmri basename (BFP BIDS format) % t1: t1 basename (BrainSuite BIDS format) % config: see preprocessing config file from BFP...
93a5e361e3c051e72173bdb0d55305a3058395c1ace4efbfb0ace64f882d3573
MATLAB
4,328
162
function varargout = ft_pimpplot(hfig,cmap,pimp,set_printing_properties) %-------------------------------------------------------------------------- % FT_PIMPPLOT can pimp single channel time frequency representations and % topographical representations created by FieldTrip. Basically, it % replots the plots created by...
009c1694ec1af6f188c134569517cbbfa49a97a0fa96d7e0b8aa7f912d675d69
MATLAB
4,331
186
function outpict = jellyroll(inpict,varargin) % JELLYROLL(INPICT, {OPTIONS}) % Remap the columns of an image into a spiral with the same geometry as the source image. % % INPICT is an I/IA/RGB/RGBA image of any standard image class % OPTIONS include the following keys and key-value pairs % 'direction' spe...
423c28046778d0d56a14000707883498802c4dde4310ae314eebfed412c54d46
MATLAB
4,335
162
function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent) % function H=shadedErrorBar(x,y,errBar,lineProps,transparent) % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color is chosen automatically. % % Inputs % x - vector of x values [optional, can be left em...
da20e1005d87bb5bc9f42dfd429147874e782cfbdefd3f8448dad158f88392bf
MATLAB
4,338
125
function [coeff, cluster_data_avg, SN_data] = Reachr_transformation_AMR(data, varargin) %'Reachr_transformation' writen by Ergi Spiro; edited by AMR. Now takes in %typical data structure with added flash_type and trigtimes (see ....). %Only takes in one data structure compared to 'Reachr_transformation'. % argum...
ff43bc4840693a62ba737873364d879be2100996aaeb8ae738c25e20dfa6a25b
MATLAB
4,340
135
function [senseMaps, eigenValues] = PISCO_bart_loop(input, output, FFT_interpolation, Threads) %% Loading data addpath(fullfile(getenv('BART_TOOLBOX_PATH'), 'matlab')); kData_raw = double(readcfl(input)); kData = squeeze(kData_raw); % Remove singleton dimensions size(kData_raw) [N1, N2, Nc, Nz] = size(kData); % ...
3ca38b220774c2e5e555d90b9078da9a2575d0f9e9246b993f88874863c89aba
MATLAB
4,345
114
% 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 ...
7fc6b37fa35b2ef7b0e00fe2c6f5f5b01bda94cc988938fbb07dd9d5fa1f921c
MATLAB
4,378
155
warning('off','all') addpath /network/lustre/iss01/charpier/stephen.whitmarsh/WhitmarshEpilepsy datapath = '/network/lustre/iss01/epimicro/patients/raw'; outputdir = '/network/lustre/iss01/charpier/stephen.whitmarsh/data/qualitycheck'; % loop through patients clear patlist patdatlist prefix i = 1; dlist = dir2(fullfi...
4960f6916ff346f8e69c32fb4226e48d213e640f20a5cf3014e9aece9f134270
MATLAB
4,386
134
% =============================== % Fig 3D : Monthly variations in average water level and flow rate % + Table 2 statistics output (based on ALL monthly water levels) % =============================== clear; clc; close all; % =============================== % Load data % =============================== data...
f8137c7b16aaa0665ed7432c913d7122eb9bdc7a71692b01a556626f54dfc3e0
MATLAB
4,387
129
function FigureS1 config = pnh_setparams; macro{1} = {'_1pNs_1', '_1pNs_2', '_1pNs_3', '_1pNs_4', '_1pNs_5', '_1pNs_6', '_1pNs_7', '_1pNs_8'}; macro{2} = {'_Casd_1', '_Casd_2', '_Casd_3', '_Casd_4', '_Casd_5', '_Casd_6', '_Casd_7', '_Casd_8'}; macro{3} = {'_TNmi_1', '_TNmi_2', '_TNmi_3', '_TNmi_4', '_TNmi_5', '_TNmi...
5670854df818e262f89c86041759b6dce4f11543a6026dc2d0ef3b8e0c6f6a42
MATLAB
4,394
148
function outpict = imdetile(inpict,tiling,varargin) % OUTPICT=IMDETILE(INPICT,TILING,{OPTIONS}) % Take a single-frame image, subdivide it into tiles, and rearrange % into a 4D image stack. Conceptually, this is the reverse of an % image tiling process as would be performed with IMTILE. % % INPICT is a s...
71535949a4fbabb19622f7a1ff2794fb89aad4386e88758ab0233bde545d1032
MATLAB
4,394
120
function [md2D, markers, xcenterw, ycenterw] = mdprepare_single(w1data, azimuth, invert, trans, offx, offy, plotsize, walkersize, xcenter, ycenter,scramblespat, scrambletemp,fr) %DC hacked to allow scrambling (spatial and temporal) of the md walker data %[md2D, markers, xcenterw, ycenterw] = mdprepare_sin...
4a45614df65c61ac411df6880174bf2098e704e3f468fcc58852c656384cb632
MATLAB
4,395
182
function generate_eig_file(L1, L2, L3, V1, V2, V3, outputFileName) %GENERATE_EIG Generate .eig file. Eigenvalues (L1, L2, L3) & % Eigenvectors(V1, V2, V3) can be nii structures or .nii.gz or .nii files. % % outputFileName - file name with/without extension (with full path) % workdir = tempname(); mkdir(workd...
89b11d7f1333b9859876ba34f7ce7065847fea8380c5a8188bf63c8087704e7a
MATLAB
4,399
164
function I = mi_mixture_gd_vec(x, y, Ym) % MI_MIXTURE_GD_VEC Vectorized MI calculation between multiple Gaussian variables % and a common discrete variable in bits from Gaussian mixture. % I = mi_mixture_gd_vec(x,y,Ym) returns the MI between the (possibly multidimensional) % Gaussian variables x and the d...
6eb857e7ec7983ce4c97c5bb622bec76baa47c5aed02b42649d26a1dc636c15e
MATLAB
4,401
103
function slope = getSlopePC(result, pCorrect, unscaled) % function slope = getSlopePC(result, pCorrect, unscaled) % This function finds the slope of the psychometric function at a given % performance level in percent correct. % % result is a result struct from psignifit. % % pCorrect is the proportion correct where to ...
a6bab0e4d55949e2ce951b0542def92d2ac9562a310601e5450fb6dec002c114
MATLAB
4,414
144
function [I,rc] = line_plane_intersection(u, N, n, M, verbose) %% line_plane_intersection : function to compute the intersection point % between the (N,u) line and the (M,n) plane of the 3D space. % % Author & support : nicolas.douillet (at) free.fr, 2019-2020. % % % Syntax % % [I,rc] = line_plane_intersection(u, N, n,...
70fd72f223313a520b8ac3be6e2714c0444b3d0c4b130898af5d129b88d05bce
MATLAB
4,425
156
function plotWindowedData(cfg, MuseStruct, dat) ncols = 1; nrows = size(dat, 2); cm = cool(5); ipart = ft_getopt(cfg, 'ipart', 1); i = 1; clear bad_t1 bad_t2 for idir = 1 : size(MuseStruct, 2) for ibad = 1 : size(MuseStruct{idir}.markers.BAD__START__.clock, 2) bad_t1(i) = MuseStruct{idir}.mark...
928a2681518cf6994fb5202c164cda0e28c76764704bee75a60bca768c7395bd
MATLAB
4,429
106
%% wrapping function for vector remap analysis function [All, Cohort]= WrapVectorRemap(workdir, discrimination) All.CellComposition = zeros(length(workdir),4); % All.OrthogonalHDC = zeros(length(workdir),2); All.VectorRemap = []; All.SpatialRemap =[]; All.Curves = []; All.Length = []; All.Angle = []; All.Con...
ed9ace131f9001f09251593fd4b97dd820328ae4618d806b9d9f12d56434e7eb
MATLAB
4,430
112
function MuseStruct_concat = concatenateMuseMarkers(cfg, MuseStruct,force) % Concatenate markers over all the dirs fname_out = fullfile(cfg.datasavedir, sprintf('%sMuseStruct_concatenated.mat', cfg.prefix)); if exist(fname_out,'file') && force == false fprintf('Reading %s\n',fname_out); load(fname_out,'MuseSt...
6e72df4c2a94a53aaddaf2f4e5583504cfe43ff8dc289771e5c30ad06eca0a37
MATLAB
4,432
129
function Figure4 % settings cfg = pnh_setparams; nodulenr = [1, 4]; seizurenr = [1, nan, nan, 2]; % seizurenr = [1, nan, nan, 1]; channelnr = [1, nan, nan, 1]; ipart = 1; xlimits = [-1, 5]; % load data x = load("\\lexport\iss01.charpier\analyses\vn_pnh\data\pnh\2230-SpikeTrials_Timelocked...
14720016e5fe7cbfde332ecd48816b62be4d7ec5e295e65d320ff374a7827bde
MATLAB
4,438
99
%% this code investigates the effect of varrying network parameters % one at a time, PN-KC weights, KCs spiking thresholds and number of inputs % on the memory performance of model fruit-flies Drosophila % this simulation uses realistic odor responses recordings from % (Hallem-Carlson 2006) and transformed from ORN to ...
bcf3420a863ad19e8ab9f515d7d1fe9c21420a28fc5f99dd8ce1dc74e9d97e3d
MATLAB
4,442
105
function skeletons = normalizeSkeletonsFlpTagCalyxDivide(filenames, spacing) % Let's start with filenames as an cell array of strings specifying the .mat % files % calling function must supply the value of 'spacing' which is the node % spacing on the 'standardized' skeleton % The purpose of this function is normaliz...
27988fa05b67ea64ecabb230408ddb8b0f8e9d61d2cc6f55e696927ebe341b2b
MATLAB
4,452
109
function [csc_trials, stimulus_ids] = cpm_trials_to_csc(trials, n_timesteps, ... csc_idx, ... relevant_stimuli, ... reward_timestep, ... ...
31c9baace1bc26019facb32fc003e1c1e27e070d191ae928c00aaeb799ce5ffb
MATLAB
4,452
118
function dtx_eegrodents_cluster(ipatient, config_script) %% Set parameters 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\...
9efde431b754cb8dbd02a11ca018947e63e0b7d49fe0e5679c34b0919b8ebc43
MATLAB
4,458
136
function G = G_matrices_2D(kCal, N1, N2, 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 Nc block of calibration data, % where N1_cal and N2_cal are the dimensions of a % ...
bc04dbc086bedea60108285535ae7adb3443f14795f3ddf079f222518c198669
MATLAB
4,460
132
function RGBnew = uwredcomp(RGB,varargin) % OUTPICT = UWREDCOMP(INPICT,{OPTIONS}) % Adjust underwater photographs to compensate for wavelength-dependent light % attenuation and contrast loss due to diffusion effects. % % Roughly based on: % Underwater image enhancement based on red channel weighted compen...
c3be5c12af8a18fed3090101cf156b4ed3ae8fbaff3a4d92efc078858c742503
MATLAB
4,460
94
function [stPR, pop_coupling, pop_coupling_1sthalf, pop_coupling_2ndhalf] ... = get_stPR(spike_matrix, max_lag, animal_name, repeat_calc, save_data, output_folder) %% by Mattia 09.19 % compute stPR (spike-triggered population rate) and population coupling % as described in Okun et al., 2015 Nature. % inputs: % - ...
80e7e2671fc9790efecef5157e801c0b3aba920d122ea5f3ca879d27f204013a
MATLAB
4,465
106
% ------------------------------------------------------------------------------------------------- % (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...
547a7f38dfab5136da8525b53e41556df0f923264435a260ce2e69461ed7f18e
MATLAB
4,467
119
function [md2D, markers, xcenterw, ycenterw] = mdprepare_single(w1data, azimuth, invert, trans, offx, offy, plotsize, walkersize, xcenter, ycenter,scramblespat, scrambletemp,fr) %DC hacked to allow scrambling (spatial and temporal) of the md walker data %[md2D, markers, xcenterw, ycenterw] = mdprepare_sin...
67cc11176c04e7793b7fdf80bfb75649b872aefe26c59af68469cc77c812a9da
MATLAB
4,471
135
function outpict = imappmat(inpict,mat,varargin) % OUTPICT=IMAPPMAT(INPICT,MAT,{OUTOFFSET},{INOFFSET},{OUTCLASS}) % Apply a color transformation matrix to an image, similar to IPT imapplymatrix(). % % INPICT is an image array of any standard image class; 4D images are not supported. % MAT is a matrix of size C0...
b86a34c5d71ee07551ddc09be21a26ee24ea6de40f40c6e805a8b74ddc492d72
MATLAB
4,471
109
function BatchResults = Batch_InterictalDetection(filename,threshold,channel,toDenoise) % USAGE % % BatchResults = Batch_InterictalDetection(filename,threshold,channel,toDenoise) % % Main function for the interictal detection. Filter the signal, receive % the interictal peaks, group the peaks to detect an ev...
fa29214b218eb863b1751ec24de96bfd2cc3ef7fa06b42a185f7491ffd659b6d
MATLAB
4,491
168
function inpict = imlnclite(inpict,varargin) % IMLNCLITE(INPICT, {OPTIONS}) % Levels & Curves tool for images. This is a simplified version of IMLNC % for reduced memory requirements when operating on very large images. % Required parameters can be determined using STRETCHLIMFB or IMMODIFY, % ...
3a42e739845f43bf22d91b468a762e1dc66888c3d375d816e51debc8fff74098
MATLAB
4,506
113
function pnh_cluster(ipatient) %% Analysis script for Valerio Frazzini's study on electrophysiology of pathoanatomy % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % % requires bandpassFilter.m from Mario % requires releaseDec2015 from Neuralynx website %% Add path restoredefaultpath %% Stephen's paths if i...
9af02f347c4382ce9dc8f93b6bc4d75b4daf6e252886c7b166273651f8dc8849
MATLAB
4,511
121
function wideTable = tableLong2wide(longTable, factorColumns, valueColumn, idColumn, newVarPrefix) %% Convert a long-format table to wide format with multiple factors. % If 1st argument is a file path, the table is imported from there. % % INPUTS: % longTable - Input table in long format, or file path to such t...
80421ac29e83406151c65891802ebd3cade437cdc89368febb11bcb573326579
MATLAB
4,521
116
function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatpb(data,win,params) % % % Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels % Does not do confidence intervals. % Also this routine always averages over trials - binned point process % % Usage: % % [Sc,Cmat,Ctot,Cvec,C...
4645fc7ee99c4f08b86c1d480d72e978c44b919fb014eff0c18af9f0d18c805a
MATLAB
4,529
98
function wod_concatenateLFP(slurm_task_id) % code copied from writespykingcircus.m % Must used a modified version of ft_writedata to give the good channel % name to Muse. On added line, which is commented with %Paul. if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\wod\EpiCode\shared')) addpath (gen...
2d92e1df0c2e97c3fa0e4c11b0a25a10a9c3da373e86a07ea0bba4d4b66c022a
MATLAB
4,531
107
% 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={'sn8133','sn4055','tr4277','sn7915','sn5895','sn7602',...
334bedf3d05f23d67040fd9fe9bd0705e4e049e7d8d2eaa78a0ee52553279350
MATLAB
4,531
101
function plotOverviewPreictal(config, MuseStruct, SpikeTrials_windowed, SpikeStats_windowed) % threshold artefacted based on total time artefacted per window for ipart = 1 : size(config.directorylist, 2) for iunit = 1 : size(SpikeStats_windowed{ipart}.window, 2) SpikeStats_windowed{ipart}.window{iunit...
0a9362c5c78b4d0de671b04ac7389387bb19d94eaf972339801ac269b5ee3d29
MATLAB
4,544
117
%% DEMO_001 basic useage % The Psignifit 101 %% save data in right format % First we need the data in the format (x | nCorrect | total) % As an example we use the following dataset from a 2AFC experiment with 90 % trials at each stimulus level. This dataset comes from a simple signal % detection experiment. data = ...
2571333fe8669ec4c1f8f36762c9f3e5baa45f025a7e74288629348a849be458
MATLAB
4,547
159
function outpict = padarrayFB(inpict,padsize,varargin) % OUTPICT=PADARRAYFB(INPICT,PADSIZE,{OPTIONS}) % Pad the edges of an array (ostensibly an image) with zeros or other content as % specified by the available options. % % This is a passthrough to the IPT function padarray(), with an internal % fallback i...
78277c0d59b2db9d269043ad6b20f2f40d324f4cf2ac66847db0fb64880b4235
MATLAB
4,562
114
function next = morse_unfold_unaccelerated(input, PPIparams) %% %************************************************************************** % % morse_unfold_unaccelerated computes sensitivities using MORSE and compute SENSE-1 % recon via S^H * data % input "data" contains: % a global header in ...
e03d961fb176b34bee1187120f917f3329421a391a863cc5a235018d4cf8b53e
MATLAB
4,568
118
function [newPhi, newVarBound] = ... CBIG_AuthorTopic_ComputeVariationalTerm__N_t(params, newPhi, ... newVarBound, varBoundFlag) % [newPhi, newVarBound] = ... % CBIG_AuthorTopic_ComputeVariationalTerm__N_t(params, newPhi, ... % newVarBound, varBoundFlag) % % Compute the expectation and variance of the count N_{.t.....
e3e9a117ef7c4638d95163a7bd0a5f6fcef7c904da000722a7f465370972050d
MATLAB
4,572
107
function metadata = createMinimalOMEXMLMetadata(I, varargin) % CREATEMINIMALOMEXMLMETADATA Create an OME-XML metadata object from an input matrix % % createMinimalOMEXMLMetadata(I) creates an OME-XML metadata object from % an input 5-D array. Minimal metadata information is stored such as the % pixels dimensio...
9412d57dc2664fc97e1bd522759bcfa3145978d622f239a435ac61b81488cedc
MATLAB
4,574
127
function outpict = tonecmyk(inpict,Tc,Tm,Ty,Tk,Tsat,enforcement,presetmode) % OUTPICT = TONECMYK(INPICT,TC,TM,TY,TK,TSAT,RANGETYPE,{PRESETMODE}) % Adjust image tone by adjusting CMYK components relative to the % CMYK and saturation distribution in an image. % % This is based on Iain Fergusson's GMIC tools. % https...
84d80f34e2bd99c94e52370a93dda1d79041369329cc2e96d739f56e11c6edff
MATLAB
4,580
104
function [EEG, simple,ep_blind_bs,ep_blind_model] = decision_tree_alignment(EEG, BS,create_diagnostic_plot, participant_selection) %% Decides when to choose the model based alignment, BS based alignment, or old alignment % % **Usage:** [EEG simple] = decision_tree_alignment(EEG, BS, create_diagnostic_plot) % % % Input(...
a81ab6bd2651f70c78ffdb6cf2140c0a20f27de8bda9d3db7e5f03676e4b1339
MATLAB
4,588
120
% 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 % modify it...
6735d6f0b78fd0fbc7a254138be8e6e14b2121ffc90ef17338315fd82b59864c
MATLAB
4,595
111
function out = Pyramid_astro_exp_decay out{1} = @init; out{2} = @fun_eval; out{3} = []; out{4} = []; out{5} = []; out{6} = []; out{7} = []; out{8} = []; out{9} = []; out{10}= @Ia; out{11}= @Ie; % -------------------------------------------------------------------------- function dydt = fun_eval(t,kmrgd,par_Is,par_Id,p...
dd2b0d236bf1dd6e4fd94847c57068a05073a2393cb2c40704594193243e0f79
MATLAB
4,596
181
function addaxis(varargin) %ADDAXIS adds an axis to the current plot % you can add as many axes as you want. % % usage: % use it just like plot, except, you need to specify the abscissa % and the third input argument should be the axis limits, if at all. % % example: % % x = 0:.1:4*pi; % plot(x,sin(x...
1ffc1cb38cd31d154eb718eebbe346ae3b16476f476fab2fc2971ea8cbb96dcf
MATLAB
4,604
139
function [A B] = matchchannels(A,B,varargin) % [A B] = MATCHCHANNELS(A,B,{MODE}) % Force correspondence between the channel arrangements of color tuples or images. % One use may be when a color needs to be specified for use in an image. MATCHCHANNELS % performs expansion or reduction as required for both i...
f1b4b82d6b3550080cdf2930cfb41b2c907bf373c5a506a9cea8d42a7ecf8b7e
MATLAB
4,605
151
function outpict = imrotateFB(inpict,angle,varargin) % OUTPICT=IMROTATEFB(INPICT,ANGLE,{METHOD},{BOUNDARY}) % Rotate an image array. % % This is a passthrough to the IPT function imrotate(), with an internal % fallback implementation to help remove the dependency of MIMT tools on the % Image Processing Tool...
f679f1fc1201ed9dad0caf4c783b0d1d4d2628ed699293d3004d0332de852e86
MATLAB
4,607
101
% With the same functionality as cvpartition, but fully customizable classdef CustomCVPartition properties (GetAccess = public, SetAccess = public) %TYPE Validation partition type. % The Type property is a string with value 'kfold', 'holdout', % 'leaveout' or 'resubstitution'. It indicat...
8988ce9654b72b4d51f596841b53e4c6f4ca6fdb3df5d4858a1e6330edc992cf
MATLAB
4,620
104
function [config, MuseStruct] = addSlidingWindows(config, MuseStruct) % [config, MuseStruct] = addSlidingWindows(config, MuseStruct) % Add a "window" field to the config and MuseStruct, allowing sliding % time-window analyses for both LFP, TFR, FFT and spike data. % % ### Necessary input: % cfg.prefix = pre...
2ca441ee6caebda2803c7158fe7c716a68f0dc3cbba1429d9096c360ffcb4bba
MATLAB
4,633
172
function outpict = roiflip(inpict,mask,dim,varargin) % ROIFLIP(INPICT, MASK, DIM, {CONTINUITY}) % returns a copy of the input image wherein all pixels % selected by the mask are flipped along a specified dimension. % % INPICT is an I/RGB image of any standard image class % MASK is an I/RGB logi...
2efc3544fa03d7c555e93457256554c941436d4b463a0d70e5ddba2a7e6103ef
MATLAB
4,636
151
function [Amatrix,Binvector,Unit_order,As_order]=assembly_assignment_matrix(As_across_bins,nneu,BinSizes,display) % Display the Assembly assignment matrix. % USAGE: [Amatrix,Binvector,Unit_order]=assembly_assignment_matrix(As_across_bins,nneu,BinSizes,display) % % ARGUMENTS: % As_across_bins - structure containing a...
6e64cac4e5cba7490669784cd1b2097686c18b87176c8ba9bbaa19c7f862dafd
MATLAB
4,641
122
%% Analysis script for Valerio Frazzini's study on electrophysiology of pathoanatomy % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % % requires bandpassFilter.m from Mario % requires releaseDec2015 from Neuralynx website %% Initialization if isunix addpath /network/lustre/iss01/charpier/analyses/stephen....
982a770bcc2f88b52f39a75fdfae8c44cfe57e8aa3ec46f33a21f5e788c9268c
MATLAB
4,645
173
function [u, u_hat, omega] = VMD(signal, alpha, tau, K, DC, init, tol) % Variational Mode Decomposition % Authors: Konstantin Dragomiretskiy and Dominique Zosso % zosso@math.ucla.edu --- http://www.math.ucla.edu/~zosso % Initial release 2013-12-12 (c) 2013 % % Input and Parameters: % --------------------- % signal - t...
3bc2405dc886fdf9f204a6212d969166c44fcd652e70047ec64611e33e459744
MATLAB
4,665
120
% MVNRNDSMOOTHRESAMPLE Generate a n-by-d-by-nSamples matrix R of random numbers sampled from a % data distribution D of size n-by-d, preserving the column mean and % covariance structure D^T D. % % Inputs % ======== % D : n-by-d matrix to rand...
d50caa83bae8a1f64ce372630b2ca4fe2300b3c03db8a7e73be58b680970dd2a
MATLAB
4,667
115
function [cell_numbers, cell_type, cell_type_number] = get_cell_indices(datarun, cell_specification) % get_cell_indices get cell numbers matching to the cell specification % % usage: [cell_numbers, cell_type, cell_type_number ] = get_cell_indices( datarun, cell_specification ) % % arguments: datarun - datarun...
d102bc83a7d0b8de68b1fc18cd1584ef4bfceb26b63cf0881d339858c374951d
MATLAB
4,668
143
function [idx,score_vector,score]=nt_split(x,depth,thresh,guard,minstep) %[idx,score_vector,score]=nt_split(x,depth,thresh,guard,minstep) - split time series into intervals % % idx: index at which to split % score: proportion variance reduced % score_vector: score as a function of split position % % % x: data (ti...