sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3fe83d5cacffd8754a663a2d22ce85792ad4e7954641f260762de6fade5b7a24 | MATLAB | 4,486 | 139 | function [result] = fit_happy_model_otherRPEactPass(mtx,happyscore,constant)
%assumes that each row of the cell array is a different subject
rptfit = 5; %repeat N times jittering the betas
tempf=fieldnames(mtx);
for n=1:length(tempf), eval(sprintf('mtx.%s=double(mtx.%s);',tempf{n},tempf{n})); end;
data = mtx;
data.ha... |
78d3f7dcdc475694eeabc6faefae9152eec39eae80c66aa4c89da71fc4c48246 | MATLAB | 4,488 | 72 | % General-purpose data processing and statistical tests for FMAToolbox.
%
% Bins and histograms.
%
% Accumulate - Accumulate repeated observations.
% Bin - Assign each input value a bin number between 1 and N.
%
% General Statistics.
%
% sem ... |
23214ed6585091f6866c8586c11ba412ad2bfb5c5ca0527accca162b8b182830 | MATLAB | 4,490 | 140 | % Copyright: Ken Takiyama (2025.10.17)
% CP decomposition for a typical subject
clear all; close all; clc;
% Example --- an example when N = 1 ---
load shared_EMG_dat_typical.mat
Dat(1).EMG_dat = shared_EMG_dat;
S = 1;
% Note: in this manuscript, we do not arrange block number.
% "shared_num_of_blocks" in shared... |
c6944f431f755407163653920a49cda6497253a5c2d33600ccde3b475a87357d | MATLAB | 4,490 | 163 | function [err] = m3dReorder (Input, Prefix, Mapfile, Opt)
%
% [err] = m3dReorder (Input, Prefix, Mapfile, Opt)
%
%Purpose:
% Reorders a time series data set (3D+time) a la AFNI plugin Reorder
%
%
%Input Parameters:
%
% Input: Input of 3d+time brick
% Prefix: prefix of output data set
% Mapfile: Name of map fi... |
0441aff8350f7a173f9aaa6263167dbad5a9dd54d8099013659a840f0daeb834 | MATLAB | 4,497 | 123 | function [stepsize, newx, newkey, lsstats] = ...
linesearch_decrease(problem, x, d, f0, ~, options, storedb, key)
% Backtracking line-search aiming merely for a decrease in cost value.
%
% function [stepsize, newx, newkey, lsstats] =
% linesearch_decrease(problem, x, d, f0, df0, options, storedb, key... |
b5264165da51fab83793a78b13399e0633891f9edc5a10d7ee7ce7bd5c0705f0 | MATLAB | 4,497 | 172 | function PlotBullwinkleRoc(bw_out,title_str,varargin)
p = inputParser();
p.addParamValue('scale','lin',@(x)any(strcmpi(x,{'lin','log'})));
p.addParamValue('farbars',false,@(x)isscalar(x));
p.addParamValue('xlim',[],@(x)isnumeric(x)&&numel(x)==2);
p.addParamValue('ylim',[],@(x)isnumeric(x)&&numel(x)==2);
p.addParamValu... |
d83a4504937184fd866af6db798670b29565a43119f42faef64dc91720c5e7fc | MATLAB | 4,502 | 160 | function PlotCircularDistribution(dist,a,s,varargin)
%PlotCircularDistribution - Plot phase distribution and statistics.
%
% Plot one or more phase distributions as histograms and polar plots
% showing circular mean and resultant length. Dotted vectors indicate
% that the data is not significantly clustered around ... |
02c66050f566d29587605aa3c8e46f6613ef6e0a2218cfc5a2335f5bb317fad3 | MATLAB | 4,504 | 119 | function out = SY_DriftingMean(y, segmentHow, l)
% SY_DriftingMean Mean and variance in local time-series subsegments.
%
% Splits the time series into segments, computes the mean and variance in each
% segment and compares the maximum and minimum mean to the mean variance.
%
% This function implements an idea found i... |
c89b18658c0283ca7c556c2e18b3ea694397c06fd6f664310825eee857172d9f | MATLAB | 4,505 | 163 | function out = osp_plotRawMRSIpos(MRSCont, kk, VoxelIndex)
%% out = osp_plotFit(MRSCont, kk, which, stagFlag, xlab, ylab, figTitle)
% Creates a figure showing data stored in an Osprey data container, as
% well as the fit to it, the baseline, the residual, and contributions
% from the individual metabolites.
%
% ... |
78802c597897eda0b64fae7e1cb6dda1bb8161a5e50c104c941491b56ea80b35 | MATLAB | 4,509 | 166 | function result = Sammon(proj,data,result,param)
%function P = sammon(D, P, varargin)
%SAMMON Computes Sammon's mapping of a data set.
% Input and output arguments ([]'s are optional):
% D (matrix) size dlen x dim, data to be projected
% (struct) data or map struct
% P (scal... |
9bb9d69b7abde766abf5237ba93ed03edb64be4ffa92c4458a868daac66a72a7 | MATLAB | 4,510 | 37 | %-----------------------------------------------------------------------
% Job saved on 08-Oct-2023 22:49:58 by cfg_util (rev $Rev: 7345 $)
% spm SPM - SPM12 (7771)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
%%
matlabbatch{1}.spm.util.imcalc.input = {
... |
d238b172147503f1cd7584db79c14565bdabec05fdda7eb46290354d759f10ac | MATLAB | 4,512 | 107 | function ft_skullstrip_spm12(filename, path_output)
% Skull stripping with SPM12
%
% ft_skullstrip_spm12(filename, path_output)
%
% Inputs:
% filename - filename of input volume.
% path_output - path where output is saved.
%
% The computation of the skull strip mask should be done on the PD-weighted
% (INV2)... |
e6ee13ac5f472b8b48de8ea45408d6f3becb25e49316bf8df3143ae6d052aa6c | MATLAB | 4,512 | 117 | % EEG_LAT2POINT - convert latencies in time units relative to the
% time locking event of an EEGLAB data epoch to
% latencies in data points (assuming concatenated epochs).
% Usage:
% >> [newlat] = eeg_lat2point( lat_array, epoch_array,...
% sra... |
fcce4c52d7829566be052c8efc94d1c384678374463add86e5a1fba780fdb4c3 | MATLAB | 4,512 | 198 | %%% BELOW ARE THE SIGNAL FILTERING FUNCTIONS
function out = op_SignalFilter(spec, r_flag, q_flag, in)
% Based on: Cobas, J.C., Bernstein, M.A., Martín-Pastor, M., Tahoces, P.G.,
% 2006. A new general-purpose fully automatic baseline-correction procedure
% for 1D and 2D NMR data. J. Magn. Reson. 183, 145-51.
showPlots... |
e2760b6df41513192ca34e81ba4c94addde95738b47b709f69e79f7bc383e9dd | MATLAB | 4,515 | 82 | function [n, nfinal, neutZone]= quant_specific_odor(plotxvals, plotyvals, CportStdLoc)
%% quant_specific_odor includes additional analyses for single-worm odor tracking assays.
%
% Currently, calculating number of worms that end in scoring circles/region with a globally defined size, as
% well as time spent in scor... |
4ed57f84a886f6ed0198bbb9b3b2f59fad00f7835df6c011b434be7ad661a254 | MATLAB | 4,519 | 125 | % CHANCENTER - recenter cartesian X,Y,Z channel coordinates
%
% Usage: >> [x y z newcenter] = chancenter(x,y,z,center);
%
% Optional inputs:
% x,y,z = 3D coordinates of the channels
% center = [X Y Z] known center different from [0 0 0]
% [] will optimize the center location according
% ... |
efd4af60a996678824844f491063dbee6909fdc55b8aa600e12e961df16b1852 | MATLAB | 4,522 | 154 | function [out] = getJS(filepth)
% takes in path of csv file and returns cell of {filename Date starttime data}
% data = [time EM TrialCt X Y pos baseX baseY SolOpenDuration DelaytoRew ITI Threshold]
% this fuction converts the csv to a matrix as data
%
% This function was build because we originally had issue... |
94d1c193d61457bb45d5b164bb7864ed930f492d0f23210a6c883230bb067547 | MATLAB | 4,524 | 112 | %% ===== DISTORTION GENERATOR =====
% EDIT THESE PATHS:
inputFolderPath = 'C:\YOUR\PATH\TO\ReferenceImages'; % folder with pristine .jpg
outputRoot = 'C:\YOUR\PATH\TO\New Distorted Images'; % root where outputs will be saved
% OPTIONAL: tweak distortion levels (kept same style as your code)
gwn_levels = ... |
175d439683deddce0ba52ed3495f0e7c3df1e658cd5e251b75bf351e4fa3d291 | MATLAB | 4,525 | 108 | function [VOLLOCS, LOCS] = tapas_physio_create_scan_timing_nominal(t, ...
sqpar, align_scan, durationPhyslogAfterEndOfLastScan)
% Creates locations of scan volume and slice events in time vector of SCANPHYSLOG-files
%
% [VOLLOCS, LOCS] = tapas_physio_create_scan_timing_nominal(t, sqpar);
%
% In cases where the SC... |
04cbad33edf7f5240dd0836bc7ce5fce6b617d913bf88bddc90976f867da0a8d | MATLAB | 4,527 | 109 | function pairwiseCorrelateRDMs(varargin)
% parwiseCorrelateRDMs({RDMs, [RDMs2, ...,]}, userOptions[, localOptions])
%
% Will draw a second-order similarity matrix from RDMs.
%
% RDMs, RDMs2, ... --- Structs of RDMs.
% All RDMs in here will be concatenated and pairwise correlated
% ... |
7abd6b3a3922a1b5dec5315f69d7309e3b91ab17817dbffcec5721a5c3bc8958 | MATLAB | 4,529 | 105 | function [R, verbose] = tapas_physio_orthogonalise_physiological_regressors(R, column_names, orthogonalise, verbose)
% orthogonalises (parts of) created physiological regressors
%
% output = tapas_physio_orthogonalise_physiological_regressors(input)
%
% Note: This is only necessary to ensure numerical stability for
... |
aa73f8620c6d8192ec4539a7c96f0033b85103ce92c50e4169f6b07c0f4721dc | MATLAB | 4,529 | 120 | function [t,peaks] = SineWavePeaks(sineWave,varargin)
%SineWavePeaks - Find peaks (or troughs) in a sine wave.
%
% Find the peaks (or troughs) in a sine wave. The algorithm can either determine
% the mid-points between the zero-crossings, or the zeros of the derivative of
% the signal. This assumes a minimum of 10 sam... |
0573e5ab971c786c8bccb0a0650bcc3a2c21d4008ce983b0a355500d9560809f | MATLAB | 4,530 | 150 | % simulate_pSFT
close all;
clear variables;
clc;
addpath('../functions');
%% Settings
% Plot settings
font_type = 'Helvetica';
axes_label_font_size = 14;
axes_tick_font_size = 13;
tick_length = 0.020;
line_width = 1;
% Colors (RGB)
red = [204 0 0]/255;
green = [0 153 0]/255;
blue = [0 76 152]/255;
purple = [102 ... |
b7fc5e14fc42f3624c4951cadf984f0750d6f7f44caba977e6a2d8cb1d5d4076 | MATLAB | 4,531 | 114 | function out = EN_Shannon(y, numBin, depth)
% EN_Shannon Approximate Shannon entropy of a time series.
%
% Uses an numBin-bin encoding and depth-symbol sequences.
% Uniform population binning is used, and the implementation uses Michael Small's code
% MS_shannon.m (renamed from the original, simply shannon.m)
%
% c... |
4f83efbc613fd53cbcfcef6632095a00c4b4a5370af02591f9514f3a9ee6df41 | MATLAB | 4,532 | 82 |
addpath(genpath('src'));
%% User Configuration for Single Capillary Analysis
datapath = 'data';
% ----- transducer parameters ----- %
Trans.frequency = 15.625e6; % transducer frequency [Hz]
Trans.aperture = 12.8e-3; % tr... |
55ed78aed198b028f6ec9dd87d58d8382cb7e9e48d105d79f6989302aef0eea7 | MATLAB | 4,532 | 106 | function [X, info] = dominant_invariant_subspace(A, p)
% Returns an orthonormal basis of the dominant invariant p-subspace of A.
%
% function X = dominant_invariant_subspace(A, p)
%
% Input: A real, symmetric matrix A of size nxn and an integer p < n.
% Output: A real, orthonormal matrix X of size nxp such that trace(X... |
8a7928cd9fb81ac20cbc9691bd52471e3a02601ac5d0a8f041f66986bf056884 | MATLAB | 4,533 | 139 | function [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(...
x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin)
% [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(...
% x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin)
... |
d58a49d13fbecbb4001f51c2522b1263385706793df06a33dcd73d1683b4176f | MATLAB | 4,535 | 121 | function [samples, originalIndex, intervalID] = Restrict(samples,intervals,opt)
%Restrict - Keep only samples that fall in a given list of time intervals.
%
% Keep only samples (positions, spikes, LFP, etc.) that fall in a given list of
% time intervals.
%
% The remaining epochs can optionally be 'shifted' next to eac... |
5317d5b3d0866cfa9e28acad3883d936a9408b7c52e7f539d17e1106094e63c0 | MATLAB | 4,536 | 83 | function exportQuant(MRSCont,saveDestination)
if ~strcmp(MRSCont.opts.fit.method, 'LCModel')
quants = {'amplMets','tCr','rawWaterScaled','CSFWaterScaled','TissCorrWaterScaled','AlphaCorrWaterScaled','AlphaCorrWaterScaledGroupNormed'};
else
quants = {'amplMets','tCr','rawWaterScaled','CSFWaterScaled','TissCorrW... |
8cea90f5cd462c5f6143b31a35bb4aff511c66ed7792aace381835c2c96d3148 | MATLAB | 4,536 | 126 | %% Generate Figure 5c
% Note: All parameters have been normalized prior to model fitting and visualization
% to allow for direct comparison across metrics, which are originally measured
% in different units and ranges.
%%
clear; close all; clc;
% Paths to change
save_path = '/oak/stanford/groups/kalanit/biac2/kg... |
4b3ec0b67f11a6d1c466e1adfaf0c6e495705223eb8374f5e33f124a0aaf89f1 | MATLAB | 4,538 | 121 | function egrad = getEuclideanGradient(problem, x, storedb, key)
% Computes the Euclidean gradient of the cost function at x.
%
% function egrad = getEuclideanGradient(problem, x)
% function egrad = getEuclideanGradient(problem, x, storedb)
% function egrad = getEuclideanGradient(problem, x, storedb, key)
%
% Returns th... |
93ec5414dddd59b86da598eed77c1cc0a15f14c2f1996db27a1a1f6064ab7fc1 | MATLAB | 4,540 | 158 | function ni = niftiSet(ni,param,val,varargin)
% Set data for various nifti data structures
%
% ni = niftiSet(ni,param,val,varargin)
%
% Parameter values
%
% 'pixdim' - Voxel dimensions in millimeters (though settable)
% 'dim' - Number of pixels in each dimension (row,col, depth, time/orientation)
% '... |
0719b96442d22db687876ff14515c45cd3f460b34c1b836d5ed4ef6d8a67a9e9 | MATLAB | 4,542 | 115 | % STD_SELCOMP - Helper function for STD_ERPPLOT, STD_SPECPLOT
% and STD_ERSPPLOT to select specific
% components prior to plotting.
% Usage:
% >> std_selcomp( STUDY, data, cluster, setinds, compinds, comps)
%
% Inputs:
% STUDY - EEGLAB STUDY structure.
% data - [cell ... |
b50a21f4b9b4d6da6aafcfd7def0c6f46f19cd06960141fa590111ecf340dc7f | MATLAB | 4,545 | 101 | function [data, layer_numbers, layer_names, colours, colour_scheme] = RegionAnalysis_Standard(data, I, source, layer_numbers, layer_names) % by Julia Becker, 01/04/2020
%REGIONANALYSIS_STANDARD Displays points while user assigns layers
% - Select area by clicking left and circling, finish with right click
% - Re... |
5bfafaa0170cb7661c47d86c61a5f9c7bb31aab1c6fc37893c28bcbc708dc83e | MATLAB | 4,549 | 111 | function out = CP_l1pwc_SweepLambda(y, lambdar)
% CP_l1pwc_SweepLambda Dependence of step detection on regularization parameter.
%
% Gives information about discrete steps in the signal across a range of
% regularization parameters lambda, using the function l1pwc from Max Little's
% step detection toolkit.
%
% cf.... |
6558949bbe02acbb8b3bd4d8bc128ffe5acb9ad42709593dc1855d562682a767 | MATLAB | 4,549 | 146 | function chNames = getChannelNames(params, signalType, dataTag, isShort)
% determines channel names based on signal type or naming style (specified in 'signal_style')
% for example: signal_style = eeg, ecog, seeg
% or anatomical assignment in structure H
% (c) Jiri, Apr16, Jun17
chNames = [];
if nargin < 3
dataT... |
921cc7f50a2a8ffb85e0ab14a29f1d5febc99c858fb0447cf26e97a339366d51 | MATLAB | 4,549 | 97 | function [quality_measures, dRp] = ...
tapas_physio_get_movement_quality_measures(R, rHead)
% Computes movement quality measures (FD, rmsMovement etc), as described in
% Power et al., 2014
%
% [quality_measures, dR] = tapas_physio_get_movement_quality_measures(R, rHead);
%
% IN
% R [nScans,6] realign... |
b61b5114b46287e013c33b578469d499e1be9d034edf6a38ade4e0c3a72969ef | MATLAB | 4,552 | 116 | function params = GiveMeDefaultClassificationParams(TimeSeries,numClasses,beVocal)
% Set default parameters describing the feature-based time-series classification
%
%-------------------------------------------------------------------------------
% If you use this code for your research, please cite these papers:
%
% ... |
d6d407758df224541284fa95aae7be968a120c362aed4811cc02b2ca99ba7fcc | MATLAB | 4,552 | 115 | function support_func_plot_raster(xdata,ydata,varargin)
%% ########################################################################
% - PLOT RASTER -
% #########################################################################
% ... |
7da42446e12cbb00e6649db43496634170e54c5ad0d7fe4cc475378c262b7523 | MATLAB | 4,554 | 128 | %
% Example analysis for snr assessment and preprocessing steps
% Author: Saskia Klein & Lars Kasper
% Created: 2014-11-18
% Copyright (C) 2014 Institute for Biomedical Engineering
% University of Zurich and ETH Zurich
%
% This file is part of the TAPAS UniQC Toolbox,
% which is released under t... |
9f91ad05d61c17778cef9eecbb4f27f1d8c0269f6b793e58dd94830bc22b9ea1 | MATLAB | 4,554 | 121 | function [predictedFeatures, accuracy, model] = svmDecode(trainingData, trainingFeatures, varargin)
% svmDecode - Train an SVM classifier to predict class labels / features from data and evaluate decoding accuracy.
%
% USAGE
%
% [predictedFeatures, accuracy, model] = svmDecode(trainingData, trainingFeatures, <opti... |
f2bf373910dbb4cb34db82e0edce2c55bcf872ffa8ce06bdaecd6e266f00a497 | MATLAB | 4,555 | 115 | % dipfit_gridsearch() - do initial batch-like dipole scan and fit to all
% data components and return a dipole model with a
% single dipole for each component.
%
% Usage:
% >> EEGOUT = dipfit_gridsearch( EEGIN, varargin)
%
% Inputs:
% ...
%
% Optional inputs:
% 'com... |
f08cecda74856332014e530b10b4468de7f0943f222311852592f756f75d14a3 | MATLAB | 4,556 | 148 | % Example function to demonstrate surface-based voxel selection.
%
% This function uses two surfaces (pial and white matter, from Freesurfer)
% to define circular regions of approximately 50 voxels using a geodesic
% distance measure.
%
% This function is aimed at the ''fingerdata' dataset
%
% NNO Feb 2011
%%%%%%%%%%... |
a22f8866479ddcc5050bf2209af818244faa2e4941460e6e36ad68e922c930b4 | MATLAB | 4,557 | 138 | function run_fisher_info_simulation(params, options, match_indegree)
% RUN_FISHER_INFO_SIMULATION - Run simulation for Fisher information analysis
%
% H1 Line: Execute simulation optimized for Fisher information calculation
%
% Syntax:
% run_fisher_info_simulation(params, options, match_indegree)
%
% Description:
% ... |
499319bc541d91c89396160b292bf765fcccb855864486ab9bb30748b3ab6f73 | MATLAB | 4,561 | 128 | function [DispManip] = AFNI_SliceDispManip (B_Info)
%
% [DispManip] = AFNI_SliceDispManip (B_Info)
%
%Purpose:
%
% Determine the manipulations necessary to apply to a
% slice for proper display a la AFNI
%
%Input Parameters:
% B_Info the output of BrickInfo function
%
%
%Output Parameters:
% err : 0 No Problem... |
b114ed58144d68f6e735735a772d2cde0147a8eaaa7e3d9c5f386dbdca6fbc8e | MATLAB | 4,561 | 129 | function V = LinearVelocity(X,smooth, varargin)
%LinearVelocity - Compute instantaneous linear velocity.
%
% Compute linear velocity for a time-varying vector X.
%
% USAGE
%
% V = LinearVelocity(X,smooth, <options>)
%
% X position <a href="matlab:help samples">samples</a>
% smooth ... |
15a5c34d352c29b50c989e49fb23ec0b35f93b9c05c7bba19eae9b6975d8cbe2 | MATLAB | 4,562 | 99 | function FCMap = WeiSeedFC(SeedDir,FCMaskDir,FCOutDir,AnalysisDir,subj,targetdepth)
%% in this weighted FC, the values of the seed mask is used to compute the seed signal
if nargin<5
error(' Error using ==> at least 5 arguments wanted.');
elseif nargin==5
targetdepth = 0 % number ... |
d0ee845bada74dd6153e65d6a8f9535da7905e7bc7540b24b86ab5ca51bcb149 | MATLAB | 4,562 | 134 | function [rez]=merging(rez,Threshold)
%Variable initialization
SF = rez.ops.fs; %sampling frequency to convert from sampling rate to second
Nclusters = length(unique(rez.st(:,3))); %Number of initial clusters from kilosort
NG_clus = Nclusters; %Number of clusters
nt0 = ... |
0eb175feaac2b9bf0543ca7a121e67271c2eca2b9bf3266efe247a4a000c00f8 | MATLAB | 4,563 | 193 | function [] = electrodeSpecificMetrics(ND, NS, MEW, Eloc, BC, PC, Z, lagval, e, FN, Params, figFolder, oneFigureHandle)
% Plots electrode-level metrics for individual recordings
% TODO: allow this to accept arbitrary number of parameters to plot,
% this allows easier extensions in the future.
%
% Parameters
% -... |
f9e0dd7698db183fe70fcaaa71fbb97ea2a6829ca40a171bc7a98d4fb4714453 | MATLAB | 4,563 | 128 | function [stepsize, newx, newkey, lsstats] = ...
linesearch_hint(problem, x, d, f0, df0, options, storedb, key)
% Armijo line-search based on the line-search hint in the problem structure.
%
% function [stepsize, newx, newkey, lsstats] =
% linesearch_hint(problem, x, d, f0, df0, options, stored... |
2bdfb12a8e822ee5f5720db82d425363d6df3c5281ddaaef04eae103bd15a890 | MATLAB | 4,565 | 135 | function M_subj = plotFC_spectral(M, EC_info, chGroups)
% plots results of functional connectivity (FC) - e.g. DTF
% input:
% - M = FC matrix, 5D: M(ch_trg,ch_src,freq,time,clz)
% - EC_info = freq & time + other info (see: connectivityAnalysis.m)
% - chGroups = struct with channel indices (see: ch2roi_getSelChnls... |
52b2724ce0f5f656f9d70652fd1f601b505925fabfcbc1536b6a9626ef8c6e6f | MATLAB | 4,566 | 92 | function [post nlZ dnlZ] = infState(hyp, mean, cov, lik, x, y, opt)
% Inference for a GP with state space covariance.
%
% Compute a parametrization of the posterior, the negative log marginal
% likelihood and its derivatives w.r.t. the hyperparameters.
% See also "help infMethods".
%
% The function takes a spe... |
c5f7333b625a92f06c7c4f9860d0e182478a92d216b0eb98b078e444c11365d4 | MATLAB | 4,566 | 100 |
%%
for ith_freq = 3:7
keyword = 'vector';
root_path = ['/Users/bo/Documents/data_liujia_lab/manuscript_gridcell3hz/analysis_liuP1_greeble/MRI_result_sinusoid/periodic_2501_testing_',num2str(ith_freq),'_fieldmap_',keyword,'_mean/'];
mask = MRIread('/Users/bo/Documents/data_liujia_lab/manuscript_gridcell3hz... |
caf3df6bc5da26f6c72fe5bb193443421b705e2c7d2473bbeed191e28409ae67 | MATLAB | 4,566 | 126 | function trials_out = trialsFiltering(params, trials_in)
% applies post-processing on trials data
% postprocessing defined in: params.triggering.trialsFiltering
% trials_in = struct with fields:
% data: [79×57×122 double]
% time: [79×1 double]
% rejected: [79×57×122 double]
% ses... |
0a24503591ed6ef81f024d19076f4945a0de06601f15f1f0e1f8494095691813 | MATLAB | 4,568 | 114 | function [EAVF_mask_trunc, FVF_mask_trunc, IAVF_mask_trunc, MVF_mask_trunc, label_mask_trunc, fieldmap] = compute_masks_and_fieldmaps( field_method, d, gap, pts, side, g_ratio, theta, sus_my, resolution, drop, drop_indices)
% field pertubation calculation method
if field_method == 0
disp('fieldmap will be calculat... |
154a867d7be4c6c196a53ffbe5a7a60bf0e42895e15a91ea8bfcfc3fa65f1aea | MATLAB | 4,568 | 112 | % Analyse behvioural responses
%
% For all those subjects where they have been recorded, calculate responses
% to the task.
clear;
clc;
warning('off');
% % add spm to the path
% initiate bidspm
% Initialize report
% Start a new report
report = {'subject','run','trial_type','keyPress','response_type'};
reportExtr... |
5d693dd1796e7eefedbe3b8d615d83764c02daa23626b2fa802353b17e422520 | MATLAB | 4,568 | 165 | function [movie_out,E_out, Info] = denoisingLOSS(movie_in, varargin)
% Denoising the movie by learning
% Two steps are included:
% 1 - decompose the original movie resulting in a clean low-rank
% layer (L) and residual layer (R);
% 2 - the residual is further modeled as a low-rank matrix
% fact... |
8c1f2bd511289fb15846c344fcc40a8f1f8a92dd75f0f1cec9ca70b15d21359f | MATLAB | 4,569 | 154 | function plot_fig3h_left(datadir)
% Plot z-scored dopamine at the reward cue conditioned on trial initiation
% time on the subsequent trial, averaged across rats. N = 10 rats.
%
% INPUTS
% datadir: file path of data downloaded from Zenodo. Link to download can
% be found in README.
nbin = 4;
fname = fullfile(datadir, ... |
3cbdd469dd3d2fc528630158bd73f5ca8d828a9a2ef7c630c99a30cfc9e8484f | MATLAB | 4,570 | 124 | %APPEND_PDFS Appends/concatenates multiple PDF files
%
% Example:
% append_pdfs(output, input1, input2, ...)
% append_pdfs(output, input_list{:})
% append_pdfs test.pdf temp1.pdf temp2.pdf
%
% This function appends multiple PDF files to an existing PDF file, or
% concatenates them into a PDF file if the output fi... |
522bcaa8014174f57ee5a99f92b2f9c9a2875c1cdc91b3ea968f4769a5cbfaf9 | MATLAB | 4,571 | 114 | %% plots transparent brains with highlighted neural networks from Yeo7 atlas
% (c) Jiri, Aug21
%% output directory
outDir = 'G:\dox\proj_switching_EI\brainNetworks_Yeo7N';
if ~exist(outDir, 'dir')
mkdir(outDir);
end
%% settings: paths to source data
% dataDir = 'F:\dox\ms5_deepDecoding\data\v9_realTime';
%% pa... |
e0e1cfaf6a80a538f0f449ba0bfb12bc1aa1b5b428c566ff04396293a067c7dc | MATLAB | 4,572 | 114 | % [Generalized Eigenvalue De-Artifacting Intrument (GEDAI)]
% PolyForm Noncommercial License 1.0.0
% https://polyformproject.org/licenses/noncommercial/1.0.0
%
% Copyright (C) [2025] Tomas Ros & Abele Michela
% NeuroTuning Lab [ https://github.com/neurotuning ]
% Center for Biomedical Imaging
% ... |
04fdf8d998053447a9848c94c72e86d2a9570e7d960dc4a8591141d55513cf42 | MATLAB | 4,573 | 124 | function [pre20_pref, pre20_nonpref, post20_pref, post20_nonpref, sig] = ...
incongruentResponse_twentyPreVsPost(SU, S, alignto, zarg)
% Compute responses on the last 20ul trial before and the first 20ul trial
% after an incongruent trial. Named based on transition type (i.e. a
% preferred transition is low to mix ... |
253b0061ad4c3ec630c866fe1c03bc85a2646f0b00ff3f4e05e819661e08e07c | MATLAB | 4,574 | 108 | function X = Shuffle(Arg1, Arg2, Arg3) %#ok<INUSD,STOUT>
% Random permutation of array elements
% SHUFFLE works in Inplace, Index and Derange mode:
%
% 1. INPLACE MODE: Y = Shuffle(X, Dim) - - - - - - - - - - - - - - - - - - - -
% The elements of the input array are randomly re-ordered along the specified
% dimensio... |
ef4ec322b17821fbeb8603d2cca64596033fd550a7581f09fb554c9d17622a02 | MATLAB | 4,574 | 112 | % Analyse behvioural responses
%
% For all those subjects where they have been recorded, calculate responses
% to the task.
clear;
clc;
warning('off');
% % add spm to the path
% initiate bidspm
% Initialize report
% Start a new report
report = {'subject','run','trial_type','keyPress','response_type'};
reportExtr... |
494ce18327eda9b7f8fa203188a6d246cf00ea934f009c00bfa9a68e67339e15 | MATLAB | 4,576 | 138 | function fieldtrip2ctf(filename, data, varargin)
% FIELDTRIP2CTF saves a FieldTrip data structure to a CTF dataset.
%
% The file to which the data is exported depends on the input data structure that you
% provide. The "raw" and "timelock" structures can be exported to a CTF dataset. The
% "montage" structure can be e... |
237d58100cc4e1d487ca7c197f1dbab39949e0d9ed702a3338c48263f278ae69 | MATLAB | 4,584 | 119 | function doubly_stochastic_denoising()
% Find a doubly stochastic matrix closest to a given matrix, in Frobenius norm.
%
% This example demonstrates how to use the geometry factories for the
% doubly stochastic multinomial manifold:
% multinomialdoublystochasticfactory and
% multinomialsymmetricfactory (for the symme... |
3e8f002fbb70e3cef47afebfaff9297e783f78021afdfb895718c418a8d1b20c | MATLAB | 4,585 | 110 | function [varargout] = likLogGauss(link, hyp, y, mu, s2, inf, i)
% likLogGauss - Log Gaussian likelihood function for strictly positive data y.
% The expression for the likelihood is
% likLogGauss(f) = 1/Zy*exp( -[log(mu)-sn^2/2 - log(y)]^2 / (2*sn^2) ) with
% mean=mu and variance=mu^3/lam where mu = g(f) is the L... |
1058a0726ea69eaa75668a4ba90a2a2809d0d9d44234609bfa5a7cbebce4b079 | MATLAB | 4,587 | 162 | % PLOTERP - plot a selected multichannel data epoch on a common timebase
%
% Usage: >> ploterp(data,frames,epoch,[limits],'title',[plotchans]);
%
% Inputs:
% data = EEG/ERP data epoch (chans,frames)
% frames = frames per epoch {default: data length}
% epoch = epoch to plot {default: 1}
% [limits] =... |
1a226185cf639465f33586ee8a66accd063b04397192a672fee09c421497731a | MATLAB | 4,588 | 160 | clc
close all
clear
Pbase = fullfile(pwd, ['..' filesep]);
Pmetadata = fullfile(Pbase, 'spm_datasets_anon');
Pdata = fullfile(Pbase, ['models' filesep 'SN' filesep 'fitted_adjusted']);
Psave = fullfile(Pdata, 'PEBs_180sec_DCT_sep_6DTC');
Pgcm = Pdata;
Presults = Pgcm;
addpath(Pdata);
spm('d... |
270d1ebc78844a3b8d6b47c72d2b108495b0d0103a24cbe5f98dae242180399a | MATLAB | 4,591 | 105 | % STD_SELECTDATASET - select datasets and trials for a given independent
% variable with a given set of values.
%
% Usage:
% >> [STUDY] = std_selectdataset(STUDY, ALLEEG, indvar, indvarvals);
%
% Inputs:
% STUDY - EELAB STUDY structure
% ALLEEG - EELAB dataset structure
% indvar... |
6935f60fdfd3beb46703718d8c296a4020d333c25ad17f3b6faee49fe6a0423d | MATLAB | 4,592 | 133 | function [spikes,V] = GenerateSpikeTrain(I,threshold,varargin);
%GenerateSpikeTrain - Generate spike train using a leaky integrate and fire neuron model.
%
% USAGE
%
% [spikes,V] = GenerateSpikeTrain(I,threshold,<options>)
%
% I input current <a href="matlab:help samples">samples</a>
% ... |
f7bff7d638d3433fe087f18c6c15fe40a319c6c4c41e43c205341b6f2e29a0ec | MATLAB | 4,592 | 120 |
%% predicted
clear;
mypath = '/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble';
sub_pool = [1:28, 30, 32, 33, 34, 35];
mask = MRIread('/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble/mask/mask_wholebrain.nii'); %mask_nowm_withsubc mask_wholebrain
mask = mask.vol;
cur_struct = MRIread('/Users/b... |
fe86ca33f1c17fe3ff5d239f5b3c384e3524478bbb9ac3e891fa25346dd8fd0f | MATLAB | 4,594 | 119 | function [c, r, t, cpulse, acq_codes, verbose] = tapas_physio_read_physlogfiles_siemens_hcp(...
log_files, cardiac_modality, verbose, varargin)
% Reads in preprocessed Human Connectome Project (HCP) Physiology Data
% NOTE: The physiological log-files downloaded as part of the HCP with the
% name format *_Physio_lo... |
658ff7ad443a433e01ffea3fbfc15c9eaebe419e6a2f3b518b48f33b77c82c5c | MATLAB | 4,595 | 112 | function M_subj = plotFC2axes_5DM_spectral(M, EC_info, chGroups, thr_nChPerGroup)
% plots results of functional connectivity (FC) to existing axes - e.g. DTF
% works for two neural networks (NN)
% input:
% - M = FC matrix, 5D: M(ch_trg,ch_src,freq,time,clz)
% - EC_info = freq & time + other info (see: connectivityA... |
d88550df1287c0034c339b875f4c11653518f922d5fd1143cf719876a939ef3d | MATLAB | 4,595 | 140 | clear all
close all
clc
% Calculates subspace generalization between simulated voxels.
% Each voxel is an average over simulated grid cells according to their
% phase. grid cells with closer phases are averaged within the same voxels.
exp_root = 'C:\Users\User\Documents\fMRI_EXP\';
more_code = fullfile(exp_root, 'c... |
2949a0f3a15303ddef598b55940a3aa943cfb183cf6766b16a7b1853fa1a3485 | MATLAB | 4,596 | 122 | % Script demo_select_image
% Example usage of how to use MrImage.select() for high-dim image arrays
%
% demo_select_image
%
%
% See also MrImage.select MrDimInfo
% Author: Lars Kasper
% Created: 2016-01-28
% Copyright (C) 2016 Institute for Biomedical Engineering
% University of Zurich and ETH... |
328b5565f55cd4924b7d3ae9c2b87df913a03f8fa3cfe11fa75659c2735b2ef8 | MATLAB | 4,596 | 162 | %%%%%%%%%%%%%%%%%%%%%%%%%% quick one off to get the values
todo = { ...
{'ncsnr' ['~/nsd/nsddata_betas/ppdata/subj%02d/nativesurface/betas_fithrf_GLMdenoise_RR/%s.%s.mgh'] @(x)100*(x.^2./(x.^2+1/3)) [0 75] jet(256) [] 'b3nc'} ...
};
hemis = {'lh' 'rh'};
for tt=1:length(todo)
name ... |
fd534ab70b903c207cc3642c5c0a46c05ceeca3e803140c78cba84a4928d71c9 | MATLAB | 4,596 | 123 | % Minimal working example: single axon, mask creation, and fieldmap visualization
% Using the same function `compute_masks_and_fieldmaps.m` as in the main.m
% file used for publication.
clc; clear; close all;
% Ensure the script runs from its own folder so helper functions are on the path
script_path = mfilename('ful... |
043758a8ed1969fb90f23e000d15ad751c37f7a2919704301dee2bc21ee5e2f2 | MATLAB | 4,597 | 106 | %function [Nens,ensId,centInd,haloInd,delta,rho,Ts,sampCent,templates,predbounds,nsamp] = subSample_ensembles_pca(raster,minSpk,sampFac,prctdata,isHalo,thrMet,maxmem,npcs,filename)
function [sampCent,Ts,nsamp] = subSample_ensembles_pca(raster,minSpk,sampFac,prctdata,isHalo,thrMet,maxmem,npcs,filename)
%
% [Nens,ensId,d... |
dafd6b7cb71ade806f1a769455b9b80bac7fbf9349b82f61d9f3e1a39582fe3f | MATLAB | 4,597 | 125 | function physio = tapas_physio_update_from_job(physio, job, ...
jobPropertyArray, physioPropertyArray, isBranch, branchProperty)
% Updates properties of physio-structure from a job-structure
%
% physio = tapas_physio_update_from_job(physio, job, ...
% jobPropertyArray, physioPropertyArray, isBranch)
%
% IN
% ... |
7eae918d72810cc0117dde3b201bee3691393f2be01d4eeb87287841e0be3545 | MATLAB | 4,598 | 113 | function cs_SpinPermuFS(readleft,readright, permno, wsname)
%% This script was build based on the original script by Aaron Alexander-Bloch & Siyuan Liu, SpinPermuFS.m, 2018-04-22
% Modified by Christina Stier, 2022
% Compute designated # of permutations/spins of the input surface data
% in FreeSurfer fsaverage5.
% FOR... |
0fb7865d51a2b15ad0b6580297a09e8a59733ea5d645119c1b9dfa1d40a5d9c6 | MATLAB | 4,599 | 135 | function cfg = naj_postICAopt_config(file_out)%% Config file
% Configuration parameters for the study.
% These are all the relevant parameters for the analysis organized
% according to the script they are used in
%
% version 1.0, written by Nadine Jacobsen, Uni Oldenburg, April 2022
subjects = 1:19;
tmp = dir(... |
ec4757ea4b088d0df704fd305ad013754e5ab01416fc6b636515b69b55636afe | MATLAB | 4,599 | 110 |
%% testing part pending
clear;
mypath = '/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble';
for sub = 1:35
for sess = 2:2:8
% access raw table
mypath_time_record = [mypath, '/sub', num2str(sub), '_mri_record_subj_vector_mean_testing_para6_1_35.txt'];
timeFile = fopen(myp... |
65814d582d740aceb3bc5252a555154e46c02b50ab10cf6a76fb8f3d1dc63596 | MATLAB | 4,600 | 130 | % firfilt() - Pad data with DC constant, filter data with FIR filter,
% and shift data by the filter's group delay
%
% Usage:
% >> EEG = firfilt(EEG, b, nFrames);
% >> EEG = firfilt(EEG, b, nFrames, chaninds);
%
% Inputs:
% EEG - EEGLAB EEG structure
% b - vector of filter coef... |
ff3b0a7c3afe98ee4ff64b3f7e2d5091278d05f4ff336606cb643a6b4e2c83a8 | MATLAB | 4,600 | 160 | function fear_reactModulationByMoving_shBase(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)
param.templateSes=2;
param.nIte=500;
%%
param=parseParame... |
175159ab3145df9c7b10ac214dd6d09d1ea8ac03915509572c12c1f042bcd680 | MATLAB | 4,604 | 123 | % DEL2MAP - compute the discrete laplacian of an EEG distribution.
%
% Usage:
% >> [ laplac ] = del2map( map, filename, draw );
%
% Inputs:
% map - level of activity (size: nbChannel)
% filename - filename (.loc file) countaining the coordinates
% of the electrodes, or array countaining com... |
3370eeddf914981eb7581526d27a42a5d097c65a64b7ebf8bec8be301bc4c118 | MATLAB | 4,604 | 105 | function runSearchlightLDC(searchLight,varargin)
% runSearchlightLDC(searchLight,varargin)
% Wrapper for the main searchlight function rsa_runSearchlight
% This version calculates the LDC from an SPM first-level analysis
% New Version takes into account the first-level design matrix
%
% INPUT:
% searchLight: a... |
1562468d40f65a762ecb562c239f6ddac4a8fc99a5e7cc3ce36a1e3e79c0f3c0 | MATLAB | 4,606 | 132 | function [datafile, jsonfile] = bids_datafile(filename)
% BIDS_DATAFILE will search for the data file, given one of the corresponding sidecar files
%
% Use as
% [datafile, jsonfile] = bids-datafile(filename)
%
% See also BIDS_SIDECAR, BIDS_TSV, EVENTS_TSV
% Copyright (C) 2020-2024, Robert Oostenveld
%
% This file i... |
201c3fcf6c93ea6dd543f57d0f0e370facb5858b4bae2c7beed68bb00b416350 | MATLAB | 4,609 | 101 | function [data, layer_numbers, layer_names, colours, colour_scheme] = RegionAnalysis_Standard(data, I, source, layer_numbers, layer_names) % by Julia Becker, 01/04/2020
%REGIONANALYSIS_STANDARD Displays points while user assigns layers
% - Select area by clicking left and circling, finish with right click
% - Re... |
8307aa8f2545896191062f3c993792baa39ed2632f720b08c41cede048818f15 | MATLAB | 4,609 | 160 | function h=similaritygraph(coord,S,lim,lcolor)
%function h=similaritygraph(coord,[S],[lim],[lcolor])
%
%PURPOSE
%
%To visualize a weighted graph
%
%INPUT
%
%[An argument in brackets is optional. If it isn't given or it's
% an empty matrix/string, the function will use a default value.]
%
% coord (Mx2 matrix) coo... |
e2d3d30a5a6b217361dcaebfddb6f449b9814b88a3a7fbeaeb9406204b6c1188 | MATLAB | 4,609 | 130 | % clc
%--------------------------------------------------------------------------
spm('defaults','EEG');
spmPath = fileparts(which('spm'));
% Data and analysis directories
%--------------------------------------------------------------------------
Pdata = fullfile(Pbase, 'spm_datasets_anon');
Panalysis = fullfil... |
f31cf195b90ff4631d703bee0bf244a168f45ff0a60a8991d65136c7ff2eb327 | MATLAB | 4,611 | 133 | %% SWIIOWrapper(input,output,algorParam)
%
% Input
% --------------
% input : input structure containing filenames
% output : output directory that stores the output
% algorParam : structure contains method and method specific parameters
%
% Output
% --------------
%
% Description: deprecated... |
0321ca7672a2fc04703c5dc78874f71979c7e41bfc7c1833e267c3c2bc63b598 | MATLAB | 4,612 | 146 | function [h, t2i] = vl_tshow(T, varargin)
%VL_TSHOW Visualize a 4D tensor.
% VL_TSHOW(T) shows the 4D tensor T in the current figure.
%
% The tensor is shown as a montage of 2D slices (e.g. filters), with the
% 3rd dimension stacked along the rows and the 4th dimension along the
% columns.
%
% For effectively... |
81f09de55fa008331e23e8a96968bce1de3f3ffd26d6ac0a82238078874b86bc | MATLAB | 4,613 | 66 | function nsd_et_preproc_figures(data, plotset)
% ----------------------------------------------------------------------- %
% Diagnostic figures of the cleaned NSD eye-tracking data. MN, July 2021
% ----------------------------------------------------------------------- %
if strcmp(plotset.flag, 'pupil')
... |
d5e374f71cc59415979c44279c6f0739c6e363b72afc2df7e35186df264065dc | MATLAB | 4,613 | 138 | function [net, info] = cnn_mnist(varargin)
%CNN_MNIST Demonstrates MatConvNet on MNIST
run(fullfile(fileparts(mfilename('fullpath')),...
'..', '..', 'matlab', 'vl_setupnn.m')) ;
opts.batchNormalization = false ;
opts.network = [] ;
opts.networkType = 'simplenn' ;
[opts, varargin] = vl_argparse(opts, varargin) ;
s... |
2a59b24fc9f8c841115e11e2fda31a340478877d55e2b163da128b61ab4e1447 | MATLAB | 4,615 | 126 | function [] = plotAnalysis03A(saveFigures)
% Produces plots to visualize the results of analysis03A.
% save figures by default
if nargin==0
saveFigures = true;
end
analysisName = 'analysis03A';
% get file paths
paths = addPaths();
% get names of all files in analysis directory
files = dir(fullfile(paths.outputs,... |
22fdaf627a167c01089526fce261fd55e278c9a940c3164218e2ca7d933d241d | MATLAB | 4,617 | 115 | function vol=addRoiToVol(vol, roi, color, solid)
% USAGE: vol=addRoiToVol(vol, roi[, color, solid])
%
% FUNCTION: to mark the specified region of interest to the true-color
% volume vol.
%
% vol the volume as a stack of true-color slices: X by Y by 3 by Z.
% the third d... |
49d66d6e6f9786316a25aeca87880c6bab1417e437fb7fd8f4822dff1530d871 | MATLAB | 4,619 | 147 | function [srf] = readsrf(filename, NoNeg)
%
% [srf] = readsrf(filename, [NoNeg])
%
% filename: filename of .srf surface file
% NoNeg: Optional parameter for dealing with nodes that should not be
% displayed
% 1 (default) tells the function to remove triangles containing
% such nodes fr... |
5471332b13e7acba0dba92c7f1e2be39ac1ad82bbf2604976c45c5602687621d | MATLAB | 4,622 | 171 | function plot_fig6f(datadir)
% Plot opt-out DA response on contralateral trials, bottom vs top quartile
% of next trial ITI distribution. N = 10 rats.
%
% INPUTS
% datadir: file path of data downloaded from Zenodo. Link to download can
% be found in README.
nbin = 4;
fname = fullfile(datadir, 'data-published/optOutDAb... |
ca54cd9716a21507b7289c7cbdc0a0a60fb6a6bb69bde0b9ff6991273e477f0e | MATLAB | 4,622 | 161 | clc
close all
clear
Pbase = fullfile(pwd, ['..' filesep]);
Pmetadata = fullfile(Pbase, 'spm_datasets_anon');
Pdata = fullfile(Pbase, ['models' filesep 'DMN' filesep 'fitted_adjusted']);
Psave = fullfile(Pdata, 'PEBs_180sec_DCT_sep_6DTC');
Pgcm = Pdata;
Presults = Pgcm;
addpath(Pdata);
spm('... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.