sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
26944297a6fd25c0dd4fb6862f0aba6bace947bfbf76aaf383b873184bb1f2fb
MATLAB
6,172
202
function [vol_reslice, nii] = myreslice_nii_match_res(vol, method, X_grid, Y_grid, Z_grid, fileOut, gz) % Similar to myreslice_nii.m but it matches the resolution of vol to target resolution before % interpolation. It is useful in case of downsampling (can not really match resolution while % upsampling). vol must be 3D...
9b4e8d0574a42d6e03ec12797cc2c1d5efd18fea926d1e9667088b8a7ec6eab8
MATLAB
6,178
151
function plot_spike_trial_example(cfg, spiketrials, waveformstats, ipart, markername, itrial, toi) % Use as : % plot_spike_trial_example(cfg, spiketrials, waveformstats, ipart, markername, itrial, maxsize) % % plot_spike_trial_example plots, for one trial, the raw LFP, the LFP % high-pass filtered, and the LFP...
0c705e216abdee31d62299ddd5e02d4aa262a58099cd433a5ae5009f17df1075
MATLAB
6,184
230
% Connecting parallel pool c = parcluster; parpool(c, 14); %Simulation//Run variables namesOfNeurons = {'TRN_PV','TRN_SOM',... 'TC_MGB','TC_HO'}; load('s_init.mat','s_init') s0 = s_init; per_neuron = 20; startTime = 0; endTime = 1000; tspan = [startTime endTime]; tmax = abs(endTime - startTime...
a70f6167de2a1e4362b1034e549ce1bd1e2cce450ee361b04bdc349fc6805e7c
MATLAB
6,202
203
clear close PATH = './../Systems/Pyramid_astro/transients/'; % FIG. 4 fileName = 'theta_gamma'; tlims = [0 5.5]; tticks = 0:0.5:5.5; clims1 = [0,75]; cticks1 = 0:15:75; ctickslabels1 = {'0','15','30','45','60','75+'}; clims2 = [0,1000]; cticks2 = 0:250:1000; ctickslabels2 = {'0','250','500','750','1000+'}; flims = [0...
d80177ce7d94330548b6199acc10d05e6ae77d6dc146bf1cee91febb77f83696
MATLAB
6,203
203
function [vol_reslice, nii] = myreslice_nii_match_res(vol, method, X_grid, Y_grid, Z_grid, fileOut, gz) % Similar to myreslice_nii.m but it matches the resolution of vol to target resolution before % interpolation. It is useful in case of downsampling (can not really match resolution while % upsampling). vol must be 3D...
3e5e15c571d8ee8e26f3fd99364e7f40c3be7cf4f0ecd03888d978c939e056dd
MATLAB
6,204
172
function [roi,roi_accepted,dcx_image_roi,nuclear_image_roi,roi_fname,settings]=finding_roi(settings,roi_accepted,angle_accepted,roi_names,nuclear_image,dcx_image,rectangle_roi_subfolder,magnification,roi_size,roi_idx,idx,rois_x,rois_y,mouse_name,nuclear_colormap,dcx_colormap) %%% Rotate ROI - Version 4 %%% set(0, '...
00c52a5dde4a310bfb75ab733319ed811c6be62f383a48c087c3e0b1b4e705b4
MATLAB
6,206
179
function outpict = tonepreset(inpict,tone,amount,presetenf) % OUTPICT = TONEPRESET(INPICT,TONE,{AMOUNT},{RANGETYPE}) % Apply a selected tone adjustment preset to an image. % % This is based on Iain Fergusson's GMIC tools. % https://github.com/dtschump/gmic-community/blob/master/include/iain_fergusson.gmic % % INPI...
08e9eb2c4dacea71445822045f472aa0049769d670b62ba39fdd957d252ffc08
MATLAB
6,215
89
function im2ods(inpict,archive,pixelsize,imwidth,palsize) % IM2ODS(INPICT, OUTPATH, PIXELSIZE, IMWIDTH, {PALSIZE}) % create an ODS spreadsheet (open office/libre office) % using colored cells to replicate an image % % INPICT is a color image % OUTPATH is the name of the output .ods file % PIXELSIZE ...
29995958e8b53a2b60f8cbd3fcf09bcc615e2f58775ca67d36d067010071be12
MATLAB
6,226
135
function preictal_project_LC restoredefaultpath if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\shared')) addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\external')) addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scrip...
cab7d40bd351400ab23aa1ad6bc0a12b6133ef969ecc3a541dc3ab392774a2d0
MATLAB
6,230
155
%% load experiment info and set a few variables for analysis clear % load experiments and generic stuff experiments = 'your function to load experiments'; repeatCalc = 0; save_data = 1; % folders where you saved various results folder4osc = 'your_folder_here'; folder4PSD = 'your_folder_here'; folder4STTC = 'your_fol...
4061168c810e33b406dd1f81fab4ee1453027a65b4116322bc0c260e34aacc02
MATLAB
6,269
151
function [trial, answer, anstime] = RunOneTrial(trial, data, iti, trans, fc, ... datatypes, nwd, window, colour, prompt, xcenter, ycenter, mmultiply, nd, dotsize, leng, test) % Usage: trial = runOneTrial_single(trial, data, iti, trans, fc, fname, % datatypes, nwd, window, colour, prompt, xcenter, ycenter) ...
1642d812f446ee24b4a5de9b9146ded223a43178963cbb22a68677fa710b9d53
MATLAB
6,276
128
function [SpikeTrials] = readSpikeTrials_welch(cfg, MuseStruct, SpikeRaw, force) % [SpikeTrials] = readSpikeTrials_MuseMarkers(cfg, MuseStruct, SpikeRaw, force) % Make a Fieldtrip spike trials structure based on equal overlapping % windows. % % ### Necessary input: % cfg.prefix = prefix to output files % cf...
c12122a6c4b4d81b5fbc545bf838ca72e3fb486949885066c302658bc6fb2989
MATLAB
6,285
201
%% Embedding extraction (sub 9) clc,clear all;close all; embed_folder = ['..\data\EEG\']; ls = dir([embed_folder,'ds*mat']); % Focus on first 30 minutes fs = 100; t_start = 1*fs; t_end = 1800*fs; t = linspace(t_start,t_end,(t_end - t_start + 1)) / fs; % Wavelet parameter wavelet_name = 'cmor1-1.5'; central_freq = cen...
8db1eec464b0c593f54c0577b51a5b2a03e90e93d620fff3d0c34d4298b5994d
MATLAB
6,296
199
function inpict = roifilter(inpict,mk,F,varargin) % OUTPICT = ROIFILTER(INPICT,MASK,F,{OPTIONS}) % Restrict the application of a filter or other function to a region specified % by a mask. This is similar to IPT roifilt2(), but more flexible, useful, and % often faster. The basic concept is to extract and...
4774f1c6d12dfd2848a912df98e4175de0edc3ab6bea412d04611c981c248621
MATLAB
6,330
226
function [nii_in, reorient_matrix, sform_new, bMatrice_new] = reorient_nifti_sform(nifti_file, output_file, bmatrices) % Reorients data matrix by applying all orthogonal rotation (& flipping) component of sform % matrix (S). It tries to get modified sform matrix (Sn) as close as possible to identity % matrix (before sc...
9a30e8adfab27cc4ba6d1b95bd3eb976931870ee37069a02d5335c4ce0032adb
MATLAB
6,335
133
classdef ConnectomeAnalysisRunner % ConnectomeAnalysisRunner % Executes full and holdout analyses for a given connectome and shared data. properties Factory AnalysisDataFactory PairGenerationOptions PairDataGenerationOptions ReconstructionOptions ReconstructionParameters Hol...
271c9e76bc98b69ce434b7607b22f8e0711a6dc728f5402dfe3399c4c307862e
MATLAB
6,358
163
function bfsave(varargin) % BFSAVE Save a 5D matrix into an OME-TIFF using Bio-Formats library % % bfsave(I, outputPath) writes the input 5D matrix into a new file % specified by outputPath. % % bfsave(I, outputPath, dimensionOrder) specifies the dimension order of % the input matrix. This value will be ign...
de7467c624984f78792079f9bda2a9467039f4734df540c117da807c4af17a44
MATLAB
6,373
232
% Save NIFTI or ANALYZE dataset that is loaded by "load_untouch_nii.m". % The output image format and file extension will be the same as the % input one (NIFTI.nii, NIFTI.img or ANALYZE.img). Therefore, any file % extension that you specified will be ignored. % % Usage: save_untouch_nii(nii, filename) % % ...
9cd3a55d27533c091ad6f96d91f15b738f0a8d5e4740295c1c1d7f7ff31ddbf1
MATLAB
6,381
149
function X = preprocessData(X, varargin) % X = preprocessData(X, varargin) % % Function to pre-process calcium imaging data. Current order of % operations: % - Filtering % - Averaging (temporal) % - Centering % - Normalization % % 2019 - Adam Charles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
0c3b3f68e44d6094223de88b49e1274d9d7c0c8778f7909ffa4c26b29322bac7
MATLAB
6,399
173
function plot_patterns_multilevel(cfg) % set LFP config to read requested patterns LFP = readLFP(cfg); TFR = TFRtrials(cfg); SpikeTrials_timelocked = readSpikeTrials_MuseMarkers(cfg); SpikeDensity_timelocked = spikeTrialDensity(cfg); cfg_TFR = []; cfg_TFR.chann...
333d94abd4c559d07dd1eb4078641b439d607145c26575030876c6b69cc908a9
MATLAB
6,401
144
function [C,phi,S12,S1,S2,t,f,confC,phistd,Cerr]=cohgramc(data1,data2,movingwin,params) % Multi-taper time-frequency coherence,cross-spectrum and individual spectra - continuous processes % % Usage: % % [C,phi,S12,S1,S2,t,f,confC,phistd,Cerr]=cohgramc(data1,data2,movingwin,params) % Input: % Note units have to be cons...
4e50581fff7476fc6328fc7cda7ca092db9250c539084104bf8b7ee35c75bc2b
MATLAB
6,414
210
function [assembly_activity]=Assembly_activity_function(As_across_bins, assembly, spM, BinSizes, lagChoice, act_count) % This function returns assembly activity. Two option have to be chosen: % % ARGUMENTS: % As_across_bins := structure containing assembly information output of ASSEMBLIES_ACROSS_BINS; % assemb...
1b8327ff7c7966e8b50b1515f39692e0b76ab575f0fbf20cda4736e77136a281
MATLAB
6,426
165
function [OPS_object_data] = Square_object_detection_OPS(OPS_object_data,save_path,position_analysis,frame,Files,idx,ind_mouse,phase) % [OPS_object_data] = Square_object_detection_OPS(OPS_object_data,save_path,position_analysis,frame,Files,idx,ind_mouse,phase) % Detect square objects in OPS videos % % inputs: % OP...
aad4602b61ed10ed54952283a591e8c3549ebb79b7b0ccc01bfbf4d32b3309b5
MATLAB
6,434
150
function MBmodel = optimiseMBparams_homeostaticInhibition(MBmodel, PNactivity) % optimising the "green model" sigmoid_factor = -1.11; Sigmoid_derivative = @(x) exp(-x./sigmoid_factor)./((1.+exp(-x./sigmoid_factor)).^2) ; Sigmoid = @(x) 1./(1.+exp(-x./sigmoid_factor)) ; tic % separate optimisation from model crea...
a297f016e1204d5cb58289625791e91c1d32fdc6d39d7e76e4d27e5a283801bb
MATLAB
6,438
229
function plotPrior(res) % this function creates the plot illustrating the priors on the different % parameters % % this is meant to be a 3 column, 2 rows multipanel plot. % parameters lineW = 2; lineC = [0,105/255,170/255]; markerSize = 30; data = res.data; % get correct stimulus range if numel(res.options.stim...
269d6a6a1681a93182bf6d6601584d40951dbb9260282da75a985b3e18e87cc4
MATLAB
6,439
249
function outpict = siftpixels(A,varargin) % OUTPICT = SIFTPIXELS(INPICT,{GRAVITY}) % Migrate non-NaN elements of an image in a specified direction. % Like sifting grains of sand, non-NaN image content is consolidated % and separated from NaN elements. % % INPICT is an image of floating-point class. Multic...
85008b3bf593040d2329568f68e99930b9bfd00f538ee7c2e393bcee577f2f5a
MATLAB
6,442
191
function [subdata_str_cell, subdata_num, headers, alldata_str] = CBIG_parse_delimited_txtfile(filename, fieldname_str_cell, fieldname_num_cell,filter_fieldname, filter_val_str_cell, delimiter) % [subdata_str_cell, subdata_num, headers, alldata_str] = CBIG_parse_delimited_txtfile(filename, fieldname_str_cell, fieldname...
b918e4e9a3f29fde22ca1bfd0ccf49d169a714a9b9d10df70450699d1015da49
MATLAB
6,446
155
classdef OverallAnalysisGroup % OverallAnalysisGroup % Manages the main full-data analysis and associated holdout analyses. properties FullAnalysisModel (1,1) PairDataCCAAnalysisModel % PairDataCCAAnalysisModel or equivalent HoldoutUnits (:,1) HoldoutAnalysisUnit % Arra...
f98c61dfb86c77fcaebecf8bcd0bf904c16f98570ef41cf7b34bd0574fab5a6f
MATLAB
6,452
180
function [outpict outtuple] = autowb(inpict,option) % OUTPICT = AUTOWB(INPICT,{GRAYVAL}) % OUTPICT = AUTOWB(INPICT,{GRAYMASK}) % [OUTPICT GRAYVALOUT] = AUTOWB(INPICT,...) % Simple automatic white balance for photos. Uses a constrained gray world assumption. % Transformations are performed in LAB with chroma c...
0d0fac7dd35561fb6b465477edce71933896d8ba6144e096f4c9f805a8669096
MATLAB
6,462
119
function [MuseStruct_new] = editMuseMarkers(cfg, MuseStruct_orig) % EDITMUSEMARKERS adds, removes or renames markers in each MuseMarker structure % % Usage: Use readMuseMarkers to obtain MuseStruct, and writeMuseMarkers to % write new MuseStruct to Muse event files. % % Optional fields: % % cfg.editmarkerfile.tore...
2b8aace56e1af506d3c6c0025e46cc90e98935331ce2e85d9aa6575931ab68f4
MATLAB
6,466
161
function [ S, f, Serr ]= mtspectrumc_unequal_length_trials( data, movingwin, params, sMarkers ) % This routine computes the multi-taper spectrum for a given set of unequal length segments. It is % based on modifications to the Chronux routines. The segments are continuously structured in the % data matrix, with the s...
05b9e15c09f88fc4489eebc2673f60d6f7e5f0d0c1c388841a6861171c85ef8c
MATLAB
6,467
160
function [img_n] = filter_image_SAP(img, fname, biom_folder, biom_set_folder, biom, kernel, colormap_biom, normalise_img, normalise_brightness); % %% biomarker info % [pixel_thresh,min_size,max_size,do_watershed,correct_brightness, kernel, colormap_biom] = get_biomarker_info(biom); %% close figs close_figs = 0; ...
81d9ebd6362c112791cf84a5a5a2ccf09dcd6cbb3041d474d80f8ce30cc4a4c9
MATLAB
6,480
138
function [conf_Intervals, confRegion]=getConfRegion(result) % get confidence intervals and region for parameters % function [conf_Intervals, confRegion]=getConfRegion(result) % This function returns the conf_intervals for all parameters and a % confidence region on the whole parameter space. % % Useage % pass the resul...
034da31e93fd1f21794a08381e68dcd3704e159531db18c55a8ff9b91cb2ee7c
MATLAB
6,494
144
function [SpikeRaw, SpikeTrials] = readSpykingCircus_phy(cfg,MuseStruct,force) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [SpikeRaw, SpikeTrials] = readSpykingCircus(cfg,MuseStruct,force) % Read results from Spyking-Circus analysis; spike-times and templates. % % % Necessary input:...
7397e0a2c9d9651435336a3e8543a4845e278df15bda59a24161b0d13c049662
MATLAB
6,495
182
function U = cpm_precompute(model, grid, fixedparams, data, precomp_file, overwrite) % cpm_precompute Summary of this function goes here % INPUTS: % -model: name computational model of interest. The user would % implement this function. See cpm_grid_template for details. % ...
439e9fda2d78e3a48dfb6b761d692f03c3379897f517c2415f21b1867f62dd09
MATLAB
6,517
227
function outpict = lch2rgb(inpict,varargin) % LCH2RGB(INPICT, {MODE}, {LIMIT}, {NOGC}, {WP}) % Convert a LCH/YCH image to sRGB. LCH variant may be CIELUV, CIELAB, SRLAB2, or OKLAB % % INPICT is a single LCH image (of known type) % MODE is either 'luv' (default), 'lab', 'srlab', 'oklab', or 'YPbPr' % ...
67eb2e57acee6e68b66c85d6999200f49af4bf84f7161cd4c13e17d966a26c3c
MATLAB
6,553
160
%% plot all data if ~isfolder(cfgcommon.imagesavedir) fprintf('Creating directory %s\n', cfgcommon.imagesavedir); mkdir(cfgcommon.imagesavedir) end analysis_names = {'Timefreq_WOD', 'Timefreq_WOD_timenorm', 'Timefreq_recovery'}; data = {timefreq_wod_grandavg, timefreq_wod_...
c8cf9528447c3b7d6cf7091aa142b2ce4f875021c6da2fab3236c27b785adf72
MATLAB
6,560
152
%% function [Best_Cost,Best_X,Convergence_curve]=INFO(nP,MaxIt,lb,ub,dim,fobj) %% Initialization Cost=zeros(nP,1); M=zeros(nP,1); X=initialization(nP,dim,ub,lb); for i=1:nP Cost(i) = fobj(X(i,:)); M(i)=Cost(i); end ...
689c9f435f8e7a1bb7e8cd50bd06262d8057fc07a7976fc1d802d135895f3e8e
MATLAB
6,564
174
%WAVE_SIGNIF Significance testing for the 1D Wavelet transform WAVELET % % [SIGNIF,FFT_THEOR] = ... % wave_signif(Y,DT,SCALE,SIGTEST,LAG1,SIGLVL,DOF,MOTHER,PARAM) % % INPUTS: % % Y = the time series, or, the VARIANCE of the time series. % (If this is a single number, it is assumed to be the variance.....
752ddd2ce1684d2c307dc05f99e435c2d4122b29b01c92e7ad8576be2ad29d62
MATLAB
6,568
139
function [TCA2B, TCB2A] = fastTC(spike_matrix, lags) %% by Mattia % this version is like the cumulative one (not single bins) but does not % need "sequential" values for lags, you don't give maxlag, but rather a % series of lags % inputs: % spike_matrix: units * time % lags: single lags at which you want the coeff t...
30aba500984a389639d642430ca767c342a5a7c758c0ae48628c544b5ba2c1f7
MATLAB
6,569
167
function [antibody_density] = get_antibody_density(settings,pixel_size,roi_subfolder,roi_fname,images_all,pgon_GCL,pgon_hilus,DG_Hilus_line) %% Set thresholds % DCX DCX_IHC_thr = 0.8; % IHC DCX_IF_thr = 2.4; % IF % BrdU BrdU_IF_thr = 10; % IF % NeuN NeuN_IF_thr = 4; % IF %% % Create subfolder to s...
0a9f8e681aaf5dfdeac3605a3a8b9cf4a832efe868466bfaea0f91bd3a800fd5
MATLAB
6,575
130
function [lh_proj_data, rh_proj_data] = CBIG_ProjectMNI2fsaverage2(data, average, interp_type, lh_index_mat, rh_index_mat) % Usage: [lh_proj_data, rh_proj_data] = CBIG_ProjectMNI2fsaverage2(data, average, interp_type, lh_index_mat, rh_index_mat) % % Warning! This function is obsolete. Please use CBIG_ProjectMNI2fsaver...
27d3be175106abe1bae953755c721c2bbf9b1fa943428cf67d92d6b69c2f8be3
MATLAB
6,576
170
function plotPatterns(config, MuseStruct) % remove empty structs MuseStruct = MuseStruct(~cellfun('isempty',MuseStruct)); MuseStruct_append = []; %rmfield(MuseStruct{1},'filenames'); MuseStruct_append.markers = []; % adding next directories for idir = 1 : size(MuseStruct,2) fprintf('Working on directory %d of %d\...
af4a7fbb5d59309ff8920247db331d342e6739c5a5351d7bbce82ebf3003fbd7
MATLAB
6,579
127
function [dat, dat_hyp, trialinfo] = Trials2GrandAverage(cfg, force) fname_out = fullfile(cfg{1}.datasavedir, 'Trials2GrandAverage.mat'); if exist(fname_out,'file') && force == false fprintf('Loading results spikeTrialStats_GrandAverage\n'); % repeat to deal with load errors count = 0; err_count ...
eff621b5dd006654686cf1ea66bdac992abdc92fb9884bf030df7f2f549f8f65
MATLAB
6,589
270
function [W] = mc_undist_loop_wouter_fast(V) nx=V.nx; ny=V.ny; tim1=V.im1'; tim2=V.im2'; mask_V2 = tim1; mask_V2(V.tmask' <= 0) = NaN; b00_best=0; b01_best=0; b02_best=0; b10_best=0; b11_best=0; b20_best=0; X = (1:nx)' * ones(1,ny); cost_best = +inf; adjustX_lin = (((1:nx)'-(nx+1)/2)/((nx+1)/2)) * ones(1,ny)...
0d849d556e4e1d63aa8688de2102542a4e1311c3a3ea03b370dc0e40012cdc36
MATLAB
6,599
194
function [y] = spm_int_sparse(P, M, U) % integrates a MIMO bilinear system dx/dt = f(x,u) = A*x + B*x*u + Cu + D; % FORMAT [y] = spm_int(P,M,U) % P - model parameters % M - model structure % M.delays - sampling delays (s); a vector with a delay for each output % % U - input structure...
69d83cc73d2b797fc98a4437c1e4208149c2ea37b5c2b7179fc61fea5bfc1863
MATLAB
6,605
177
function ArgStruct=parseArgs(args,ArgStruct,varargin) % Helper function for parsing varargin. % % % ArgStruct=parseArgs(varargin,ArgStruct[,FlagtypeParams[,Aliases]]) % % * ArgStruct is the structure full of named arguments with default values. % * Flagtype params is params that don't require a value. (the value will b...
f3c9ace8f481b614c931c2f89fb6a874d2e952f9cb83f526621f18d11e23afb6
MATLAB
6,607
150
%% Stimulation micro analysis script % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % addpath /network/lustre/iss01/charpier/stephen.whitmarsh/WhitmarshEpilepsy/scottclowe-matlab-schemer-f8115af/ %https://github.com/scottclowe/matlab-schemer/blob/master/schemes/README.md#matlab-schemes % schemer_import('/networ...
816094984190a966c22f5e0799f40e74ce7ca62ed3b473dbb51b37a0b74b629e
MATLAB
6,618
196
clear close %% PLOTTING diagram_path = './../Systems/Pyramid_astro_threshold_Is_impulse/impulse_extension_by_astrocyte/'; diagram_name = 'impulse_extension_by_astrocyte'; fig = figure; tlo = tiledlayout(17,2,'TileSpacing','compact'); lwd = 0.4; % Left (Theta = 0) c1 = load(strcat(diagram_path, 'Impulse_Is_no_ast.ma...
714315bf491ab68398d44cd106aee847ed2a6b6b629d134f2b34d45751ba0e3d
MATLAB
6,628
209
function [FinalData, TrialData] = TrialPETHTrace( Fs, Ts, Pre, Post, EventTS,Ch490,Ch405, varargin) %Trial Analysis: This code will take inputs and create Photometry %Raster-PETH. The Raster PETH is a Heat map. The PETH is really a line %curve (not a histogram). The FinalData output will posses a number of %columns...
45f3600e325cba28f9ccc254bc8971596ab30df8254bf6ccf3443eea76a3b3f6
MATLAB
6,630
160
% patient_directory = '/Volumes/epimicro/Donnees-analyses/Stephen/2230 files with markers/'; directory_searchstring = '02230_*'; data_searchstring = '*m1*.ncs'; eventtype_start = 'P'; eventtype_end = 'P'; [P.clocktime,P.clocktime_append,P.sample,P.data,P.ldir,P.fdir] = extractMuseMarke...
15bb0ef65bd15ec011d6c1171a7f5a3ecb2ec2f48011d64104d819f92bcf3ba3
MATLAB
6,636
238
function ds = dsim(t,s,sim) ds = zeros(max(size(s)),1); for i=1:sim.n idx = sim.per_neuron*(i-1); v = s(idx+1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Applied Current if sim.istart{i}<t ix = -sim.bias(i)-sim.iDC(i)*exp(-((t-sim.istart{i})/30)); else ix = -sim.bias(i); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Synapt...
9c3784bf11fafc56b9574d9fca08b17a5a9967e553cb5985e9bf7bc627a175c8
MATLAB
6,657
211
%% Gergely Tarcsay, 2025 Ewell lab. MATLAB script to recreate learning curve and performance (Figure 1) close all clearvars -except behavior_struct cd("G:\Behavior only\") if ~exist("behavior_struct", "var") load BehaviorData behavior_struct.details.GPassed(5) =behavior_struct.details.GPassed(5)-1; % co...
c7d2db00f220ae3bdda47ba783ce5e4ac6fca90ec1a8e329bb1d43b049f9597e
MATLAB
6,672
187
clc; clearvars; close all % load and define specific parameters load("par.mat") dt=0.001; tau=98; par.tspan = 0:dt:tau; par.opts = odeset('RelTol',1e-6,'AbsTol',1e-8); par.I0=0.2; par.k=10; par.je=0.5; antag = 0.5; % suppression strength stim = 0.5; %amplitude stim stimB = 2.6; % baseline of sine wave for UCN3 baseline...
f9f618756652c5beef3883625319d729a5c79aff6ca7b3e6db90840787331f08
MATLAB
6,687
255
function [mask, thresh] = maskHeadPseudoHist(data_file, output_mask_file, if_aggresive) % This function tries to detect head (including skull and skin) just based on % intensity in a 3D volume. This function assumes that the head (or area of interest) and % background have significant difference in their intensity valu...
645524fa3e196f220fe3fe4e241b9f9dcb1f80386c36e10819669e9acea663f3
MATLAB
6,691
257
function imp = copytoImagePlus(I,varargin) % copytoImagePlus allows you to open an array I with an instance of ImageJ % within MATLAB with a proper data type and hyperstack dimensions. % % % SYNTAX % imp = copytoImagePlus(I) % imp = copytoImagePlus(I,dimorder) % imp = copytoImagePlus(____,'Param',value) % % ...
1169886c0caf7e6c45f64828d4d3c2c5d747d3a50ca1e63e50cabe06f1564e26
MATLAB
6,692
228
function outpict = radgrad(s,point,radius,colors,varargin) % RADGRAD(SIZE, POINT, RADIUS, COLORS, {METHOD}, {BREAKPOINTS}, {OUTCLASS}, {COLORTYPE}) % returns an image of specified size containing % the multipoint radial gradient specified. % gradient type is linear interpolated rgb % % SIZE is a 2...
403ca04bd7213ab9daf0b70b1528bd399c5faec13bbc5beedaf8bba614d2d283
MATLAB
6,695
229
function outpict = lingrad(s,points,colors,varargin) % LINGRAD(SIZE, POINTS, COLORS, {METHOD}, {BREAKPOINTS}, {OUTCLASS}, {COLORTYPE}) % returns an image of specified size containing % the multipoint linear gradient specified. % gradient type is linear interpolated rgb % % SIZE is a 2-element vect...
33ad747344fa8e4130cbb0410b8afbb131016e3396c3831da522282f17871be7
MATLAB
6,696
125
function [artefacts] = writeSpykingCircus_deadfiles(cfg, MuseStruct, force) % WRITESPYKINGCIRCUS_DEADFILES creates artefact files (deadtime) for % SpykingCircus in data directories for spike analysis % % use as % writeSpykingCircus_deadfiles(cfg, MuseStruct, force) % This file is part of EpiCode, see % http://www.g...
4f802ac7604c3baaee098033043b40f549e429ede53ea11ed96b637e62d85d8d
MATLAB
6,702
223
%% Simple RL example for CPM % In this example script, I will show how to set up functions and data for the CPM and provide a guide through the results etc. % The scenario % Suppose you have behavioral and neuroimaging data from a simple multi-arm bandit experiment and you are interested in how reward prediction errors...
0381b9d6361d04ba490421cf9038078a85f049d97933c15ce7811af49f0443dc
MATLAB
6,703
189
function artifacts = gcmi_cpp_mex_compile(varargin) p = inputParser; p.addParameter('Targets', {}, @(x) iscell(x) || isstring(x) || ischar(x)); p.addParameter('Verbose', false, @(x) islogical(x) && isscalar(x)); p.parse(varargin{:}); opts = p.Results; cfg = gcmi_cpp_mex_config(); if ischar(opts.Targets) || isstring(op...
9adbe6954ebe4903c4677ff1084eca929d2e30a27c0aedd56faa7f0931b5fe48
MATLAB
6,706
222
function [elec_handles,ei] = plot_ei_(ei, position, frame_number, varargin) % PLOT_EI_ Plot a frame of an electrophysiological image % % frame_number==0 max(abs(ei)) % % shlens@salk.edu 2006-07-17 % greschner new framework, % uses raw ei, % take full EI as input, if no framenumber is given or it's 0 -> produces ma...
6080b8cf10c9a600cc10dccbb53be359abfcf6f4aba7139414a7f9c58eb041ce
MATLAB
6,720
155
% OPTIMALFIGURE Compute an optimal width/height for a figure comprised of a grid of plots. % % Optimal figure size for a given subplot aspect ratio. The shape % information can be returned either as separate [numRows, numCols], or a % single shape vector with two entries. If outerPosition is not requested...
96b15811cd24166991b9d565780c8f3387c9012b7414766305fa8b21076bda20
MATLAB
6,720
184
function [halfwidth, peaktrough, troughpeak, amplitude] = plot_morpho(cfg,data) % Plot trials and average of trials + compute some parameters, see the % following cfg inputs : cfg.morpho = ft_getopt(cfg, 'morpho', []); cfg.morpho.channame = ft_getopt(cfg.morpho, 'chann...
a9a788ba5bf759b10cafda787bc6d6ba5b4bc9098d45be1f6f1009b616861fed
MATLAB
6,724
175
% Purpose of this script: % The specified Excel file has a list of .mat files which store the outputs % of the sparseness and correlation analysis from multiActivity, and a list % of .txt files listing the original .tif files of the movies. % This will go through all the .mat files and compile the sparseness and % corr...
8ecfceffade9cf56e0e6a6383823af5837714dda078ec04332b579806dd3e51c
MATLAB
6,751
161
%% CLUSTERPLOT Clusters data and plots each via bandplot separated by an offset. % % clusterplot(x, y, numClusters, probability = [0.05 0.95], yOffset = [], fractionPos = [x w h]); % clusterplot(ax, ...); % clusterplot([hLine,hBand,hBox,hFill], ...); % clusterplot(..., kmeansOptions = {...}, lineOpti...
61603e64073bea74be5c9f83ff24adfdf58f932cdac0f053ca0682eb7257d049
MATLAB
6,752
197
spmdir = 'C:\Users\admin\Documents\MATLAB\spm12'; noisetooldir = 'C:\Users\admin\Documents\MATLAB\NoiseTools'; addpath(spmdir) spm('Defaults','EEG') addpath('C:\Users\admin\Documents\MATLAB\analysis') datadir = 'D:\ES_data_Hannah\data'; for s = setdiff(1:31, 20); % try if s<10 subdir = fullfi...
875aab2dfd9fea63fe349363f56403dd763c4653bed81e9fddbd70b6e32ead15
MATLAB
6,772
165
function [classification, PC1,reachr_cell_idx] = Reachr_classification_AMR(SN_data, cluster_data_avg, rat, coeff, other_PCs, varargin) %'Reachr_classification' writen by Ergi Spiro; edited by AMR.Only takes in one data structure compared to 'Reachr_classification'. % arguments: SN_data - Signal-Noise Vectors; see...
cfa4a7a3a51b7148348d58ad0f2316806dd41daae3215f14267dd2903380a235
MATLAB
6,783
146
function plotMarkerOverview(MuseStruct) %% concatinate marker directories MuseStruct_append = rmfield(MuseStruct{1},'filenames'); % for first directory mrknames = fieldnames(MuseStruct{1}.markers); for imarker = 1 : numel(mrknames) MuseStruct_append.markers.(mrknames{imarker}).sample = []; if isfield(MuseStr...
3518bc644bf148fee4ff3eafd63d7568ee317df4fb60b1c6e7db9fff3a088296
MATLAB
6,786
173
%% Set parameters if ispc addpath \\lexport\iss01.charpier\analyses\lgi1\Git-Paul\fieldtrip; addpath \\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\development addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\projects\dtx')); addpath (genpath('\\lexport\iss01.charpier\a...
fa6d648e76ca581eccf27e652ce603cbf11952f371cadf97bc8086da616060f6
MATLAB
6,794
258
addpath /network/lustre/iss01/charpier/stephen.whitmarsh/WhitmarshEpilepsy datapath = '/network/lustre/iss01/epimicro/patients/raw'; outputdir = '/network/lustre/iss01/charpier/stephen.whitmarsh/data/qualitycheck'; dlist = dir(fullfile(outputdir,'*.mat')); for ipatient = 1 : size(dlist,1) fprintf('Loading %s.....
375bdb77ad539b144ba330afef6dd7e27082639ac14954ebb00a58d2be6674ed
MATLAB
6,818
146
function walkerdots = mmComputePositions(mm, markers, periods, phases, azimuth, angvel, t, lintrans, speed, scrambleoption, walkersize, xcenterw, ycenterw,invert); %DC: added input parameter "invert". If invert == 5, 6, switch x and z %walkerdots = mmComputePositions(mm, markers, periods, phases, azimuth, angvel, t, ...
9a235034289fb1a43e2955b6d1263ddab1ef97c78e0209bff7b77a37b0584f24
MATLAB
6,824
201
%% BANDPLOT Plots the central value (mean) and confidence band for a given set of data % % [hLine, hBand] = bandplot(x, y, probability = normcdf([-1,1],0,1)); % [hLine, hBand] = bandplot(x, y, probability, color, alpha); % [hLine, hBand] = bandplot(ax, ...); % [hLine, hBand] = bandplot([hLine,hBand], ...
738cfe5cf5113bd46fbc2ca55123ead64f409164309ee3c36589990dfe064c3c
MATLAB
6,826
188
% Load NIfTI / Analyze header without applying any appropriate affine % geometric transform or voxel intensity scaling. It is equivalent to % hdr field when using load_untouch_nii to load dataset. Support both % *.nii and *.hdr file extension. If file extension is not provided, % *.hdr will be used as default. % %...
94c7f37d1ff45a8b61f539ec5378178659fc07dadf90119d238044e553b3a0df
MATLAB
6,849
342
%%% Designed and Developed by Mohammad Dehghani and Pavel Trojovský %%% function [lowerbound,upperbound,dimension,fitness] = fun_info(F) switch F case 'F1' fitness = @F1; lowerbound=-100; upperbound=100; dimension=30; case 'F2' fitness = @F2; ...
0315785b102818f39fd142cef9aac6da7bc1c66e37fdd193f8e7cec9eb11ae02
MATLAB
6,865
257
% Make NIfTI structure specified by an N-D matrix. Usually, N is 3 for % 3D matrix [x y z], or 4 for 4D matrix with time series [x y z t]. % Optional parameters can also be included, such as: voxel_size, % origin, datatype, and description. % % Once the NIfTI structure is made, it can be saved into NIfTI fil...
a1bbc78b3012f45a1410e1f2a81127a4b57c301c1d52089048eb1c6fc809f9b0
MATLAB
6,865
146
%% function [best_fitness, best_solution, Convergence_curve] = ESC(N, maxIter, lb, ub, dim,fobj) % Initialize population if max(size(lb)) == 1 lb = lb * ones(1, dim); ub = ub * ones(1, dim); end population = repmat(lb, N, 1) + rand(N, dim) .* repmat((ub - lb), N, 1); fitness = a...
82ae3181ce9a67cf1efd80795d12beee90919938b63a89bc387cfff0a8cc7944
MATLAB
6,877
185
function [svm_values] = spont_svm_characterization_fig3D(merged_output_array,merged_sz_parameters) % On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy % Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano % DOI: https://doi.org/10.7554/eLife.101859 % Use Support Vector Machine to ...
187b43dbd3f40e823806055389b92a461ffec9acf3274ed7920f5ea1d9cc6117
MATLAB
6,882
222
% ========================================================================= % Title: Electrophysiology Regression & Longitudinal Modeling % % Author: Gabriele Mancini % Date: 2025-12-10 % % Description: % 1. Loads LFP data (frequency corrected PSDs). % 2. Performs subject-specific Z-score normalization against base...
8b9827181370c33c43e5f0fb086ac7f149b04601f50edacbcfc0c43cff4bfe88
MATLAB
6,886
231
for ipatient = 1 : 8 [marker{ipatient}, hypnogram{ipatient}, hypmusestat{ipatient}] = hypnogramMuseStats(config{ipatient}); end clear totaldur totalsum hypTable = table; mrkTable = table; for ipatient = 1 : size(hypnogram, 2) % plotting IEDs x Sleep stage for all marker (e.g. all templates) for ipar...
dc997582753d5c960c2d014baee95791f57d6e8ef29f21ed5fdd2caa0e057d59
MATLAB
6,891
119
function X1D = gridSetting(data, options, Seed) %set for each dim the stepN Xvalues adaptively %function gridSetting(data,options) % This tries to get equal steps in cummulated likelihood in the slice % thorugh the Seed % it evaluates at GridSetEval points from Xborders(:,1) to Xborders(:,2) %Initialization d = s...
dcb0d976bdc67a1c0427aef4ad103ffc8dcd2edf17b0af132e1fa516d6f4075b
MATLAB
6,899
202
function [pixel_thresh,min_size,max_size,do_watershed,normalise_img, kernel, colormap] = get_biomarker_info_SAP(biomarker, biom_set_folder, fname) %% Define detection threshold and analysis strategyfor each antibody % @author: speressotti % Threshold can be between 0 and 1, with smaller values corr...
b3ec5c744e17c1a0fcee66e72edad2733e71f5d33281ceb544eb4fc59a1ec1de
MATLAB
6,904
143
classdef ConnectomeVisualizer % ConnectomeVisualizer % Static methods for visualizing connectome-related data structures. methods (Static) function [hAx,hIm] = plotConnectomeMatrixWithMask(connectionMatrixObj, crossRegionInfo,options) % Plot the connection matrix with source and target...
fc5205da3aedae4025486a113778faf2983e44298a1a544023b98dfa1337878b
MATLAB
6,907
193
% ========================================================================= % Title: Spectral Feature Extraction from Simulated LFP/EEG Signals % % Author: Gabriele Mancini % Date: 2025-12-10 % % Description: % This script processes simulated neural data to extract periodic and % aperiodic spectral features from LFP or...
1cbdd98c2b2f84f9ae380682e4da570579071724820405f7b20874520b5adf8e
MATLAB
6,911
169
function [flag, m2, SE, Va, Ve, Lnew] = Morphometricity_1RandEffect(y, X, K, alg, tol, MaxIter) verbal = 0; % This function implements morphometricity. % It fits a linear mixed effects model using the restricted maximum likelihood (ReML) algorithm, % and produces the morphometricity estimate and its standard error. ...
4677a57a848f1b478cba6016138ef3f3dbd9d5d2628dace269dfcec3442c2fbd
MATLAB
6,930
204
function [flag, m2_tot, se_tot, M2, SE, Vc, Lnew] = Morphometricity_NRandEffects(y, X, K, alg, tol, max_iter, verbal) % This function implements morphometricity for multiple kernels. % It fits a linear mixed effects model using the restricted maximum likelihood (ReML) algorithm, % and produces morphometricity estim...
84d4088713d7fee56b779d8c5ec473d3fbdcdf8f081e04465122b57beb4d921e
MATLAB
6,941
193
function [config] = Figure_FFT set(0,'defaulttextinterpreter','none') %% load data for ipatient = 1:8 config = hspike_setparams; config{ipatient}.FFT.name = {'window'}; config{ipatient}.FFT.postfix = {'_noWelch'}; FFT{ipatient} = FFTtrials(config{...
60a6c1efe9be7432452811d2e7109d335aa7ee9310fc1fa4a730464456f992ce
MATLAB
6,945
204
function outpict = imdrag(inpict,varargin) % IMDRAG(INPICT, ARGS) % Select random vector segments within an image and replicate them perpendicular % to their length. Blend replicated data with the original image and repeat the process, % creating a smearing effect depending on blend parameters. S...
ad023bd1ca40470a8c7c39645e831c15971082611ad655a8ab5fed47aa1b3348
MATLAB
6,952
201
clc,clear all;close all; %load the embedding load('..\embedding\sub19.mat'); % Download MCCM_sub08.mat from https://zenodo.org/records/16907957 and put % into the folder ./data/Inference/ load('../data/Inference\MCMC_sub8.mat'); load('mode_wake.mat'); load('mode_sleep.mat'); min_KL_idx = find(KL==min(KL)); min_KL_tr...
6f0f8c606c58eb57e16499890857a33bd4c3dc82318c7f893103bb968aaac845
MATLAB
6,954
129
function x_im = sample_exemplars(data_obj, opts) % function x_im = sample_exemplars(data_obj, opts) % % Function to sample exemplars. Takes in a data object and a struct of % algorithmic parameters and returns either a uniform sampling of the data % or a sampling based on finding a sample set with low correlations bet...
ef5d5be37087207fd06ff4089d7d43c7d954bc9cc2079dbf1a4fd34c36cad21a
MATLAB
6,957
229
% This script provides a tutorial application of the Gaussian-Copula Mutual % Information (GCMI) estimator with a continuous auditory stimulus feature % (low pass filtered speech envelope) in a continuous design % This script uses cell mode - cells are delimited by %% lines and can % be run with: % ctrl-enter (wi...
5deefdf10fe9ce4c14dc1f080415dec46f213828859e4077e979bf77600d9fed
MATLAB
6,967
183
% ========================================================================= % Title: DATA INTEGRATION & NORMALIZATION SCRIPT % % Author: Gabriele Mancini % Date: 2025-12-10 % % Description: % Loads Multi-Unit Activity (MUA) and Spectral Feature (LFP) data. % Performs data cleaning, channel selection, Z-score normaliz...
b500126ad5bd914f93b010c6b3e5c6274f86478ade4c00289afd4473ff5c808e
MATLAB
6,975
227
clear totaldur totalsum hypTable = table; mrkTable = table; for ipatient = 1 : size(hypnogram, 2) % plotting IEDs x Sleep stage for all marker (e.g. all templates) for ipart = unique(hypnogram{ipatient}.part)' for i = 0 : 4 totaldur(ipatient, ipart, i+1) = seconds(sum(hypnog...
adbc3aedba89a87f77e3a2b191ca6988cc66ee6d8c2411b5daff42c4991dc7c5
MATLAB
6,977
187
function emg_infos = dtx_stats_emg_timings(cfg, MuseStruct_concat,ipart) % computes some descriptive stats on EMG data % ## INPUT : % - cfg : %mandatory : % cfg.seizuretimings.marker_start % cfg.seizuretimings.winsize % cfg.seizuretimings.winstep % % Optional : % cfg.seizuretimings.marker_end % cfg....
1a45bbd082de9d07bb0b5f1513f77c5de6cdd3a11fd25a459f71c85c7d102314
MATLAB
6,978
171
function [vertex_label, colortable] = CBIG_read_annotation(annot_file) % [vertex_label, colortable] = CBIG_read_annotation(annot_file) % % This function takes in a .annot file and converts it to a Nx1 column % vector vertex_label where N is the number of vertices. The colortable % struct from the original read_annota...
819071d6dce541235cff68365a2670adc51c5f9be3bc53d725f85ce86db973fe
MATLAB
6,991
158
function output = CBIG_Projectfsaverage2MNI(lh_surf, rh_surf, MNI_mask, index_volume, delimiter) % Usage: output = CBIG_Projectfsaverage2MNI(lh_surf, rh_surf, MNI_mask, index_volume, delimiter) % % Warning! This function is obsolete. Please use CBIG_Projectfsaverage2MNI_Ants instead. % % Function projects surface data...
1e6d53dde8b49f2c47555ba90410af36118b942f00958bdd4e6fb72ad703f87a
MATLAB
6,999
110
function ReconMPM(connection) disp("Matlab MPM Recon launched...") recon_type = 'MORSE' ; % 'MORSE' or 'ESPIRiT', 'ESPIRiT' recquires installation of the Berkeley Advanced Reconstruction Toolbox (BART) toolbox disp(['Reconstructing with ', recon_type]); % Hard-coded reconstruction parameters: global onlineROFT scaleKs...
6460efdec854e61bcc1d09e6890784934f6bac5f33175edc5f03ef2f8fafe6df
MATLAB
7,015
247
%% Cluster-based permutation test - Example function [Sig, stat] = CBP_CTG(data, opt) %% numSub = size(data,3); numT = size(data,2); numF = size(data,1); for i = 1:numSub Data(i,1,:,:) = data(:,:,i); end switch opt case 'Base' zero = zeros(numSub, 1, numF, numT); case 'Binary' ...
da7ccd980fb146b535795c99dec3f85d687758995d6d9dd99454899f61443274
MATLAB
7,037
172
function [allData_final] = get_finalResults(save_path,method_comb) %%% Summarise final data - V2 (MGG) %%%% %% Combine all data in a single table and generate results % Find mat files for each dataset files = dir(fullfile(save_path,'*.mat')); % Remove files ending in '._' for MAC for i = 1:length(files) ...
ebad322e33054e3b0887a170a5d334f1ac06ebfc905534065f0797bbb2d6f17f
MATLAB
7,049
261
function [header] = deserialize(xmlstring) %DESERIALIZE Summary of this function goes here % Detailed explanation goes here % Get a parser db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder(); % Turn the string into a stream isrc = org.xml.sax.InputSource(); isrc.setC...