sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
65d8887cfdd9cce790aae4f76ee7557ae63a04358e476380c4da4ce38a3dd34d
MATLAB
5,380
194
% 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_recip_prob = 0:0.2:1...
2206e41c08bbf43d4f4fcc377092d0ef712ba2e6687588f1c2a1902750744b25
MATLAB
5,395
147
classdef CrossRegionInformation < handle % CrossRegionInformation % Manages information between source and target brain regions, such as distance and domain definition. properties SourceRegionInfo BrainRegionInformation TargetRegionInfo BrainRegionInformation DistanceMatrix double =...
252533b7473ea158f4642d7ce7873d70198570ad9a026a6435e5c01e40d928a7
MATLAB
5,405
158
%% Gergely Tarcsay, 2024, Ewell lab. Script to calculate % of type of trial errors made during the lesion experiments. close all if ~exist("lesion_struct", "var") load ("G:\HPC lesion\LesionData.mat") end if ~exist("behavior_struct", "var") load ("G:\Behavior\BehaviorData.mat") end %%get baselin...
b23e10f89623624abcef70f0f33ea65218d67dda862ae456a02112a470261a39
MATLAB
5,411
184
function varargout = gettfm(mat,varargin) % A = GETTFM(MODEL,{SPEC}) % [A OFFSET] = GETTFM(MODEL,{SPEC}) % Generate the color transformation matrix for conversion % between RGB and various luma-chroma models. Transformation % matrices are calculated from scratch and are not truncated. % % MODEL specifies ...
d67e5476bee837271bbcf0d9371b9759703f20237b6a2413f55d1e48058cfc2e
MATLAB
5,411
148
clc clear all Q_N = 23; Q = 2^23-1;%%量化位宽,整数8位小数23位 Q_FIL = Q; data = readNPY('D:\YCB\YCB\PROJECT\EEG_signal_processing\python\raw_signal.npy'); data_Q = floor(data.*Q); %ese a0 =[ 1. -0.93906251]; b0 =[ 0.96953125 -0.96953125]; a0_Q =floor(a0 .*Q_FIL) ; b0_Q =floor(b0 .*Q_FIL) ; x_filtered_band0 = f...
1aade7216d5ff021331ec12bd29fe13832971bb8de34d237f768f9d0e1496eb6
MATLAB
5,426
127
function writeSpykingCircusParameters_new(cfg) % WRITESPYKINGCIRCUSPARAMETERS writes .params and .prb file for Spyking Circus % % use as % writeSpykingCircusParameters(cfg) % % The .params file is based on the one in the template folder of EpiCode. % Change this file to have new default values. % % Mandatory inputs ...
4fb25e4a2abf8b6f66508b1b2d0e7cfdfe1e3d28bbeb90b68c9600605aa2f796
MATLAB
5,428
196
% 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_recip_prob = 0:0.2:1...
e8067feeea3b9dae8d771d6af8663a6782818f27783aa66b07645562e9da0e3e
MATLAB
5,433
158
%% ============================================================ % Brightfield + fluorescence prep → training images + label map % Author: Pei-Hsun Wu @ JHU | Cleaned: 2025-12-05 % % Output: % - Example Data\TrainData\im\xy01_bf.tif % - Example Data\TrainData\label\xy01_allLabel.tif % % Label codes...
2768e2d2d10d9829b7ced8e1f33398c6aa7ed05f39d897b65e43d9b609d77927
MATLAB
5,451
158
function [y, h] = resample( x, p, q, N, bta ) %RESAMPLE Change the sampling rate of a signal. % %!!!!! % Lower LP corner than Matlab's resample (Matlab's gives inadequate % antialias filtering). % Works with multidimensional arrays (Matlab's doesn't). %!!!!! % % Y = RESAMPLE(X,P,Q) resamples the sequence in vec...
ea41cd1ce5b2b61f316447fa93cbdf5f4fb83ff6fc11c56474ce2517ed900997
MATLAB
5,452
82
%----------------------------------------------------------------------- % Job saved on 11-Oct-2023 10:43:05 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- load('tmp_workspace_batch_ANOVA_2_groups.ma...
240a8fa1764d81d7d3a017969266c4fc95c172683338987b4a47fbac6c229d4d
MATLAB
5,453
135
%% wrapping function for vector analysis - second version function [All,Individual]= WrapVectorRemap2(workdir, discrimination, LightBin) All.AngleDiff = {[]; []}; All.IsOrthogonal = {[]; []}; All.MeanRate = {[]; []}; All.TuningStrength = {[]; []}; All.TuningBin = {[]; []}; All.RewardTuning = {[]; []}; All....
b1e2201971abd1b3a0b732fc3c19618a3a5079631559dbc1b2a23688b316b53e
MATLAB
5,453
150
function [data_out, Tr_pp, Tr, bin_center] = histeqSmooth(data, arg2, arg3, arg4, arg5) % Performs histogram equilization using parzen window estimates of histogram and pchip based % mapping of CDFs. It should produce smoother output images and more continueous and smooth % intensity transformation than matlab based hi...
4834810bcbe28035f2ac8aa992fe4c13434844f38e0b5b638a142c4c2b9a85ca
MATLAB
5,454
83
%----------------------------------------------------------------------- % Job saved on 11-Oct-2023 10:43:05 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- load('tmp_workspace_batch_ANOVA_2_groups.ma...
a1ec24e18957202cc18918e997dc67dfed5657ae132567c7ff6c0dbf136de43f
MATLAB
5,472
116
%% load experiment info and set a few variables for analysis clear % load experiments and generic stuff experiments = 'Load your experiments'; repeatCalc = 0; save_data = 1; % loading and filtering variables fs = 32000; % from data downsampling_factor = 320; % downsample for LFP analysis fs_LFP = fs / downsampling_f...
e8048804c38ade7789915583a01ebab1a257c826d676f91a5980af354b34323b
MATLAB
5,476
160
function clusterInfo = cluster_data(locAll,varargin) % the returned index contains noise data with idx=1 % locAll %um prmAll = varargin{2}; prmAll.cluster = set_default_parameters(varargin{:}); prm = prmAll.cluster; for ll=1:numel(locAll) if ~isempty(locAll{ll}) locAll{ll} = locAll{ll}*1e3; ...
8c414ef3fca29886cfd10e2725967286bd436ee3b86e8660cdd554333980c551
MATLAB
5,479
135
function PET_project_per_patient(ipatient) restoredefaultpath if ispc addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\shared')) addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\external')) addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\templates')...
e9d0bbc82856b820b4a1d495409c7a0db5e1f1f0923205136cafb564b0cdc652
MATLAB
5,488
196
% Connecting parallel pool parpool("Threads"); 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; var_som_prob =...
7cd01ad152f85f90930b70c8616d97b7f2a08746d1aa5335a8d14d1adbbe5e88
MATLAB
5,498
131
function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatpt(data,win,T,params) % % % Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels % but does not do confidence intervals. Also this routine always averages % over trials - point process as times % % Usage: % % [Sc,Cmat,Ctot...
28e4b227604786d0593a6f0716b94b61f33fac45ccc279dfcbea1c9e42e28f68
MATLAB
5,508
182
function [] = modelDiagnostics(mixed_folder, file_name, data, lme) close_figs = 0; fit_plot =0; Y = data; diag_folder = fullfile(mixed_folder, 'Diagnostics'); if ~exist(diag_folder) mkdir(diag_folder); end % model fit model_fit = lme.ModelCriterion save(fullfile(diag_...
b6eedb980e649aea644c3c1361c1c0ba166c4be6358a1558ac477567e0ead184
MATLAB
5,508
154
% analysis of behavioural data exgaussdir = 'C:\Users\admin\Documents\MATLAB\bramzandbelt-exgauss-7cf8c4c'; addpath(exgaussdir) clear all pps = setdiff(9:31,[12 20]); for s = 1:length(pps) datadir = 'D:\ES_data_Hannah\data'; cd(datadir) if pps(s)<10 cd(strcat('P0',num2str(pps(s))))...
86fbff92d062c37f72d893766e6bddf1f556158323d997f11de61d252b1e8e74
MATLAB
5,515
135
function smoothedPhi = CBIG_AuthorTopic_SmoothPhi(params) % smoothedPhi = CBIG_AuthorTopic_SmoothPhi(params) % % Spatially smooth the parameters of the variational distribution phi. % % Input: % - params: struct containing parameters of the author-topic model and % the Collapsed Variational Bayes (CVB) algo...
fd35442c73d7575698a64e9b868d30caace05676d190b49a22413331a6d76878
MATLAB
5,517
133
%% wrapping function for vector analysis - second version function [All, Cohort, Individual]= WrapVectorRemap3_FINAL(workdir, discrimination, LightBin) All.AngleDiff = {[]; []}; All.IsOrthogonal = {[]; []}; All.MeanRate = {[]; []}; All.TuningStrength = {[]; []}; All.TuningBin = {[]; []}; All.RewardTuning = ...
84cc4d64283a303bef64313e083feb017b9990de5dddeaf7f692770061cf584d
MATLAB
5,521
185
function kbboxchart(paramArray, varargin) % KBBOXCHART - Draws multiple stylized boxcharts with explicitly defined parameters, % mimicking the style of MATLAB's boxchart. % % Inputs: % paramArray - struct array, each with fields: % bottomWhisker, bottomBox, bottomNotch, median, % topNotch, top...
fcbf28db320b1eb67bcbb93c60c63e51314b16cb64b457586d40efc6cbfe23f5
MATLAB
5,523
159
function [Best_Finfo,Best_Pinfo,Historical_Info]=IAO(N,Max_iter,LB,UB,Dim,fobj) % Initialize Info=initialization(N,Dim,UB,LB); % solution New_Info=Info; Ffun=zeros(1,size(Info,1)); % fitness value Ffun_new=zeros(1,size(New_Info,1)); Best_Pinfo=zeros(1,Dim); % best solution position Best_Finfo=inf; % best...
5c29b6504aadafeb7fbd90ac95b5ae811f679683ae2b0a6ffb42bcbc4c594161
MATLAB
5,534
161
function U = nullspace_vectors_C_matrix_2D(kCal, varargin) % Function that returns the nullspace vectors of the C matrix. % % 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 rectangular %...
40dd62a0e5e31fbd17c65f1b845c82a07665be3b65bd6b69abca64f5a246c4ca
MATLAB
5,538
194
function outpict = bwfilmemu(inpict,film,varargin) % OUTPICT = BWFILMEMU(INPICT,FILMTYPE,{FILTER},{OPTIONS}) % Roughly emulate the appearance of color scene as represented by one % of various B&W film types. The result is a simple weighted sum of sRGB % components. Obviously, this shouldn't be taken as an accura...
8c4c72bae368feb66e7bb77a4acc696d0d7a59c084085227a16d421bca1e2de7
MATLAB
5,538
198
% Connecting parallel pool parpool('Threads'); 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; var_som_prob = ...
d2968dd02ab5563aa8940bba6640fa31ab5a6c3e8800ddd57020683c63853ca4
MATLAB
5,541
58
%%% This code is designed for visualizing rank changes and annotating behavioral observations in the tube test. clear all close all clc %%% Plot for social rank changes for a cohort of hM4Di-EGFP mice before and after CNO administration to the rank-3 mouse at time 0. rankchange=[1 1 1 1 1 3 1 1 1 %% Crea...
72477decf1183aade326ce33e56766b7cfa7a29be5b310d646f2b1591bbbf7a7
MATLAB
5,544
184
%% Downloads example data (900MB), runs GLM analysis and extracts timeseries % Settings % Directory into which to download example dataset data_root_dir = 'D:\samdata\'; data_dir = fullfile(data_root_dir,'Example','pRF'); surf_dir = fullfile(data_root_dir,'Example','surf'); % Directory for creating GLM glm...
6124fc414bd08f5631bb9c7d45900d6fc92fc8b2dbc09095967de5ba7ed04512
MATLAB
5,547
138
function [OPS_object_data_pos] = Object_detection_OPS(settings,pos_idx,phase) % [OPS_object_data_pos] = Object_detection_OPS(settings,pos_idx,phase) % Detects object locations and saves data in a struct % % inputs: % settings - Analysis and experimental settings % pos_idx - position number to analyse % phase - ...
e3bf4bc7db2e0dd844cb162685a2643d310df5c36bf7dde5debe410c71e7be6e
MATLAB
5,552
154
function Figure_hypnograms MuseStruct{8} = []; LFP_cluster{8} = []; LFP_cluster_detected{8} = []; clusterindx{8} = []; config = hspike_setparams; for ipatient = 1 : 8 MuseStruct{ipatient} = readMuseMarkers(config{ipatient}, fal...
2635c7b7ef377e341edef328b3761c83ec1285efc24437dfb3f0ef9a8a8766bd
MATLAB
5,555
98
function neurons_table = summarized_neurons_table(cfg, markername, force, spikestats, waveformstats, spiketrials) % Use as : % neurons_table = summarized_neurons_table(cfg, ipart, markername, force, spikestats, waveformstats, spiketrials) % summarized_neurons_table creates a table with the summary of the main ...
847d98f9cfcdee9905a5445d247887fe7e0feb8efbadc7dbaf164789bd62ca95
MATLAB
5,558
200
% Connecting parallel pool parpool('Threads'); 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_recip_prob = 0:0.2:1; var_div_prob...
bacaf35d75a924c773cf62385e6bf025221313229b350ee6196eec2d39a007e6
MATLAB
5,560
163
function [data] = ft_appendspike(cfg, varargin) % FT_APPENDSPIKE combines continuous data (i.e. LFP) with point-process data % (i.e. spikes) into a single large dataset. For each spike channel an % additional continuos channel is inserted in the data that contains % zeros most of the time, and an occasional one at the...
509e20aa0e7659b093a1bbf85c78630ca8edb3ae0908c1876bec7f091cee9d4f
MATLAB
5,564
161
function U = nullspace_vectors_C_matrix_3D(kCal, varargin) % Function that returns the nullspace vectors of the C matrix. % % 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 dimensions ...
bae6890bae08a6bd4b6d59dbea1218a5c134504964bf77b8ed88f8d34d6cb69e
MATLAB
5,567
139
function [output_data] = filter_downsample(path_extract,fs,plot_duration) % On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy % Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano % DOI: https://doi.org/10.7554/eLife.101859 % Function Purpose: Filter Raw EEG Data. % Input Variabl...
4fb63cbf705b89d49fc5f5dd8a5a92891198cb8abefd460ae2702ec811c4896f
MATLAB
5,568
153
function wod_project_lfp(slurm_task_id) if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\wod\EpiCode\shared')) addpath (genpath('\\lexport\iss01.charpier\analyses\wod\EpiCode\external')) addpath (genpath('\\lexport\iss01.charpier\analyses\wod\EpiCode\templates')) addpath (genpath('\\lexport\...
61c28b34b34ce8bd834302b164fa3c424b8f5808d9b174c8745b1998a3901f81
MATLAB
5,576
176
function [D,E,R]=nt_cca_aad(xA,xB,y,ssize) %[D,E,R]=nt_cca_match_aad(xA,xB,y,ssize) - calculate metrics for match-mismatch task % % D: d-prime % E: error rate % R: correlation coefficient over entire trial % % xA,xB: stimulus streams % y: response % ssize: samples, segment size [default: all] if nargin<3; erro...
d96b8d58adfb3a97b46109d82317c914c0a18ce75aeeae855950e9865a4ca4b9
MATLAB
5,579
118
%% Import data from text file txtfileFullName = ['.txt']; % Text File location OutputSaveLocation = ['\dataStruct.mat']; % Enter location of folder where output is desired % import .txt. file (lick times and state) opts = delimitedTextImportOptions("NumVariables", 5); % Specify range and delimiter opts.DataLines = [...
05c3157d0b8ac96629524f5b8a173f5759b2014b46879b1c62ec63b63cb45c07
MATLAB
5,585
202
% Connecting parallel pool parpool('Threads'); 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_recip_prob = 0:0.2:1; var_div_prob...
07a6b14de31b8a7590fce27b6af83f28c6a460be257947de3ef0ba12cf518fb5
MATLAB
5,588
116
function [lh_proj_data, rh_proj_data] = CBIG_ProjectMNI2fsaverage_Ants(data, average, interp_type, lh_index_mat, rh_index_mat) % Usage: [lh_proj_data, rh_proj_data] = CBIG_ProjectMNI2fsaverage_Ants(data, average, interp_type, lh_index_mat, rh_index_mat) % % Function projects MNI data to fsaverage % Also see reverse tr...
ebbd84e576b6bd2557948e4d274ec278eda93b1a2228f56c270b646c9be80965
MATLAB
5,590
123
[textFileName, textFilePathName] = uigetfile('*.txt', 'Pick txt file specifying input'); fid = fopen(strcat(textFilePathName,textFileName)); % filename pathname conditions textFileInput = textscan(fid, '%s %s %s %s %s', 'Delimiter', '\t', 'HeaderLines', 1); fclose(fid); numFiles = length(textFileInput{1}); fullPathFi...
21cae4ebe4ba257fa0f547a167ff06fd695859cbca4d01ad261d66069c271f73
MATLAB
5,600
162
% Correlate varA with varB accounting for confounds (SPM) clear, clc, close all %% Paths / data path_batches = 'D:\Projects\2023_multib\MK_multi_b\Scripts'; cd(path_batches) % load('Table_demographics_biomarkers_2024_04_09.mat') load('Table_297_subjs_demographics_biomarkers_2024_05_03.mat') n_subjects = ...
d60fa960eb2806e317096d4514a3f221223e193f5a740720a16980c2734be321
MATLAB
5,606
202
% Connecting parallel pool parpool('Threads'); 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_recip_prob = 0:0.2:1; var_div_prob...
13da0f440f350846edee17ad7b79c6425066286090c43a02ba93e8109bc70e4c
MATLAB
5,610
171
classdef SynapseLive < handle %SynapseLive TDT online data streamer. % obj = SynapseLive() connects to TTank server and opens currently % recording block in Synapse % % obj.data reference to all available data from block % obj.update get latest data from current block % obj.TT...
5dd854fa650c5bf463a0ba110a5af5f2a12f5423bb77b58726f5994ac34f8a75
MATLAB
5,629
190
function outpict = mono(inpict,channel,weights) % MONO(INPICT,CHANNEL,{WEIGHTS}) % Extracts a single channel from RGB images or triplets % % INPICT is an RGB/RGBA image. Multiframe images are supported % If INPICT is I/IA, it will be expanded and processed as usual, % though the results may be tr...
ed81f82d28a0a481c4fdc7c772c5bd32700d95641a9297b197923525e88c6a0e
MATLAB
5,646
156
%% ============================================================ % Semantic segmentation training (DeepLabv3+) % Author: Pei-Hsun Wu @ JHU | Cleaned: 2025-12-05 % % Labels (must match your label TIFFs): % 1 = background, 2 = dapi, 3 = pi % ============================================================ c...
3efbb5bd4614baf181ef3e0f3156ee80a5c68f0cefd2f6bb12001a11313d453a
MATLAB
5,648
197
function outpict = replacepixels(FG,BG,mask,varargin) % OUTPICT = REPLACEPIXELS(FG,BG,MASK,{LINEAR}) % Simple image composition tool. Loosely speaking, the output image will % be equal to BG in regions where MASK is dark, and equal to FG in regions % where MASK is bright. This tool can be used with either ...
fd75df5e32ddf0adcdcff3ed5dc0d935288708cd95473feefa5c80d13d3a8e23
MATLAB
5,657
182
function inpict = imfold(inpict,varargin) % IMFOLD(INPICT,{SEQUENCE},{METHOD},{OPTIONS}) % Generate an image stack as if repeatedly fan-folding an image. % Optionally unfold the stack back into a flat image. % % INPICT is an I/IA/RGB/RGBA image of any standard image class % SEQUENCE the intended fold se...
691db73b312e3701a93500785fccce72fa26c5b455ce63e370162e15f487db86
MATLAB
5,677
123
classdef AnalysisDataFactory properties ConnectionMatrix ConnectionMatrix GeneExpressionLevels GeneExpressionLevels CrossRegionInformation CrossRegionInformation Description string = "" % explanation end methods function obj = AnalysisDataFactory(con...
9aba2630040cfb267aa805c0160adce61bdadbe7d08f874d648ab36445a67c14
MATLAB
5,696
84
%% Analysis script % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % % requires bandpassFilter.m from Mario % requires releaseDec2015 from Neuralynx website addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/scripts/epilepsy/shared/ addpath /network/lustre/iss01/charpier/analyses/stephen.whitmars...
8f9b678d9584927e677d3e216fd52da4eea5695d27ff8613515ee8537551c1d4
MATLAB
5,710
138
function nested_lasso_ms_fatigue() % NESTED_LASSO_MS_FATIGUE % % Nested elastic-net / LASSO logistic regression for MS fatigue classification. % % - Outcome coding (IMPORTANT): % y = 1 -> fatigued (MS_F) % y = 0 -> non-fatigued (MS_NF) % - Theory-driven candidate predictors; NO outcome-based pre-screening...
408a6bbbddbea159bfdace53b90865a601a93cb1989145f0f16d52f3f53df5ca
MATLAB
5,711
169
function CT = im2ct(inpict,varargin) % CT = IM2CT(INPICT,{OPTIONS}); % Create a color table of specified length using the dominant colors of an image. % This is a simple tool, and it should be expected that there are many configurations % of images and options which will yield completely garbage results. Often w...
c77d9db2a448cebca2c9456f65360754226de03381af9586d201b9088604842f
MATLAB
5,713
111
function [all_data,indx] = generate_spectral_data(EEG_integrals_am,EEG_integrals_nam, participant, indx, all_data, 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_integrals_nam, participant,...
aae87920dedee4564fa19985f983dab299165a1e0f1f358be4002156f494607d
MATLAB
5,731
159
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 ...
7344b8ed801df544cb60ce553f5d762f01f14d702ab2cb0a1d4e902fec8afece
MATLAB
5,736
172
function [z] = plot_single_voxel(PRF, idx, plot_names, transformers, ... transform_names, num_samples, posterior, show_grid) % Plotting function for a single PRF with many possibilities, needs to be % rewritten significantly in the near future. % TODO: Rewrite % % Fo...
68970642d3bb8c4af96894699fdd8b9627f2eaf88aa3dfddbc0656677a6808f9
MATLAB
5,739
112
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...
e9380ad3ed6691070452558979dfe7c16abb8de6fd758d283d62fea4bdd956d0
MATLAB
5,741
119
function [TCA2B, TCB2A] = fasterTilingCoeff(spike_matrix, maxLag) %% by Mattia 01.20 - this version has an improved unwrapping part and is % faster than the standard (fastTilingCoeff) one % inputs: % spike_matrix: units * time % maxLag: the maximum lag for which xcorr will be computed. in the same % units as the spike...
452eff59b63f6c8a9bdb011c55f45ac97d69a2814cb71197c2323c3749bcc9c9
MATLAB
5,748
129
%% Gergely Tarcsay, 2024. Main analysis to classify cells as spatially stable cells after shuffling. %% 0. load data & set params main_path = "C:\Users\ewell\Desktop\TestCodeGitHub\"; % change this according to your path rootdir = strcat(main_path, "\Discrimination 2025 data\CA1 miniscope data"); addpath(strca...
e69dd86a1de765039729b5883502303040820cdb94435bff47f4921912c0bc48
MATLAB
5,752
152
function colors = distinguishable_colors(n_colors,bg,func) % DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct % % When plotting a set of lines, you may want to distinguish them by color. % By default, Matlab chooses a small set of colors and cycles among them, % and so if you have more than ...
81d4cb434dc1e9ed2204d212b15b9f463704ad6ea61ca73f1f0a64a152fc75ac
MATLAB
5,756
143
function plotSeizureSegmentation(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...
18673db995b043d57019fbebe853a8c454b0ded5e81950af8f0d6873b5c7e1d5
MATLAB
5,757
126
function [fig_clust] = plot_clusters(clusterInfo,varargin) p = set_default_parameters(varargin{:}); for ll=1:numel(clusterInfo.locAll) if ~isempty(clusterInfo.locAll{ll}) edges = [0:0.5:20 Inf]; edgesNumEl = [0:1:100 Inf]; fig_clust(ll) = figure(345+ll); ...
2567c5eff719283b0469c39c06f2dfb947d01ed2625f5ef12b56cced80df6d93
MATLAB
5,761
125
config = dtx_spikes_setparams; ipart = 1; irat = 1; %% plot example of raw intercritic SpikeTrials = readSpikeTrials_MuseMarkers(config{irat}, [], [], false); %same trial length as the intracellular example : trialsel = find((SpikeTrials{ipart}.Interictal.trialtime(:,2) - SpikeTrials{ipart}.Interictal.trialti...
15b8f5f56add863165f72746b3a609d77e4abac964e32e20abb1989d1ae7c208
MATLAB
5,763
209
% Connecting parallel pool parpool("Threads"); 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:350; var_cell_inh = 0:2; var_conn = 1:5; ...
d616be912f85772a4d7424723e52c6063a866573033c6fed119edfc57f846cdc
MATLAB
5,767
160
function outpict = husl2rgb(inpict,varargin) % HUSL2RGB(INPICT, {MODE}) % converts an RGB input image from HUSL (human-friendly HSL), which is an adaptation % of CIELCHuv with normalized chroma. This is particularly useful for tasks such as % avoiding out-of-gamut values when rotating hue at high c...
94a587f9a138d6e1ba5f9a30d437ae93078dd40c59c1d5f3489e48abbca828e4
MATLAB
5,768
42
function headers = decode_acquisition_headers(bytes, dims) % Convert from a byte array to a ISMRMRD AcquisitionHeaders % This conforms to the memory layout of the C-struct bytes = reshape(bytes, 340, []); N = size(bytes, 2); dims = num2cell(dims); headers.version = ...
aa59c7370e6b7a0535bda693826c2d105dde9b335aa5bbe11f8f061f196656bd
MATLAB
5,777
177
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % RECOVERING LOST 'BOMB' MODE TRANSFER FUNCTIONS % So you used imblend() 'bomb' modes and found a random mesh that you really like % but you weren't using the 'verbose' option, so now it's gone forever! % Well don't worry (too much...
eca486f311ff09bdf7ec715c1e63dfb27671229447491edeb1f30b3554e7ecab
MATLAB
5,784
343
%% % CEC2005 function [lb,ub,dim,fobj] = Get_CEC2005_details(F) % Obtain the upper and lower bounds and dimensions of the test function switch F case 'F1' fobj = @F1; lb=-100; ub=100; dim=30; case 'F2' fobj = @F2; lb=-10; ub=10; dim=30; ...
78dbb1d2e06039f50b849de06fe694d87ef3306cdc4440582d523dcc75d26ad1
MATLAB
5,788
101
function writeSpykingCircusDeadFile_concatinated(MuseStruct) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function writeSpykingCircusDeadFile(MuseStruct) % % Crawls and searches through patient- and recording-directories and writes % artifact definitions for SpykingCircus. The input st...
31911033497a73f0bc3ca12a507ee05921bb18c666fa0e17021719a41e370759
MATLAB
5,798
156
function results = gcmi_cpp_mex_test(varargin) p = inputParser; p.addParameter('Compile', true, @(x) islogical(x) && isscalar(x)); p.addParameter('LegacyPath', fullfile(fileparts(fileparts(fileparts(fileparts(mfilename('fullpath'))))), 'extern', 'gcmi_mex'), @(x) ischar(x) || isstring(x)); p.parse(varargin{:}); opts = ...
be6809e6aa6c980533b3d75f333983b4cdc451f7d8d54e790703831717b58351
MATLAB
5,820
150
%WAVELET 1D Wavelet transform with optional singificance testing % % [WAVE,PERIOD,SCALE,COI] = wavelet(Y,DT,PAD,DJ,S0,J1,MOTHER,PARAM) % % Computes the wavelet transform of the vector Y (length N), % with sampling rate DT. % % By default, the Morlet wavelet (k0=6) is used. % The wavelet basis is normalized t...
179eb04f733d8c329a52d230798d24addf3dc15b2a82b7d73f604a5ce4d1c66f
MATLAB
5,834
102
function S = reCalcCoefSparse(data, D, S, lambda, varargin) % S = recalcCoefSparse(data, D, S) % % Function to recalulate the sparse coefficients given a dictionary D and % data "data". The current coefficeints S are used to identify support. % This function is not designed to be used instead of the inference step, ...
7352afbe2e0dd27611fc19c77870e7f5ea4707eac97d64f5863ed84f6839517f
MATLAB
5,845
123
z%% Objective function: minimum envelope entropy, minimum sample entropy, minimum information entropy, minimum permutation entropy, permutation entropy/mutual information entropy (select one) clear clc fullpath = mfilename(“fullpath”); [path,name] = fileparts(fullpath); addpath(path) addpath(genpath(pwd)) % Add all fi...
83d739e8f7b8350b99a5bb86788178f7767f68f8c20df35dc1b7d313c5ed7559
MATLAB
5,852
123
z%% Objective function: minimum envelope entropy, minimum sample entropy, minimum information entropy, minimum permutation entropy, permutation entropy/mutual information entropy (select one) clear clc fullpath = mfilename(“fullpath”); [path,name] = fileparts(fullpath); addpath(path) addpath(genpath(pwd)) % Add all fi...
ea2de2ff2b5ceee6343fc9b596aecd62c8e48f09b64e2f89c3624c75b1a93266
MATLAB
5,869
136
function CBIG_AuthorTopic_RunInference(seed, K, alpha, eta, doSmoothing, baseDirectory, dataPath, burnin, isSavingPhi) % CBIG_AuthorTopic_RunInference(seed, K, alpha, eta, doSmoothing, baseDirectory, dataPath, burnin, isSavingPhi) % % Wrapper function to estimate the author-topic models parameters using the Colla...
3f69c88f5f9a13ccba8d6921f25b942956fe1dcdac00d1f26d163369b227ad3b
MATLAB
5,873
146
classdef SpatialAutocorrelationCalculator methods (Static) function moransIMatrix = calculateMoransIMatrix(valueMatrix,distanceMatrix,hList) arguments(Input) valueMatrix (:,:) double % [NRegion, DimComponents] distanceMatrix (:,:) double % [NRegion, NRegion] ...
8a6039d0d95c0ac74c0a42637c857c110d00f3895bb293343f5a466b082097f0
MATLAB
5,873
110
function [EEG] = set_parameters(EEG, feature, params, all_eventtypes) %% Extract the features used for GLM % **Usage:** [EEG] = set_parameters(EEG, feature, params, all_eventtypes) % % Input(s): % - EEG = EEG struct % - feature = cell with the feature name (either delta and integral) % - params = struct with resu...
9bea8da4653b31b004507d7b321b192a069edaaf6776c883d872202a235c1299
MATLAB
5,873
202
function [x,w,ww]=nt_star(x,thresh,closest,depth) % [y,w,ww]=nt_star(x,thresh,closest,depth) - sensor noise suppression % % y: denoised data % w: 0 for parts that needed fixing, 1 elsewhere (time*1) % ww: 0 for parts that needed fixing, 1 elsewhere (time*chans) % % x: data to denoise (time*chans or time*chans*tria...
f7360cc9edd27664140c8a0560ec8c504a249b93ba7600a129d9a9d9c477b660
MATLAB
5,902
198
clear; close all; trials = 2; base_path = '../Simulations/Simulation results'; save_dir = '../Figures/Supplementaries/Supplementary NI'; % Create folder if it does not exist if ~exist(save_dir, 'dir') mkdir(save_dir); fprintf('Created directory: %s\n', save_dir); end root_path = fullfile(base_path, 'd...
fe1d0b1544cba3e1a69f10feb5cb66ece90a2229b60bd5de0e8cc4bb8bb38d37
MATLAB
5,902
93
function [SUAinfo, features] = loadKlusta(animal, PRMfolder, DATfolder, save_data, directory2save) % by Mattia 25/01 % 30.06.2022 Irina: fixed RVP calculation, was using spikes from all clusters % 04.10.2024 Tony: fixed problem with adding last spike from the previous % recording into the next one % instead of current...
01d452c7382ca6ac4ce85a517b102f6b3b034e2017f60726fa53be01d882ab1b
MATLAB
5,956
214
%% Cluster-based permutation test function [Sig, p_stat] = CBP_AB_single(data, opt) switch opt case 'Cue' time = 1:1:1500; case 'Pursuit' time = -99:500; case 'Saccade' time = -399:200; case 'VS' time = 1:size(data,2); case 'la...
3e38ff351efd8a4e48faafbf0b6b11fd38f9669ed84355fbbc5b3b147b6a7f3c
MATLAB
5,957
223
function outpict = rgb2lch(rgb,varargin) % RGB2LCH(INPICT, {MODE}, {LIMIT}, {NOGC}, {WP}) % Convert an sRGB image to the cylindrical mappings of CIELUV, CIELAB, SRLAB2, OKLAB, or YPbPr % % INPICT is a single RGB image of any standard image class % MODE is either 'luv' (default), 'lab', 'srlab', 'okla...
1154cc006f424944728aa8dfe38a777744593353e6b44e0a2d0e323323255502
MATLAB
5,963
120
%% DSCATTER() -- Dynamic scatter plot where the point details depends on zoom level. % % Arguments: % px : list of x locations of points % py : list of y locations of points % minPixels : minimum number of pixels for the correspondingly indexed % point re...
f00f29ce7eed01f589bc5c02db17ba488713f2cb843ecebfa6ca8fe7f39b1a3a
MATLAB
5,987
132
function [stats] = spikeTrialDensity(cfg, SpikeTrials, force) % SPIKERATESTATSEVENTS calculates spike statistics % % use as % [stats] = spikeTrialDensity(cfg, SpikeTrials, force) % This file is part of EpiCode, see % http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details. % % EpiCode is free...
61b18dbffe669d4a6d95bfc9270e523062eadc6432af84801d86357fb9fd1dce
MATLAB
5,994
116
%% demo_005 Plotting Functions % Here the basic plot functions which come with the toolbox are explained. % Most of the functions return the handle of the axis they plotted in % to enable you to plot further details and change axis properties after the plot. % In our Wiki on Github you will find a file explaining ...
c9de3a3687256fcdd60b5ac129875851996af8cd9fd32e4a591241676d6e2749
MATLAB
6,001
160
% ************************************************************************ % % Code for preprocessing EEG data % % Author: Eduardo Gonzalez Moreira % email: eduardo.moreira@nki.rfmh.org % date: 11/01/2022 % % ************************************************************************ %% cleaning c...
d8a74620a50b949ed94ef82ab65acb4b907c47150facdc240ca95a63f11afc74
MATLAB
6,007
126
function neurons_table = PET_neurons_table_timelocked(cfg, ipart, statsPSTH, spiketrials, markername, force) fname = fullfile(cfg.tablesavedir,[cfg.prefix, 'p', num2str(ipart), '-neurons_table_timelocked_', char(markername), '.xlsx']); if exist(fname, 'file') && force == false fprintf('Reading %s\n', fname); ...
423e1b0c1c004a5e460da3e621f364ee6ee71f14578c45a47923cbd3dc3bfec7
MATLAB
6,009
133
function [SpikeRaw, SpikeTrials] = readSpykingCircus_selected_stim(cfg) addpath /network/lustre/iss01/charpier/stephen.whitmarsh/WhitmarshEpilepsy addpath /network/lustre/iss01/charpier/stephen.whitmarsh/fieldtrip/ ft_defaults %% use spiking circus output % SpikeRaw{height(cfg.markers)} = []; SpikeTrials{height(cfg....
6a839955353e2060396ea8e15ac1bcc311a58f25a1ff677ffd0a89f87abd6ebc
MATLAB
6,017
150
function t = Table1(cfg, MuseStruct) fname_in = fullfile(cfg{1}.datasavedir, 'pattern_quantifications.xlsx'); dat = readtable(fname_in); for ipatient = 1 : size(cfg, 2) intervals{ipatient} = inter_trial_intervals(cfg{ipatient}, MuseStruct{ipatient}, false); end % distance between discharges - absolute time dat.i...
933cc14c335291373cdf7e2a07cf0dcf4482346ca4269bf34ffc2e6f5393af59
MATLAB
6,020
148
function T = analyze_periodicity(cfg, MuseStruct) fname = fullfile(cfg{1}.datasavedir, 'Manual periodicity annotation.xlsx'); dat = readtable(fname); fname_out = fullfile(cfg{1}.datasavedir, 'Periodicity.xlsx'); for ipatient = 1 : size(cfg, 2) intervals{ipatient} = inter_trial_intervals(cfg{ipatient}, MuseStruct{...
1d616ba1d613a4374ab20a3decbbc06131889b44bf1e4bca25e95fb6b6b8c162
MATLAB
6,034
133
function tf=ifversion(test,Rxxxxab,Oct_flag,Oct_test,Oct_ver) %Determine if the current version satisfies a version restriction % % To keep the function fast, no input checking is done. This function returns a NaN if a release % name is used that is not in the dictionary. % % Syntax: % tf=ifversion(test,Rxxxxab)...
6cd0d17e515330aa7d5ce462aa61957560cf39a0472f48ffbde4d654ea2ca4f0
MATLAB
6,040
162
function [ripples] = getRipples(experiment, signal, fs, freq_band, thresholds, durations, save_data, repeatCalc) % by Mattia based on buszaki code: % https://github.com/buzsakilab/buzcode/blob/master/detectors/detectEvents/bz_FindRipples.m % Ripples are detected using the normalized squared signal (NSS) by % ...
a96b3323d8d521a556a792b6a78a937d3a2de483cec3a217f3f1f1fd847a0cd9
MATLAB
6,063
214
function [bstats,wstats]=nt_plotxx(fname,bounds,chans,imageflag) %nt_plotxx(fname,bounds,chans) - plot using index file % % fname: name of file to plot (or of its index file) % bounds: [start,stop] (s) range to plot [default: all] % chans: channels to plot [default: all] % % Data are plotted using cheap data repres...
bccd02fe37b1599ebd58bcc0cbe727430af76dd83c889c598f6beccad575ade1
MATLAB
6,082
57
function bytes = encode_acquisition_headers(headers) nheaders = numel(headers.version); bytes = zeros(340, nheaders, 'int8'); function bytes = byte_view(array) bytes = typecast(reshape(array, 1, nheaders, []), 'int8'); end bytes( 1: 2, :) = byte_view(headers.version); end functi...
108a8e0ba5362fa76ffedf75b247007f00e304d995236046f844a1790171dda0
MATLAB
6,098
159
function outpic = rectds(inpic,bsize,grid,Nblocks,Nframes,RGBlock,rim,outlines,mode); % RECTDS(INPICT, BLOCKSIZE, GRID, NBLOCKS, NFRAMES, LOCKRGB, {RIM}, {OUTLINES}, {MODE}) % % INPICT is an RGB image array (uint8) % BLOCKSIZE is an array specifying block sizes in pixels at start and end % [x0 y0; xf yf] % ...
fc511467b9dbe1eef3415bdf05a93d8fba5b2c7868e58cb9ef027fb792a515ea
MATLAB
6,132
154
function CBIG_SPGrad_generate_gradient_matrix(mesh, medial_mask, downsample, output_dir) % CBIG_SPGrad_generate_gradient_matrix(mesh, medial_mask, downsample, output_dir) % % This script reads in the resting-state function connectivity gradient map stored in % <output_dir>/gradients_edge_density.dtseries.nii, downsam...
b727924fd716f964e40f9904bac6bae683bf14f41679dc0c14160c0f348b5a17
MATLAB
6,151
120
function [SpikeRaw] = readSpikeRaw_SpykingCircus(cfg,force,varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [SpikeRaw] = readSpikeRaw_SpykingCircus(cfg,force,varargin) % Read results from Spyking-Circus analysis; spike-times and templates. % % Necessary input: % % cfg.prefix ...
0d5881d4c860fe42d62019c79af2c173edcf83ab2ee4373270a584fb325fd2b5
MATLAB
6,163
154
function cfg = gcmi_cpp_mex_config() toolingDir = fileparts(mfilename('fullpath')); cppMexDir = fileparts(toolingDir); matlabDir = fileparts(cppMexDir); repoRoot = fileparts(matlabDir); release = version('-release'); arch = computer('arch'); matlabRootDir = matlabroot; matlabBinDir = fullfile(matlabRootDir, 'bin', arc...
7ed9619931d790615c307e971d808ae058b47275bd372fd14713dad2baf77f4c
MATLAB
6,169
109
function dtx_spikes_project(irat) if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\development')); addpath \\lexport\iss01.charpier\analyses\lgi1\Git-Paul\fieldtrip; ft_defaults addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\shared')); add...
bc9998dffff4a47b9976c07a76581fb6d4cd0dd6b8df3428401677175c43888b
MATLAB
6,170
151
function [img_n] = filter_image(img, fname, results_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; %% Smooth image...