sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ec1135e80b40cbb96cbf856dc13443ff00c2daa68e5efc5718842fcb52d8c86c
MATLAB
2,033
65
function [f1,f2,OUT] = plot_dens_results(OUT) % function [f1,f2,OUT] = plot_dens_results(OUT) % % ---------------------------------------------------------------- % * read input fields into variables % ---------------------------------------------------------------- N = fieldnames(OUT); for i = 1:length(N) eval([N{...
3260a878d6a33cb87910a9fab733bfaf992c7ca6d18ac9e2a29c2b3f9cbb3693
MATLAB
2,034
58
function [lp,dlp] = priorSmoothBox2(a,b,eta,x) % Univariate smoothed box prior distribution with quadratic decay in the log % domain and infinite support over the whole real axis. % The plateau pdf is built by cutting a Gaussian into two parts and % inserting a uniform distribution from a to b. % Compute log-likelihoo...
656c2f345e34836f245a5642fd9e29ad0c7bb5151bb7ba3738393ed8734ad5d0
MATLAB
2,034
53
%{ # Compute frequency of abnormal activity -> experiment.Scan --- dff: longblob # quality intesity for all fields, length(trace) x nFields mean_dff: longblob # mean quality intensity trace (df/f) across all fields prominences: longblob # peak amplitudes of global epileptiform events widths: longblob ...
960ed067ed2c9cd3212c3b4a65f2cb4133853d59bcd044e25715ffe510f0af2a
MATLAB
2,034
52
%% ------------------------------------------------------------------------ % Specify input/output folders input_folder = '/scratch/shape/oasis/oasis_disc1'; output_folder = '.'; %% ------------------------------------------------------------------------ % Build dataset file_list = {}; sub = dir(input_folder); f...
d5554c2fb07d62a47e751373d431973e47b27cc8b234913daad11932f6db9e87
MATLAB
2,034
51
set_up_paths_and_data_directories; components = {'p', 'g'}; freqs = {'freq4', 'freq3', 'freq2', 'freq1', 'freq0'}; regions = {'Hippocampus', 'EntorhinalCortex', 'vmPFC'}; map_dir = fullfile(folder_project, 'outputs', 'brain_weight_maps', 'PLSbeta', 'brainToTEM', 'MDSseed121', 'iteration32000', 'walkRandomSeed42', 'ni...
e05a6255404fec43ee133629f04012a578c590d9b100b614aebabb1c627d80b2
MATLAB
2,034
69
function varargout = replaceWildcards(stringIn, varargin) % % stringOut = replaceWildcards(stringIn[, wildcard1, replacement1, wildcard2, replacement2, ...]) % % replaceWildcards is a function which takes a string "stringIn" and % (recursively) replaces all occurrences of {wildcard1, wildcard2, ...} with % {replacement...
8d8b05bfcec6cd54bba82de854cf916ed4381bad23c2eb0d46b3d2c4c441df54
MATLAB
2,035
46
clear all close all clc data_path='path_to_the_dataset'; colorlabel_layer=brewermap(12,'Paired'); colorlabel_layer=colorlabel_layer([10,4,3,8,2],:); %% for idx=1:4 load(fullfile(data_path,['data_BO_session',num2str(idx_session),'.mat'])); BO_Mod=data_BO.BO_index; %% histogram of BO modulation index fi...
76892ddc375d48973dfd9cb2a10a218e33a405044a39204b957d06921edf4d5a
MATLAB
2,036
62
function [movie,summary]=h5readchunk(fpath,framerange,varargin) % HELP % reading chunk of a movie % SYNTAX %[frame,summary]= h5readchunk(fpath,framerange) - use 3, etc. %[frame,summary]= h5readchunk(fpath,framerange,'optionName',optionValue,...) - passing options using a 'Name', 'Value' paradigm frequently used by Matl...
8ab57059c994f13c49adeada12e8373dc8efbf1d3a51c9e343d7e70d092cf20c
MATLAB
2,036
65
function c = tapas_rs_precision_whatworld_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the 'precision' response model according to: % % Vossel, S.*, Mathys, C.*, Daunizeau, J., Bauer, M., Driver, J., Friston, K. J., and St...
be5f521cb8be33b1d6f4095685f2ba7dfc22c799367e1507ae97ae956ded421e
MATLAB
2,036
81
function [Y] = predict_output(X, Model, parm) % Prediction from input data % Input X should be normalized according to 'parm.data_norm' mode % Time delay embedding for X is done in this function % Y = predict_output(X, Model) % = Model.W * X % Y = predict_output(X, Model, parm) % = (Model.W * X) * (parm....
7ea8c8baa37b238855b73f6f1f3b5366b1f075f5c5a09a8812b017c4b4bb1674
MATLAB
2,039
58
function plot_fig4i_right(datadir) % Plot z-scored latency to poke in the reward port after the reward port % light turns on following short vs long reard delay trials, averaged % across rats. N = 16 rats. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. load(f...
016dfe4530b1910853cf0a376c44adbe8ee5b84db195830abaa7110bb9113fe6
MATLAB
2,040
61
function TCA_saveModel(tensorPath, savePath, R, titles) %save the model with the lowest error and corresponding figure %INPUTS: % tensorPath = path to tensors % savePath = path to save in % R = number of components % titles = plotting titles e.g. {'neurons' 'time' 'trials'}; matfiles = dir(fullfile(tensorPath...
2596a6ac92eb3efd6d72e3128ea2d8a5ecb30827aa76d71e82ed87169e64e69d
MATLAB
2,040
78
function [d,n,p,oldd]=surfing_dir(pat) % directory listing with support for '?' and '*' wildcard characters % % [D,N,OLDD]=PHOEBE_DIR(PAT) % INPUT: % PAT File name pattern: either a directory name without wildcard % characters, or such a directory name followed by a file name % thay may contain w...
a4d7cfc1fe7e6f96c9c270d47b692395819fbb0e55aac46defb9e59bc77aabe6
MATLAB
2,040
66
function database = DBCreate(database) %DBCreate - Create database. % % Create database with figure and variable tables. Use this function % if you have admin rights to the database server. Otherwise ask % the DBA to create an empty database with the appropriate access % rights, and then use <a href="matlab:help DBCre...
3998debe1085889ae58dbe1d2da6b50b20e7d440cde24ca7579cab6e85dbc7ea
MATLAB
2,041
84
function [filepath,filename,formatted_string,options]=getFile(varargin) % EXAMPLE USE WITH ARGUMENTS % [filepath,filename,formatted_string]=getFile() % [filepath,filename,formatted_string]=getFile(options) % This function prompts a window to choose a file, whose path is passed as an output argument % and corresponding...
c5b2c37ee6732ab41b5deeb20b3cf1e6ad1942ac87523b76856e94b3c498d441
MATLAB
2,042
78
function maxCh=fear_getMaxThetaCh(basename,varargin) % basename='~/data/Fear/triple/karmeliet190901/karmeliet190901'; % basename='~/data/Fear/triple/achel180320/achel180320'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.nCh=b...
e291c8c11346c259708ade0032e8d45e4d079a4269bf675771606772cf5fda10
MATLAB
2,042
87
function [su_hdr,ex_hdr,se_hdr,im_hdr,pix_hdr,im_offset] = GE_readHeader(IFileName) % % [su_hdr,ex_hdr,se_hdr,im_hdr,pix_hdr,im_offset] = GE_readHeader(IFileName) % Reads the header info from a GE lx2 or 5.X file % % % Souheil J. Inati % Dartmouth College % May 2000 % souheil.inati@dartmouth.edu % %%%% Open the IFile ...
54ae3df1edd4b6b1b02dbd80e499b9c0dcc47949e279cc0c9f14bd1782ca1edd
MATLAB
2,043
54
function [A, Bx, By] = operator2matrix(Mx, x, y, F, Bx, By, My) % Forms a matrix representing a linear operator between two tangent spaces % % function [A, Bx, By] = operator2matrix(M, x, y, F) % function [A, Bx, By] = operator2matrix(Mx, x, y, F, [], [], My) % function [A, Bx, By] = operator2matrix(M, x, y, F, Bx, B...
19c73e19aa2d3ad1a1ddc4c02daefb95265766e9db9a2ac5f1fde1a947a90964
MATLAB
2,044
38
keyword = 'vector'; ith_freq=7; export_path = ['/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble/MRI_result_sinusoid/periodic_2501_testing_',num2str(ith_freq),'_fieldmap_',keyword,'_mean/']; % export_path = ['/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble/MRI_result_sinusoid/periodic_2501_tes...
2ff959fa6dc702ae6133d140f382765cfda7824109bf31c61128307a45987b87
MATLAB
2,044
58
%{ preprocess.EyePosClusterCenter (computed) # my newest table # add primary key here -> preprocess.CircleMap -> preprocess.ClusterPeaks ----- # add additional attributes center_x : smallint # center of the cluster in x dimension (camera # pixels) center_y : smallint...
5122605dc2c927677b513463cc234a3a2bb0f13cf5bb28adbfce292c1e52f76e
MATLAB
2,044
43
%% sepia_configuration_EchoCombine % % Description: a script contains all the echo combine method names and related function names % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 5 June 2021 (v1.0) % Date modified: % % DO NOT change the variable name % DO NOT change the order of the entities, add a n...
e66fa26c94b748ae63ac67649a691241b5d8741f2bd14797d5dc6db1cddd4faf
MATLAB
2,044
57
function S = statscounters(names) % Create a structure for statsfunhelper to record counters in manopt % % function S = statscounters(name) % function S = statscounters(names) % % The input can either be one string containing a chosen name for a % counter, or a cell containing multiple strings designating multiple % c...
efd842120a633b57506fc1e58f212c7a931cfa7cb5f8f97733842b23764930af
MATLAB
2,045
74
function group = cvalgroup(Dat,type) %designs labels for cross-validation groups for stratifying indices % %inputs: %Dat: the data from OFC %type: switch case for which kind of groups % %output: %group: index for each sample that corresponds to a unique group hits = Dat.hits; prev_hits = [nan;hits(1:end-1)]; chosenp...
058ef5affd672a04a96ee7e4892fb2df131e89a16c39567481d81138febb601a
MATLAB
2,046
56
%% Sample script to compare simulation to binary tumor image clear all; close all; clc; load('simulations\simdata\run_demo.mat') slice_ind = 140; %Extract simulated tumor tumor_sim = squeeze(occupancy(:,slice_ind:slice_ind,:)); tumor_sim = imrotate(tumor_sim,90); %To match tumor images orientation tumor_sim ...
1cd858e84c160edde26b98dd5bf485980ff83ca0b61950872b4912b6bd16e45a
MATLAB
2,046
73
% op_naaFit.m % Jamie Near, McGill University 2014. % % USAGE: % parsFit=op_naaFit(in,ph0,ph1); % % DESCRIPTION: % Perform a Lorentzian lineshape fit to the NAA resonance in a brain % proton MRS dataset. % % INPUTS: % in = input data in matlab stucture format. % ph0 = zero order phase to add to the input data...
b6144b4e57454552bf97c4915c2ac09ac811ca5d5fd4372786a23c9733718d73
MATLAB
2,046
57
% SIZE - size of memory mapped underlying array % % 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 with...
f56fe88f22217bce28a7b2d01b2f90d17dfce137aafc5237b09c3dcab9bd3fdc
MATLAB
2,047
81
function ft_deface(file_in, file_other, write_mask) % MRI defacing % % ft_deface(file_in, file_other, write_mask) % % Inputs: % file_in - file name of input image. % file_other - file names (cell array) of other images. % write_mask - save binary. % % This function defaces an MRI image using the SPM function s...
65e2e6691e5d3894230e074545891c351a953f512bda32c4c2b4a57604b3d7bb
MATLAB
2,048
52
function params = preprocDownsample_GetMetaParams(Arg) % Usage: params = preprocDownsample_GetMetaParams(Arg) % % ML 2012.11.16 params.class = 'preprocDownsample'; switch Arg case 1 % Simple box average, for TR=1, imhz=15 params.dsType = 'box'; params.imHz = 15; % movie / image sequenc...
01dfc6409f8ae75e495d8ee7d34b1319fee4efdb23530a152c75ebd776069ed5
MATLAB
2,049
46
function [optimalThreshold, maxSENSAIScore] = SENSAI_fminbnd(minThreshold, maxThreshold, refCOV, Eval, Evec, noise_multiplier, COV, evecs_Template_cov) max_number_of_epochs = 500; % if EEG recording is long (default = 500 epochs) number_of_epochs = size(COV, 3); if number_of_epochs > max_number_of_epochs rng(2,"twis...
3ae73c9b8e9774d3ae1313a7bcde42d4fad800be61271444d78e339235defa7e
MATLAB
2,049
76
function [xpos, ypos] = Unbiased_Movement(xpos, ypos, PB) % UNBIASED_MOVEMENT % % Performs unbiased random movement of agents on a 2D grid with optional % probabilistic boundary crossing (e.g. blood-brain barrier). % % INPUTS: % xpos - x-coordinates of agents % ypos - y-coordinates of agents % PB - structure c...
94173f2d431515994e6024e20f92a0896a825e90e7a92cd16f1f07d3affac43e
MATLAB
2,049
80
function Y = delay_embed(X, k, step, shift) % DELAY_EMBED - Delays-embed a signal % % Y = delay_embed(x, k, tau, shift) % % Where % % K is te embedding dimension % % TAU is the embedding delay % % SHIFT is the embedding shift % % Y is the delay-embedded reconstructed state space, i.e. a KxT matrix % % %...
2b03efb829807c1cc00979d2a3b36ffaa7be0f7ea341dd24620c922fd59da1c9
MATLAB
2,050
86
function [LatOpt, LatMdl, RPE, Kappa] =... GenerateLatencyData_RPEAlpha(params, ratTrial,... gen_arg, noise_arg, noise_params) %GenerateLatencyData_VanillaAlpha % params - model parameters % params(1) = learning rate, in [0, 1] % params(2) = scale parameter, [0, 1] % ratTrial - trial data. Usual...
4f275a6a8f723304ece0d7dd9978a3c60e1e4df0e9072becee269e7723ed53ef
MATLAB
2,050
52
function [ensmat_in, enscells_in, nens, time_comp] = get_carrillo_ens(raster, param) % Gets the activation sequence and core-cells by Carrillo's algorithm. % INPUT: % raster: <logical> N-by-T matrix with the raster. N is the number of total neurons % and T is the number of total frames. % param: [optional] <str...
cb9bcc1aab6ecf7e565bf7a60bf1d722291a7d19a48a49e21c8e306a1416eddb
MATLAB
2,050
42
%% load libraries run('set_library_paths.m'); addpath(SPM_PATH); % per spm docs, do not genpath it addpath(genpath(CANLABTOOLS_PATH)); %% VARIABLES THAT MUST BE DEFINED BEFORE THE SCRIPT IS SOURCED % THIS SCRIPT IS DESIGNED TO RUN ACROSS A SINGLE SUBJECT/TASK % with multiple runs per subject % the nested cell arrays a...
efd35fb7b6ce61e4f3bc0ee8113639a8953dda999fd146173e879f877a49e0a4
MATLAB
2,050
87
function [ SGEdirs]= nmri_run_multiple(subjects,cfg,cmd,params) % [ SGEdirs , sge_ids]= nmri_run_multiple(subjects,cfg,cmd,params) % Function to run jobs via nmri_parrun & nmri_qsub on multiple subjects % % Sets some defaults for MEG/EEG processing and makes sure params are % attached to subject structs % % wil...
fd661063b539ebe9904232a174cf46c9b2f842fdb7f7a9fdd86a112fac829cbd
MATLAB
2,050
56
function [detector lgraph options] = TrainSqueakDetector(TrainingTables,layers) % Estimate Anchor Boxes blds = boxLabelDatastore(TrainingTables(:,2:end)); imds = imageDatastore(TrainingTables.imageFilename); anchorBoxes = estimateAnchorBoxes(blds,8); % Load unweighted mobilnetV2 to modify for a YOLO net load('BlankNe...
69004760725ba4d68f32b95cf8d5b94c49f6aa68140a6e59fadf0b6fe1655cd4
MATLAB
2,051
80
function c = tapas_logrt_linear_binary_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the linear log-reaction time response model according to as % developed with Louise Marshall and Sven Bestmann % %%%%%%%%%%%%%%%%%%%%%%%%%...
15559d88df1da2fd4e0345d81d0016d74a7623b4de63aea10cf9e99fc8877d07
MATLAB
2,052
51
function AssessVar global run filename sheetname numComb textWidth activateVAR replicate numCells global intraVarAlgo interVarAlgo Xint Uint PCint Xfin Ufin PCfin global XlogScoreR UlogScoreR PClogScoreW interExpVarCV intraExpVarCV global PCintRangeR PCfinRangeR DataSet % Use coefficient of variation (100x(s...
97f396325758fb65e17878c70379badea0332c9afcccf122337380a23060926b
MATLAB
2,052
80
function [traj, infStates] = tapas_rw_binary(r, p, varargin) % Calculates the trajectories of v under the Rescorla-Wagner learning model % % This function can be called in two ways: % % (1) tapas_rw_binary(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector in native spa...
dc9d9fd989e83ff051c774c5b453e063681bd0eb1be4f8424f2c6490f5ab5ed4
MATLAB
2,052
64
% Create example colormap % (cbrewer YlGnBu-colormap) % https://mathworks.com/matlabcentral/fileexchange/34087 cm = [0.8431 0.1882 0.1529; ... 0.9569 0.4275 0.2627; ... 0.9922 0.6824 0.3804; ... 0.9961 0.8784 0.5451; ... 1.0000 1.0000 0.7490; ... 0.8510 0.9373 0.5...
f54762fde2543bba3a915df741a587349c629c3e3110c101cbadb8b56c293720
MATLAB
2,052
44
function datastruct = fitF0smoother (datastruct, widthfactor) if nargin<2 %Timescale over which to look for a local minimum widthfactor = 20; end for j = 1:numel(datastruct) %extize numframes = size(datastruct(j).rawF, 2); numcells = size(datastruct(j).rawF,1); uncertainty = 99999999*on...
eb567cb12dac31301521b59e7c6c338d209bcc997d5e40ee0f4772b9f867f3e1
MATLAB
2,053
58
% PERMINV - returns the inverse permutation vector % % Usage: >> [invvec] = perminverse(vector); % % Author: Scott Makeig, SCCN/INC/UCSD, La Jolla, 11-30-96 % Copyright (C) 11-30-96 Scott Makeig, SCCN/INC/UCSD, scott@sccn.ucsd.edu % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and ...
76daf2734954d16607306e96da6bbef8ed5457153ec198d4184bd0e23e95c336
MATLAB
2,054
54
% (C) Copyright 2021 Remi Gau, Marco Barilari function opt = demoGetOption() % % returns a structure that contains the options chosen by the user to run % slice timing correction, pre-processing, subject and group level analysis. % % for more info see: % <https://cpp-spm.readthedocs.io/en/lates...
14d3a9a2d2ce289c1125b1d8aca43593d2d53379f3d69976de876254ab6d94bb
MATLAB
2,055
55
%% Based on files from alex white, refine. zz = 8; subjid = sprintf('subj%02d',zz); % which subject cmap = jet(256); % colormap for ROIs rng = [0 7]; % should be [0 N] where N is the max ROI index roilabels = {'OWFA' 'VWFA-1' 'VWFA-1b' 'VWFA-2' 'MFS-WORDS' 'ATL-words' 'unlabeled'}; % 1 x N cell vector ...
931d40aa8ef70923ee92272789b9c7905bc71d497a02c3cb753171f46c3fd490
MATLAB
2,055
62
function [omega,R2,loglike]=fitModelOLS(Model,dist,varargin); % function [omega,theta]=rsa_fitModelOLS(Model,Data,varargin); % Does a linear fit to some data % INPUT: % Model: numDist x numReg: Design matrix or model structure % dist: numObs x numDist: Data, with obserations stacked in rows % OUTPUT: % ...
dc9964bee0b4188a072d5bf3b7e0bbf0adbe09ceb2a839902f5d7847b71047d9
MATLAB
2,055
60
function approxgrad = getApproxGradient(problem, x, storedb, key) % Computes an approximation of the gradient of the cost function at x. % % function approxgrad = getApproxGradient(problem, x) % function approxgrad = getApproxGradient(problem, x, storedb) % function approxgrad = getApproxGradient(problem, x, storedb, k...
f04637e0cd21a737c9491ffb559cdee1f8359d0c3d99359446ddc365116f1ce0
MATLAB
2,055
66
function p = PlotSpikeWaveforms(W,varargin) %PlotSpikeWaveforms - Plot spike waveforms. % % USAGE % % p = PlotSpikeWaveforms(W,<options>,<options2>) % % W waveforms obtained using <a href="matlab:help GetSpikeWaveforms">GetSpikeWaveforms</a> % <options> optional list of property-value pairs...
166de8dd6358260b9aeec0bdc4f776e42e5bbc9bc6798e1049a1a7da54608ac0
MATLAB
2,056
49
function [fr_pdf, fr_mean, fr_std, edges] = get_fr_pdf_mean_std(fr, fr_max, bin_width) % GET_FR_PDF_MEAN_STD % Syntax: % [fr_pdf, fr_mean, fr_std, edges] = get_fr_pdf_mean_std(fr, fr_max, bin_width) % Description: % Compute the firing-rate PDF (normalized as a density), mean, and std. % Avoids magic numbers by ma...
653e60960545e6fc389521b9c5c602a21416a1d310380164ad8fd7847b1e5cb4
MATLAB
2,057
75
function [nstate] = tapas_sampler_mixedlinear_gibbs_node(data, model, ... inference, state, node) %% Samples from a linear multivariate model with fixed and random effects % and a diagonal covariance matrix. % % Input % % Output % % This level assumes only and unknown mean with known variance for some the % the el...
5f8bdb2646c3d14901c094c421e11521d2586143c7784aea44a495ffe1b96064
MATLAB
2,059
76
function [m,boundaries] = CircularConfidenceIntervals(angles,alpha,nBootstrap) %CircularConfidenceIntervals - Compute circular mean and confidence intervals. % % Compute circular mean and confidence intervals of circular data (see Fisher, % Analysis of circular data, p. 88). If fewer than 25 angle measurements are % p...
0e4a64821467536bb119f437d232e8766b6160bae33c4df212ad470d5cc80820
MATLAB
2,060
67
classdef LossSmoothL1 < dagnn.Loss %LossSmoothL1 Smooth L1 loss % `LossSmoothL1.forward({x, x0, w})` computes the smooth L1 distance % between `x` and `x0`, weighting the elements by `w`. % % Here the smooth L1 loss between two vectors is defined as: % % Loss = sum_i f(x_i - x0_i) w_i. % % where f is the func...
10600dfcbd17d3cb7cecbd81740b35d9bb2f3f190c57e1725e19a2856b513932
MATLAB
2,061
61
function varargout = ColorMap(axis,varargin) %ColorMap - changes the current axis' color map to a custom color map % % ColorMap - changes the current axis' color map to a custom color map, % a gradient of the desired colors. The desired colors should be 2 at the minimum % [start stop], and can be any number above tha...
39deb68c7d26126a9581a21b72ff832050c31c60d03c7b62b58fa3cf134e82dc
MATLAB
2,061
68
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
d607c7a9a75d63b05e241e010d58ce5dec2361988ec655cb807b9e918063b23d
MATLAB
2,061
69
classdef ReLU < dagnn.ElementWise properties useShortCircuit = true leak = 0 opts = {} end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnrelu(inputs{1}, [], ... 'leak', obj.leak, obj.opts{:}) ; end function [derInputs, derPar...
38e221576fdb633169f1093502e6e261010f0729d245b69530742076981051a6
MATLAB
2,062
59
function [ gamma ] = EmergenceGamma(X, V, tau, method) %% EMERGENCEGAMMA Compute causal decoupling criterion from data % % GAMMA = EMERGENCEGAMMA(X, V) computes the causal decoupling criterion % gamma for the system with micro time series X and macro time series Y. % Micro data must be of size TxD and macro...
8b7acad4e950f325bc60791156918bbce08bd75d01a1bbc033bec68b75edbea1
MATLAB
2,062
68
function [loader, channel] = create_loader(key, do_squeeze) if nargin < 2 do_squeeze=1; end reader = preprocess.getGalvoReader(key); fluorophore = fetch1(experiment.SessionFluorophore & key,'fluorophore'); switch fluorophore case 'Twitch2B' channel= [1,2]; loader = @(islice, varargin)(twitch_loa...
c21aa74896aad58f658ae850b7f3998b103b1c7a48a136411b879c8ed8740767
MATLAB
2,062
50
function TellMeAboutLabeling(whatData) % Tells the user information about the class-labeling of their data %------------------------------------------------------------------------------ % If you use this code for your research, please cite these papers: % % (1) B.D. Fulcher and N.S. Jones, "hctsa: A Computational Fra...
0d12cc02ebfd5a3a0b0a83328e0068c4ed67a26e3a18f96cf11f594e92b77e14
MATLAB
2,063
63
function lesionNorm (finalChar) if ~exist('finalChar','var') finalChar = '' %for parallel e.g. use '1' to only process files which end with 1 end inDir = pwd; outDir = '/Users/chris/norm'; tempDir = ['/Users/chris/temp', finalChar]; ext = '.nii.gz'; pth = fullfile(inDir,['*_lesion', ext]); lesions = dirVisible...
24ff9cc8e96033d7d21981c49c0bd0de434ec58dd73f4d70382ac3e0584f1ad6
MATLAB
2,063
63
function plotJointKinematicsCVPCALoss(lossTests, lossSEMs, mouseN, maxDims) % Loss curve plot of cvPCA results % Figure fig; axis off hold on % Params colors = [[0, 0, 0]; [0.5,0.5,0.5]]; % Only one mouse is plotted % Angles mouseLoss = lossTests(mouseN,2:end,1); mouseSEMs = lossSEMs(mouseN,2:end,1); plot(2:maxDims,...
35f8e4c8a3ffe841eda700c332e222a07b37e351aec4085fcf7f73a4f5c485da
MATLAB
2,063
114
function [err, Vo, DS] = AFNI_OrientCode (V) % % [err, Vo, DirSign] = AFNI_OrientCode (V) % %Purpose: % Changes the orientation code from number to letters and vice versa % % %Input Parameters: % V, a 3x1 vector of numbers or characters % like [0 2 4] or 'RPI' % % %Output Parameters: % err : 0 No Problem %...
6da115357306382dc727576256ac9265628c841da52c87a0714998c7fd8df6ea
MATLAB
2,064
62
function [val] = filetype_check_extension(filename, ext) % FILETYPE_CHECK_EXTENSION helper function to determine the file type % by performing a case insensitive string comparison of the extension. % Copyright (C) 2003-2012 Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % fo...
b3a095ffd59ce5ee3fe28bce666e9737d1f4236b6c2d96a3ad27fc19b229824b
MATLAB
2,064
69
classdef ReLU < dagnn_bc.ElementWise properties useShortCircuit = true leak = 0 opts = {} end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnrelu(inputs{1}, [], ... 'leak', obj.leak, obj.opts{:}) ; end function [derInputs, der...
24e63d7d5705591084a63456cb0f686b0a2eb7d15266e5d31ea849fff109e5a8
MATLAB
2,065
68
function pos = getorthoviewpos(pos, coordsys, viewpoint) % GETORTHOVIEWPOS obtains the orthographic projections of 3D positions % based on a given coordinate system and viewpoint % % Use as % getorthoviewpos(pos, coordsys, viewpoint) % % For example % getorthoviewpoint(pos, 'mni', 'superior') % % See alo SETVIEWPO...
3509f657fa4c51d4c4e35a1a36ca769d40e2177918c6908f47d0bc73e7b97124
MATLAB
2,065
66
function [] = plotAnalysis01C(saveFigures) % Produces plots to visualize the results of analysis01C. % save figures by default if nargin==0 saveFigures = true; end analysisName = 'analysis01C'; % get file paths paths = addPaths(); % get names of all files in analysis directory files = dir(fullfile(paths.outputs,...
8cdce6ae17fd71b093391f10deebd73f68f3bf3839d6d43d72c00c248f1d1343
MATLAB
2,065
57
function [binRDM, nCatCrossingsRDM]=categoricalRDM(categoryVectors,figI,monitor) % Given a single vector of category indices, this function returns a binary % representational dissimilarity matrix (binRDM) containing a zero for each % pair of conditions falling into the same category, and a one for each % pair of con...
7957b37ebf79479b78e6c3ee6c502aa410312b8de35350f9c427aba79d44ade2
MATLAB
2,067
58
function [out] = GetResponseMatrices(sdf, nTrialsPerCondition) %% % Wrapper function for preprocessing results from localization test. % Function takes in the sdf-format results of a single subject and returns % three matrices containing the responses for low-pass, high-pass and % broadband stimulus conditions. % % ...
234e567761371303773e7380c19653597bf4b53e6e647505d72a0364c27f4ada
MATLAB
2,068
55
function [T1map, R1map]=T1estimateMP2RAGE(MP2RAGEnii,MP2RAGE,varargin) % usage % [T1map, R1map]=T1estimateMP2RAGE(MP2RAGEnii,MP2RAGE,varargin) % MP2RAGEnii is the nii structure resulting from loading the MP2RAGE % with load_nii or load_untouch_nii % MP2RAGE is a structure containing all the relevant sequence % informat...
89b448ecf976cba2718a57e72b22aeaca8f2f609a36279b89e178f887b93275f
MATLAB
2,068
71
% load behavioral data bdata = {}; for subjix=1:8 file0 = sprintf('~/nsd/nsddata/ppdata/subj%02d/behav/responses.tsv',subjix); a1 = importdata(file0); bdata{subjix} = a1.data; end % bdata = % % 1x8 cell array % % Columns 1 through 5 % % {30000x19 double} {30000x19 double} {24000x19 double} {22...
bbfbeeee78e233830935ed5c1e51b58acca5c08c623907d5fe989f14b2fad5e8
MATLAB
2,069
59
function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % tight_subplot creates "subplot" axes with adjustable gaps and margins % % [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % % in: Nh number of axes in hight (vertical direction) % Nw number of axes in width (horizontald...
cc8f76d643862cc53b6ae8a242a7be1a7f403a858d03d6274b8ce698c7f7e98d
MATLAB
2,069
71
function [K,dK] = covPref(cov, hyp, x, z) % covPref - covariance function for preference learning. The covariance % function corresponds to a prior on f(x1) - f(x2). % % k(x,z) = k_0(x1,z1) + k_0(x2,z2) - k_0(x1,z2) - k_0(x2,z1). % % The hyperparameters are: % % hyp = [ hyp_k0 ] % % For more help on design of covarian...
9a7b57f31d005292e6e3686bd991d038a963b9959c5b70109dcfc2887f953e3f
MATLAB
2,070
73
function [g] = gen_BAnet(n,m0,m) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % GEN_BANET scale-free network based on Barabasi-Albert model. % % Arguments: % n: Number of nodes in the network (default = 100). % m0: Initial number of nodes in the network. (default = 5) % m...
26dbcbf94ee4958bfb5eeb1529bad8e0440951a1a8873962bb4c4a79cb8e1894
MATLAB
2,071
55
% DATLIM - return min and max of a matrix % % Usage: % >> limits_vector = datlim(data); % % Input: % data - numeric array % Outputs: % limits_vector = [minval maxval] % % Author: Scott Makeig, SCCN/INC/UCSD, May 28, 2005 % Copyright (C) Scott Makeig, SCCN/INC/UCSD, May 28, 2005 % % This fil...
b5ba2d70a74d827e1099c7a8470852d65acb24b0a914c386328941f6ba3f2ecd
MATLAB
2,072
38
function preprocessed_data = preproc_fmri_data_canlabtools(trs_to_use, n_runs, tr_duration, paths_nifti, paths_confounds) % this is designed to read in one subject/task's worth of fMRI data, across all of their runs % and then preprocess and return the whole-brain data for masking and etc elsewhere % NB: 3 ...
f336cf95d5043f8cc753d7a789313aa2d11ea22d6bf0a39a93179e158f7b6f3e
MATLAB
2,073
61
% dipfit_reject() - remove dipole models with a poor fit % % Usage: % >> dipout = dipfit_reject( model, reject ) % % Inputs: % model struct array with a dipole model for each component % % Outputs: % dipout struct array with a dipole model for each component % % Author: Robert Oostenveld, SMI/FCDC, Nijmegen 2003 ...
4382b333f22d8a63cde3a79b7959f67aa28314cd8383bf1ac427ab3dc1847061
MATLAB
2,074
51
%% ds = sepiatest.get_real_dataset() % % Description: locates the real dataset used by the Tier-2 toolbox-dependent % regression matrix. Looked up from (in order): % 1. environment variables SEPIA_TEST_REAL_DATA_DIR (input directory) and % SEPIA_TEST_REAL_DATA_MASK (brain mask NIfTI) % 2. a test/config/real_da...
47347eea5bad787184fe53c2f0858943c3553cd4f8f38e253157490ebad60ea5
MATLAB
2,075
80
function X_physio = create_hr_basis_dt(hr,TR) % create physiological basis set, based on the time and % dispersion derivatives of each gamma in the RRF, and each gamma % in the CRF. % as in Chen et al. NI 2020 % This function will be called. Just keep it saved. % time axis dt = TR; t = [0:dt:40]; % assume 40-s long ...
0f4aa5dfea9b0e6dad3da6e00970295059c7cec1116eda7247867299a341fe50
MATLAB
2,076
56
function Scalebar(bar_length, bar_thickness, fontsize, PathName) % JB 14/10/2021 %SCALEBAR Will add a scalebar and label in the lower left corner of the %plot % Input: % - bar_length: in µm, will convert the text label to mm if entered number >= 1000 % - bar_thickness: line width as a...
43627aaee38d874e9369d3ebc8492aa051b6a7007005ed855ec62f2b209e8dcc
MATLAB
2,077
86
% op_takeextras.m % Jamie Near, McGill University 2018. % % USAGE: % out=op_takeextras(in,index); % % DESCRIPTION: % Extract the extras with indices corresponding to the 'index' input % array. % % INPUTS: % in = input data in matlab structure format. % index = vector indicating the indices of the extras you wo...
fa41ae6ea7359724bcec80d93d039c776a83d7bcb38230b6bf5e2f5c9dde1574
MATLAB
2,077
61
function output = decodePartialD2S(kinematics, neurons, tBins, ROIs, kinematicField, neuralField) % Fit instantaneous regression of joint angles with linear correlation of % centroid distance to the spout removed % Format kinematics outcomes = kinematics([kinematics.locked]); % Subselect to desired time period for tr ...
fc99271577cd5b16ea852b2df3104f490b48b869af933608dedd46ada81c2026
MATLAB
2,077
67
function this = set_from_affine_geometry(this, affineTransformation, nVoxels, TR_s) % Sets dimInfo from affine affineTransformation, assuming 4D nifti data % % Y = MrDimInfo() % Y.set_from_affine_geometry(affineTransformation, nVoxels, TR_s) % % This is a method of class MrDimInfo. % % IN % % OUT % % EXAMPLE % se...
1a2edc557bf9456d3db6ab6b8a46f3d3a0655910e51dad24b4f2b8a4a1051995
MATLAB
2,078
56
function osp_onCoreg( ~, ~ ,gui) %% osp_onCoreg % Callback function on coreg button click. % % % USAGE: % osp_onCoreg( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written into the % gui cla...
2614503e15e435a18f79831eaf448c94fd4712866f6a2355e0e4f63e4b347118
MATLAB
2,078
57
function phiFaceAverage = geometricMean(phi) % This function gets the value of the field variable phi defined % over the MeshStructure and calculates the geometric average on % the cell faces, for a uniform mesh. % % SYNOPSIS: % phiFaceAverage = geometricMean(phi) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE...
1a0d76bc3b8918b47979848ae230f10564899d7e14b4c3445bcef062a4ab3857
MATLAB
2,080
73
% Test how accurately we can orthogonalize ill-conditioned bases of tangent % vectors. We test three metrics: % 1) Is Q actually orthonormal (the figure displays log(|Q'Q|); since Q'Q % should be identity, we hope to see 0 on diagonal and -inf everywhere % else.) % 2) Is A = QR? This is in the title of the pl...
740ecb9651a90b36e065ad00b808ede59101546c71dda0999553c6a7ff60e11f
MATLAB
2,080
56
function cellvar = createCellVariable(meshvar, cellval, varargin) % cellvar = createCellVariable(MeshStructure, cellval) % cellvar = createCellVariable(MeshStructure, cellval, BC) % this function creates a cell variable based on the dimension of the % problem. The cell variable does not include the ghost cells, unless ...
3b60b1c222a5f3ce4a061f7aa811fa82963ab3a6387503521eb946d75e271ded
MATLAB
2,081
59
function [Y,XYZ] = spm_read_vols(V,mask) % Read in entire image volumes % FORMAT [Y,XYZ] = spm_read_vols(V,mask) % V - vector of mapped image volumes to read in (from spm_vol) % mask - implicit zero mask? % % Y - 4D matrix of image data, fourth dimension indexes images % XYZ - 3xn matrix of XYZ locations returne...
fa7f93cf1050edf95b8bcb84626c10dce57d2eb4736e9b9f01185e6c09157e4d
MATLAB
2,081
86
% Packing is very flexible - it doesn't just do grids. % % (a) Pack a pair of columns. % (b) Pack a bit into one of them, and then pack some more. % (c) Pack into the other using absolute packing mode. % (d) Call select('all'), to show off the result. % (e) What you can't (currently) do. %% (a) % create the root p...
0e1258f1b286d9f201537257f03411c914101dd7fd5d6b9d9217902a7c4547ac
MATLAB
2,082
66
function [ ] = save( filename, obj, varargin ) % Save properties of HUGE object to mat file. % % INPUTS: % filename - File name. % obj - A tapas_Huge object. % OPTIONAL INPUTS: % Names of property to be saved. See examples below. % % EXAMPLES: % SAVE(filename,obj) Save properties of 'obj' as individual...
3abd25ecb32472bea8d2fad8c523860b053a6b01f08d66dd1ed9699f33324502
MATLAB
2,082
55
% VAR - variance of memory mapped underlying array % % 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 w...
ec36a412db1213bffd5e0d19204356157f5dd41d7d4ccaaffe9dd11a36d814bc
MATLAB
2,082
72
% op_autophase.m % Jamie Near, McGill University 2015. % % USAGE: % [out,phaseShift]=op_autophase(in,ppmmin,ppmmax,ph,dimNum); % % DESCRIPTION: % Search for the peak located between ppmmin and ppmmax, and then phase the % spectrum so that that peak reaches the desired phase. % % INPUTS: % in = input data in ...
2b3563bc685a7be74715e543f262448ce30c8df1348ef8f9e46c768a832bc103
MATLAB
2,083
66
function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % tight_subplot creates "subplot" axes with adjustable gaps and margins % % [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % % in: Nh number of axes in hight (vertical direction) % Nw number of axes in width (horizontald...
556f1c53109aa98881cff7e55be6831c149c2f94399e860ef13979795e6b4787
MATLAB
2,083
72
%isdvector - Test if parameter is a vector of doubles satisfying an optional list of tests. % % USAGE % % test = isdvector(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests (see examples below) % % EXAMPLES % % % Test if x is a vector of doubles % ...
8939103df9dabd9dab2bd1cbf1f3152720bc9b3bb2c7f1a12d7f1abd55453348
MATLAB
2,083
55
function trainnew_Callback(hObject, eventdata, handles) %% Train a new neural network cd(handles.data.squeakfolder); % Apparently, "wind" is a function name, so initialize it as empty wind = []; %% Select the tables that contains the training data waitfor(msgbox('Select Image Tables')) [trainingdata, trainingpath] = ...
9aaf0cb7f5243aca0cf651fd5ca60162eb997f1db30a2e8297803d2a00a4717f
MATLAB
2,083
56
% bids_gettaskfromfolder() - Scan bids folders to get the list of tasks % % Usage: % >> tasklist = bids_gettaskfromfolder(bidsfolder); % % Inputs: % bidsfolder - a loaded epoched EEG dataset structure. % % Outputs: % tasklist - [cell array] list of tasks % % Authors: Arnaud Delorme, SCCN, INC, UCSD, March, 2021...
c48cb2339f566f21cad605d501d1824ecd2104bf70fbfe804f3365fcf8696373
MATLAB
2,083
81
% (C) Copyright 2020 CPP visual motion localizer developpers function diplayDesign(cfg, displayFigs) %% Visualize the design matrix if displayFigs close all; figure(1); % Shows blocks (static and motion) and events (motion direction) order directions = cfg.design.directions;...
2d401acc80c08e23c36959a9e0355fdf378c4c8fbd28ec56695a51e93d07ded2
MATLAB
2,084
54
function cos_amp = mahalTune_func_fast(data,theta,num_features,weights,foldvar) % computes the mahalanobis distances between the data of single test-trial of a particular orientation and the rest of the data, % averaged into specific orientation bins relative to orientation of the test-trial. %% input % data i...
7e4f6276b0b557d636e7d28eda4ad631f6a22ff1aebe604cee76841f0982eac1
MATLAB
2,084
87
function [ccace_out,segs,U,C] = ccace_detector(hsi_img,tgt_sig,mask,n_comp) % %function [ccace_out,segs,U,C] = ccace_detector(hsi_img,tgt_sig,mask,n_comp) % % Class Conditional ACE % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vector) % mask - ...
aed82317a0895fea786ef91632070efbca3b6d3310ec5171d8446caf09195f24
MATLAB
2,085
80
% TEXTSC - places text in screen coordinates and places % a title at the top of the figure. % % Usage: % H = textsc(X,Y,TXT) places the text string, TXT % at the normalized coordinates X and Y. H is the % handle to the text object. % % H = textsc(TXT) or H = textsc(TXT,'title') or % H = textsc('t...
f040f4479269d083f4f47ba1e2fbd6b2725f396fe0757a86d9776ca44c8be2f9
MATLAB
2,085
53
function [postLow, postHigh, postLow_q1, postHigh_q1] = quartileAnalysis_MD(data,bins) % split mixed blocks into quartiles to look at changes in wait time over % the course of a block % INPUTS: % data = data struct containing behavior data containing wait_time, % reward, etc fields % OUTPUTS: % mean z-scored wait-...
5539c191dbbc4ccf045c7dc75b5f18f94a4ae719737bdd0782238b72ad35ff66
MATLAB
2,086
86
function DBConnect(host,user,password) %DBConnect - Connect to the database server. % % Open connection to MySQL database server. Connection information can % be either passed explicitly as arguments, or read from your .my.cnf % configuration file. % % USAGE % % DBConnect(host,user,password) % % host ...
6edf62c4ab5fd745c7e508a0f7a62b9da9b25fc06f9347aff17895db62e5b61e
MATLAB
2,086
59
function [event] = read_bucn_nirsevent(filename) % READ_BUCN_NIRSEVENT reads the event information of ASCII-formatted NIRS % data acquired with the UCL-BIRKBECK machine and postprocessed by the % Paris group. The first line contains the header-info and the rest of % the file contains per line an event. The first colu...