sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7b612d04ab9173175cc0a1d947a846cbc59f21e1274f08c29002eecb04d958c2
MATLAB
1,704
51
function c = tapas_softmax_2beta_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the softmax observation model for multinomial responses and % different betas for rewards and punishments. NOTE: this model is acausal in situat...
833763ea43b7f511169d7459ecbe0d63904f8558cf58ffc2a48c2d5a5172cbbc
MATLAB
1,704
62
%% h = sepia_handle_panel_qsm_myMethod(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and other h...
b4af315bc29a1832834fddeb714c185e2d247a78c40b997de700949e9c315136
MATLAB
1,704
55
function [channels,groups] = GetChannels(groups) %GetChannels - Get list of channels for one or more spike groups. % % USAGE % % channels = GetChannels(groups) % % groups one or more optional electrode groups (default = all groups) % % EXAMPLES % % all = GetChannels; % list all channels % ...
3d32d380acad6d967a9b2f3a225da9581c90478278f33b6c04b435695a1146ca
MATLAB
1,705
40
function Mppe = localCorrelationMap(movie,tilesize) distMat = zeros(tilesize^2,tilesize^2); for i = 1:tilesize^2 for j = 1:tilesize^2 [x1, y1] = ind2sub(size(distMat),i); [x2, y2] = ind2sub(size(distMat),j); distMat(i,j) = norm([x1 y1]-[x2 y2]); end end mask = 1./(distMat+1); mask = ma...
06e3333266d403d294175de36d6ffed8b4104580f58cedff8e7d802a8967ac22
MATLAB
1,706
61
function [y_fit, x_fit] = datafit_smoothingSplines(x, y) % fits smoothing splines, estimates the smoothing coefficient such that the % R-square value => 0.90 % (c) Jiri, Dec16 assert(size(x,1) == size(y,1)); %% settings for fitting rSq_lim = 0.50; rSq_tol = 0.01; %% initial fits % upper bound pSm_hi = 1.0; % para...
243184028bf60a36639c1afe3bb9f1afa0bd81808a2c7722e87c45580368d68f
MATLAB
1,707
48
%% tol = sepiatest.tolerance_for_method(category, methodName) % % Description: returns the numeric tolerance to use when comparing a % method's output stats (sepiatest.mask_stats) against its saved % reference (sepiatest.compare_to_reference). Deterministic closed-form % methods get a tight tolerance; iterative solvers...
5dc7a1153c1f39f82bf5e61f23f1b52cc4fb7dff5af98a6cfcf944b14631ef94
MATLAB
1,707
50
function C2 = mahiem_trialwise(dat,theta,thetabasis) if nargin < 3 thetabasis = -pi:pi/8:(pi-pi/8); end thetabasis = thetabasis(:); %make sure the basis set locations are in a column vector nChan = length(thetabasis); %number of virtual channels of output nsens = size(dat,1); %number of M/EEG sensors ntrl = size...
d04d6fbdb257b66cf912fea2c996c1d8832c30b9d49ee51c212f3652d0cc5b86
MATLAB
1,707
57
function outputImage = imerode(this, structureElement, nD) % Erodes image clusters slice-wise; mimicks imerode in matlab functionality % % Y = MrImage() % dilatedY = Y.imerode(structureElement, nD) % % This is a method of class MrImage. % % IN % structureElement % morphological structuring element for d...
fcaccc46bdc4233ceaec1c48ea45766dac453a282d8c4b0f1904233b4bbe28b6
MATLAB
1,707
54
function [] = create_comparison_image(sim,bin,sim_domain) % %@create_comparison_image Creates a good looking image that compares a % %simulation (sim) with a real binary tumor (bin). % % Detailed explanation goes here % sim, bin and sim_domain must have the same size (182 x 250) brain_contour = bwperim(sim...
571c4ee4bb388f4793d0c6727b3fde24503fb49ae980fa762644397c07cc887a
MATLAB
1,708
55
function y = vl_nnrelu(x,varargin) %VL_NNRELU CNN rectified linear unit. % Y = VL_NNRELU(X) applies the rectified linear unit to the data % X. X can have arbitrary size. % % DZDX = VL_NNRELU(X, DZDY) computes the derivative of the block % projected onto DZDY. DZDX and DZDY have the same dimensions as % X and ...
a4087a1feae04c36e1b4c802ab5e91475499e61254e72ad6dd70fed0d2b4780a
MATLAB
1,709
42
%% ============================= % PALM Analysis: REEXT CS×TUS×EXP % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % stats/permutation_tests/palm_code/<thisfile>...
33abbe7c5bdeefc6422965ed456876e124813b76b49fd6ca22005dceead43659
MATLAB
1,710
59
function wpt = modwt_custom(data, wavelet_type, level) % Usage: % wpt = modwt_custom(data, wavelet_type, level) % % Inputs: % data - (Samples x Channels) matrix % wavelet_type - 'haar' (currently only 'haar' supported for manual implementation) % level - Decomposition level % % Output: % wp...
40a7a13bca58972349662bd6ae9aa8b2b8e7ab03c6d166ccfc1b36be09386185
MATLAB
1,710
55
function tapas_rdcm_compile() % tapas_rdcm_compile() % % Compiles integrator for DCM. Assumes that source code file % 'dcm_euler_integration.c' is in the same folder as this function % and places the compiled mex-file in the same folder. % % Input: % % Output: % % % -----------------------------------------------...
b7d4dd71dabcfb87d2e1957ebf6906fe6ffe6b56c67a83e425bc179a66552f29
MATLAB
1,710
37
function [I,Ie,Ii,Ix] = atttRec_compute_input_current(Wrr, Wrf, Jrr, Jrf, r, r1, Ne, Ni, Nx, Ke, Ki, Kx) % Vectorized computation of input currents from excitatory and inhibitory neurons N = Ne + Ni; I = zeros(N, 1); % Output current % Excitatory connections idx_e = 1:(Ne*Ke); ...
a342d8f58874148617b3f66cbaf55aee2f531de07f94aa0439109aebd0d8e8db
MATLAB
1,711
59
function plotEventTimeDistributions(eventInfo, eventName, yLim, zeroLabel) % Plot the distribution of the desired event as a box plot % Make figure fig; hold on; axis off ax = gca; % Box plotting parameters lw = 0.5; bxw = 0.25; alpha = 1; spacing = [1,1.75]; buff = 2.5; axlocs = [spacing; spacing + buff; spacing + b...
274267a1cf920d83501fb322c532f2a6a74130be9b337e44de15969b4aea6bbe
MATLAB
1,712
68
function obj = centre_latent(obj) N = numel(obj.data); D = prod(obj.lat); % --------------------------------------------------------------------- % Centre z0 = sum(obj.Z,2)/N; obj.Z = bsxfun(@minus, obj.Z, z0); obj.ZZ = obj.ZZ - N * (z0 * z0'); % ---------------------------------...
2ec1fb13f724e01f99c78d20f42cef1927887e6c8875a38ddbdf3c0079a4f2ec
MATLAB
1,712
44
function [neuronid,idthr,ens_cel_corr,sur_cel_cor] = find_core_cells_by_correlation(raster,ens_raster,nsur,p) % % [neuronid,idthr] = find_core_cells_by_correlation(raster,ens_raster,nsur,p) % % Detectes the core neurons of a given raster. A core neuron is defined as % a neuron that whose correlation with an ensemble is...
4473cd7f9aded502e91e021dff7bf209940d149c60791cd05cd470505d1de0a8
MATLAB
1,712
47
%% Downlaod example CSV and data if ~isdir('ExampleData') mkdir('ExampleData'); end availableDataSource = {'HarvardDatabase', 'Dropbox'}; downloadSource = 'Dropbox'; app.MEANAPStatusTextArea.Value = [app.MEANAPStatusTextArea.Value; ... 'Downloading example matlab files...']; pause(0.1); fileNames = { ......
7afed0fee85be21e600ac34e8a80378224f74849937189bd836c92b82a1bdcce
MATLAB
1,714
54
%% Set up the analysis % ------------------------------------------------------------------------ % Add the MKDA Toolbox with subfolders to your Matlab path: % (Customize folder name for your computer) g = genpath('/Users/tor/Documents/Code_Repositories/Canlab_MKDA_MetaAnalysis'); addpath(g) savepath % Create a direc...
ae7ed7bd2ca71ad6281138d1879b77980bea0941ff9bde35395f6f45784dc3f5
MATLAB
1,714
97
% plot_error % Data dir rootdir = [getenv('MATHOME') '/umeda_data/']; datadir = [rootdir 'motion_unit_rate/']; modeldir = [rootdir 'model_spr3/']; errordir = [rootdir 'model_err/']; dataname = 'motion'; modelbase = 'neuron_to_motion'; %modelbase = 'motion_to_neuron'; xy_mode = [1 3]; Nxyz = 6; ...
110f12bf78227b3343714b73621287737c9c26a97b0d3de4d58cd59b5f864df1
MATLAB
1,715
67
function pfxFileArray = tapas_uniqc_prefix_files(fileArray, pfx, isSuffix, isMixedCase) %prefixes/or suffixes (cell of) files (incl. paths) with file prefix before file name % % output = tapas_uniqc_prefix_files(input) % % IN % fileArray cell(nFiles,1) or single string of filenames % e.g. % '/LK215...
49170ad5a7a50aa28fc95625d6afd3ed97e3d5ec97aae08918d3339d3d5252a5
MATLAB
1,715
50
% setup circles lookup tables % lookup tables are in files that are pointed to by a database table % circles_lookup % a unique file exists for a combination of width, height and radius % if a previous file exists, it will be overwritten % assumes datajoint is setup in the environment, and table definition is % already ...
d65695fc43c1380c191d7596e5c6a13f324fed4572f4ae60141565111e4ffe8d
MATLAB
1,716
65
function [betas,residuals] = massGLM(X,y,add_offset,rank_regression) %function [betas,residuals] = massGLM(X,y,add_offset,rank_regression) %efficiently calculates betas for mass univariate GLM % %inputs: X (design matrix) should be nTrials*nRegressors % y (data) should be nTrials*nChannels*nTimepoints(*nFrequenc...
a6d0e50dd62b6ff1b8ff94ad61a6af2b01e64ef5ed1ae03fe33020f949b6f333
MATLAB
1,717
56
function c = tapas_gaussian_obs_offset_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the Gaussian noise observation model for continuous responses, with % an offset lambda % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
23ff7b0506bee8e5edb4066644dbc4d47abbeffba57288822142c3dfef894199
MATLAB
1,718
43
function outputCellCell = SUB_cell2cellcell(inputCell,delimiter) % SUB_cell2cellcell Turn a cell of delimited strings into a cell of cells. % % Inputs a cell with some delimiter, and outputs a cell of cells using this % delimiter. % ------------------------------------------------------------------------------ % C...
03ad89507cd1405a7be6686badf3f5c18c94da090795418688864274514ac5d1
MATLAB
1,719
41
%{ monet.DriftTrial (computed) # noise drift trials -> monet.DriftTrialSet drift_trial : smallint # trial index --- -> psy.Trial direction : float # (degrees) direction of drift onset : double # (s) onset time in rf...
0e00ff8b1316540fe69ef8828faba1024ec08eb4aafc3b73ec639e7e759ce396
MATLAB
1,719
62
function [fh, f, P1] = tapas_physio_plot_spectrum(t, y, hAx) % Plots one-sided amplitude spectrum of a time series, following Matlab % help examples % % [fh, f, P1] = tapas_physio_plot_spectrum(t, y) % % IN % t [nSamples,1] time vector % y [nSamples,nTimeseries] different signal time series, one per % ...
71ba4e16947838c50f465061c70836aea47a3349abade4b1000e593b0df20553
MATLAB
1,719
55
function this = MrAffineTransformation_affineMatrix(this) % Unit test for MrAffineTransformation computing the affine Matrix % % Y = MrUnitTest() % Y.MrAffineTransformation_affineMatrix(inputs) % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrAffineTransformation_affineMatrix % % See als...
903182edbe857001ea014966dc6cec43e23512e9bb4d3fff3bbdc46130246434
MATLAB
1,719
57
function [verbose] = tapas_physio_plot_iterative_template_creation(hasFirstGuessPeaks,... t, c, cpulse1stGuess, nPulses1, nPulses2, cpulse2ndGuess, meanLag1, meanLag2, verbose) % Plot refined heartrate templates % (C) 2023 Johanna Bayer stringTitle = 'Preproc: Iterative Template Creation Single Cycle'; if hasFir...
e34783f7b4d0afab20bd0ca3c94c188291a2affcf7269a1610f4e8c2e05c8016
MATLAB
1,719
72
% op_zeropad.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_zeropad(in,zpFactor); % % DESCRIPTION: % Apply zeropadding (a.k.a. zero-filling) to MRS data. % % INPUTS: % in = input data in matlab structure format. % zpFactor = the factor by which the number of points in the fid will be % ...
91181688a70a6f98b939a47114c60da19c94cb012de49ffd681cc79e89754e20
MATLAB
1,720
57
function [dvt,types,ids] = detector_vs_truth(hsi,det_out,filt,halo) %function [dvt,types,ids] = detector_vs_truth(hsi,det_out,filt,halo) % % Gets detector confidence for each target, put it in a matrix vs ground truth fields % for easy comparison % % outputs: % dvt - n_targets x 6 - [detector_output | id | size | ty...
a29e2b3573bd50c893790df2ed3dbc91ce36ec25c8a029e6fe6f89f42b82682b
MATLAB
1,721
37
function [pvec, pstruct] = tapas_hgf_jget_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % ...
2d0a791dd28e29e626c9e8e788cff659c360ed61ba7d25994d447846c67b8952
MATLAB
1,722
41
%! % @brief This script transfers from json to deepsqueak % @details This script converts from predefined json files to .mat file % that can be used in deep squeak files = dir("json/*.json"); for file = files' jsontext = fileread(strcat(file.folder, "/", file.name)); json_data = jsondecode(jsontext); % ...
c1c88fa75aa976a461024ee799db7ed281b1f01ab88d0887789df2a0c5d274f3
MATLAB
1,723
37
function [pvec, pstruct] = tapas_ehgf_jget_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013-2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Pub...
da944830fcffe3b1c77002a206ffe8e8cddcc2ff19dd5e352e61950744768c28
MATLAB
1,723
49
function npx_example_plotter(ex_unit1,raster_traces,sdf_all,t_pre,t_post,color_s) trial_nr=size(raster_traces,1); data={};data=raster_traces; fig2=figure;set(gcf,'color','w');set(fig2, 'Position', [500, 800 ,700, 350]);t=tiledlayout("vertical"); t.TileSpacing = 'compact';t.Padding = 'compact'; nexttile; ylim([0 10...
e65bee150a4a8be206154090d050bdeaefea871e0af8ebf0ec2904bdf6e5e085
MATLAB
1,723
40
%% The McsHDF5 Matlab tools % This and the following documents gives a short explanation of the usage % of the McsHDF5 Matlab tools. % %% Purpose % The McsHDF5 Matlab toolbox can be used to import HDF5 files generated by % software from Multi Channel Systems MCS GmbH. Importing the HDF5 files % via this toolbo...
4da77c187912885cd7b1c0b2ae2bb30f325ad3561c8614736df3417429741213
MATLAB
1,724
58
function outputImage = imdilate(this, structureElement, nD) % Dilates image clusters slice-wise; mimicks imdilate in matlab functionality % % Y = MrImage() % dilatedY = Y.imdilate(structureElement, nD) % % This is a method of class MrImage. % % IN % structureElement % morphological structuring element f...
1932b86cda57f4069930fc5c5b49a9e6a7be58d14ec55e8f103882bbecd264fa
MATLAB
1,725
92
function dt = DistanceTransform(b) %DistanceTransform - Compute distance transform of a binary matrix. % % This function assigns to every point (x,y) in a binary matrix B the distance % to the nearest point in B with value 1. It uses the Euclidean metric for % computing distances. The code is based on the algorithm...
959a0708c97c71238bcb4f535643acfa3318e98908e17f805c38909924756fbb
MATLAB
1,726
47
addpath('/Users/monaminishio/Downloads/nonfractal/m') addpath(genpath('/Users/monaminishio/Downloads/wmtsa-matlab-0.2.6')) lb = [-0.5,0]; ub = [1.5,10]; H_combined = readtable('Hurst_rat_alcohol.csv', "FileType","text"); %col457 = H_combined.H_combined157; %col458 = H_combined.H_combined158; %col459 = H_combined.H_com...
a129cb0668a10309b48a00f8a09307147465127e90682bb1715f4e048299b255
MATLAB
1,726
47
% function Z = ZG_rdiv(X,Y) % % row division: Z = X / Y row-wise % Y must have one column % % Machine Learning Toolbox % Version 1.0 01-Apr-96 % Copyright (c) by Zoubin Ghahramani % http://mlg.eng.cam.ac.uk/zoubin/software.html % % ------------------------------------------------------------------------------ % The M...
f7fabf345bd2eaacef6d2c59794ea10a58d1cc4135c86def73b890ff083a8173
MATLAB
1,726
61
classdef Loss < dagnn.ElementWise properties loss = 'softmaxlog' ignoreAverage = false normalise = true opts = {} end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnloss(inputs{1}, inputs{2}, ...
9b50d0b3d37a6dacf9898b96280574a8f159dae884d23856016c8260048edd65
MATLAB
1,727
56
function tuning_summary % summarizes the quality of mice set(groot,'defaultAxesColorOrder', parula(4)*0.7, 'defaultAxesLineStyleOrder', '-|--|:') von = aod_monet.VonMises & 'preprocess_id=3' & 'spike_inference=2'; keys = fetch(vis2p.Experiments & aod_monet.VonMises, 'exp_date', 'ORDER BY exp_date DESC'); scores = array...
43a5a665e8851e3cd85004c1dc69990f3d91590e25cb31eb916ab41fb34156ce
MATLAB
1,728
47
function [neurons, config, M] = lockNeural4Classifier(R, M, config) % Lock neural activity for classifier models if ~isfield(config, 'goodTrials') goodTrials = [R.success] & ~isnan([R.grabTimeC]) & [R.timeToContact] < 1000 & [R.liftRT] < 1000 & [R.goodDLC] == 1 & [R.liftRT] > 0 & [R.hasNeuralData];% & ~isnan([R.li...
9a06b349ff0907a0ec3d66c3321b5e3a03f6da46bafafb1b965d4fe3e23d3bd4
MATLAB
1,728
83
function [Wout,Weff] = make_test_weight(parm) % Make output weigtht for test % -Input % parm.Ydim = Output dim % parm.Xdim = Input dim % parm.Meff = Effective Input dim % parm.Tau = Lag time steps % parm.Dtau = Number of embedding dimension % parm.WXmax = maximum weight of X-dim % parm.WYmax = ...
cde1008ea13ab01421915c8b047194d968b953eeb940a923fb8ffb5fd178ae61
MATLAB
1,728
55
function [intervals,subcycle,cycle] = FindSubcycles(angles,nSubcycles) %FindSubcycles - Find timestamps for subcycles of an oscillating signal. % % USAGE % % [intervals,subcycle,cycle] = FindSubcycles(angles,nSubcycles) % % angles phase <a href="matlab:help samples">samples</a> % nSubcycles numbe...
d50989d548ca2b60eb3f2ff6820804c4796e85de33dcaaaf909d4c0535280604
MATLAB
1,728
68
function [IXr, IEr, IIr, normX, normE, normI] = atttRec_calc_current_norm(weight_name,stats_name,J,optSave) load(weight_name,'Wrr','Wrf',... 'seqindE', 'seqindI', 'seqindX'); temp1=load(stats_name); if isfield(temp1, 'Stats1') V1fr = temp1.Stats1.V1fr; MTfr = temp1.Stats1.MTfr; else V1fr = temp1.V1fr;...
2e8f6641c99f0868ac0ea718edc189146551b05309da209fc6b6328ca42b41e8
MATLAB
1,729
50
%% Interface for batch spike detection - simple version %{ This is the main script for running spike detection in multiple files ("in batch") with most advanced settings hidden away to make this easier to use. The things you need to modify are: dataPath (str) : where your .mat files containing electrode recordings ar...
9b7fe573f94866ab72fe8dbbc82053f91e48450bf08c88c04d1f2c28f31b35bc
MATLAB
1,729
61
classdef Loss < dagnn_bc.ElementWise properties loss = 'softmaxlog' ignoreAverage = false normalise = true opts = {} end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnloss(inputs{1}, inputs{2...
c5df2972c657ff1df2e9078aa5e9d13eabb24e02bf57adf95eab7aaa33293c8a
MATLAB
1,729
42
function [R, keepers] = BF_RemoveNaN_DistMat(R) % BF_RemoveNaN_DistMat Removes NaNs from an input distance matrix % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you use this c...
c8c6e7f2bc15cbd74a49fc098cd212b7f7dc0ec8d7eef2d83a4ed62535a0e77f
MATLAB
1,729
60
classdef Crop < dagnn.ElementWise %CROP DagNN cropping layer. % This is a pecurial layer from FCN. It crops inputs{1} to % match the size of inputs{2} (starting with a base crop amount). % A future version properties crop = [0 0] end properties (Transient) inputSizes = {} end methods f...
d0313bd220c0c56f04b74d10063a7e0238c346b07359b076384facc325340f80
MATLAB
1,729
25
% Helper functions for FMAToolbox. % % Parameter testing. % % isastring - Test if parameter is an (admissible) character string. % isdscalar - Test if parameter is a scalar (double) satisfying an optional list of tests. % isdvector - Test if parameter is a vector of doubles sa...
db684bf6d31e5151bcd2c346f3f2f6bb7e61764c3b88f32618f4c98e03ab02b9
MATLAB
1,729
45
function exportCurrentFigAsPostscript(filespec,appendFlag,userOptions) % exports the current figures to the file [filespec,'.ps'] in postscript % format. if appendFlag is 0 any existing file [filespec,'.ps'] is % overwritten. if appendFlag is 1 the figure is appended to the existing % postscript file [filespec,'.ps']. ...
082bbf2b747bcdd89b94ff32cab4c5e82c5817447f64d6d14fcbdbc8c5c450c2
MATLAB
1,731
71
%{ %%%%%%% INPUT %%%%%%% This function assume 32-Channel ECoG recording along with behavioral TTL input representing Baseline versus OddBall stimuli Need to specify: Fs, epoch length (begin&end times) as a 2 element vector Extract and normalize each epoch based on the 2s baseline prior to the stimulus. %%%%%%% OUTPU...
443ca3ad576a7b698a12d12795d4a62789cae255e30292195f4112b38270101f
MATLAB
1,731
79
function [folderpath_out,foldername,formatted_string]=getFolder(varargin) % EXAMPLE USE WITH ARGUMENTS % getFolder() - dialog % getFolder(initial_folder_path) - folder to start % % This function prompts a window to choose a folder, whose path is passed % as an output argument and corresponding matlab commands are form...
5c455c52b62e7fda7c319d84552cb1ce9e75a577e0f78c77d3d138f60a0825d1
MATLAB
1,732
60
classdef Crop < dagnn_bc.ElementWise %CROP DagNN cropping layer. % This is a pecurial layer from FCN. It crops inputs{1} to % match the size of inputs{2} (starting with a base crop amount). % A future version properties crop = [0 0] end properties (Transient) inputSizes = {} end methods ...
80537117c36651543299d63e7262cdbfc1dc43825b6eb7dc40d15fd81900eb20
MATLAB
1,732
64
function bleach_rate = estimate_bleaching_rate(params) timepoints_to_skip = 1000; % skip first 1 second show_simple_plot = false; show_fits_in_cftool = false; % Load data ts_fn = string( getFileName(params,'TS') ); load(fullfile(params.pth, "Analysis", ts_fn)); roi_fn = string( getFileName(params,'ROI')); l...
84d983bf47c73209ce90bda36060eb61a0e9e32e3c3a466240a7593d1e75fff3
MATLAB
1,732
58
function [nel] = afni_nel_parse(nellcell) %should really check that this is nel and not ngr ... %assuming we have nel %get the header part cnel = char(nellcell); clear nellcell; ncnel = length(cnel); %break up into head and data expr = '(?<head><(\w+).*?>)(?<data>.*)<'; %using expr =...
a64b65a6aebe19ea9d5ed8a91e4ebdcb497c19102afce11196ec3f8aaacefdeb
MATLAB
1,732
48
function [K,dK] = covPoly(mode,par,d,hyp,x,z) % Polynomial covariance function. The covariance function is parameterized as: % % k(x,z) = sf^2 * ( c + s )^d , where s = x*inv(P)*z is the dot product % % The hyperparameters are: % % hyp = [ hyp_dot % log(c) % log(sf) ] % % Copyright (c) by Carl Edward ...
0a49978776df0d3ed6fafd373a8cca5b2d4632b27fb29ae6406619338333a5ee
MATLAB
1,733
52
% this function adds the pairwise copmparison bars to a figure; the 'hold on' % should have been set before executing this function % pairWisePs: an nxn pairwise comparison matrix. This is supposed to be % sorted in descending order of average values (large to small heights) % a horizontal bar would be displayed whene...
1d87af4fc68d62efc3c3f761c4361e0e15e5c3946a6f8979f5dafc97cf33460d
MATLAB
1,733
62
function [RHSdiv, RHSdivx, RHSdivy, RHSdivz] = divergenceTerm3D(F) % This function calculates the divergence of a field using its face % average flux vector facevariable, which is a face vector % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari %...
3c7e8c6ede4d11b53e5b9b38692ae6c00c1ed70d27a23058d9090b88e3945cb4
MATLAB
1,733
42
function slice_regressors = tapas_physio_split_regressor_slices(... slice_regressors_concat, nSampleSlices) % Splits a concatenated phase regressor into slice-wise regressors, one per % column % % slice_regressors = tapas_physio_split_regressor_slices(... % slice_regressors_concat, nSampleSlices) % % IN % ...
6c18045cc427fb62af416417212f3707e3e559d1780945ee92067db6a65d50d0
MATLAB
1,733
58
function r = issubfield(s, f) % ISSUBFIELD tests for the presence of a field in a structure just like the standard % Matlab ISFIELD function, except that you can also specify nested fields % using a '.' in the fieldname. The nesting can be arbitrary deep. % % Use as % f = issubfield(s, 'fieldname') % or as % f = i...
72ac6551590f3818fd05032f2748e86bef517c9688942562a564199bb39e2474
MATLAB
1,733
61
close all clear all load('Z:\BCI\Data\NDNF_Opto\NDNF_07\062624_NDNF_07\Baseline_noopto\baselineMask_1.mat') frames_tmp = sbxgrabframe('Z:\Scanbox\Data\NDNF\NDNF_07\062624_NDNF_07\062624_NDNF_07_000_009\062624_NDNF_07_000_009', 1, 24000); frames_tmp = squeeze(frames_tmp); frames = frames_tmp(:,:, 1:2:end); % writer...
bed7612be119946eabeead9da440c67e4cffe854fc75f2ebb241a60d2f873bea
MATLAB
1,733
56
function vol=addBinaryMapToVol(vol, map, col) % USAGE: vol=addBinaryMapToVol(vol, map, col) % % FUNCTION: to superimpose the binary map map to the true-color % volume vol. where map==1 the corresponding voxel of volume % vol is marked in the color col. all other voxels retain % ...
c00b1813b9fc6333109aea1ad85570eb871e153e5c5a108d2875c7b9950c9e51
MATLAB
1,733
51
function run_current_noise_simulation(params, options) % RUN_CURRENT_NOISE_SIMULATION - Run with current noise injection % % H1 Line: Execute simulation with additive current noise % % Syntax: % run_current_noise_simulation(params, options) % % Description: % Runs simulation with white noise current injection to ea...
8f3657674b7b22c3e6cba619740fa017310e05bd14b596af8977676232900cbe
MATLAB
1,735
46
addpath('../Functional/modules/nonfractal/m') addpath(genpath('../Functional/modules/wmtsa-matlab-0.2.6')) lb = [-0.5,0]; ub = [1.5,10]; H_combined = readtable('Hurst_schaefer100.csv', "FileType","text"); col457 = H_combined.H_combined157; col458 = H_combined.H_combined158; col459 = H_combined.H_combined159; IDs = str...
cf6eca766b9e63cd12bf17faab677f29ced12f6ac43122cb98646b6e15e2b0ae
MATLAB
1,735
47
function [rez] = Waveform_T(rez,DATA) M_T = length(unique(rez.st(:,3))); temp = unique(rez.st(:,3)); nt0 = rez.ops.nt0; Nchan = rez.ops.Nchan; %calculate the average template of the merged clusters template = zeros(rez.ops.nt0,Nchan,M_T); sumaT = zeros(nt0,Nchan,M_T); %To calculate the average template nb_spike...
79b8bca3f79549ec66ab0b438039bc88efb79a2d4e9685462b197565180e7876
MATLAB
1,736
44
function TMSmkC6(subjdir) %% delete the noise of the DARTEL c6 %% 1. find t1 voxels with low intensity (e.g., arbitrary threshold 1000). This also highlighed within brain voxels, such as CSF %% 2. only keep the largest cluster in the result map of step1. These were performed one slice by one slice in three dimentio...
c796af1616a4cc691dcafe07df0f4271fdebe08be58dbc8b2c22c35e8db53df6
MATLAB
1,736
34
%{ # 3-D volumes that compose this stack (usually tiled to form a bigger fov) -> stack.StackInfo roi_id : tinyint # same as ScanImage's --- -> experiment.StackFilename field_ids : blob # list of field_ids (0-index) sorted from shallow...
43ad0543d6f4ec3ed76715ad4d5e0ede9524e7c2cc7dd6dc5ef87778abbe7783
MATLAB
1,737
30
%----------------------------------------------------------------------- % Job configuration created by cfg_util (rev $Rev: 4252 $) %----------------------------------------------------------------------- function TMSseg(T1dir) matlabbatch{1}.spm.spatial.preproc.data = {T1dir}; matlabbatch{1}.spm.spatial.preproc....
a1db46ad781c3c33a6eb2650b604889abb9b3444832f3cd4ddefa1dac645fb01
MATLAB
1,737
48
%% Installing the Toolbox % Following these instructions is only necessary, if you have downloaded % the Toolbox as a .zip file. If you are using the .mltbx file or have % installed the Toolbox via Matlab's "Add-Ons" menu, there is no need to % perform the steps in this document %% Adding the package base bath ...
bf11e2f4ddc0c2626a8e9d0c0ffbcc65d07bccbdeb9e4a01e15ec2278293f8c0
MATLAB
1,737
54
classdef BatchNorm < dagnn.ElementWise properties numChannels epsilon = 1e-5 opts = {'NoCuDNN'} % ours seems slightly faster end properties (Transient) moments end methods function outputs = forward(obj, inputs, params) if strcmp(obj.net.mode, 'test') outputs{1} = vl_nnbnor...
fedf73b2b4ae48d638f056085a03e8fd665b52cb7a4805692d9208df8f47d8ab
MATLAB
1,737
80
function [r,c,V] = findnearest(srchvalue,srcharray,bias) % Usage: % Find the nearest numerical value in an array to a search value % All occurances are returned as array subscripts % % Output: % % For 2D matrix subscripts (r,c) use: % % [r,c] = findnearest(srchvalue,srcharray,gt_or_lt) % % % To also output the f...
108afcb8ded86c63ed3b12e6f0b2dccde806a97be7ac214511d24edacf0278a5
MATLAB
1,738
79
function status = GE_convertVolume(inDir,runnum,outName) % % status = GE_convertVolume(inDir,runnum,outName) % %GE_convertVolume % % Version 3.1 % % Converts a series of GE slices into Analyze format for SPM. % inDir is the name of the directory containing the first file of % the series, e.g. 003 % runnum is the run nu...
5adf1c418eaf979f5e44cac9ff6fa52f3ab83a8377a5ae9f60b2556ed37a488b
MATLAB
1,738
52
function [ screen ] = tapas_BLT_initScreen(params) % tapas_BLT_initScreen initilaizes the screen for the BLT experiment % Here we call some default settings for setting up Psychtoolbox PsychDefaultSetup(2); % Psychtoolbox has some issues in Mac which only allows us to run this % by skipping some default tests, we mig...
78aef502b3aad8b7fbd9f1b7fc2117bbf90681bbd4338d1b42adfbf49e18f364
MATLAB
1,738
50
function [new_pos] = applyDeformation(deffilename, pos) % % Input: deffilename <string> fullpath to the SPM deformation file % pos <nx3 float> point coordinates to be transformed. % Output: new_pos <nx3 float> transformed point coordinates. % % This function applies the nonlinear SPM voxelbas...
bdef5e9eca90f907ddca726fdbba4850cc2130e0cfc83f0a7089d2dad661101a
MATLAB
1,739
30
function [] = path_statistics () %%path_statistics (tracks.xvalscm, tracks.yvalscm, tracks) % This function calculates pathlength, max displacement, distance ratio, % and (if applicable) displacement relative to user provided reference ROIs global tracks global vals %% Calculate path and max displacement for gene...
15e21453d90bb0b4e1531a1900ddd7cd5659552e15c17c62a205e788ce8fe72f
MATLAB
1,740
58
% generateSimulatedBOLD - Generate simulated BOLD time series with noise % % Generates clean BOLD responses from ground truth pSFT parameters and adds % Gaussian noise at multiple SNR levels % % Inputs: % gt_params - Ground truth parameters [mu; sigma; beta; beta_0] (4 x num_voxels) % I - Stimul...
3fe7ea9ae2be6df5c76d84892397815b57b6a61a3c9d4314c0f9d074edfd6e06
MATLAB
1,740
51
function [ output_args ] = findAssemblyPatterns( activityPatterns ) %FINDASSEMBLYPATTERNS( activityPatterns ) % % INPUT: % activityPatterns [1x? cell]: cell array of binary activity patterns % % EXAMPLE: % findAssemblyPatterns( num2cell( [ sort( randi( [0,1] , 20 , 40 ) , 2 , 'ascend' ) ; sort( randi( [0,1] , 2...
6495e3a5291864933c9e3aad79268b08391d65a438f130e57c092f86d89f4eda
MATLAB
1,740
54
classdef BatchNorm < dagnn_bc.ElementWise properties numChannels epsilon = 1e-5 opts = {'NoCuDNN'} % ours seems slightly faster end properties (Transient) moments end methods function outputs = forward(obj, inputs, params) if strcmp(obj.net.mode, 'test') outputs{1} = vl_nnb...
05fe1b6c8e38e796b23248c082e6ac4eb1de532d177e1a0a15955225735ab1b2
MATLAB
1,741
48
function plot(data,cfg,varargin) % Function to plot the contents of a McsData object. % % function plot(data,cfg,varargin) % % Input: % % data - A McsData object % % cfg - Either empty (for default parameters) or a structure with % (some of) the following fields: % ...
4bb03afc07b6a7221dadd2fad9930bde3b5d9732c8f6d51dc5f1a60c4b851c52
MATLAB
1,741
43
function data = fixcoordsys(data) % FIXCOORDSYS ensures that the coordinate system is consistently % described. E.g. SPM and MNI are technically the same coordinate % system, but the strings 'spm' and 'mni' are different. % % See also FT_DETERMINE_COORDSYS % Copyright (C) 2017-2022, Robert Oostenveld % % This file is...
d3e841fa991c4ed73a33d6ab3737ae0cfdb08e1847027a987778f9fa5a7d10de
MATLAB
1,741
43
% SPHER - return the sphering matrix for given input data % % Usage: % >> sphere_matrix = spher(data); % % Reference: T. Bell (1996) % Copyright (C) S. Makeig CNL / Salk Institute, La Jolla CA 7-17-97 % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribut...
ede19b151d9aae3a239e30d52988b6b74a603cbaaee61b52656150e163857fe7
MATLAB
1,741
58
function tidy_ref_models() % Update reference models to latest MatConvNet version run(fullfile(fileparts(mfilename('fullpath')), '..', 'matlab', 'vl_setupnn.m')) ; models = {... 'imagenet-resnet-152-dag', ... 'imagenet-resnet-101-dag', ... 'imagenet-resnet-50-dag', ... 'imagenet-matconvnet-alex', ... 'image...
f87cd01e20e744d72318c131a77c0d4c717430b68582b2b11c834c155f573711
MATLAB
1,741
79
%% S = Signal_mGRE(m0,x2s,te,varargin) % % Description: Multiple exponential decay model for multiecho GRE % % Input % ---------- % m0 : T1weighted signal % x2s : either T2* or R2* % te : echo times % ***flag*** % ---------- % 'r2s' : input R2* instead of T2* % 'freq' : frequency shift of...
cf7b2220013e1fc06d6944c2ec80751a8d15d1aeea7e4304abdcdfc80f30e2d9
MATLAB
1,742
63
function [this, hasRegressors, hasConditions] = init_glm(this) % This method initializes MrGlm, i.e. checks for consistency and saves % neccessary files % % Y = MrGlm() % Y.specify_Glm(inputs) % % This is a method of class MrGlm. % % IN % % OUT % % EXAMPLE % init_glm % % See also MrGlm % Author: Saskia Boll...
5d653e73e4aebfae7da0e4fcaaabfdc0728c1da3777204c873cac2b340a6bc8a
MATLAB
1,743
49
function orthobasis = tangentorthobasis(M, x, n) % Returns an orthonormal basis of tangent vectors in the Manopt framework. % % function orthobasis = tangentorthobasis(M, x) % function orthobasis = tangentorthobasis(M, x, n) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M....
7794981c70083317f9959a1336dd3acc80829b01b47b775906a284ffb664091d
MATLAB
1,743
51
function waveforms = LoadSpikeWaveforms(filename,nChannels,nSamples,list) %LoadSpikeWaveforms - Read spike waveforms from disk. % % USAGE % % waveforms = LoadSpikeWaveforms(filename,nChannels,nSamples,list) % % filename spike waveform file name % nChannels number of channels in electrode...
84944cb51ea0d776204352e6fd7c9bf3bad977c58425e0a7c0c2200ab461793e
MATLAB
1,743
61
function [p0,pa_h0] = p0_monte_carlo_FWE(DB,iterations) % [p0,pa_h0] = p0_monte_carlo_FWE(DB,iterations) % % needs fields: % DB.XYZmm % mm coords for each study % DB.maskV % mask mapped volume % DB.radius % in voxels % ---------------------------------------------------- % * get list of all coordinates; selec...
a6f8bc40eb52e78cb5718b253394408d083c6b9bc344b1a1bde3329588f6680a
MATLAB
1,743
55
function img = read_avw_img_slice(filename,slice); % [img] = READ_AVW_IMG_SLICE(filename,slice) % % Read in one slice of Analyze (or nifti .img) file into either a 2D or 3D % array (depending on the header information). % The purpose is to allow reading big 4D volumes on slice at a time, % thereby reducing the ris...
df6c20c1645afc53971a293026052611b3859b7c45b40356aeea8dfad045a8ed
MATLAB
1,743
54
function fitUtilityFunction(decTab) % from: https://www.mathworks.com/matlabcentral/answers/154879-using-fminsearch-to-estimate-utility-function-with-mle?s_tid=srchtitle % I want to estimate the alpha (a) of a simple utility function of the form % % EU(P,V) = P*V^a % % where P is probability of outcome, and V is mag...
6d833b7a171990bd5b4856dbc53debd218602fda03f1d810898187427310e3ac
MATLAB
1,744
56
function [groupNameBeginsWnumber, groupNameContainsSpecial, allDIVisValid, groupNameIllegal] = checkCSV(csv_data) %CHECKCSV Summary of this function goes here % Detailed explanation goes here groupNames = csv_data(:, 3); groupNames = groupNames.(1); groupNameBeginsWnumber = 0; groupNameContainsSpeci...
3efdf8bbf30376da516d25190b0c28993ef180cec789b84c8bc8720e1e3f616b
MATLAB
1,745
71
function [s, s_stds, s_means] = norm_std_mean(s, s_stds, s_means) % Usage: [s, s_stds, s_means] = norm_std_mean(s, s_stds, s_means) % % Compute std and mean of a sample, z-score using them, return z-scored % data, stds, and means. % % Essentially the same as matlab's "zscore.m", but with optimization for % very large...
4aa66cdd54a8c71982e0a0cb75584358b28edd7035b0618526ee4e0372feb402
MATLAB
1,745
64
function [DA, AUC, pval, rcorr, T, ITI_legend, bins]... = ITI_effect(bstruct, pstruct, ITIbins_density,... event, binnum, window) bdata = bstruct.(event); pdata = pstruct.(event); % define bins ITIs = bdata.ITI; ITIs(ITIs>prctile(ITIs,99)) = NaN; %remove outliers ITIs = [ITIs(2:end); NaN]; %shift initiation...
58c4b80f6ea8ffe79e6653dced6df4316e7f3675732d5ec3df2940059b6a6fde
MATLAB
1,745
57
function c = tapas_softmax_mu3_wld_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the softmax observation model for multinomial responses with phasic % volatility exp(mu3) as the decision temperature and parameters accountin...
1b01bae0655f9b7a82a6da2c4ff88720de958aa758709aa14407b0319fa6170e
MATLAB
1,746
65
function plotEC_spectrum2axes(EC, freqAxis, timeAxis, cLims, clz, EC_info) % plots effective connecivity (EC) data as imagesc to axes % (c) Jiri, Nov22 %% defualt settings if ~isfield(EC_info, 'plot_xlabel'), EC_info.plot_xlabel = true; end if ~isfield(EC_info, 'plot_ylabel'), EC_info.plot_ylabel = true; end %% >>> ...
299f885e7ee3a24d6b8d2b15e09afcded7efbcfdd74a5a82bf4597bb6d07fd49
MATLAB
1,747
47
function [ S_index_significant, sis_query ] = Search_significant(csi_num,tf_idf_Rasterbin,Rasterbin) %LC En14 A partir del diccionario de vectores tf-idf %calcula el indice de similitud basado en el angulo entre las celulas %clave y cada vector. csi_num es una matriz [celulas edo] que contiene las celulas mas %represe...
9db570b6505a4c98fc9b925fe243cc2a6d9ba3d0cad5fb7197844cbe001ff72f
MATLAB
1,747
48
function ndef = notDefined( varString ) % Test whether a variable (usually a function argument) is defined % % ndef = notDefined( varString ) % % This routine is used to determine if a variable is defined in the calling % function's workspace. A variable is defined if (a) it exists and (b) it % is not empty. This r...
a2806572fe76462413ea78249b2a864dece37d8319513171fd6364399e99cc1d
MATLAB
1,747
53
function otherImage = permute(this, order) % Permutes array dimensions (and corresponding) % % Y = MrImage() % permutedImage = Y.permute(order) % % This is a method of class MrImage. % % IN % order [1, nDims] vector or permutation of 1:nDims indicating order % of dimensions after permutation. % ...
e3488cdea72142737e05f854d3163b870aa97604a5c2f0e2b71e2259713811fa
MATLAB
1,747
65
function [val, status] = ft_findcfg(cfg, var) % FT_FINDCFG searches for an element in the cfg structure % or in the nested previous cfgs % % Use as % val = ft_findcfg(cfg, var) % where the name of the variable should be specified as string. % % e.g. % trl = ft_findcfg(cfg, 'trl') % event = ft_findcfg(cfg, 'eve...