sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f2a678c158bf71cf8b31d4fe7978bfc4c99047dd29343fee340f2f007d7ce498 | MATLAB | 1,699 | 47 | function display = attInitFixParams_rd(display)
%Set the fixation parameters for meg attention experiment
%
% display = attInitFixParams(display)
display.fixType = 'largecross';
display.fixSizePixels = 2;
display.fixColorRgb = [0 0 0 255; ... % black
255 255 255 25... |
a23bccb34ba165ed040d8f65169965b4726524d6bc39a3b9118a64ce600ef9c8 | MATLAB | 1,701 | 51 | function [gx,dgdx,dgdp] = g_AVL(x,Phi,u,in)
% OTO: reaction time observation function
% function [gx,dgdx,dgdp] = g_AVL(x,Phi,u,in)
% This function computes the observation function (reaction time) for the
% audio-visual associative learning task.
% IN:
% - x: the 5x1 vector of states. The last one is the only releva... |
c281df8c8bb181fefae6677f1028c61877bf13c01e746c366b09c10a72f3018f | MATLAB | 1,701 | 51 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
%% Manual peak detection
%% --> to use after automatic detection steps
% Usage of manual r-peak selection tool:
% Input: some eeglab data (set file) with peaks as additional events
% Output: new file with old file name and _mancorr
srmr_nr = 2;
ana_dir = '/data/pt_02151... |
ec03d3e22a5f06d017b41a963426b63559f4202e42c202a6a546d39064708cc4 | MATLAB | 1,702 | 81 | function var = choise_var(file)
% v.0.0.2
% Pablo Billeke
% 03.09.2012
% 16.05.2012
if (nargin ==0) || (isempty(file))
w=evalin('base','who');
ifws=true;
else
w = who('-file',file);
ifws=false;
end
n = (numel(w(:)));
if n ==1
var = w{1} ;
return
end
%ifcellis(w,'ans')
% vt=[]
for i = n:-1:1
... |
659684b83b7b6fd5d80fe08d6b63a9a1e4a4ef4533d6ccf4094ae2629eb51bc3 | MATLAB | 1,703 | 60 | function el = ET_terminate(el, path) % TODO make a function out of this
%% terminate ET data collection and transfer files
Eyelink('Message', 'end');
% wait a while to record a few more samples
WaitSecs(0.1);
% finish up: stop recording eye-movements,
% close graphics window, close data file and shut down tracker
st... |
74282dad955e9bfaf953658f4b95986c193b6abc33e627bfd01e14d28cc510d4 | MATLAB | 1,703 | 65 | clear all
clc
figure (1)
subplot(1,3,1)
% Define relevant machine learning/deep learning methods and their sorted counts
methods = {
'CNN', 'Transfer Learning', 'Grad-CAM', 'Ensemble Learning', ...
'SAM with adapter modules', 'FCNs with U-Net', 'ViT', 'MobileViT', ...
'ConvNeXt', 'GAN', 'AFMS-Net', ... |
8ee3a1cad6da01b24e72af2d53e453ba03c95ca2d01c472b037c4888b196b30e | MATLAB | 1,703 | 65 | function [train_images, train_labels, test_images, test_labels] = mnistRead()
% mnistRead Read in MNIST digit set in Le Cun's format
% function [trainImages, trainLabels, testImages, testLabels] = readMNIST()
%
% The data is available at
% http://yann.lecun.com/exdb/mnist/
%
% OUTPUT:
% trainImages(:,:,i) is a uint8 ... |
741c9077961f6f2999c678f7a4fb6ff76a26611f83fea4ea7b93b819a29c6ab6 | MATLAB | 1,704 | 52 | function [dat] = read_neuralynx_ttl(filename, begsample, endsample)
% READ_NEURALYNX_TTL reads the Parallel_in values from a *.ttl file
%
% Use as
% [dat] = read_neuralynx_ttl(filename, begsample, endsample);
%
% The *.ttl file is not a formal Neuralynx file format, but at the
% F.C. Donders Centre we use it in conj... |
ef8f7a4eb2c92859f1e391b5abf583ec1a4020d1dcb7e6f29aa6d274ef4aa51a | MATLAB | 1,704 | 43 | function [spikes1] = int_spikes(spikes,cfg);
%Interpolates with cubic splines to improve alignment.
int_factor = cfg.int_factor;
detect = cfg.detection;
w_pre=cfg.w_pre;
w_post=cfg.w_post;
ls = w_pre + w_post;
nspk=size(spikes,1);
s=1:size(spikes,2);
ints=1/int_factor:1/int_factor:size(spikes,2);
int... |
f306447c54635e25c1c276a91f32d8bf6efe3a72bc10140f8f9aeab29c578c83 | MATLAB | 1,704 | 53 | function Images = load_and_flatten(parentfolder,folders,normalization,maxes,savename,subtractmean)
for fidx = 1:length(folders)%loop through all folders
fnames = dir([parentfolder folders{fidx} filesep '*.tif']);
Iflat = [];
for imidx = 1:length(fnames) %loop through all files
fname = fnames(imidx)... |
65dae4bf165847997b91e64b394b1be0163825fff4f652f60618275029e86914 | MATLAB | 1,705 | 52 | %OLD script that might be useful later
clear all;
% load('');
%output_dir = '';
%IMG_SIZE = [2048 2048 100];
%% First create a 3D image of all the puncta in space
output_img = zeros(IMG_SIZE);
for p_idx = 1:length(transcript_objects)
output_img(transcript_objects{p_idx}.voxels) = 500;
end
save3DTif_uint1... |
8094086f4be1076f088687b62ebf30b416d98ed55cbf39cd737ff0316aa2bc90 | MATLAB | 1,706 | 63 | function Y = sptenrand(sz,nz)
%SPTENRAND Sparse uniformly distributed random tensor.
%
% R = SPTENRAND(sz,density) creates a random sparse tensor of the
% specified sz with approximately density*prod(sz) nonzero
% entries.
%
% R = SPTENRAND(sz,nz) creates a random sparse tensor of the
% specified sz with appr... |
dcfdc91d6ff361b51c3ae8cc62858cc7bb5c3c678ff753629eaada82297a73f5 | MATLAB | 1,706 | 51 | %% One Dimensional Averaging Matrix
% Returns the 1D averaging matrix.
%
% av = ave(h);
%
% Where h = [d1 d2 ... dn]'; where d is the size of each cell.
%
% Boundaries use nearest neighbour approximation, interpolation is linear.
%
% Rowan Cockett
% 10-May-2012
% University of British Columbia
% rcockett@eos.ubc... |
ef3c00eb10b0c68f6f7b13d006b9f48e80cd17373dcc7ff06a04afa4cc2aba1a | MATLAB | 1,706 | 70 | function ndataF = svd_reduce_component_AMP(dataF)
% LAN toolbox v.0.2
% Reduce componente of source bases in AMPLITUDE of frequency !!!
% rotate de bipolar commponente to the maximum variaotion of amplitud ( freq - time - trial !!!)
% Pablo Billeke
% 18.04.2016
inx = ~isemptycell(dataF);
ndataF = cell(size(dat... |
141b940a6237291a4b60a4a22c20bea0502257c3ad4296e5a181fbeee4333ac6 | MATLAB | 1,707 | 36 | % Edited by Jerry. 06/30/2022
function clickWheelData=ProcessWheelData_220630...
(clickArray,wheelData,params)
% ********************************************************************
% This function sequences wheel data into windowed-timecourses
% corresponding to individual clicks.
% It returns a m... |
3f75379530a7f8f6239f1ea4026376f7e6d1ee75c662c5c546773698abfd2af6 | MATLAB | 1,707 | 52 | %% SDO Sum
% Simple Util for conform-summing SDO operators (dSDOs)
%
% Does not do any checks, assume all inputs provided to matrix are of
% compatible sizes. Can be SDO stacks, if ALL arguments are the same size.
%
% If multiple matrices are added as independent arguments; these will be
% added together. These may be... |
b15bdffcd47e835c240128aa41e019b44b3abe6de1fcd1033dd264e88bd822ae | MATLAB | 1,707 | 65 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
%% brainstem preprocessing wrapper script
clear; clc
delete(gcp('nocreate')) % clear parallel pool
%% variables that need to be changed
% loop
loop_number = 2
% subject, condition, and block info
subject_idx = [];
condition_idx = [];
%% define variables and paths
% e... |
c79decf1db8b00e3e8fe789c4df024edec93ecceb40a848b373e996255e084dc | MATLAB | 1,707 | 44 | function [ROIpairCorr,numFramesRemaining,numFramesScrubbed,totalNumFrames] = getROIpairCorrelations(rts,GS,WS,CS,fMPs,badVector,useGSR,numROIpairs,TR, minSecDataNeeded)
% NOTE: RETURNS ALL CORRELATIONS AS Z TRANFORMED
totalNumFrames = length(badVector);
numFramesScrubbed = sum(badVector);
numFramesRemai... |
07351db761ef0764c345296e03249101e5be2150949293be6a5fc7b2668513c3 | MATLAB | 1,708 | 58 | function params = ret_rd(params, runGUI)
% [params] = ret_rd([params])
%
% ret - program to start retinotopic mapping experiments (under OSX)
% params: optional input argument to specify experiment parameters. if
% omitted, GUI is opened to set parameters
%
% 06/2005 SOD Ported to OSX. If the mouse is i... |
42f914c47f271e196983c619b6134e9aa737fe776809590ad1b9cf87155ff2cb | MATLAB | 1,708 | 45 | % Edited by Jerry. 09/21/2022
function ScatterPlotBehavior_220921(dataTable,Title,Yaxe)
% Function to do a scatter plot with error bar of the data
% dataTable: a table with labels corresponding to the categories
% title: the title of the plot
% yaxe: the yaxis label
colors = [10,139,148;130,10,4... |
84ee8997300ef7952e566066b9afaba651011198ebff74ef6e1b790cde187a80 | MATLAB | 1,708 | 71 | function newftevdata = wlFT_unMapChannels(subsetftevdata, chandefs)
% function newftevdata = wlFT_unMapChannels(subsetftevdata, chandefs)
%
% This function alters "ft_channelnum" fields in "trialinfo" metadata for
% events extracted from trial data with channel subsets (processed with
% wlFT_getChanSubset()) to use ch... |
88367b80cc5ee63f2d2eb8e228a2957a06edde4da6764dfc4f4a0d4dea81e521 | MATLAB | 1,708 | 60 | function [CI] = binoCI(n1, n, alpha)
%binoCI Confidence interval from binomial distribution
%
% [CI] = binoCI(n1, n, alpha)
%
% Returns the confidence interval for the probability (or ratio)
% p = n1/n given by binomial observations, where n1 is the number of
% successes, n is the total number of trials, an... |
999fe5d3d0f59e48bc8b33bdc2b70a9ea9138f5f7c3d443f9aa8215c47f6fb5b | MATLAB | 1,708 | 45 | function C = mat2cell2( X, parts )
% Break matrix up into a cell array of same sized matrices.
%
% Useful wrapper for matlab function mat2cell. Instead of specifying
% locations along each dimension at which to split the matrix, this
% function takes the number of parts along each dimension to break X into.
% That is ... |
99ac6ce5182e77d41e6791034b95adb569dbaac961b5acfa49591818d919b373 | MATLAB | 1,708 | 47 | function [hrf,p] = VBA_spm_hrf(RT,P)
% Returns a hemodynamic response function
% FORMAT [hrf,p] = spm_hrf(RT,[p])
% RT - scan repeat time
% p - parameters of the response function (two gamma functions)
%
% defaults
% ... |
cadb328576d6f508794e95baa1a1040b8b87bd244d4ab3baf30c20f1d393ed5a | MATLAB | 1,708 | 49 | function headmodel = ft_headmodel_infinite(varargin)
% FT_HEADMODEL_INFINITE returns an infinitely large homogenous
% volume conduction model. For EEG the volume conductor can be used
% to compute the leadfield of electric current dipoles, for MEG it
% can be used for computing the leadfield of magnmetic dipoles.
%
% ... |
2798fefcac7f9817e6bcb8932933a0e24e54130cb24f991f45a310fa57b825eb | MATLAB | 1,709 | 43 | function [ Rsqf, RsqTime, rfin, rTime] = imageTrialRsq( allTrialCounts )
%IMAGESELECTIVITYINDEX Calculates the selectivity to natural images
% First defined in Quian Quiroga et al. (2007), also used by the Allen
% Institue Brain Observatory.
% Inputs:
% allTrialCounts: n x Nt x p matrix, n is number of ... |
749dfdef7ad891d8a40fa82abc0596b007875226026658a374f5249a4e94b474 | MATLAB | 1,709 | 60 | % This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
c6ab0a1245ddfcabfe93eeaba0e26b4d85e64a42b20ac38ab223f27b81ea73c3 | MATLAB | 1,709 | 40 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with the ... |
de997f07b0e8d3cfdbd44c856eef2c04a04f188e6b1a2dbe248f099818d34c14 | MATLAB | 1,709 | 77 | function LAN = lan_clear_unselected(LAN,cfg)
if nargin==1, cfg=[];end
getcfg(cfg,'win','hann');
getcfg(cfg,'width',10);
getcfg(cfg,'border',20);
getcfg(cfg,'iffig',1)
if iffig
H = figure;
end
% only trial with unselected areas!
T = find(ifcellis(LAN.selected,'any(~@)'));
for nt = T
% nt = T(1)
DIF = find(abs(diff... |
11696a4a2db68481cdc19e1dc5a133d6c293d17def80b148ba5b50a523749cdf | MATLAB | 1,710 | 52 | % DivideData.m
% Sarah West
% 5/10/22
% Inputs:
% parameters.division_points -- an array of index points along divideDim where
% the data should be divided.
% parameters.divideDim -- a scalar. The dimension you're dividing across.
function [parameters] = DivideData(parameters)
% Display progress message to user... |
2a1bde09a579a94ef6e3b51fd857fac785a48d2541a6df26cc9fbffc464762af | MATLAB | 1,710 | 74 | function res = grs2rgb(img, map)
%%Convert grayscale images to RGB using specified colormap.
% IMG is the grayscale image. Must be specified as a name of the image
% including the directory, or the matrix.
% MAP is the M-by-3 matrix of colors.
%
% RES = GRS2RGB(IMG) produces the RGB image RES from the grayscale image... |
4cacfeb398f49030c3be4853bcb1be20f45e04e7637d2dd8062aa2e0b8d909df | MATLAB | 1,710 | 55 | function [tri] = projecttri(pnt, method)
% PROJECTTRI makes a closed triangulation of a list of vertices by
% projecting them onto a unit sphere and subsequently by constructing
% a convex hull triangulation.
%
% Use as
% [tri] = projecttri(pnt, method)
% The optional method argument can be 'convhull' (default) or '... |
f96e8e6a7eda9d08f1a21572b5e6b981e74733fc2971dd03a332056977d846f2 | MATLAB | 1,710 | 66 | function NNdelete(self, src, event)
if self.verbosity > 9
disp(mfilename)
end
channel = self.channel_to_work_with;
switch src.Text
case 'Delete NN data on this channel'
if isempty(channel)
return
end
self.common.NNdata(channel) = crabsort.NNdata(1);
% try to stop anything being trained
try
cancel(self.w... |
736ed7c54782782d29b4ccf77222a59a94fe45e14bacc14b9175cee3f1dda47b | MATLAB | 1,711 | 46 | function C = xeucn( A, T, shape )
% n-dimensional euclidean distance between each window in A and template T.
%
% Similar to normxcorrn, except at each point (i,j) calculates the
% euclidean distance between the T and the window in A surrounding the
% point, storing the result in C(i,j).
%
% USAGE
% C = xeucn( A, T, [... |
2a3dcee3a82835b35123cf07a93a775e5d839a39ada307aba7893b0c896f4690 | MATLAB | 1,712 | 45 | function bigparams = loadBigExpParams(yamlfile)
%Use a YAML file to load the parameters for a large experiment
yamlspecs = ReadYaml(yamlfile);
%NOTE: The YAML files might have extra quotes so remove them
bigparams.EXPERIMENT_NAME = strrep(yamlspecs.basename,'''','');
bigparams.EXPERIMENT_FOLDERROOT = strrep(yamlspecs... |
3e0d3d835e6960202074fd36adef7bdaeaa59d97ce22c040d557df1a3834aced | MATLAB | 1,712 | 63 | % Plot stimulus-locked mean traces for all coherences - considering nans in
% each trial
% meanTracesRL_bigSbigT
if exist('sigRL') == 0 && exist('normS') >= 1
sigRL.sig_coh = normS.sigRL.sig_coh;
sigRL.t = normS.sigRL.t;
sigRL.correct = normS.sigRL.correct;
sigRL.session = normS.sigRL.session;
... |
5f40b15d116513b75663f921ab7456e746553593c2d0bf6e617d4b2246547e12 | MATLAB | 1,712 | 46 | function [O_error, O_grad]=jacobiandet_cost_gradient(O_grid,sizes,O_goal,sizeI,Spacing)
% Convert Grid vector to grid matrix
O_grid=reshape(O_grid,sizes);
% Delta step used for error gradient
step=0.001;
if(nargout>1)
if(length(Spacing)==2)
[O_error1,O_grad1]=jacobiandet_error_2d_double(O_grid(:,... |
0863ee610acafbb9b304776c3d9edb32cd555e15ad2a000c0cb175b25b49318e | MATLAB | 1,713 | 52 | function params = fitNakaRushtonToSpikes(xvals, spikes)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%==========================================================================
%unwrap and standardize variables
spikes = spikes(:);
xx = xvals(:);
yy = spikes/max(spikes);
%====... |
131abdbe3500a4aa179be52a7d59755d8f840becaee844ef21e8256eb56fedff | MATLAB | 1,713 | 54 | %% Rosenbrock constrained optimization demo
%
%%
% This file is from pmtk3.googlecode.com
function demoRosenConstrained()
% minimize 2d rosenbrock st x1^2 + x^2 <= 1
% Example from p1-8 of Mathworks Optimization Toolbox manual
requireOptimToolbox
xstart = [-1 2];
% Hessian is ignored by quasi-Newton so we use int... |
47fead033c48dc39d61bbd37c85b06deaab730fbbb7d55cfd1f1cd8d5e2807d7 | MATLAB | 1,713 | 58 | function [missing, extra] = pmlMoveExtraCode(bookSource, demosDir)
% Allocate code in demos/extra to the various chapters
% according to the pml latex extraCode index.
%
%% Inputs
% bookSource - path to the PML latex source containing e.g. pml.tex
% (default = C:\kmurphy\dropbox\PML\Text)
%
% dem... |
3713232623eb1eca95b4b308297d41d86a057c8b25a059a30e8718fdb76fb9fd | MATLAB | 1,714 | 47 | function TSexportscript(NameOfScriptFile)
% reads Experiment-building script out of the Experiment.Script field into
% a Matlab .m newly created script file in the current directory. If there
% is already a file with the specified name, its contents will be
% overwritten
%
% Syntax: TSexportscript(NameOfScriptFile)
%
%... |
a4b419dad9e332117b6ba30cc27252369e0893f6cfc2e3a3c02fa6dfd08e17cf | MATLAB | 1,714 | 22 |
function DensityScatterOutput=DensityColoring(DensityScatterOutput,map)
L = size(map,1);
if isempty(DensityScatterOutput)
warning on
warning('No DensityScatterOutput...')
DensityScatterOutput=[];
else
if min(DensityScatterOutput.dd(:))<max(DensityScatt... |
c23b338e7b682ec97613adb322d137edb3cf9483d679033e14dda62a91f79881 | MATLAB | 1,714 | 59 | clear all; close all; clc
Datapath='/home/Damian/PD_sleep_memory/EEG/';
SubjectList={'001', '002', '003','004', '008','009', '010','011','013','015','016','017', '018', '020','021', '022', '023','024'};
nSubj=numel(SubjectList);
NewSR=100; % downsample to 100 Hz
for Subj=1:nSubj
clear Events EEGPSD
% load... |
c68a828bbd44353f9ea2a1c197c5b3911d48ea3b20492821fd9489b83b5621a9 | MATLAB | 1,714 | 67 | function [xproj,yproj] = conic_project_hack(type,center,theta,normform,x0,y0)
w = length(x0);
% convert to normal form coords
R = [cos(theta),sin(theta);-sin(theta),cos(theta)];
pt = [x0-center(1),y0-center(2)]*R';
x = pt(:,1);
y = pt(:,2);
A = normform(1); C = normform(3); D = normform(4); E = normform(5);
xfit = n... |
f836439da79a6c7edaf599168a2918f4b7cabeca31b60b989c30a16f3d5beaf5 | MATLAB | 1,714 | 46 | function parallel_extract_VOI(stat_path,exp_folder,N,N_ROIs)
% ========================================================================
% Ruslan Masharipov, October, 2023
% email: ruslan.s.masharipov@gmail.com
% ========================================================================
for subji = 1:N
for j = 1:N_R... |
a59e504234346d7309000578c3840dbd8b9762eabdc10b97f6948af413c0a431 | MATLAB | 1,715 | 42 | % This script computes and plots the incident magnetic field magnitude
% (or any of the components) for any brain compartment surface/interface
% (plots the surface field + optionally coil geometry)
%
% Copyright SNM/WAW 2017-2023
eps0 = 8.85418782e-012; % Dielectric permittivity of vacuum(~air)
mu... |
e027b3399e92449b827880e98e1798990858ec68bf952e92884671deaa6cd063 | MATLAB | 1,715 | 47 | classdef AbstractHeavyFeatures < handle
% HeavyCoordinates are coordinates that can contain data > 2GB. To store this
% 'heavy-data' data fast, special arrangements are needed. Storing of
% the data is done by the saveTableDataSource_v3 function.
%
% Default methods work if a property named 'Xf... |
153bee41d40ab41f5c1d8d0d6ebcb8ec513a9ad47a2261abbdec9f3386eb60c0 | MATLAB | 1,718 | 71 | function z = ge(x,y)
%GE Greater than or equal for sptensors.
%
% See also SPTENSOR.
%
%MATLAB Tensor Toolbox.
%Copyright 2015, Sandia Corporation.
% This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others.
% http://www.sandia.gov/~tgkolda/TensorToolbox.
% Copyright (2015) Sandia Corporation. Under the t... |
159f71fc4fabc2c06b155743871fe07eeb4d345177843f3823c0d805203265aa | MATLAB | 1,718 | 52 | function GER122E1 = read_txt_data(filename, dataLines)
%IMPORTFILE Import data from a text file
% GER122E1 = IMPORTFILE(FILENAME) reads data from text file FILENAME
% for the default selection. Returns the data as a table.
%
% GER122E1 = IMPORTFILE(FILE, DATALINES) reads data for the specified
% row interval(s) of... |
8bf05c300c90fb44abbcd40cf32d29a40d3f9fb81e6661fcce74d880bc448ce8 | MATLAB | 1,718 | 57 | function M=movwv2at(N,Np);
%MOVWV2AT Oscillating structure of the interferences of the WVD.
% M=MOVWV2AT(N,Np) generates the movie frames illustrating the
% influence of the distance between two components on the oscillating
% structure of the interferences of the WVD.
%
% N : number of points for the signal;
% Np... |
31d288c64e66f0ed130576039dff6e67f4d6459b91e3e3d5e50cd6728bace040 | MATLAB | 1,720 | 47 | % function [fracSignal, filtSignal]= get_trajectory_signal(inSig, fs, freqTrajectory, filtParams)
function [fracSignal, filtSignal, sig_remod, sig_static_mod]= get_trajectory_signal(inSig, fs, freqTrajectory, filtParams)
if nargin<3
error('Need at least three inputs (input signal, sampling frequency, frequency tra... |
70b1133ea29700ffdf417a41e3a4ddd56c451ecc2bd4c29e93a3c3b3b9a2edca | MATLAB | 1,720 | 58 | function model = smlrFit(X, y, varargin)
%% Fit a sparse multinomial logistic regression model using L1+CV
%
%
% Optional inputs:
% kernelFn ... should be a fn of the form @(X1, X2).
% pathOpts ... structure passed to logregFitPathCv
% regType ... L1 or L2 (default is L1)
% usePath ... if true, builds kernel basis on... |
f699dde5f51bb05ea858083bfc0f52f09bcdda5c1e95048e1ab9c43f679ace03 | MATLAB | 1,720 | 77 | function ROI_siz = h_getROISize3(str)
ind = horzcat(strfind(str, 'x'), strfind(str, 'X'), strfind(str, ','));
if numel(ind) == 1
ROI_siz(1) = str2double(str(1:ind-1));
ROI_siz(2) = str2double(str(ind+1:end));
elseif numel(ind)==0
ROI_siz = [str2double(str), str2double(str)];
else %more than 1 giv... |
47342c49864791d01b801dc18c0d96f14b2c2a14a3fa92068170ffc89f1cb8af | MATLAB | 1,721 | 60 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
function pot_latency = esg_prepro_loop7_potentialLatency(subject, nerve, srmr_nr)
%% set variables
subject_id = sprintf('sub-%03i', subject);
analysis_path = [getenv('ANADIR') subject_id '/esg/prepro/'];
save_path = [getenv('ESGDIR') subject_id '/'];
cfg_path = getenv('C... |
dc3bcda919681cde46355aecda71a9592e20d9ef611d4744d3a85d8617298fc2 | MATLAB | 1,721 | 59 | function [ rgbimg ] = makeRGBImageFrom4ChanData(data4d,clims)
%MAKERGBIMAGEFROM4CHANDATA Take an (X,Y,C) dataset and turn it into a 3D
%image in the RGB format. Tailored the colors to
% Chan 1 = Blue
% Chan 2 = Green
% Chan 3 = Magenta
% Chan 4 = Red
%NOTE! The data4d input MUST be between 0 and 1.
if nargin==1
... |
aede0837514e0066834bbeb4237fe1b97911c05bc19bdaeaec152d16e4437506 | MATLAB | 1,722 | 50 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
%% cfg definition
% this file defines important analysis parameters.
%% sampling rate
srate_ica = 250;
srate_rpeak = 5000;
%% interpolation window - just for R-peak detection!!
interpol_window_rpeak = [-1.5 1.5];
%% interpolation window
% eeg
interpol_window = [-1.5 4]... |
eb0a031367d77ee4884293560e8dc5ecca123cdb50e402a75511efc9ca522825 | MATLAB | 1,722 | 76 | % Demo for DAVB Van Der Pol oscillator.
% This demo inverts a model of nonlinear Van Dr Pol oscillator, which is
% observed through a nonlinear sigmoid function.
clear variables
close all
% Choose basic settings for simulations
n_t = 2e2;
deltat = 1e-1;
f_fname = @f_vanDerPol;
g_fname = @g_sigmoid;
alpha = 1e2;
sig... |
93f5899168c504ecc8860921b3831ff73babadd4b1c866816e6ef656b335b0a1 | MATLAB | 1,723 | 52 | %% load group
%% setup
user = 'karen'; % 'mcq','karen','rachel'
expt = 'TANoise'; % 'TANoise'
sessionIdx = 1:20;
p = meg_params('TANoise_ITPCsession8');
%% get session names
allSessions = meg_sessions(expt);
sessionNames = allSessions(sessionIdx);
%% run analysis
groupA = []; groupD = []; groupI = []; groupB = [... |
e14b499bb4d73fc86d6375ad2742237911333f795fa1051c42fdb8abdad68ba2 | MATLAB | 1,723 | 64 | function [SSS_mask,Pseudo_TOF_init]=segment_SSS(PET_dyn_path,time_PET,out_path,options)
[~,~,~,~, IDIFTemp_path, IDIFVessels_path, IDIFQC_path, ~, ~, COREG_path] = out_path_preparation(out_path);
SSS_mask_path = fullfile(IDIFVessels_path,'SSS_mask.nii');
if nargin<4
options=get_default_options();
end
%loading... |
328e748c10347b2fea260cb94c99e6d016f3b516d4119ef3947d8d6703f7668f | MATLAB | 1,724 | 54 | function [trl, event] = ft_trialfun_imotions(cfg)
% FT_TRIALFUN_IMOTIONS makes a trial definition for an iMotions event structure
%
% The trialdef structure can contain the following specifications
% cfg.trialdef.eventtype = string or cell-array of strings (default = 'StimulusName')
% cfg.trialdef.eventvalue = string... |
cbf863ab489b7d3ed2eb3030f8d050a5bfa48e0343e2a3e45e3629ba681b20e2 | MATLAB | 1,724 | 54 | function [trl, event] = ft_trialfun_imotions(cfg)
% FT_TRIALFUN_IMOTIONS makes a trial definition for an iMotions event structure
%
% The trialdef structure can contain the following specifications
% cfg.trialdef.eventtype = string or cell array of strings (default = 'StimulusName')
% cfg.trialdef.eventvalue = string... |
1170c85712c3f9ae53e3c83042c67735b0bfd7e56426a02513929249e60a336b | MATLAB | 1,725 | 42 | function CBIG_LiGSR_LME_unittest_PMAT_cmp_w_reference_HCP( all_stats_mat )
% CBIG_LiGSR_LME_unittest_PMAT_cmp_w_reference_HCP( all_stats_mat )
%
% This function compare the variance component model results of fluid
% intelligence measure in HCP dataset that the user generated with the
% ground truth results.
%
% Inp... |
49118ff190e75a995c397bfdf12ac9ee8cd6894a49f68c060d7a839a9c560c13 | MATLAB | 1,725 | 59 | function [y,coeff,loc,residual,Error]=OMP_Visualize(D,X,L,S1,S2,S3)
%=============================================
% Sparse representation (OMP) of a group of signals based on a given dictionary and specified number of atoms to use.
% Input arguments:
% D - The dictionary (its columns MUST be normalized).
%... |
4cf8b788b18a1432ffc22af55fda3c567dd253f806f73159f08cdbd7affe6cae | MATLAB | 1,725 | 68 | fprintf(1,'Script that merges two "Cabib_Results.mat" data sets of the same camera into a single dataset\n')
dir;
cont = 1;
while cont
data_set1 = input('Filename of the first dataset (with complete path if necessary): ','s');
cont = ((exist(data_set1)~=2));
if cont,
fprintf(1,'File not found... |
9fedb8ef24a5b3d110181125acfb1050d1fbb5aa4760d69e9c85be45790f15f2 | MATLAB | 1,725 | 48 | function [fcost,u_sol,e_sol,F_err] = Spring2D(k0,F,u_output,params,optims,condition)
if isequal(condition,'1')
k = Convert_k(k0,params);
elseif isequal(condition,'0')
k = k0;
end
D = params.C.'*diag(k)*params.C;
F([2*params.ind_fix-1,2*params.ind_fix]) = [];
D(:,[2*params... |
9ff4c7641635b2acd28ab586dad8457139ba528c5a9f586187a8f3a65f65d328 | MATLAB | 1,725 | 63 | function Pout = boney_segment_cleanup(Pout,out,job,i)
%boney_segment_cleanup. Update Pout structure and clean up files
% _________________________________________________________________________
%
% Robert Dahnke & Polona Kalc
% Structural Brain Mapping Group (https://neuro-jena.github.io)
% Departments of Neurology ... |
d45a783c76828a15c86b78bec5cef732a04f49523c7e4022c010c232e5d4bcc0 | MATLAB | 1,725 | 70 | function flag = canwrite(loc)
% CANWRITE Determines if there is write access to the directory.
%
% SYNTAX:
% CANWRITE(LOC)
% [FLAG] = CANWRITE(LOC)
%
% [FLAG] = CANWRITE(LOC) Determines if there is write access to the
% directory LOC. If LOC is a full file path e.g. '/dir1/dir2/file.xxx'
% the file path '/dir1/... |
0ac0e41a30d353316b50f1d9263a32fb1a7c09061324e99242d10cff2dbd1ef4 | MATLAB | 1,726 | 60 | function [h,p, chi2stat,df] = chisq(X , N, correct)
% [h,p, chi2stat,df] = prop_test(X , N, correct)
%
% A simple Chi-square test to compare two proportions
% It is a 2 sided test with alpha=0.05
%
% Input:
% X = vector with number of success for each sample (e.g. [20 22])
% N = vector of total counts for each... |
16ee2ec272078789044b390be7fc1f8eaa86e6f163f1c14d87a14457a2ca035a | MATLAB | 1,726 | 50 | function t = scale(t,s,dims)
%SCALE Scale along specified dimensions for sparse tensors.
%
% Y = SCALE(X,S,DIMS) scales the sparse tensor X along the
% dimension(s) specified in DIMS using the scaling data in S. If
% DIMS contains only one dimensions, then S can be a column
% vector. Otherwise, S should be a te... |
4185a25b3eb6f8dbce01d54a7054e2b4a7ad4ccb78944aad4c8fda2ad2ed82e3 | MATLAB | 1,726 | 66 | function [n_Wru_v, n_Wrr_n, m_Wzr_n, n_x0_c, n_bx_1, m_bz_1] = unpackRNNUtils(net, varargin)
% This function returns masks in the format of the corresponding training
% parameters.
optargin = size(varargin,2);
do_theta = false;
do_entry_mask = false;
do_cost_mask = false;
for i = 1:2:optargin
switch varargin{i}
... |
5b8b36e6c6ab425ba97cea82572a5495211ec812f38131a82af729a19d7af590 | MATLAB | 1,726 | 60 | function v = myind2sub(siz,ndx,switch_row_col,nout)
%IND2SUB Multiple subscripts from linear index.
% IND2SUB is used to determine the equivalent subscript values
% corresponding to a given single index into an array.
%
% [I,J] = IND2SUB(SIZ,IND) returns the arrays I and J containing the
% equivalent row and co... |
90a84f041a91b9df6ecd386189970e3ab624df258f00712e9d457e6977a3343d | MATLAB | 1,726 | 68 | function header = read_spmeeg_header(filename)
% read_spmeeg_header() - import SPM5 and SPM8 meeg datasets
%
% Usage:
% >> header = read_spmeeg_header(filename);
%
% Inputs:
% filename - [string] file name
%
% Outputs:
% header - FILEIO toolbox type structure
% _________________________________________________... |
f23a02d7c60cdd2b1c713127ef80b771d7ebecb4e83dec6249724a39c1a4d024 | MATLAB | 1,726 | 39 | function [Metabolic_Rate, Dir, Dataset, Time_Variable] = ChooseExample
dname = pwd;
cd ([dname]); %go to main folder
opts.Interpreter = 'tex'; opts.Default = 'HAP2 Mice (2-Hr DID)';
button = questdlg('\fontsize{16} Which example would you like to run?', 'Choose Example', 'HAP2 Mice (2-Hr DID)', 'cHAP/HDID Mice (2-Hr ... |
47ebaca6f46025af47d970fc2a984b85651a6114fb736b1733c8dbd342fc2348 | MATLAB | 1,727 | 70 | %% Denoise some MNIST digits using a binary RBM
%PMTKauthor Andrej Karpathy
%PMTKmodified Kevin Murphy
% This file is from pmtk3.googlecode.com
setSeed(0);
if 0
load mnistSubset;
% data is 5000*784, testdata is 1000*784 both are in [0,1]
% labels(i) in 1..10, testlabels(i) in 1..10
Xtrain = data; Xtest = testdata;
... |
7dbc4734e848449ea7b034847055efc337c5eb66be0d7449cf7fc929a972777f | MATLAB | 1,727 | 61 | %% Embed the digit 3 into 2D and sample from the space
% Reproduce fig 14.23 from Hastie's book p489
%%
% This file is from pmtk3.googlecode.com
if 0
loadData('uspsAll'); % data(1:256, 1:1100, 1:10)
c = 3;
n = size(data,2);
X = double(data(:,:,c))'; % n x 256
figure(3);clf;montageKPM(reshape(X', [... |
e1c307fb6b089f3197a143e0117b2e4ac49e858e181355162c9707195d49971c | MATLAB | 1,727 | 60 | function [iQ] = VBA_inv(Q,indIn,flag,v)
% overloaded sparse matrix pseudo-inverse
% function [iQ] = VBA_inv(Q,indIn,flag,v)
% IN:
% - Q: the nxn matrix to be inverted
% - indIn: a vector of indices that specifies the submatrix of Q that has
% to be inverted. The rest of the matrix is padded with zeros. If empty,
... |
34fe1710ba70a9fe1dde61789f08ad3b9e85d62625698dc379836fd7598807a8 | MATLAB | 1,728 | 62 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% e1_prepare_raw_data.m %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
raw_data_path = fullfile(dipole_folder, ...
strcat(patno,'_',model... |
0e660e2a69eca47a410babe3c4ccfd60dc82016f8b3931bbc322fce555480dd9 | MATLAB | 1,729 | 45 |
% Download a sample 2p dataset from https://sungsoo-nas1.mcdb.ucsb.edu:5001/sharing/nU6uifCJC
%(and all code in the "Two-photon calcium imaging" github folder)
%% Part 1: analysing 2p data
clear
addpath(genpath([pwd '\Matlab functions']))
addpath(genpath([pwd '\sample dataset']))
temp_dir = dir('sample dataset\para... |
521fea81c19c7b6d45bf7a4ead01954a2508d158185dc5a0dc54b691ac93aded | MATLAB | 1,729 | 65 | function [ cfg ] = fcp_rejectartifact_threshold( cfg, megdata )
%FCP_REJECTARTIFACT_THRESHOLD
%
% Reject artifacts on a dataset based on given thresholds
%% process optional parameters
if ~isfield(cfg, 'bpfilter'), cfg.bpfilter = 'yes'; end
if ~isfield(cfg, 'bpfreq'), cfg.bpfreq = [1 150]; end
if ~isfi... |
77571c6bca94127ba483ba310ae6eb97ec6fbfb5f8e1170959fb6ab2a23af83b | MATLAB | 1,729 | 47 | % function [fracSignal, filtSignal]= get_trajectory_signal(inSig, fs, freqTrajectory, filtParams)
function [fracSignal, filtSignal, sig_remod, sig_static_mod]= get_trajectory_hilbert_signal(inSig, fs, freqTrajectory, filtParams)
if nargin<3
error('Need at least three inputs (input signal, sampling frequency, frequ... |
ccaa62a74edc01783eb1b97028a270353ca47786944d57f26d1e67f4867b23cb | MATLAB | 1,729 | 54 | function fcBx_PercFC_Scat2(pairsOut,IM)
% This function creates a scatter plot of the proportion of positive fcMRI
% values against fcBx correlation from the output of
% pairsOut=View_Clear_Brain_ROI_Corr2a.
% tp is the time point of interest (set to 1 if only 1)
% IM is the infomap structure.
%% Parameters and Ini... |
d6bb04b38e8e9c675f20d97b070131c50695ae99e6cd570e11032404dcf2777e | MATLAB | 1,729 | 51 | %% generateShuffleMatrix;
%
% Using a mean and standard deviation matrices, generate a mixture of
% normally distributed scalars for shuffles.
%
% Used to simulate draws from the predefined Mean + Standard Deviation
%_______________________________________
% Copyright (C) 2024 Trevor S. Smith
% Drexel University Co... |
7ab9276b217d07cb73bbd78921f45e16d88cdd760ff57f9138ade445bb63354a | MATLAB | 1,730 | 56 | function [C, N] = VBA_spm_mesh_label(M,opt)
% Label connected components of a surface mesh
% FORMAT C = spm_mesh_label(M)
% M - a [nx3] faces array or a patch structure
% opt - return connected components on faces/vertices:
% {['faces'] ,'vertices'}
%
% C - a [nx1] vector containing labels... |
af3a9a427c11a9a622a2a60d7cf5cdd8849bf2a3d5d42c1c595604d312e224d4 | MATLAB | 1,730 | 57 | function df = load_dlc_csv(file_path)
% load_dlc_csv: general function to load dlc csv files
%
% works by iterating over headers until x,y,likelihood are found, then
% makes sure all columns are type double.
%
% Iterating over headers are needed as multi-animal tracking has more
% headers than the standard single ani... |
ed42be1bd4754e9415655a1a261632892cf4b2071d7ef42106812aebdd40ba61 | MATLAB | 1,730 | 70 | function trx = load_tracklet(matfile,frompy)
% trx = load_tracklet(matfile,frompy)
% trx = load_tracklet(matcontents,frompy)
if nargin < 2,
frompy = false;
end
if ischar(matfile)
td = load(matfile,'-mat');
else
td = matfile;
end
% % aux fields like confidences, occlusion-scores etc
% fldsaux = fieldnames(td);... |
7b6dabd41dc2bdeb6ac8e584016844336c49e30d98ee865ecf08d5c5b20cfb1b | MATLAB | 1,731 | 78 | function plot_inter_banda(LAN,elec,axis)
% elec=[1:32];
%
%
%
for i = 1:length(LAN)
f = figure('Position', [100,100,1000,500]);
%uicontrol('Style', 'text', 'String','hhhhhhh', 'Position', [0.1, 0.9, 0.8,0.1]);
try
annotation(f,'textbox',[0.135 0.744 0.687 0.22],...
'String',...
{'ESTU... |
9acb324b429716b19c15ee4d1ccb97f6dbc0a97a9205aecf34cd3ddc05494062 | MATLAB | 1,731 | 56 | function [output, firstIndexPoint] = read_bti_hs( filename, outfile)
%read_hs_file Reads in BTI-Headshape files
% filename: file with the headshape informations
% outfile: if present, a ctf ".shape" file is written
% output: if present, a 3xN matrix containing the headshape-points
%
% (C) 2007 by Thomas Hartma... |
ba535aa2ad4318a8d99f6d3d87f237fa0493448622d6e0abeb37ab41fdfb1788 | MATLAB | 1,731 | 63 | function plot_avRainbow4_wxLeg_dur(vcf, avsd, summaryInfoTable, avColors, selSmltIds, varargin)
% in plot_avRainbow4_wxLeg_dur
% also plot_avDistribution2 is used
% plot_avRainbow4, plot_avDistribution was mistakeny used
%% handle optional inputs (varargin):
nOpVar=0; % counter for optional variable
nOpVar=nOpVar+1; op... |
bfa23b66abd7047f0abe4f7fe11cf0386f7e321cea057ccfaa8b5af6d737e962 | MATLAB | 1,732 | 53 | function folds = make_folds(datadir, kerneldir, n_reps, n_folds)
% folds = make_folds(datadir, kerneldir, n_reps, n_folds)
%
% make randomised repetitions of k folds for CV of 1001 HCP subjects,
% taking into account family structure and saving folds to be used by
% prediction methods
%
% Input:
% datadir: directo... |
2c821fef2ce48475a43ed82468712d19ad9fde4cf2e4fa53c82c4dde39a6777f | MATLAB | 1,733 | 66 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
%% ESG preprocessing wrapper script
clear; clc
delete(gcp('nocreate')) % clear parallel pool
%% variables that need to be changed
% loop
loop_number = 1;
disp(['loop number = ' num2str(loop_number)])
% subjects
subject_idx = 1:24;
%% define variables and paths
% exper... |
5f6f6fea38cbc3c7ce524a65b5035d49d02f4b0c4c336469e16fce2c789de832 | MATLAB | 1,733 | 65 | function inv = betainvOct (x, a, b)
%% This is a replacement function for stats toolbox betainv
% It is an adaptation of the betainv function in Octave written by KH
% <Kurt.Hornik@wu-wien.ac.at>, released under the GNU General Public
% License version 3. It was modified to make it Matlab compatible, and to
% use beta... |
fcb4f25785c66ad4f62584be73e802b52b5e73fc9c657fd998e36d5a930487e1 | MATLAB | 1,733 | 59 | function [LLH0] = VBA_LMEH0(y,options)
% evaluates the log-evidence of the null (H0) model
% [LLH0] = VBA_LMEH0(y)
% This function evaluates the exact log marginal likelihood of a null model
% H0, which basically assumes that the data only contain Gaussian noise of
% unknown variance, i.e. y ~ N(0,sigma^-1*I), where si... |
101c1e881d80b7a0ddeaf090360d74e8871f5a3bcce64bf91a20d5c310d840a5 | MATLAB | 1,734 | 78 | function [fx,dF_dX,dF_dTheta] = f_dcm4fmri0(Xt,Theta,ut,inF)
% nonlinear DCM evolution function
% function [fx,dF_dX,dF_dTheta] = f_dcm4fmri0(Xt,Theta,ut,inF)
% This function evaluates the evolution function of the neuronal states of
% a nonlinear DCM for fMRI model.
deltat = inF.deltat;
n = size(Xt,1);
[dxdt,J,dfdp]... |
f700ad73bbf51250fef8137365a441d17d13207b73a2fbe075294d28498dd1b4 | MATLAB | 1,736 | 42 | function filter = gauss_filter_fun(FILTER_SIZEXY, FILTER_SIZEZ, STDXY, STDZ, DIM)% filter size is scalar plz. gives (filter_size)^DIM filter
% Maryann Rui 08/2017
%% 2d and 3d gaussian kernel by scratch
if nargin < 5
DIM = 3; % default 3D filter
end
switch DIM
%% manual 2d [same as fspecial('gaussian', FILTE... |
0b0b74ceed0d23fdd3f51ed0e6e889f46b6cdddd7736c0d5d01a7e771f7008bd | MATLAB | 1,737 | 74 | function [condNumbers,condLabels] = read_ctf_cls(fname)
% READ_CTF_CLS reads the classification file from a CTF dataset
% Copyright (C) 2003, Ole Jensen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute ... |
2027e0152f72caa3773e2dda9fc849a73e1ead3cbd7a055e2024076b26b349b2 | MATLAB | 1,737 | 69 | function plotContours(fov,cellN,contours,background, color)
%% >>> OPERATION >>>
% Plot contours of selected cells for defined field of view
% >>> INPUT VARIABLES >>>
% NAME TYPE, DEFAULT DESCRIPTION
% fov double field of view (image or movie)
% cellN double ... |
447038e740cdc72cf4c938e489777380957a3e49e0e1f4f05b1f039b46b7199f | MATLAB | 1,737 | 42 |
data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*');
ind=1;
contrasts = ["error-correct", "error-baseline", "correct-baseline", ...
"instruction-baseline", "response-baseline", "runs2_response", ...
"runs3_response", "runs2_error", "runs3_error", "runs2_correct", ...
"runs3_correct", "runs1_response"]... |
be8820e045edbeb9d0fd1d8753053a8395bcaf88499a696df1a27995878b63a3 | MATLAB | 1,737 | 52 | function RegressEEGVsBeh(timelock, timesToPlot)
% function RegressEEGVsBeh(timelock, timesToPlot)
% regress each time point and electrode separately against main 3
% behavioural variables
% Inputs:
% timelock is a string of the epoch name to load e.g. "readyBS" or "sacc"
% timesToPlot are the [min max] times to plo... |
3dd381ce111168e4a31e6abc8af4833008a9d4a645fce35be2c130cb98718e14 | MATLAB | 1,738 | 60 | function trialDat = TrialSplit(spkTimes, behav_ts, varargin)
% "zeroEvent" is the index for the event on which times are aligned
% 1: trial begin 2: nose in center port, 3: tone
% 4: nose out of center port, 5: nose in side port
% ".spkTimes" is a cell array
zeroEvent = 2;
preWin = 0;
postWin = [];
for i = 1:len... |
9543e039735397475fada543b3f2e6401248bdc98ee4fdb525bb219a0bc26eee | MATLAB | 1,738 | 50 | function [margt,margf,E]=margtfr(tfr,t,f)
%MARGTFR Marginals and energy of a time-frequency representation.
% [MARGT,MARGF,E]=MARGTFR(TFR,T,F) calculates the time and
% frequency marginals and the energy of a time-frequency
% representation.
%
% TFR : time-frequency representation (M,N)
% T : vector containing the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.