sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
21c575c8c8db71eb37691185ffcfc1920cb70fbf60395d72cc38e916576aaa0b
MATLAB
2,258
70
function ProcessData_Figure1(BestFitEarly, codedir, savedir) %ProcessData_Figure1 - function to process data to generate Figure 1. Saves % data in savedir to be accessed by PlotFigure1 % INPUTS: % BestFitEarly - BestFit.mat file found at: Mah_CellReports_BehavorialData/FitAll_ITI_VanillaAlpha_First10/BestFit.mat % fr...
65b824896f873ef7497c86ad4687ef595b27af99538ae2dc11d3c1258ef1d9f7
MATLAB
2,258
59
% SUBSASGN - define index assignment for eegdata objects % % 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, wit...
c8472e96f2324c4529495f7fef62e0ccfe24bcd412a2d5c50e46d9d8571cc722
MATLAB
2,259
76
function Ptrial = prob_den(rr,cc,AMean,Astd,x0Mean,x0Std,nMean,nStd,noiseStd) M = size(rr,3); %probabilities for generating latent variables x0, n given normal %distributions for x0, n Px0 = @(x0) 1./sqrt(2 * pi * x0Std.^2) * exp(-1/2*(x0 - x0Mean).^2/x0Std^2); Pn = @(n) 1./sqrt(2 * pi * nStd.^2) * exp(-1/2*(n - ...
482c64ae277def9600cf93cf62cb0e6a7a3a05364475b1f2c4a6caff17092574
MATLAB
2,260
42
% STD_READERPIMAGE - load ERPimage measures for data channels or % for all components of a specified cluster. % Usage: % >> [STUDY, erpimagedata, times, trials, events] = std_readerpimage(STUDY, ALLEEG, varargin); % % Note: this function is a helper function that contains a call to the % std_...
9f94c442e0c0cb002041769c79cd6d84bcfcf9bc3d8d32fd6a0e816db6d38536
MATLAB
2,260
64
% PARSETXT - parse text input into cell array % % Usage: >> cellarray = parsetxt( txt, delims ); % % Inputs: % txt - input text % delims - optional char array of delimiters (default: [' ' ',' 9]); % % Note: commas, and simple quotes are ignored % % Author: Arnaud Delorme, CNL / Salk Institute, 18 April 2002 ...
f164a24cb388b20c7c0068f82734e41cb6aae0d77b3607b2e15f1702f6dc1dcf
MATLAB
2,260
53
% EEG_GETVERSION - obtain EEGLAB version number (version is embedded in % the script, edit the function to see the version). % % Usage: % >> vers = eeg_getversion; % >> [vers vnum] = eeg_getversion; % % Outputs: % vers = [string] EEGLAB version number % vnum = [float] numerical value fo...
7137808f388a775d3103dda6edcccdd65f4e338a3fdbf0160d991f4ecf3b8a05
MATLAB
2,261
59
%{ preprocess.ScanCoordinates (imported) # mask center of mass of a segmented cell -> preprocess.ExtractRawGalvoSegmentation ----- xpos : double # x motor location in micro meters ypos : double # y motor location in micro meters zpos : double # z motor location in micro...
a42866afbb6392a63625b685d84d85cd46d5cb4736fc06aac7353b8fccef88aa
MATLAB
2,261
37
% Safe computation of logphi(z) = log(normcdf(z)) and its derivatives % dlogphi(z) = normpdf(x)/normcdf(x). % The function is based on index 5725 in Hart et al. and gsl_sf_log_erfc_e. % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2013-11-13. function [lp,dlp,d2lp,d3lp] = logphi(z) ...
08e881343b0738bec76595683e6ec3cfc782808a997da15d5f9974f597a8d7b1
MATLAB
2,263
66
function density_results_table(OUT) % density_results_table(OUT) % % prints table of results for density_pdf or density_diff_pdf % Tor Wager fprintf(1,'Density results for %s\n',OUT.fname) fprintf(1,'Brain mask file: %s with %3.2f x %3.2f x %3.2f mm voxels',OUT.mask_file,OUT.voxsize(1),OUT.voxsize(2),OUT.voxsize...
1f2dc053b645d9a708d7310453a7a82e2762fa2ea27d0758693751fc1e95de14
MATLAB
2,263
92
function Test_MN() % function test15() % Test for fixedrankMNquotientfactory geometry (low rank approximation) % % Paper link: http://arxiv.org/abs/1209.0068 % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, July 11, 2013. % Contributors: % Change log: clear all; close all; clc; % ...
6920ed3f39b223fea4970be1b3a1bb83005b323274fbcc503a42a3b833a595d9
MATLAB
2,263
73
function T = spm_type(x, arg) % translates data type specifiers between SPM & Matlab representations % FORMAT T = spm_type(x, arg) % x - specifier % T - type % arg - optional string argument, can be % - 'maxval' - return maximum allowed value. % - 'minval' - return minimum allowed value. % - 'nanrep' - ret...
97751c7d31c65c95ace9cfbf00fc9a747ddef7c8b15e250e8af51c7651259b17
MATLAB
2,263
66
function [Aerr, werr]=ARFIT_arconf(A, C, w, th) %ARCONF Confidence intervals for AR coefficients. % % For an AR(p) model that has been fitted with ARFIT, % [Aerr,werr]=ARCONF(A,C,w,th) computes the margins of error Aerr and % werr such that (A +/- Aerr) and (w +/- werr) are approximate 95% % confidence intervals fo...
9e6d85902a999b04bc6b1e77f0b13aeaaa21f8d67d100a1852b0563767dd685f
MATLAB
2,263
85
% % nets_spectra - calculate and display spectrum for each node, averaged across subjects % Steve Smith and Ludo Griffanti, 2013-2014 % % [ts_spectra] = nets_spectra(ts); % [ts_spectra] = nets_spectra(ts,node_list); % [ts_spectra] = nets_spectra(ts,node_list,tailnorm); % % node_list is optional, and is a vector list...
1291ae90684ddd6eb43e773a378922048def527a7ea86faf976aa00ffdad5e99
MATLAB
2,264
83
function [b, tau, er] =... regress_latency_vs_rew(A, nback, plotarg, z_arg, varargin) %regress latency to cpoke against rewards, a la Wang/Uchida 2013. %also fits exponential. cmc 12/2/20 %inputs: A struct. If you give it the S struct, will convert it to A struct. %nback specifies number of previous trials to regre...
547c29c9f3f96a721bbfb1c0f076a0cc3156d0ce748dfdab866a9867df04e06c
MATLAB
2,264
58
function fieldtrip2spss(filename, labels, data) % FIELDTRIP2SPSS compiles data and correpsonding labels into a textfile, % suitable for importing into SPSS or JASP (jasp-stats.org). % % Use as % fieldtrip2spss(filename, labels, data) % % When exporting from MATLAB, set: % - filename; should be string (e.g. 'counts...
60e7aa234dd542c8ab8ea61eb8d35fca09a1e9d3798318aa01d533babc315c26
MATLAB
2,264
72
% eeg_writechanfile - write channels.tsv from single EEG dataset. The % function also outputs channels count % % Usage: % channelsCount = eeg_writechanfile(EEG, fileOut) % % % % Inputs: % 'EEG' - [struct] the EEG structure % % 'fileOut' - [string] filepath of the desired output locati...
140a8d1003471004e712f95f083df9b2779433545b2a216486687390b2fc7148
MATLAB
2,265
93
function [xdata,ydata,tx,ty] = embed_data(x,y,parm) % Delay or Integral-delay embedding for input-output prediction % [xdata,ydata,tx,ty] = embed_data(x, y, parm) % [xdata,dumy, tx ] = embed_data(x, [], parm) % --- Input % x : Input data : Xdim x Tsample x Ntrial % y : Output data : Ydim x Tsample x Ntrial ...
659e5567b4fcbebf40420973e004e64c06f5b0ffb9530958ac9dfc34e221c9cc
MATLAB
2,266
61
% Deal with merging fMRI data from partial sessions. cd /home/surly-raid1/kendrick-data/nsd/ppdata/NSD929-nsd02/ % DATE CENSORED %%%%% preprocessVER1SECONDSTAGE a1 = load_untouch_nii('preprocessVER1SECONDSTAGE/run04.nii'); a2 = load_untouch_nii('preprocessVER1SECONDSTAGE/run05.nii'); % 50 trials from run04a; ignor...
82829911e693dcd9d9650f63737213e1217465fa4893a410d881f5ded92adb53
MATLAB
2,266
60
%{ preprocess.SpikesRateTrace (computed) # Inferred spikes -> preprocess.Spikes -> preprocess.ComputeTracesTrace --- rate_trace=null : longblob # leave null if same as ExtractRaw.Trace %} classdef SpikesRateTrace < dj.Relvar methods function makeTuples(self, ...
f57870d00ac71ac555e7397743f4ec640048cea61049ba8e3c050e1fbc9e0083
MATLAB
2,267
67
function [params, ellapsed, difference, abort] = wait2_escapeOption( timeout, params ,flushevents) %WAIT2_ESCAPEOPTION waits for a specified duration checkes at % the same time if the abort (ESCAPE) key was pressed % % Syntax: WAIT2_ESCAPEOPTION(timeout, params); % Syntax: WAIT2_ESCAPEOPTION(timeout, params, flush...
278816256d19ad6ecebdd8909e9d85cbee472abedbc4a30ff58db01bfdca0f5a
MATLAB
2,269
91
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Unit tests for causal emergence functions. Can be run from the repository's % root folder with runtests('tests/'). % % Note: these tests are stochastic, so if any of them fails try running them % again :] % % Pedro Mediano and Fernando Rosas, Aug 2020 % %%%%%%%%%%%%%%%%%%...
6092af9016f3d94d0c249d28a9748d84b03712fa5e9ecfc6054b5b14b5dbb6b1
MATLAB
2,269
82
%% overview % this script will generate the figure used in the NSD data paper of % adjusted hit rate as a function of lag between repetitions. % % jbh 2/22/21 %% load in data % for 10 day bins [day_ahr, day_binvals, day_subj] = get_allsubs_adj_hr('10day',true); % for log seconds [logsec_ahr, logsec_bi...
6ce62e090d806a530bedf74e28daebd2dabfe672900a24dfec16f7a1d1457cc8
MATLAB
2,269
51
function osp_check_distrOv_Call(src,~,gui) %% osp_check_distrOv_Call % This function is triggered when Grand Mean is checked for the raincloud % plots % % % USAGE: % osp_check_distrOv_Call(src,~,gui); % % INPUT: src = handle of the fit tabs % gui = gui class containing all handles and...
0fdbd210249bf2eb8b011ed26146e776b43fe10c29716904e94ed8c3d9035b26
MATLAB
2,270
55
%% AnalyzeFineDistanceData basePath = 'D:\Data\Lobster\FineDistanceResult_syncFixed_first_half'; behavDataPath = 'D:\Data\Lobster\BehaviorData'; filelist = dir(basePath); sessionPaths = regexp({filelist.name},'^#\S*.mat','match'); sessionPaths = sessionPaths(~cellfun('isempty',sessionPaths)); load("Apparatus.mat"); ...
cffada820bb77efdfaf59e948d8ab7526bb42beae5c6f8fddb37d8ff098e83c8
MATLAB
2,270
65
% IMAGESCTC - DEPRECATED. never completed or documented. % IMAGESCTC - imagesc in true color. Can help plot different % colormap on the same window. % % Usage: same as imagesctc % % Example: % figure; % colormap(jet); % subplot(1,2,1); imagesctc(rand(10,10)); % colormap(g...
8a58aa8ec9c0229388b573bfae4dd7381413ce9847f49d9df5ca0e6e000b7365
MATLAB
2,271
76
function x = ML_ckfilter(y, K, M, p) % Implements the Chung-Kennedy sliding window nonlinear step filter. This % filter is similar to a centred moving average filter of length K, but the % centre sample in the window is replaced by a weighted sum of forward and % backward moving average filters. The weights are inverse...
052a5a7eb05e4b5e2fbbbfd0453f6b63d2e41190657722e6dd5ecc9c121ec50e
MATLAB
2,272
66
% philipsLoad.m % Georg Oeltzschner, Johns Hopkins University 2018. % % USAGE: % [data, header] = philipsLoad(filename); % % DESCRIPTION: % Reads in philips MRS data (.spar and .sdat files) using code adapted from % PhilipsRead.m, provided as part of the Gannet software package by Richard % Edden (gabamrs.com). % %...
4d0f283db8bbc936b80050c6cf84643b2389ffcfb3cf7a626282c1da0d49a859
MATLAB
2,272
96
% 2016/11/11 by T. Ezaki % This function calculates accuracy indices: % r = (S1-S2)/(S1-SN), rD=(D1-D2)/D1 % % probN: empirical prob dist (exact), % prob1: independent MEM % prob2; pairwise MEM function [probN, prob1, prob2, rD, r] = pfunc_03_Accuracy(h, J, binarizedData) [nodeNumber,dataLength] = size...
ed031accd03e2a5024a88c8e549f152c19b448a1234ac5c7b36d2fc70e284183
MATLAB
2,272
69
function Pd = getPrecon(problem, x, d, storedb, key) % Applies the preconditioner for the Hessian of the cost at x along d. % % function Pd = getPrecon(problem, x, d) % function Pd = getPrecon(problem, x, d, storedb) % function Pd = getPrecon(problem, x, d, storedb, key) % % Returns as Pd the result of applying the Hes...
68fee234fce84e06ac30ca92da9dfd22d0a415f31669d7c3cd8fba7c48d5d0bf
MATLAB
2,273
60
% chunkTimeSeries - Create chunks of time series data % Assumes the time series data shape is a 2D matrix with time along the first dimension (ie time x voxels). % % Syntax % [time_series_chunks, chunk_indices] = chunkTimeSeries(time_series_data, num_chunks) % % Input Arguments % time_series_data – t...
e858a78c6e78c7fb0be7df1f8ca5d31e3e3e0634cdc79ff4fa59992a4f47df24
MATLAB
2,273
55
% demonstrate usage of mean functions % % See also meanFunctions.m. % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2022-04-04. % File automatically generated using noweb. clear all, close all n = 5; D = 2; x = randn(n,D); % create a random data set % set...
fdccecc62e4211ba26b1fbe0f0ab03b50448cae18b59b7ad730fe64f84ec107f
MATLAB
2,273
108
function f = compute_gaussian_filter(n,s,N); % compute_gaussian_filter - compute a 1D or 2D Gaussian filter. % % f = compute_gaussian_filter(n,s,N); % % 'n' is the size of the filter, odd for no phase in the filter. % (if too small it will alterate the filter). % use n=[n1,n2] for a 2D filter % 's' i...
f5a6f03e97df19f4066c7f3c11333cb50b9c98d711c5a41799ee90d39c51cd85
MATLAB
2,274
64
function SaveExcelSheet global run filename sheetname pathname dataSaveDir fileHeader Key KeyRange global Stock StockRange global sourcepathSES targetpathSES sourcefile factorNameList allListRange % Open Excel application process. e_process = actxserver('excel.application'); if run == 1 [sourcefile,pa...
520484fb1a9c9e372b5a0b5366b73f775a440a070a6361dbc853a6936f75acd6
MATLAB
2,275
67
%{ # Simulated Filter Responses -> stimulus.MovieClip filter_idx : smallint # filter index --- resp : mediumblob # filter response to the center of the movie %} classdef SimResp < dj.Imported methods(Access=protected) function makeTuples(obj,key) %create clips ...
ceea486143b5557be3add3a2d49b0fc3cfc67f55a57311c3e1cfd9e449650376
MATLAB
2,275
72
%% Figure 4 main YOURDATAPATH = ''; %% PANEL A: % FOVs on Allen CCF % FOV information locsM1 = [[-1.823, -1.193]; ... [-1.754, -0.153]; ... [-1.592, -0.625]; ... [-1.444, -0.561]; ... [-1.587, -0.699]]; locsS1 = [[-2.584, 0.191]; ... [-2.578, -0.274]; ... [-2.801, -0.079]; ... [-2.259, -0....
354f44ff5264c58fa1243243a2e2a17e4d0dc4103c0a17c81fafd562d7fb4017
MATLAB
2,276
79
% SHUFFLE - shuffle a given dimension in an array % % Usage: >> Y = shuffle(X) % >> [Y = shuffle(X, DIM) % % Inputs: % X - input array % DIM - dimension index (default is first non-singleton dimension) % % Outputs: % Y - shuffled array % I - forward indices (Y = X(I) if 1D) % J - reverse indice...
3d384b6f5b54f80eff2b04772790201a4bdae32496fcd235c462382aef5124ba
MATLAB
2,276
52
%{ preprocess.Treadmill (imported) # -> experiment.Scan --- treadmill_raw : longblob # raw treadmill counts treadmill_vel : longblob # ball velocity integrated over 100ms bins in cm/sec treadmill_time : longblob # timestamp...
668b7d24ce6a9a0264d07af8f7e391d47e1c159bb0e0ce8b603ae9dbb8a688c1
MATLAB
2,276
57
%% FromHE2HW_PETH % Draw HE to HW PETH graph % Since the duration between the HE and the HW varies across trials, % interpolation method is included. % Beware. % This methods is more like the method for generating the ML classifiers' % dataset, not the z score for the PETHs. addpath('../FeatureImportance/'); Classif...
8978d686b2b7bc10a1fa155184f79c4f2264b9baa9b4365409157bfecc1ebb40
MATLAB
2,276
61
function [orthobasis, L] = orthogonalize_legacy(M, x, basis) % Orthonormalizes a basis of tangent vectors in the Manopt framework. % % function [orthobasis, L] = orthogonalize(M, x, basis) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % basis is a cell containing n line...
c2bac8a78e156635d26e4248fdb0419af1cb20fe0b6b300bca3bca04b6343b16
MATLAB
2,276
74
function c = tapas_hmm_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the hidden Markov model (HMM) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The structure ret...
d89689a81e50c6ad8e6b498581468a7d5e32db543cb1e20afc8280ee01085525
MATLAB
2,276
64
% VASA estimation % % This script computes baseline corrected contrast files using the VasA % fMRI approach for task-based data. % % Dependencies (should be installed as SPM toolbox): % - VASA toolbox: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5573956/ % input data img_input = { '/data/pt_01880/MonocularBlindne...
e5f13b0b50a0b1a592af06d7dd44bfa3a098feb61ea569c41520f36bfccc3a04
MATLAB
2,276
70
function errorbar_tick(h,w,xtype) %ERRORBAR_TICK Adjust the width of errorbars % ERRORBAR_TICK(H) adjust the width of error bars with handle H. % Error bars width is given as a ratio of X axis length (1/80). % ERRORBAR_TICK(H,W) adjust the width of error bars with handle H. % The input W is given as a rat...
ee1bc47d2fe11d3d10265a197eff0fd81a66420a9ee8c9271f7c657c471cf52c
MATLAB
2,276
104
function [fitres, gof, fout] = gauss2DRotFit(im,varargin) % external file % Create a fit. % Input : % % im : input image of 2D gaussian % fop : fitoptions - a structure with 3 fields : Lower,StartPoint and % Upper. Each of the fields is an array of 7 values : % offset % ...
4b2e39319afd601087f5b01b8872b68bb6b699e02e29c85300860c46906ed9b2
MATLAB
2,277
90
%% single trials: raw traces % - load trials % - select channels % - plot raw traces % (c) Jiri, Feb24 %% settings subjTag = '20_PR11'; selected_channels = {'Rd1-Rd2', 'Ld6-Ld7'}; selected_networks = {'DMN', 'DAN'}; pathBeg = 'F:\dox\ms_switch_EI\data\v31_stft_session_bip\switchin_EI_IE_bip'; %% load trials params.s...
cb2767dcf378a2673d544a1938292a5e03e21dccb9e0b0ae08b61775e6509c0c
MATLAB
2,278
53
function [basisSet]=osp_recalculate_basis_specs(basisSet) %% [basisSet]=osp_recalculate_basis_specs(basisSet) % This function recalculates the basis spectra and ppm-axis of the basis % set. % USAGE: % [basisSet]=osp_recalculate_basis_specs(basisSet); % % INPUTS: % basisSet = Basis set loaded in FID...
0906d4d914e83c60590b26daa969919113efa893af57308d78a8bdca6ad6083b
MATLAB
2,279
42
function [R]=surfing_circleselection(c1,c2,f,circledef,voldef,nodeidxs,linedef,distancemetric) % C1,C2: 3xP coordinates for the P vertices: C1 is usually the white, C2 the pial surface % F: 3xQ vertex indices for the Q faces (1-based indices) % VOLDEF: Struct with fields .mat (4x4 voxel to coo...
6768a909eb6ce7f89851732e68bf6ff4e3bc68106ef647e3f0453e12d007c67a
MATLAB
2,279
56
function [accuracyMean,accuracyStd,inSampleAccStd,allFoldData,CVMdl] = ComputeCVAccuracies(dataMatrix,dataLabels,cfnParams,doSummarize) % ComputeCVAccuracies % Summarizes the output of GiveMeCfn as mean/std in folds, and works with single inputs to GiveMeCfn % (for the case of CV where the training/test split is specif...
661e436ea93a70f5cebd4a38ab6641b90e8c54ba4a0cd8c40a654235ce79a4ad
MATLAB
2,280
64
function tapas_fit_plotCorr(r) % Plots the posterior correlation matrix of the model parameters estimated by tapas_fitModel. % This is estimated by calculating the Hessian at the MAP estimate. The negative inverse of the % Hessian is the parameter covariance, which is standardized to yield the correlation. % Usage: es...
8aa53b1035698896582ee4b6c38d65f1ff40749514c79859605bd2051c92887b
MATLAB
2,280
68
function [mergedStart, mergedEnd] = mergeCloseBursts(tStart, tEnd, gapSec) %MERGECLOSEBURSTS Join bursts separated by less than gapSec into one. % % Parameters % ---------- % tStart : vector % burst start times, in seconds % tEnd : vector % burst end times, in seconds % gapSec : double % bursts cl...
9c25341e30f5b991373138fce14aa74fe1a2cf6aa1e482cca14ff0270e0a81e5
MATLAB
2,280
59
function [ sig_dF_F_activity , sig_dF_F_coactivity_threshold , sig_dF_F_coactivity_peaks ] = findSignificantDF_FCoactivity( dF_F ) %FINDSIGNIFICANTDF_FCOACTIVITY( dF_F ) % % PARAMETERS: % \_ dF_F [TxN matrix]: dF/F-signal for N units in T time steps % % % === Jan Moelter, The University of Queensland, 2018 ==========...
ef22c09406bf62244bbe094726a6d84447b3429446a364a8ac492a83b56bcd05
MATLAB
2,282
72
function this = write_nifti_analyze_nd(this, filename) % saves MrImage to nifti/analyze file depending on file extension % (.nii/.img) % % Y = MrImage(origFileName); % Y.write_nifti_analyze_nd(newFileName) % % This is a method of class MrImage. % % IN % fileName string of file identifier to save to; if not spe...
2ec8cd241f84899bbe1b8b27bab95430b20de5f6cd85045f73f974b901b76add
MATLAB
2,283
56
% STD_SELECTDESIGN - select an existing STUDY design. % Use STD_MAKEDESIGN to add a new STUDY.design. % % Usage: % >> [STUDY] = std_selectdesign(STUDY, ALLEEG, designind); % % Inputs: % STUDY - EEGLAB STUDY structure % STUDY - EEGLAB ALLEEG structure % designind - desired (existing...
935325689eeb1dc7d0b8098ea628ca9517d7ca4b41e45491c33ddf4a376c2f33
MATLAB
2,284
80
% this was just used internally (for QC and for subject leaderboard) % and to derive FIR for library purposes. function glm_nsdSIMPLE(ppdir) % this is one-regressor GLM for the screening session phase. % approach: every stimulus is the same, assume HRF, no boots % define stimdur = 3; tr = 1; % figure out runs file...
74dac305621c351c145f7d64207105d8d5fdc7566e7ba4f48a9a85fb4fe5de55
MATLAB
2,285
60
% STD_RESET - Remove all preloaded measures from STUDY % % Usage: % >> STUDY = std_reset(STUDY); % % Inputs: % STUDY - EEGLAB STUDY structure % % Outputs: % STUDY - EEGLAB STUDY structure % % Author: Arnaud Delorme, CERCO/CNRS & SCCN, INC, UCSD, 2009- % Copyright (C) Arnaud Delorme, arno@sccn.ucsd.edu % % This f...
e71f2f597dbff4313656ca99e72cff15f7614e0c30fa3f320ce378afeee196a1
MATLAB
2,286
59
function [g] = gen_SWnet(n,k,beta) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % gen_SWnet generates small-world network using Watts-Strogatz model. % Ring lattice of n nodes with k-nearest neighbor is first created, and % then nodes are rewired depending on rewiring probability. % % Ar...
5bbb38301d353a7efda1155526543aa6e7b9b4f0a06358c2dd3599fe7d9a14de
MATLAB
2,288
70
function convertMCSh5toMat(dataFolder) % Converts h5 files from multichannel systems (MCS) to mat files to be used % in MEA-NAP % Adapted from code from Alessio % Written by Tim Sit during March 2024 % The code currently assumes that the reference electrode is number 15 fileList = dir(fullfile(dataFolder, '*...
ce981dd32b9aa02ad9e8f2c22dd0d27324a3d8f2930c3b30293312ecf6e49c38
MATLAB
2,288
88
function [LatOpt, RPE, Kappa, Rewards, Delays] =... simulate_vanillaTD(alpha, ratTrial, rpetype, scalingfactor) if nargin<4 scalingfactor = 0.48; fprintf('Using default discount factor %.2f\n', scalingfactor) end %% Pull Data from Rat Trial % Only use trials where we have data from the rat (basically cove...
147e4ea026871fe386896fe0ba6637a30dd5c3714d151be199bc86c270790582
MATLAB
2,290
56
% Convert EEG data in BrainVison format to MATLAB-compatible format % % Please see description PDF file for more details % Example rawdata is from VP026 % We strongly recommend you to use data in MATLAB-compatiable format uploaded separately % Please download BBCI toolbox %%%%%%%%%%%%%%%%%%%%%%%%%% please modify folde...
1d2684498524d944ae067858371a04c85c4fa256770bb87e9b55db3345e0e4b1
MATLAB
2,292
68
function [dat] = read_brainstorm_data(filename, hdr, begsample, endsample, chanindx) % READ_BRAINSTORM_DATA reads .EEG files that have been generated by % the Nihon Kohden system. The function constitutes a wrapper around % BrainStorm3 functionalities % % Use as % [dat] = read_brainstorm_data(filename, hdr, begsampl...
ec86278489e19f99ee2e4fd718663722aa5d32564aa423e6248f7c68eb921768
MATLAB
2,292
87
function [funcs, PB, sizing, borders, myelin] = Setup_Simulation % SETUP_SIMULATION % % Initialises the spatial domain, region boundaries, myelin grid, % and model parameters for the simulation. % % OUTPUTS: % funcs - function handles and behavioural parameters % PB - probabilistic boundary parameters % s...
60d253670f597fc907a2adc6593e3a171e851417cf6395cbdd9fe42805bc2f74
MATLAB
2,293
82
function plot_hylid_gt(gt,filter,varargin) p = inputParser(); p.addParamValue('inds',true,@(x)isscalar(x)); p.addParamValue('names','short',@(x)ischar(x)&&any(strcmpi({'none','short','long'},x))); p.addParamValue('sizes',true,@(x)isscalar(x)); p.addParamValue('Parent',[],@(x)isscalar(x)); p.parse(varargin{:}); args = ...
f6060c2ded87af9ab716f215bf5af9c677b752271526213359a7d5c43d3f2ec2
MATLAB
2,296
56
% -------------------------------------------------------------------- function import_raven_Callback(hObject, eventdata, handles) % Requires a Raven table and audio file. % (http://www.birds.cornell.edu/brp/raven/RavenOverview.html) %% Get the files [ravenname,ravenpath] = uigetfile([handles.data.squeakfolder '/*.txt...
0704722f112299b01172e6e7c872231ab1f217b97214434242707f111a748866
MATLAB
2,297
67
classdef MrCopyDataTest < MrCopyData % Implements class with nested MrCopyData objects to test recursive % operations of MrCopyData % % % EXAMPLE % MrCopyDataTest % % See also MrCopyData % Author: Lars Kasper & Saskia Bollmann % Created: 2017-07-20 % Copyright (C)...
24392125401528a787fca5e3867b8fc1208a14d17fb7ccc32e62ee7433b5fdf4
MATLAB
2,298
69
function [dat] = read_biosig_data(filename, hdr, begsample, endsample, chanindx) % READ_BIOSIG_DATA reads data from EEG file using the BIOSIG % toolbox and returns it in the FCDC framework standard format % % Use as % [dat] = read_biosig_data(filename, hdr, begsample, endsample, chanindx) % where the header has to be...
35de7047b1e88add715b60a269d5e3435c79a178560d41d15c30c33ea9571f26
MATLAB
2,298
75
function [err,Eq] = Plane_Equation (Triplets, verbose) % % [err,Eq] = Plane_Equation (Triplets, [verbose]) % %Purpose: % Determine the equation of the plane passing through three points % % %Input Parameters: % Triplets is an Nx1 vector of strucutres. Each structure defines a plane % .XYZ : is a 3x3 matrix con...
6bd90f58b1031bf24c1288480b8ad73dadbd47e765eca28a249803a9e979aeab
MATLAB
2,298
86
% % nets_spectra - calculate and display spectrum for each node, averaged across subjects % Steve Smith and Ludo Griffanti, 2013-2014 % % [ts_spectra] = nets_spectra(ts); % [ts_spectra] = nets_spectra(ts,node_list); % [ts_spectra] = nets_spectra(ts,node_list,tailnorm); % % node_list is optional, and is a vector list...
18b77efad8d3169c10ed12fffbb776fca7a99687f2948e16528f094d33b1e3ff
MATLAB
2,299
68
% EEG_ISBOUNDARY - check if an event is a boundary event % % Usage: % >> logical = eeg_boundaryevent(INEEG); % >> logical = eeg_isboundary(event); % % Inputs: % event - EEGLAB event % % Outputs: % logical - true or false % % Author: Arnaud Delorme, 2022 % % see also: EEGLAB % Copyright (C) 2022 Arnaud...
0344a02689af8061ba028b1044d77ef01f1f191b855927dffe0648cf37f1abda
MATLAB
2,300
79
function fear_frzTrigReact_cond(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.targetHC=3; param.varName='frzTrigReactCond'; param.saveFile=[basicMetaData.AnalysesName '-fr...
198a6ddf5523015af914e7d3cbde5ad4c764d753af80255b364fbdae25255a16
MATLAB
2,300
68
function [ psi, v_mi, x_mi ] = EmergencePsi(X, V, tau, method) %% EMERGENCEPSI Compute causal emergence criterion from data % % PSI = EMERGENCEPSI(X, V) computes the causal emergence criterion psi for % the system with micro time series X and macro time series Y. Micro data % must be of size TxD and macro d...
c2052250e7823df47eb43cc9d88668aa4301f06c2ee3990fe5ed94dc0e2795ce
MATLAB
2,301
37
function [photoOn_epoch_mean,photoOff_epoch_mean,photoOnMid_frames,photoOffMid_frames] = get_epoch_mean(full_deconv_traces,photo_onset_frames,... num_photoOn_frames,num_window_frames,maskout_frames,num_baseline_frames) Fs = 10; % frames per second % num_photoOn_frames = photostimulation epoch length;...
81e2c7e114b6b28e99e959b2c98df37ac50e21d46ea91fb2cb5c796f444f0b4b
MATLAB
2,302
84
function fear_getRipFrMod(basename) % 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 '.okUnit.spikes.mat']) load([basicMetaData.Basename '.s...
4b069922764b9118683c05a4211ca6a658ff400045171c3ec882ba8750cbbb8c
MATLAB
2,303
75
function ConcentrationProfile(file,molec,model,dx,Mx,S0,U,UT,Cb) % Transform units from SI to desired ones scaleC = convertFromSIunit(U); scaleT = convertFromSIunit(UT); Cb=Cb*scaleC; C=load(file); Y=C.Data; t=C.t.*scaleC; T=C.t(end) * scaleT; % Generate parameters...
5f8152c53e6a15e12a2c9c4063bdfe38729bc8d4f12df0eff919b2f1935adbeb
MATLAB
2,303
73
%% Figure 3 main YOURDATAPATH = ''; %% Panels A,B,D use mouse 1 mouse = 'cfa17'; session = '200825'; [R, M, config] = loadData(mouse, session, 'R', 'DLC3', YOURDATAPATH); % Lock data for joint angle time series config.preT = -100; config.postT = 400; config.tBase = 10; config.tPts = config.preT:config.tBase:config.po...
662b98b66ba614cba4079667f034199b7c4a2023df71f51e5e2f13bb3e2f94d4
MATLAB
2,303
66
function essential_svd % Sample solution of an optimization problem on the essential manifold. % % Solves the problem \sum_{i=1}^N ||E_i-A_i||^2, where E_i are essential % matrices. Essential matrices are used in computer vision to represent the % epipolar constraint between projected points in two perspective views. %...
69069139e3ac6d3d44f3a575c96dcd78b24ba6985d31361d910d161389773ea5
MATLAB
2,303
79
%% Add path addpath('H:\Kaizhen\Anxiety_behavior_phenotyping_analysis\Ethological_Behavior\Heat_Map_spatial'); % List of Excel files (behavior phenotypes) fileList = { ... 'nr_walking_spatial.xlsx', ... 'nr_grooming_spatial.xlsx', ... 'nr_climbing_spatial.xlsx', ... 'nr_headdip_spatial.xlsx', ....
564f578ce508a63db7761458e0ab8df77fc01904c2d783896d065dc7c26fe747
MATLAB
2,304
52
% # (JM) MODIFIED FROM ORIGINAL FUNCTION 'AssembliesActivations' function AssembliesActivations( filenameCLUSTER ) % # [filename,pathname] = uigetfile({'*_CLUSTERS.mat';'*_CLUSTERS.MAT'},'Open file with assemblies data', 'MultiSelect', 'off'); % # filenameCLUSTER=fullfile(pathname,filename); load(filenameCLUSTER); ...
be703d4af90809b0f05d2f1b2e41b45d7ad71f29e22dcef59fb71984d1875cd3
MATLAB
2,304
74
function [y,mask] = vl_nndropout(x,varargin) %VL_NNDROPOUT CNN dropout. % [Y,MASK] = VL_NNDROPOUT(X) applies dropout to the data X. MASK % is the randomly sampled dropout mask. Both Y and MASK have the % same size as X. % % VL_NNDROPOUT(X, 'rate', R) sets the dropout rate to R. Rate is defined % as a probabil...
5329d696563e337288ba24427758f2612b2997f49381358ee8f22bd7ef35dc8e
MATLAB
2,305
81
% BIDS_LOADFILE - import JSON or TSV file % % Usage: % bids_loadfile(localFile, globalFile) % % Input: % localFile - Name of the localfile % globalFile - Name of the global file if the local file cannot be % found function data = bids_loadfile(localFile, globalFile, rawFlag) [~,~,ext...
de169915b2571d370b607d07ff8de5a0cd7b04ff04d0394d962c5edaa649dfac
MATLAB
2,305
93
function [ volsperrun ] = GE_get_volsperrun(inDir) % % [ volsperrun ] = GE_get_volsperrun(inDir) % % A utility to find the number of volumes per run in an ADW scan. % inDir is the starting directory for the I.* files. % % Souheil J. Inati % Dartmouth College % July 2001 % souheil.inati@dartmouth.edu % % Get series ID ...
686fd3933e7380c1c16dc37261c611e60385f730f07124816e6bc5c4f27753db
MATLAB
2,306
77
function [frequency,pow,options]=plotPSD(data,varargin) % EXAMPLE: [frequency,pow,options]=plotPSD(data,'FrameRate',200,'FreqBand',[0.1 100]) % 'VerboseMessage' ,true; % 'VerboseFigure' ,true; % 'Savefig' ,false; % 'FrameRate' ,1000; % 'FreqBand' ,[0.1 min(options.FrameRate/2,30)]; % 'Window' ...
874355d77cfd16dd0a5ca1087190634c9f6d950c6b41964ad1cea167b25581e8
MATLAB
2,306
75
% LLE ALGORITHM (using K nearest neighbors) % % [Y] = lle(X,K,dmax) % % X = data as D x N matrix (D = dimensionality, N = #points) % K = number of neighbors % dmax = max embedding dimensionality % Y = embedding as dmax x N matrix % Modified by LC. January 2008. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
5b17be9e99820faf1db7d4f541ef2ec75ef05c2fde9fb243677b75ea111a2ef8
MATLAB
2,307
77
function [lossTests, lossSEMs] = jointKinematicsCVPCA(kinematicsAll, maxDims, nLabels) % Computes cross validated PCA on joint angles and velocities if nargin < 3 nLabels = 5; end if nargin < 2 maxDims = 16; end % Params mice = unique({kinematicsAll.animalID}); lossTests = zeros(length(mice),maxDims,2); loss...
99214b9a7caafad6d147267150f96550033d5456934670f717336caf4247a775
MATLAB
2,307
67
%% %2X5 anatData = [anat_lS1, anat_lMTt, anat_rMTt,anat_lhMT, anat_rhMT]; extData = [ext_lS1, ext_lMTt, ext_rMTt,ext_lhMT, ext_rhMT]; dataMat=[anatData;extData] subjNb=20 ; %number of replications [p,tbl,stats] = anova2(dataMat,subjNb); c1 = multcompare(stats); %% anatData = [anat_lS1, anat_lMTt, anat_rMTt,anat_lhM...
166ced5935bc0fe7fa42bfae2c29231f7e75ce462bfa295defdeb383331fbac7
MATLAB
2,308
75
function s = appendstruct(varargin) % APPENDSTRUCT appends a structure or a struct-array to another structure or % struct-array. It also works if the initial structure is an empty structure or an % empty double array. It also works if the input structures have different fields. % % Use as % ab = appendstruct(a, b) %...
0ad051e9f6fd69360c77cb98a361059b27a2468fe6916713844bd69a4ef7b9ae
MATLAB
2,309
66
%% testing part pending clear; mypath = '/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble'; para=7; 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_para',num2str(para),'_1_35.txt']; ...
9ae75da8a3d0da3880a0d248f085fcb2c72244837e11056c7e06208cd99b671b
MATLAB
2,309
121
function plotSnips() parent = 'D:\Voltage_Imaging\03.02\Analysis'; fn = {}; fn{end+1} = 'Snip(field1d_00001)_1-4.mat'; fn{end+1} = 'Snip(field4a_00001)_1-4.mat'; fn{end+1} = 'Snip(field4b_00002)_1-4.mat'; fn{end+1} = 'Snip(field5_00001)_1-4.mat'; fn{end+1} = 'Snip(field7_00001)_1-4.mat'; fn{end+1} = 'Snip(field8_0000...
0f667abd5b1d7406611d9f878730a4f469f4b7dea41a9ddd4c4ccb501393cd25
MATLAB
2,310
83
function geometry4D = get_geometry4D(this, dimLabelsGeom) % Converts specified dimensions into classical (e.g. nifti) 4D geometry % % Y = MrDimInfo() % geometry4D = Y.get_geometry4D(dimLabelsGeom) % % This is a method of class MrDimInfo. % % % IN % dimLabelsGeom cell(1,4) of dimension labels constituting 4D geo...
7a1a6457ff46c5cc16f222b374517ae9df5cedaebcedd7337c5a1e0cf62f92c3
MATLAB
2,310
84
function plot_fig5h(datadir) prct = 15; fpath = fullfile(datadir, 'data-published/NpxData/pD1pD2.mat'); load(fpath, 'SU', 'S', 'pd1_coff_list', 'pd2_coff_list'); plot_persistence(SU, S, pd1_coff_list, pd2_coff_list, prct) end function plot_persistence(SU, S, d1list, d2list, prct) if nargin<5 prct = 15; end AvgF...
8c8674b573390ee03530514b3ee02942bfc6acf91169c9115b6b781d8f8fc66b
MATLAB
2,312
55
function mask = transientrise(trace, dTmin, nsigmarise, nsigmadecay, sigma, smoothGauss) % Make a mask that identifies the significant transients in a calcium % recoridng that cross the nsigmarise and last until crossing nsigmadecay. % Adapted from Dombeck et al., 2007. % Note H.-L. Chen: dTmin is in unit of frame ...
c81ac82dd8951733387e26878bfcf1e63e3b92b0de16d24afb7350d670b45369
MATLAB
2,312
79
function [x] = ft_struct2char(x, maxdepth) % FT_STRUCT2CHAR converts all string elements in a structure % into char-arrays. % % Use as % x = ft_struct2char(x) % % See also FT_STRUCT2STRING, FT_STRUCT2SINGLE, FT_STRUCT2DOUBLE % Copyright (C) 2018, Robert Oostenveld % % This file is part of FieldTrip, see http://www....
ce80077b85d1795a03e89bf778613d8512c35ce0d40f89848c97ac2f7d646ad8
MATLAB
2,312
88
% function [d,i] = MS_nearneigh(X,tau,blocksize) % % calculate the nearest (RMS) neighbour of each embedded point % represented as columns of X. % tau points either side of each point are excluded (default tau=0); % i is the index of the nearest neighbours and d are the distances. % % nearest neighbours are calculat...
efea9c45a111b952cc41726642cbdb7d088e8e24728c28c3ff6ebd2bdbd40de7
MATLAB
2,313
59
function [h_axes,h_image] = clrBar_axes(plotInfo) % plots "colorbar" as a new image into new axes of existing figure % useful in case of two or more colormaps are catted together % draws only specified range of the figure's colorbar % (c) Jiri, Apr17 %% defaults %if ~isfield(plotInfo, 'axPos'), plotInfo.axPos = [0.9...
0fa02d367b31b3df2d3d909ba61b601ec3096fad22213be46a915dd7bc45344a
MATLAB
2,314
81
function SurfStatWriteSurf( filenames, surf, ab ); %Writes coordinates and triangles to an array of .obj or FreeSurfer files. % % Usage: SurfStatWriteSurf( filenames, surf [,ab] ); % % filenames = .obj or FS file name (n=1) or n x k cell array of file names. % If extension=.obj, writes a .obj file (ASCII...
5ffa8545a3b24a59a8fb1ddc7d5204f98b6ac2f18aafc3c2ce8109e3fed0a8c8
MATLAB
2,314
76
function [myelin] = Oligo_Remyelination(local_threshold, myelin) % OLIGO_REMYELINATION % % Simulates remyelination driven by oligodendrocytes. % Myelin regeneration occurs if: % - Local damage is below a threshold % - The associated oligodendrocyte is healthy % - A regeneration timer condition is met % % INPUTS:...
ea4d5ba962985b52fe171d618283718771eb9471c09a7e295165776970e2fadc
MATLAB
2,314
67
% Script demo_load % Loads Nifti-image (TODO: other file formats) from disk into MrDataNd % % demo_load % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2017-01-18 % Copyright (C) 2017 Institute for Biomedical Engineering % University of Zurich and ETH Zurich % % This file is ...
379e4954c3f93b34c782aaeb76c26c98e0ae56f7a8f5a81bd9b637aa0394e4b0
MATLAB
2,315
49
function ROIstat = eval_ROIS(ROIs,fit,Model) %eval_ROIs(ROIs 'cell', fit 'struct', Model 'string') % evaluate ROIs for calculated parameters % % ROIs : cell array containing ROIs as matrix % fit : struct containing fitting results % Model : "Biexp", "Biexp_T1corr" or "Triexp" switch Model c...
a311cfcd82c4e53902722cd30e4190408a3d92fe794446c957290d0a10c1571f
MATLAB
2,315
74
function [y,mask] = vl_nndropout(x,varargin) %VL_NNDROPOUT CNN dropout. % [Y,MASK] = VL_NNDROPOUT(X) applies dropout to the data X. MASK % is the randomly sampled dropout mask. Both Y and MASK have the % same size as X. % % VL_NNDROPOUT(X, 'rate', R) sets the dropout rate to R. Rate is defined % as the probab...
ab11b1864f485e396f1c8678e67896ca3c763dae74ce7fef711d9991efca8749
MATLAB
2,315
65
%{ # brain area membership of cells -> fuse.ScanSetUnit --- -> anatomy.Area %} classdef AreaMembership < dj.Computed properties keySource = proj(experiment.Scan) * proj(shared.SegmentationMethod) * proj(shared.PipelineVersion) & fuse.ScanDone & anatomy.AreaMask end methods(Access=prot...
bf76bd513247a7e6b02ca67745192c134ae2697b0b67a0addac8f281a09324a3
MATLAB
2,317
75
function tests = tapas_physio_pca_test() % Test both pca() from "stats" toolbox and svd() built-in Matlab functions % give the same results. % % tests = tapas_physio_pca_test() % % IN % % OUT % % EXAMPLE % tapas_physio_pca_test % % See also tapas_physio_pca tests = functiontests(localfunctions); end % function f...
b40964d8065cf1f94609056e150a2d07d30c56dd968c9dbc140a3080659101e8
MATLAB
2,319
68
function pred = nnrpred2(Xtest,X,y,y_exp,K,dist_type,pret_type) % prediction of new samples with knn regression model % % pred = nnrpred(Xtest,X,y,K,dist_type,pret_type) % % ------------ INPUT --------------------------------------------------- % Xtest: dataset to be predicted [n_test x p] n objects, p variable...