sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4a7e716846dcb2ce16e817d4b89d20c771b8c7d3b8b497cb59d68945f641f481
MATLAB
3,345
83
function [normtrace, baseline, sigma] = normtobaseline3(trace, percentile, window, nsigma) % Normalize a trace to baseline in two steps: % 1/ In a defined window, calculate the percentile value to be substracted. % A large window (but still smaller than the total length of trace) allows % to remove the slow drift o...
5f99ccf8c2f70d200f753f2961589a42924c6947d75beabc6f26996008cb9eaf
MATLAB
3,345
88
function [t, wv] = LoadTT_Intan(fn,records_to_get,record_units) %LOADTT_INTAN MClust loading engine for Intan data. % LOADTT_INTAN loads Intan data and fullfils all requirement for % Neuralynx loading engines (see MClust 3.5 documentation for details on % MClust loading engines). % % Syntax: % [T, WV] = LOA...
05a60554d8571ba6277521cfd5475793e92fd99cb6aa68241c56c08e46dfe6c0
MATLAB
3,346
98
function [mean_burst_amp,num_bursts,mean_burst_length] = BURST_ANALYSIS_W_SPECGM(bandpass_analysis,threshold_val,ts_data,band_edges,fs) % Identify burst count and duration, as well as mean burst amplitude % Input is the hilbert transformed amplitude values, and the amplitude % threshold value for determining a bur...
cce56cfa63ecfa5f67a15f244472bc3c9090088fdd4863566f42ef995b97036b
MATLAB
3,347
111
function x=randht(n, varargin) % RANDHT generates n observations distributed as some continous heavy- % tailed distribution. Options are power law, log-normal, stretched % exponential, power law with cutoff, and exponential. Can specify lower % cutoff, if desired. % % Example: % x = randht(10000,'powerlaw',...
c93552cf5c5cdf1e9142ceb251b6e891bf81231b0b753acb8d21e8ae5ff765ae
MATLAB
3,349
74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % pop_GEDAI plugin % This EEGlab GUI is used to call the GEDAI denoising function, and select parameters % % [Generalized Eigenvalue De-Artifacting Intrument (GEDAI)] % PolyForm Noncommercial License 1.0.0 % https://polyformproject.org/licenses/...
66733498b58ec5a00b7acf8c298c7f44ac4f5fe8312c5a88dd93d977c13fd018
MATLAB
3,350
82
function [] = fun_video_analysis(date) % wrapped video_analysis_main into this function %% single mouse tracking % load DLC results and make into mat files % ZZ 2022 % close all %% select sessions to process video_dir = 'C:\Data\videos'; proc_dir = 'D:\DeeplabcutProcData\matfiles'; figure_dir = 'D:\Deeplab...
925d8742173746bbb15f88127c941869d8bbe233d7c096064b66a1a2757378ff
MATLAB
3,350
102
function MS = createMeshCylindrical2D(varargin) % MeshStructure = buildMeshCylindrical2D(Nr, Ny, Lr, Ly) % MeshStructure = buildMeshCylindrical2D(facelocationR, facelocationY) % builds a uniform 2D mesh on a cylindrical coordinate: % Nr is the number of cells in r (radial) direction % Ny is the number of cells in y (ve...
039481f1acef687a4cbe9e9334c68629c23f0db4cef0810c18f8ab454274f35e
MATLAB
3,351
118
function fear_detectOFFstates(basename,varargin) % basename='~/data/Fear/triple/achel180320/achel180320'; %% load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.SleepState.states.mat']) load([basicMetaData.Basenam...
e1cfde4ab06c9275dd43c1955e981d9763d37d9b76f897e65da74f96d09bf7a9
MATLAB
3,351
47
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
1b6063e550c700300c194ec33423254c7d3fa6fe9117bf92e236d22526bcd53d
MATLAB
3,352
66
function [Gait_avg, ERDS, GPM, cycle_cnt, si] = gait_ersp(EEG_block, F_Rest,... N_freq, f_axis, FWHM,... gait_event,gait_timeNextHs, gait_event_order, varargin) %UNTITLED Summary of this function goes here % Detailed explanation goes here %v1.2 Nadine Jacobsen, April 2022: added IC option % add docume...
d5427881791666d96d76f21221ed08f27e8aae5999518be5742e35d820f6604e
MATLAB
3,352
119
function plotHalfViolinByX(compiledData, eMeti, eMetl, X, lagIdx, Params, figureHandle) %HALFVIOLINPLOTBYX Make half-violin by X, where X is either group or DIV % eMeti : str % name of the network metric, eg. 'ND' % eMetl : str % label of the network metric, eg. 'Node Degree' % X : str % ...
d567d37525872b21b682ddd2a9b02c658baca329896a83f81b4bb638dad89698
MATLAB
3,353
87
function w = window_func(name,m,param) % Design a window for a given window function % % In: % Name : name of the window, can be any of the following: % 'bartlett' : Bartlett window % 'barthann' : Bartlett-Hann window % 'blackman' : Blackman window % 'blackmanharris' : Blackman-Har...
3488a2adeab5937e4d7645afc42c1a49f85dca281519410c1538c5ec600ce091
MATLAB
3,354
140
function [] = plotNodeCartographyProportions(NetMet, lagval, FN, Params, figFolder, oneFigureHandle) % Plot proportion of nodes belonging to each node cartography group % Parameters % ---------- % NetMet : structure % lagval : int % FN : % Params : structure % figFolder : path to directory % absolut...
11650387360e659b61d982ef659835d9af2abad0cac167746d2c11ae06dbfcf5
MATLAB
3,356
85
% DFTFILT - discrete Fourier filter % % Usage: % >> b = dftfilt(n,W,c,k,q) % % Inputs: % n - number of input samples % W - maximum angular freq. relative to n, 0 < W <= .5 % c - cycles % k - oversampling % q - [0;1] 0->fft, 1->c cycles % % Authors: Sigurd Enghoff, Arnaud Delorme & Scott Makeig, % ...
5d4447de9acdbbf13ead7644f4c05ee334898f7633d3b4fd1476cef04afd17cf
MATLAB
3,356
65
% extract eye positions for all animals, all sessions and all scans % build a map, an element of the map represents the number of eye positions % within a circle centered at the element function BuildEyePositionClusterMap(radius) % get lookup table to assign circle membership to eye positions rv = preprocess.CirclesLo...
e40b6e95d4de8127cd720cf71872a6f1cbe03acdffe62e208eafd644d6b4670d
MATLAB
3,356
87
function out = MD_Porta(x,numLevels) % MD_Porta Porta's symbolic-dynamics word-type indices. % % Quantizes the time series into a small number of levels and classifies % consecutive length-3 "words" of symbols by their pattern of variation: % 0V -- no variation (all three symbols equal) % 1V -- one variati...
7b849dd7f67772ee78946f7813561cd6714ec717894cbb7e4f26f3a35d0dedc1
MATLAB
3,357
127
classdef node < handle % NODE Helper class for circularGraph. Not intended for direct user manipulation. %% % Copyright 2016 The MathWorks, Inc. properties (Access = public) Label = ''; % String Connection = line(0,0); % Array of lines Position; % [x,y] coordinates Co...
9d5f93fb8822440b5f97ec9cff9e14b48d9cee67bc1e9e3e2b24b7a64bbd6404
MATLAB
3,357
106
clc; clear; atlas = cifti_read('C:\Users\lihon\Desktop\abcd_study\atlas\Schaefer\Schaefer2018_400Parcels_17Networks_order.dlabel.nii'); atlas_parcel = atlas.cdata; atlas_label = unique(atlas_parcel(atlas_parcel>0)); num_parcel = length(atlas_label); % load rbag patterns K = 3; cen_dir = 'C:\Users\lihon\Desktop\abcd...
f9184e51eb6c832bc19c3c6d85c1410e1c7d531dde7f6160ac166b6eaf89a125
MATLAB
3,359
82
function calcProjMatContrastsSubj_forPalm_Shirley(matFname, analysis_name , n_sub) % save single subject contrusts of Tim's PCA projections analysis spm_path = '/data/holly-host/smark/spm'; data_path = '/data/holly-host/smark/fmri_sub_preproc_dir'; addpath(genpath(spm_path)); util_path = fullfile(data_path,'alon_util')...
717722ff72ce0fb3cece602ad0a9ad053a26f96e224204155d5bbc5c24fd619c
MATLAB
3,360
97
% bids_importjson - Import json file following BIDS key-based inheritance rule % (https://bids-specification.readthedocs.io/en/stable/common-principles.html#the-inheritance-principle) % % Usage: % curjsondata = bids_importjson(curFile, ext) % % Inputs: % curFile - [string] full path to the cu...
ec143d4cbd65786b8cbe472565f67488a464bea45a44af77d9c9b7d18736fa1b
MATLAB
3,360
61
function [deconv_sta_traces,noisy_sta_traces,speed_sta_traces,dist_sta_traces, sp_sta_traces,rawdeconv_sta_traces, deconv_baseline_mean,noisy_baseline_mean,raw_sta_traces] = get_var_df_stas(full_deconv_traces,full_noisy_traces,full_speed_trace,full_dist_trace,... photo_test_frames,this_pre_frames,this_post_frames,...
410940a77a8c325e3aaf82c7cbb1db66289f94608649ca4c684aba7b80d0bb3b
MATLAB
3,361
60
function osp_pop_corrOvQuant_Call(src,~,gui) %% osp_pop_corrOvQuant_Call % This function is triggered when the correlation quantification popup menu is changed. It refreshes % the figure. % % % USAGE: % osp_pop_corrOvQuant_Call(src,~,gui); % % INPUT: src = handle of the fit tabs % gui ...
aa434a3662eec7edb53ead07fb8961e8df6da1bfec80d5788f8df140499bb0b1
MATLAB
3,362
111
function fear_deltaTrigLFP(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.pfcSlowWave.new.events.mat']) load([basicMetaD...
d37dd9f3f754b22d390c4ec3a5968813fe9dfe3bd8534dabed6857833aee9692
MATLAB
3,363
133
% parse up the beliefs into a 2d discrete distribution, but from raw matlab % file function [output] = decode_parsedata_rawdat(fname,varargin) % parse up the beliefs into a 2d discrete distribution, but from raw matlab % file. a general form of dSTR_decode_parsedata that uses Maggie's curated % dSTR data. does beleifs...
fd994300ac0b923c2de0e0984e6e0ad5a9497f7f5adc9cd12fe888333d77f776
MATLAB
3,363
95
function [] = run_decoding_mlb_shuffle(dataname, savename, shuff_idx) % for each shuffle, run code to decode rng(shuff_idx) % which shuffle to do %location of analysis codebase codepath = '~/projects/constantinoplelab/Analysis/'; % add code paths addpath(genpath(codepath)) addpath(gen...
1b1eb10479e037dc8db6eb01ea7b5d1e6169804bc090f7adabab3aaf537f6780
MATLAB
3,364
113
% RUNPCA - perform principal component analysis (PCA) using singular value % decomposition (SVD) using Matlab SVD or SVDS % >> inv(eigvec)*data = pc; % Usage: % >> [pc,eigvec,sv] = runpca(data); % >> [pc,eigvec,sv] = runpca(data,num,norm) % % Inputs: % data - input data ma...
0dc11ee1dabd76269691ced6806fcfae47b6c9d5a2d54c262c55b700dd354f79
MATLAB
3,366
84
function varargout = hlp_scope(assignments, f, varargin) % Execute a function within a dynamic scope of values assigned to symbols. % Results... = hlp_scope(Assignments, Function, Arguments...) % % This is the only completely reliable way in MATLAB to ensure that symbols that should be assigned % while a function is ru...
055d5050b693b2bee987ac11bc9bc27a347f7400dab8e3b192a5c17361dda67c
MATLAB
3,367
76
function [tsTime,masterTime,masterIDs] = TS_TotalCalcTime(whatData) % TS_TotalCalcTime Total calculation time per time series, counting each master % operation once. % % TS_CalcTime stores, for every operation (feature), the time taken to evaluate % its *master* operation -- so all operations drawi...
7b15fc5f2f98aee933a3c232f61532aa2b5a8825bef73d8af9e40eed232ed71c
MATLAB
3,367
96
function MS = createMeshCylindrical3D(varargin) % MeshStructure = createMesh3D(Nr, Ntheta, Nz, Radius, theta, height) % MeshStructure = createMesh3D(facelocationR, facelocationTheta, facelocationPhy) % builds a uniform 3D mesh: % Nx is the number of cells in x (horizontal) direction % Ny is the number of cells in y (ve...
34044dd4ef1a6a49be6bf876763c07039e54f7c432b5ec2ac811194a840b3596
MATLAB
3,368
88
function data = removeLinesMovingWindow(data, lineNoise) % Removes significant sine waves from (continuous) data using overlapping windows. % % Usage: % data = removeLinesMovingWindow(data, lineNoise) % % Parameters % data data in [N,1] (a single time column vector) % lineNoise structure with va...
38e2c0b896139eb89363937b1c3ca549008cc5f1b3efd87e935c967c0d6eeed7
MATLAB
3,368
101
function [np_data] = np_readdata (filename, np_info, idx_begin, data_length, option) % % function [np_data] = np_readdata (filename, idx_begin, data_length, option) % % np_readdata reads data from a NEURO PRAX data file (*.EEG). % % % Syntax: % % [np_data] = np_readdata(filename,idx_begin,data_length,'samples'); % ...
1656cd10b0f1bfeebd6b130c257bf2ebf9b031e8cd27a8b14ab5786bf94d290a
MATLAB
3,369
103
% pop_firma() - Filter data using moving average FIR filter % % Usage: % >> [EEG, com] = pop_firma(EEG); % pop-up window mode % >> [EEG, com] = pop_firma(EEG, 'forder', order); % % Inputs: % EEG - EEGLAB EEG structure % 'forder' - scalar filter order. Mandatory even % % Outputs: % EEG - filtered ...
7bff15bd2d57437fabf92735977819c1e57f12da0f67e544c878badd6936a8cf
MATLAB
3,369
93
% SUBSREF - index eegdata class % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in source and binary forms, with or without % modificati...
f45184c3ab8f978e0f0234f3d082826edb1d2cdf7197a068cf1a621cad38cc69
MATLAB
3,369
119
function [ testResult ] = tapas_ceode_testScript_cmc() % [ ] = tapas_ceode_testScript_cmc() % % THIS IS A SCRIPT SOLELY FOR TESTING THE SPM/TAPAS SETUP. DO NOT CHANGE! % % Takes a synthetic dataset (3 population ERP model), and computes the % predicted response for different integrators and levels of delays. The % c...
127d492cf521a8872094ad209e2ad1f07147559618e453d46a64284b83e5e575
MATLAB
3,372
132
function [ hFig ] = nmri_schemaball_plot( metric, ref_surf, opt ) %[ hFig ] = nmri_schemaball_plot( metric, ref_surf, opt ) % will generate a schemaball plot from a metric, with some options % opt.scale = number to scale the metric from -1 to 1, i.e. the maximal % value. If not provided, will take abs-max...
d0e105b2e79cd1b8c0dddb88956af71cbb630551ab6d007593347e9d582a2897
MATLAB
3,372
127
function phiBC = cellBoundaryCylindrical3D(phi, BC) % function phiBC = cellBoundary2D(MeshStructure, BC, phi) % It creates the matrix of coefficient based on the BC structure provided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % phiBC = cellBoundary2D...
456265e8ea1be55eb0ce91d2502cb64a221b7ffa119493c9c707527ac7f8fd8a
MATLAB
3,373
84
%% sepiatest.assert_output_contract(testCase, outputPrefix, suffix, expectations, maskFile) % % Description: asserts a set of non-numeric regression properties about % SEPIA's output for one pipeline run: % 1. each expected output NIfTI file exists % 2. its BIDS-Derivatives-style JSON sidecar is present/absent exac...
edbc827ec4a13474105e8d3ebb8dfdd7da89e29c45dc7ddb1026718f78ac1b43
MATLAB
3,373
101
function normalized = NormalizeFields(fields,varargin) %NormalizeFields - Normalize one or more firing fields in space and rate. % % For each field, interpolate space in [0..1] and normalize z values % (typically, firing rates for place fields). Z values outside the fields % should be set to zero (see example below...
f078ffb93559d6d5e1bdd21fdb6bbfd523c34e9f1c232cbfa7e347e2265adc3b
MATLAB
3,373
89
function [diffObject, isObjectEqual] = diffobj(obj, input_obj, ... tolerance) % Sets all values of obj to [] which are the same in input_obj; i.e. keeps only the distinct differences in obj % % Y = MrCopyData() % [diffObject, isObjectEqual] = diffobj(obj, input_obj, ... % tolerance) % % This is a method of c...
1a31f29458ae59f0115d957f90edbf5bb5f67e809ff4a3880af9998457f7f2e0
MATLAB
3,374
120
function Z = inormal(varargin) % Applies a rank-based inverse normal transformation. % % Usage: Z = inormal(X) % inormal(X,c) % inormal(X,method) % inormal(X,...,quanti) % % Inputs: % X : Original data. Can be a vector or an array. % c : Constant to be used in the t...
4d2e09b4d53e6e1711abc6c83149b138d37a8c0cfea1720ded9bc94ba778e050
MATLAB
3,374
88
function angles = GetAngles(varargin) %GetAngles - Get angles (from position samples). % % Angles are returned in radians (in [-pi,pi]). This function requires two % or more LEDs (only the first two are used). % % USAGE % % angles = GetAngles(<options>) % % <options> optional list of property-value pairs...
abe4c9427dbd3537463094ee6429715543e5d7dc50a7dc5cb1f81af142c8f6e8
MATLAB
3,375
100
% EEG_HEDREMOVEUNICODE - remove unicode characters in HED strings. % % Usage: % >> EEGOUT = eeg_hedremoveunicode(EEGIN); % % Input: % EEGOUT - EEG dataset structure or array of structures % % Output: % EEGOUT - EEG dataset structure or array of structures % % Author: Arnaud Delorme, SCCN/INC/UCSD, 2021 % Copyrig...
fb3924f3cbac02d7ca4f657d8a41541f24ec5d0ae3581007d229f5104cf47c5b
MATLAB
3,376
73
set_up_paths_and_data_directories; types = {'category', 'valence_arousal'}; num_types = length(types); brain_atlas = load_atlas('canlab2018'); region_masks = {fullfile(folder_project, 'masks', 'HC_Julich.nii.gz'),... fullfile(folder_project, 'masks', 'ERC_Julich.nii.gz'),... select_atl...
1d87d984fcbc30d2705cedec2efa6dad0448b60c92fbd25ac1132a120f67ac86
MATLAB
3,377
101
% BLOCKAVE - make block average of concatenated data sets of same size % Each data set is assumed to be of size (chans,frames). % Usage: % >> aveout = blockave(data,frames) % >> aveout = blockave(data,frames,epochs,weights) % Inputs: % data = data matrix of size (chans,frame...
b5cc58429ca7e0a7eed8d93b9a97786f5816fcbe751a6fbd15c06c2492f1557b
MATLAB
3,377
101
function dimsiz = getdimsiz(data, field, numdim) % GETDIMSIZ % % Use as % dimsiz = getdimsiz(data, field) % or % dimsiz = getdimsiz(data, field, numdim) % % MATLAB will not return the size of a field in the data structure that has trailing % singleton dimensions, since those are automatically squeezed out. With t...
8999eac61695e7d27c02b71eb59c6aef63a3c8482441ff9dd458fb12c0f32312
MATLAB
3,378
103
function DataAnalysis( BASEdir ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Wrote by David André Barrière 09th September 2022 % This function permit to create and launch non linear normalization % (DARTEL), spatial smoothing and two sample Student' t-test comparison % using SPM8 fun...
7c04da0be6f320bcf9fb980d9f0b1b862392c7a281d714b51c2b20839eec530b
MATLAB
3,379
102
function plotZETAScores(modScores, thresh) % Scatter plot containing cells plotted by log(p-value) thresh = log10(thresh); % Get logs of p-values for left and right pval_L = log10(modScores(1,:)); pval_R = log10(modScores(2,:)); % Set NaN values to 0 pval_L(isnan(pval_L)) = 0; pval_R(isnan(pval_R)) = 0; pval_L(isinf...
b4cc6ac52b6267aab9cc0615ee7b1a7cbd1704485e3f6e68a118cc9a8a81d8a0
MATLAB
3,380
96
function [M, Mx, My, Mz] = diffusionTerm3D(D) % This function uses the central difference scheme to discretize a 2D % diffusion term in the form \grad . (D \grad \phi) where u is a face vactor % It also returns the x and y parts of the matrix of coefficient. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE:...
54acd488c0b09ee28f17dd426ec36d33275e2013763cbae51dfd3c3050e57cc8
MATLAB
3,382
93
function [theta_x,theta_y,theta_z] = axislabel_rotation_angle(h_a) % This function computes the proper angles of x, y and z labels in order to % align them to the direction of their axes. % It can be used as part of an 'ActionPostCallback', which is a callback % function of a rotate3d object. % Each of the output...
0f310a057c01fb0a4ad78addf63c5a85efe62137bddb31225a2999be6743957b
MATLAB
3,383
95
function [lfp,indices] = GetLFP(channels,opt) %GetLFP - Get local field potentials. % % Load local field potentials from disk (unlike spikes or positions, LFP data % is usually too large to keep in memory). % % USAGE % % [lfp,indices] = GetLFP(channels,<options>) % % channels list of channels to load (u...
d4719c67fdc2563c6deb2d645eb5bd9e385ad0d2dadb4844a15228bc7dfc4647
MATLAB
3,384
83
classdef segmentationSPMIntegrationTest < matlab.unittest.TestCase %SEGMENTATIONSPMINTEGRATIONTEST End-to-end test for petraToCT.segmentationSPM. % % DESCRIPTION: % Runs the SPM unified segmentation plus morphological % post-processing on the small PETRA fixture, and verifies that % ...
0000c67a4d259babae6a7bf73578436ad27708c76d2d7bcd903878cb39fa56b5
MATLAB
3,386
130
%RunBatch - Run a batch job. This should *not* be called directly. % % Run a batch job. This function is called automatically by the % batch timer upon expiration of the required delay. % % USAGE % % RunBatch(timer,event,b) % % timer Matlab timer object % event Matlab timer event type % b...
f665180ea10c00d87eefdb4f0b90ccd27099c3eb26a713111bc293e32bff7128
MATLAB
3,386
73
function [imageSpm4DArray, selectionArray] = split_into_MrImageSpm4D(this, dimLabelsSpm4D) % Splits high dimensional MrImage (>4) into array of 4D MrImageSpm4D % objects to be used for SPM interfacing % % Y = MrImage(); % >4 dimensions % imageSpm4DArray = Y.split_into_MrImageSpm4D(inputs) % % This is a method of cl...
e1642d596c910cbd77bf9dd7ef51150d1be7297e19f364837fd6ab7f6c7ffd93
MATLAB
3,392
80
% COMPVAR - project selected components and compute the variance of % the original data they account for. % % Usage: % >> [proj, variance] = compvar( data, wts_or_act, winv, components); % % Required Inputs: % data - 2-D (channels, points) or 3-D (channels, frames, trials) % data ...
e817bb1e3ccdac04c4c88a39cd4e33704c953b2dbdd115c7751b962e04bddc83
MATLAB
3,392
98
function [FIT3D,Residuals,b]=PolyFit_weights(Data3D,Mask,order,weights); dim=size(Data3D); %% for volume fitting Indices = find(Mask(:,:,:)); [x1,y1,z1]=ind2sub(size(Data3D(:,:,:)),Indices); % x1 = cast(x1,'like',Data3D); % y1 = cast(y1,'like',Data3D); % z1 = cast(z1,'like',Data3D); if isempty(weights)...
c6259ff63e3c7cb2ce18bb89df3665c6a3c5596e5f54f86ddc135337849ff8a3
MATLAB
3,394
79
%% Load data data_path = 'Y:\Alice\0012_NeuroGI\NeuroGI_ephys_data\2024-11_all_ex-vivo_experiments\20241115_ExVivo-09\'; load([data_path 'datafile0018.mat'], 'data') %% Preprocess data reorder = (1:32:128)' + (0:31); reorder = reorder(:); y = resample(double(data),200,2000); y = highpass(y, 10, 200); ...
e608dadb4e31dc59e8f7ccc86be4750879031e3b63a7e945d152c6011f2c001c
MATLAB
3,394
110
function tpl = set(tpl,action,varargin) %TEMPLATE/SET Edit data stored in a Template object % TPL = SET(TPL,ACTION,VARARGIN) % ACTION 'root' % ACTION 'unknowns' % ACTION 'file' % ACTION 'block' % ACTION 'var' % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> % $Revision: 1.0 $Date: ...
6a6fd072913c5d35dfae39ef339d7e4a544333e12b8d383e02d6f56fa622a53a
MATLAB
3,395
123
function df = cent_diff_n(f,h,n) % df = cent_diff_n(f,h,n) % Computes an n-point central difference of function f with spacing h. % Returns a vector df of same size as f. % Input f must be a vector with evenly spaced points. % Input n must be 3,5,7, or 9. % All three inputs are required. % % Differences for points near...
cee4655a9abda3eac6f044060337e33e1f6b1c561b1be08b17bc5fa5f8d5a5ef
MATLAB
3,395
104
% INPUTDLG2 - inputdlg function clone with coloring and help for % EEGLAB. % % Usage: % >> Answer = inputdlg2(Prompt,Title,LineNo,DefAns,funcname); % % Inputs: % Same as inputdlg. Using the optional additional funcname parameter % the function will create a help button. The help message will be %...
e3dc28639024244ae340b5360c5e02d67e6605509ad16cd41eee4e8cb6ebc0d0
MATLAB
3,395
109
function fear_pfcRipTrigIcaReac(basename,varargin) % basename='~/data/Fear/triple/achel180320/achel180320'; % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']); fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.tWindo...
6b3995203e92331a967afcfeaf5069d36b36a63aa4f2a95957e604219876b304
MATLAB
3,396
88
function task_sPCA_sensor_condTogether(sii, PATH, cfg) % perform spectral PCA à la Seeber % - sii: vector of subject IDs to be processed % - PATH: structure with all paths leading to diff processing steps % generated in naj_neurCorGait_paths % - cfg: structure with all processing variables generated in naj_ne...
7a7aab3c079b600db3c83b4bec303e78c10c96a0933ced47ddba625bd4bdbdbc
MATLAB
3,397
106
function [t_incongruent, t_congruent] = findIncongruentTrials_Vio(S) %Finds the index for the first REWARDED incongruent trial in a mix block %and the most recent rewarded trial congruent with the adaptation block. %input: % S: S struct of neuropixels data %output: % t_incongruent: % ltom: low to mi...
4de59a8f3a71bc0aeae4425358d7fbae3f4833f9d879a22f30a7fd5ed2ca9ed9
MATLAB
3,400
66
function [n, nfinal, neutZone]= quant_specific_co2(plotxvals, CportStdLoc) %% quant_specific_co2 % includes additional analyses specific for for single-worm CO2 tracking assays % that are done using a CO2 gradient. % % Currently, calculating number of worms that end in scoring regions, as % well as time spen...
c3bd541e0787a07bb692fd8b263cc30bdddc4eba944558aea5e0cad4a8a26a99
MATLAB
3,400
85
%{ # RF map. -> tune.DotRF -> fuse.ScanSetUnit --- response_map : blob # average response for each location center_x : float # (fraction of x) center of receptive field on x, from Gaussian fits center_y : float # (fraction of x) center of receptive field on y, from Gaussi...
7cd9d6cd765661c237a671334f0c1c8febfe29d86ca3479a1961a9b7afb4797b
MATLAB
3,402
101
function varargout = preprocNonLinearOut(S, params) % Usage: [Spreproc,params] = preprocNonLinearOut(S, params) % % Output nonlinearity on each channel of a model. Generally done BEFORE % (zscore or other) normalization. % % Inputs: % S : Stimulus or PreprocessedStimulus (STRFlab classes), or simple % numeric...
cecb42fecf97a69f6d537122232f6f90c3973061b2b79765cfd2199da3615c0f
MATLAB
3,403
107
function result = modvalidity(result,data,param) %modified validation function for clustering, it calculates all the %validity measures, so param.val is not needed N = size(result.data.f,1); c = size(result.cluster.v,1); n = size(result.cluster.v,2); v = result.cluster.v; if exist('param.m')==1, m = param.m;else m = ...
e21fdf591042de7aefa4748046f5a11add0b03b52fe5dbfc8903aabd717ea7e1
MATLAB
3,403
91
%% Setup do_followup_viz = true; % To run this demo, you will need a stack of movie frames stored as a 4D % (X x Y x Color x Time) array. % If you have your own stimuli, you will need to modify this variable: fname = 'nishimoto_2011_val_1min_uint8.mat'; % add relevant paths if ~exist('preprocColorSpace_GetMetaParams'...
1073c3a3d321445798e00e159a1bba92b60af94a06482d3a4466b8803e13f9b8
MATLAB
3,405
96
function this = compute_stats(this) % Compute statistical values for ROI per slice and in total volume % % Y = MrRoi() % Y.compute_stats() % % This is a method of class MrRoi. % % IN % % OUT % % EXAMPLE % compute_stats % % See also MrRoi % Author: Saskia Klein & Lars Kasper % Created: 2014-07-18 % Copyright...
4358d999c23872bb9b4406044a871400e827f23b4f5eaa822dd21bdb5c8e69a7
MATLAB
3,405
126
function [ data , regional_labels] = nmri_regional_timecourse( data, ref_surf, opt) %[ regional_metrics ] = nmri_regional_values( full_metrics, ref_surf, opt ) % Will resample a full brain e.g. SUMA surface (1 value/vertex) metric % into a regional metric (1 value / region) % the regional information will be take...
8de2c81b3622c92ad7042adb2035e04b882961bb67d3896d69511a8fb2f5cd22
MATLAB
3,405
106
function [A] = spm_matrix(P, order) % Return an affine transformation matrix % FORMAT [A] = spm_matrix(P [,order]) % P(1) - x translation % P(2) - y translation % P(3) - z translation % P(4) - x rotation about - {pitch} (radians) % P(5) - y rotation about - {roll} (radians) % P(6) - z rotation about - {yaw} (r...
b11107b815d7750e0ce0eb7c90c776e01fdadd652446cd8d5329f084ac499dd2
MATLAB
3,405
86
function download_HEIDI_toolbox() % One-time setup: check whether the HEIDI_SEPIAready package is available; % if not, download it into SEPIA_HOME/external/ and register its path in % SpecifyToolboxesDirectory.m. % % This script only runs when you call it explicitly - it is not invoked % automatically by sepia_addpath,...
37702950c6f92251a67022396a7a290cce768fdea79e5bbbf9a87d8e8d420f5b
MATLAB
3,406
98
% Script demo_model_estimation_1st_level % 1st level model specification and estimation % % demo_model_estimation_1st_level % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2018-05-04 % Copyright (C) 2018 Institute for Biomedical Engineering % University of Zurich and ETH Zuri...
81a9e1b2a871ca8d73424c18832fb8b78b35817feda59d1386f5a839a44446c8
MATLAB
3,409
134
function figure4() % Create public-facing Figure 4 panels. % % Inputs: % 1. Thresholded No > Yes statistical map % 2. Joined ROI/questionnaire CSV produced by roi_statistics.m % % Edit USER SETTINGS, then run: % figure4 %% USER SETTINGS spmDir = 'C:\path\to\spm'; noGreaterThanYesMap = [ ... 'D:\path\to\seco...
8679f1cd75a245098ca8d2de37de67e7ed5952e3e0966af53afd90febe8af446
MATLAB
3,409
117
function [indices,mask] = findcells(data,categories,active,pSI,pPF,combination,region) % Options: % old version (fast, no removal of highly correlated cells/boutons) = [indices,mask] % new version (slow, with removal of highly correlated cells/boutons) = [indices_new,mask] % Get indices of cells in a dataset tha...
bae6e2e2c42ce3fa652dfe4d21710d44913b9f89ed2d8d8b5343e6aade7b1461
MATLAB
3,411
71
function rhoBest = findCARArhoInSearchSpace(riskyHigh,riskyLow,EVsafe,ChooseRisky,rhoToTest,plotFlag) % % function rhoBest = findCARArhoInSearchSpace(riskyHigh,riskyLow,EVsafe,ChooseRisky,rhoToTest); % % This function finds the value of the risk aversion parameter rho that, % under the CARA model, best fits the observe...
0ab5c8413d442815b470b97265e2cbc4dd86a6aab08c51417cd3dbed9cc4adde
MATLAB
3,412
128
function [Y,Nsum] = moveavg(X,F,DIM) %MOVING_AVERAGE Smooths a vector through the moving average method. % % Syntax: % [Y,Nsum] = moving_average(X,F,DIM); % % Input: % X - Vector or matrix of finite elements. % F - Window semi-length. A positive scalar (default 0). % DIM - If DIM=1: s...
20c233e6d36a7c6f39f6de058d56dab0520472967e1cf7885b0fd0a4e08a9fe8
MATLAB
3,412
77
function W = BF_TheilerWindow(y, spec, Nfrac) % BF_TheilerWindow Resolves a Theiler-window specification to a number of samples. % % Neighbor-based methods (recurrence, dimension, Lyapunov, and nonlinear % prediction estimates, ...) exclude candidate neighbors that are close in % time to a reference point, since those...
ae4e53c9daf07a6e4b3a4c1fe965334d29daab239d788615317226833631e9ac
MATLAB
3,412
101
function plot_fig1c(datadir) % Plot time to initiate trial by block type for an example rat and all % rats included in fiber photometry experiment (N = 16). % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. % load list of photometry rats and example rat load(ful...
d518a56de7ccf74e45ff1744bf3bec62f96e4ae6e9591bb7720c7276fe702cba
MATLAB
3,413
109
function info = mrs_readLcmodelTABLE( fileName ) % MRS_READLCMODELTABLE reads the important metabolites concentration from the % LCModel output file (.table) % % info = mrs_readLcmodelTABLE( fileName ) % % ARGS : % fileName = name of LCModel ouput .table file % % RETURNS: % info = information about quantified metabol...
a1435a3dd4d6f0c2d6d1a646ba2850011d14869f64325f21bbd402ff1aca9e62
MATLAB
3,415
48
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
86428c99dbccb8af1ffcf75c93bd44d7122255373d60932278068cf0b9a7d748
MATLAB
3,417
95
function SU = channelLocation_MD(S,SU) %% Updates the SU to include the AP, ML, & DV of the electrode. % Note that this assumes that the electrode goes straight up without changing % the AP/ML. Because there is definitely some angle associated with implants, % I widened the range of acceptable values for the LO from w...
814dfc01948bc22225877f9a5a78a14c7e24e17c09816ac17eec8d0e7c03a78f
MATLAB
3,418
100
function [refShift, refFWHM] = fit_OspreyReferencingMM(dataToFit) %% [refShift, refFWHM] = fit_OspreyReferencingMM(dataToFit) % Calculates the reference shift and full-width half-maximum (FWHM) of a % spectrum according to the LCModel algorithm. The algorithm is described in: % S.W. Provencher, "Estimation of...
ab6cc0c84a423465dc4a4e64554a89062c9b56951ccaff691f358a467d02eee1
MATLAB
3,418
113
function plot2ptraces(suite2pFolder, Params, fileName, fs, figFolder, oneFigureHandle) %PLOT2PTRACES Summary of this function goes here % Detailed explanation goes here %% Set up figure p = [50 100 700 550]; if Params.showOneFig if isgraphics(oneFigureHandle) set(oneFigureHandle, 'OuterPosition', p); ...
bebffab0380a621c110e71bb51644b49d12d960b4e993a4924560421b0e2e700
MATLAB
3,419
81
function [ensmat_in,enscells_in,raster,frates] = MakeEnsembles_fix_rate(ncells,fr,T,nens,ncellsperens,ntimesperens) % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1 ...
b425cd54c9aade2396bc1d99e471ef78fa8d810b078f80be88297b1403e65673
MATLAB
3,420
104
function [pE, pC, x] = tapas_rdcm_spm_dcm_fmri_priors(A, B, C, D) % Returns the priors for a two-state DCM for fMRI. % FORMAT:[pE,pC,x] = spm_dcm_fmri_priors(A,B,C,D,options) % % options.two_state: (0 or 1) one or two states per region % options.endogenous: (0 or 1) exogenous or endogenous fluctuations % % INPUT: ...
bf62052e49a0c493c3b8db17ae648d6c52a253f35d48744e20c58a9d66e2047a
MATLAB
3,420
107
function linidxsrs=surfing_coords2linvoxelidxs(coords,voldef,dim,mask) % maps coordinates to linear voxel indices % % I=SURFING_COORDS2VOXELIDXS(C,VOLDEF) % INPUTS: % C: A 3xN matrix or 3xPxQ array with (x,y,z) coordinates % VOLDEF: Struct with fields .mat (4x4 voxel to coordinate transformation matrix % ...
ffffc9b5454fea32c06b99d21e1ae8841d6b86426150a69d6edcaab350bb505d
MATLAB
3,420
101
% fit_selectMetabs.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % basisSetOut = fit_selectMetabs(basisSetIn, metabList, fitMM) % % DESCRIPTION: % This function loads the basis set functions for the metabolites % that have a positive flag set in the structure metabList, which has % previously been c...
c15719615d349d93ccf717c90764eb575aebf6488f19c69f1a8a3648f11a2c0b
MATLAB
3,421
111
function [e, p, A, B] = PN_sampenc(y,M,r,justM) % PN_sampenc Sample Entropy % %---INPUTS: % % y input time-series data % M maximum template length (embedding dimension) % r matching tolerance level % %---OUTPUTS % % e sample entropy estimates for m=0,1,...,M-1 % p probabilities % A number of matches for m=1,...,M % ...
e92ae013ca3f49f7a9c4ad2b4119002c3c28f5537ef7e98d8b2b4b487209a1c7
MATLAB
3,422
109
function Behavior_Only_Plots(ProcDataIT1_Rep,ProcDataIT2_Rep,ProcDataHC1_Rep, ProcDataHC2_Rep,ProcDataIT1_Lure,ProcDataIT2_Lure,ProcDataHC1_Lure, ProcDataHC2_Lure) %% Behavior_Only_Plots %{ This Code takes in the procdata files and extracts only the behavioral data in order to generate a mean plot of monkey performanc...
c1992ac1d84e9c7f4288877360d4e36d8a7f2ae8e5fa9a26fc9624f91ce380eb
MATLAB
3,423
94
function isObjectEqual = isequal(obj, input_obj, ... tolerance) % Sets all values of obj to [] which are the same in input_obj; i.e. keeps only the distinct differences in obj % % Y = MrCopyData() % [diffObject, isObjectEqual] = isequal(obj, input_obj, ... % tolerance) % % This is a method of class MrCopyDat...
57bcedb1941dca44345870ac032a8a516be3e30ffc3d800e469c620be0c8fc3e
MATLAB
3,426
100
function [h,U2] = WatsonU2Test(group1,group2,alpha) %WatsonU2Test - Test if two samples (circular data) have different means / variances. % % This non-parametric test assumes the data comes from a continuous distribution. % % USAGE % % [h,U2] = WatsonU2Test(group1,group2,alpha) % % group1 angles in rad...
13ce5f63a744b235503a87a22e74e8201e5f0ad785f3eef82693b103aa5cf8e2
MATLAB
3,427
130
function [WTOpt, WTMdl, BlkInf, Belief, Prior, Kappa] =... GenerateSynthData_Bayes_priorUpdate(params, ratTrial,... noise_arg, gen_arg, noise_params, updateParam) %GenerateSynthData_Bayes - generates synthetic wait times %for optimal Bayes model. % Inputs: % params - Parameter vector. [kappa_mi, kappa_hi, kap...
9f67083cc6e5222feb675846f025fccf3f1b255539680bddda87f0e661630e89
MATLAB
3,427
95
function niiv = niftiNi2Vista(nii) % % Transforms a NIFTI-1 structure to an old VISTASOFT nifti-1 structure. % % niiv = niftiNi2Vista(nii) % % INPUT % nii - nifti-1 structure % % OUTPUTS: % niiv - OLD VISTASOFT nifti-1 structure % % Web Resources: % mrvBrowseSVN('niftiNi2Vista') % % Example: % nii = make_nii(on...
e539bccad57fbbc025d154a1ca9b6fb9d9c02e6198c7aca030931415285e743f
MATLAB
3,428
93
function [nidxs,vidxs]=surfing_randomsubspace_select(c1,c2,voldef,nodeidxs,roisize,itercount,linedef,progressstep) % selects voxels and nodes randomly from the surface, for a fixed number % of voxels % % [NIDXS,VIDXS]=SURFING_RANDOMSUBSPACE_SELECT(C1,C2,VOLDEF,NODEIDXS,ROISIZE,ITERCOUNT,LINEDEF] % % INPUTS: % C1,C2 ...
5deb80558465bb4873f5c62c170d819a3e10c323b0ddda94fed447881488b425
MATLAB
3,429
105
function [fh, prop, MyColors] = tapas_physio_get_default_fig_params(... verbose, convfac, xscale, yscale) % set and return General settings for plots % % IN % visibility 'on'/'off'; sets figure visibility when created % convfac conversion factor (1...Inf) to scale size of text and % ...
e6dfc0b5cfb16f63884a4399777ad239cd9375326db2cf699a5014ba2bc5daf6
MATLAB
3,433
99
function [pdd, pddnode, meanpdd] = dyn_pdd(data,sample,mindur,meanfreq) % Computes the phase difference derivative (PDD) without pairwise % leakage correction/pairwise orthogonalisation % % Tewarie et al., 2019 Tracking dynamic brain networks using high temporal % resolution MEG measures of f...
4ec5e973fc44f8636caaa869b40cefb639f203fe314d1e1042b4cfb065727cd1
MATLAB
3,434
87
function out = CO_FirstCrossing(y, corrFun, threshold, whatOut) % CO_FirstCrossing The first crossing of a given autocorrelation across a given threshold % % ---INPUTS: % % y, the input time series % corrFun, the self-correlation function to measure: % (i) 'ac': normal linear autocorrelation function. Uses CO_...
a5c5c7483867ad2e521c014c4ed6f16d60f2b038b99a7dc6ceb2d4f741fe3f40
MATLAB
3,434
116
function this = MrDataNd_split_epoch(this) %Tests split_epoch by creating artificial trials for fmri_short example % % Y = MrUnitTest() % run(Y, 'MrDataNd_split_epoch'); % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrDataNd_split_epoch % % See also MrUnitTest % Author: Lars Kasper ...
c93bc4878c018d59dbef501845c18c66021453865110d07de1edc3b333fd9f1a
MATLAB
3,434
48
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
0d25f8686580251dfac77db7bc9d8450b0ba0f0ac5da79eb9e2959b46e1c1ae2
MATLAB
3,437
81
function [xk,crlbs] = createModelIVIM(data,parameter) %% [xk,crlbs] = createModelIVIM(data,ModelFunction,parameter) % This is the heart and soul of the optimization. This function takes % the data, model function, and parametrization and translates them into % appropriate loss and gradient functions % % USAGE:...