sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
87044bd57e7b4f9a797b6152886285f6922749e218449c466675833bb9112baa
MATLAB
573
17
function keyDown = checkkeydown(params, whichkey) % WAITFORKEY - this functions waits for a key press of a specific key indicated by the % keynumber in whichkey % Code: F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 keyDown = 0; if params.keyboard == 0 % wait for response box key clearse...
954ab5a0019c1f0e5d2f2d1440bff8d8f99e44f561fc7f904de1b23dea577838
MATLAB
573
24
function [sstate, si] = tapas_sem_hier_get_stored_state(data, model, ... inference, state) %% Get the state that should be stored % % aponteeduardo@gmail.com % copyright (C) 2016 % sstate = struct('graph', {cell(4, 1)}, 'llh', {cell(4, 1)}, 'v', []); order = state.graph{2}.u.temperature_ordering; sstate.graph{2}...
e6675125fa4725e30e95cbf852f9bb2c1509a390d88e93ab3f1a0f3d8d388474
MATLAB
573
12
function pstruct = tapas_unitsq_sgm_mu3_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2018 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence ...
ad9f7f580f5f447b5304e88b25e92fd5b2b9df75515c0485707a4a46fca9208e
MATLAB
574
27
%A partir del S_index vectorizado compara todos los renglones para %determinar cuales son diferentes. El numero de renglones diferentes %constituye el numero total de estados de la red. function [Edos_vector]=Nedos(S_index) N=size(Y,2); %Número de picos j=1; for i=1:(N-1) Ya=Y(:,i); Yb=Y(:,i+1); Yab=...
0285b12f5ca73cf3cd86c792363ff77a67e761c956f1a7ba44e641943a3a13e9
MATLAB
575
27
function [ output_args ] = cross_evaluation( f , X , Y ) %CROSS_EVALUATION( f , X , Y ) Returns the matrix f(x,y) for x in X and y %in Y. % % INPUT: % f [function handle]: two-argument function % X [1x? cell]: data points % Y [1x? cell]: data points, =X if not explicitly given % % % === Jan Moelter, The Unive...
13323cb3038fbc167a98fb46ec0191ef78fc7f9b89dbfee43503752cd89c14d0
MATLAB
575
12
function b=sero_pulseq_calculateBval(g, delta, DELTA) % see DAVY SINNAEVE Concepts in Magnetic Resonance Part A, Vol. 40A(2) 39–65 (2012) DOI 10.1002/cmr.a % b = gamma^2 g^2 delta^2 sigma^2 (DELTA + 2 (kappa - lambda) delta) % in pulseq we don't need gamma as our gradinets are Hz/m % however, we do need 2pi as diffusi...
321b31f09de734ec4333e6200fda3eed3e48fba79d42bc13282f63f4d41e6160
MATLAB
575
26
function sh_TimeTracePlot(Mx,Fs) Mx=sh_Standardize(Mx); name={'Green','Red','Voltage'}; fig=figure('defaultAxesFontSize',18); tps=0:1/Fs:(size(Mx,1)-1)/Fs; subplot(4,1,1) plot(tps(1:60*Fs),Mx(1:60*Fs,1:2)) legend(name(1:2)) subplot(4,1,2) plot(tps(1:2*Fs),Mx(1:2*Fs,3),'k') legend(name(3)) last=floor(length(tps)/Fs)*...
8c2462853916758d6d1b69e60c131e7fda5963c158b719930c99d2d7df27165c
MATLAB
575
14
function make_yyplot( ActualY, EstimatedY, YMax, YMin, EstimatedYName, ActualYName,i ) %MAKE_YYPLOT Make plot of Actual Y vs. Estimated Y subplot(2,1,i) plot( [YMin-(YMax-YMin)*0.05 YMax+(YMax-YMin)*0.05], [YMin-(YMax-YMin)*0.05 YMax+(YMax-YMin)*0.05], 'r','linewidth',2 ); hold on; plot( ActualY, EstimatedY, 'b.'...
fa6cacc72a08a3949ab88d0ec80c6f44c70680d328b7b287235f6994cf99da46
MATLAB
575
25
function RDMs=concatRDMs(varargin) % concatenates representational dissimilarity matrices and returns the % concatenated RDMs in a wrapped structure. %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.*...
08513436a8ec02a74ce14a4b48489739a5ef8a263c0508e13019c960b57e7b2f
MATLAB
576
28
function test_suite = test_expDesign %#ok<*STOUT> % (C) Copyright 2021 CPP visual motion localizer developers try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine e...
3d8c4ba11ed236d7966d65d61c7ef9a44931e886195006987db73b8b0e45d5d0
MATLAB
576
31
function [val_norm]=getBloodVesselTimeProfile(movie) nFrame=size(movie,3); if nFrame>10 f0=mean(movie(:,:,end-10:end),3); else f0=movie(:,:,1); end imshow(f0,[]) [cx,cy,~] =improfile; xi=round([cx(1) cx(end)]); yi=round([cy(1) cy(end)]); [cx,~,~] =improfile(double(movie(:,:,1)),xi,yi,'bilinear'); c=zer...
4ab35a095d00f0a341283794c20dcf5f15f47dd9437f34471bf3c708fe1289fe
MATLAB
576
21
% this will deal with the params structs only, subject is not used % intended as matlab include % check the params struct if (~exist('params','var') || isempty(params)) % check if the params are attached in the subject struct (this can be % needed in compiled mode) if (~exist('analysis_params.m','file')) error(...
67b33672c75a5f1c992320961c176c1441483948fac593fd33e0ea9c0839507d
MATLAB
576
18
function set_seed(seed) % Get MATLAB release information releaseInfo = matlabRelease(); releaseName = char(releaseInfo.Release); % Extract the year and letter from the release name releaseYear = str2double(releaseName(2:5)); releaseLetter = releaseName(6); % Check if the release is...
8d3f4af307926f5f7399d11529d90ae3fbd2d9ba05c1f7b541c7f073ada9cf56
MATLAB
576
33
function [posterior] = tapas_linear_prepare_posterior(data, model, ... inference, states) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % T = model.graph{1}.htheta.T; posterior = struct('data', data, 'model', model, 'inference', inference, ... 'samples_theta', [], 'fe', []); np = numel(states); nc = n...
adafd37f0b5439ba7666c4c01a43cbc81ca9bba9f621400f525672b5481a4699
MATLAB
576
28
function [model] = tapas_vlinear_prepare_model(data, model, inference) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % % Number of regressors nc = numel(model.graph{2}.htheta.T); nb = size(data.u{1}, 2); if ~isstruct(model.graph{4}.htheta.y) model.graph{4}.htheta.y = struct(); end if ~isfield(model.graph{...
f6366244053656edcf55d7cb3d2589c22a673141d8d61fd1b77a23b823b07e3c
MATLAB
576
27
function [posterior] = tapas_sem_hier_estimate_interface(data, model, inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % % Verify input tapas_validate_data(data); tapas_validate_model(model); tapas_validate_inference(inference); [data] = tapas_sem_hier_prepare_data(...
f78fb29eb282cb665c1c63747105e667b3f604c81343ddc2d1643c7c5d870482
MATLAB
576
19
function [res]=prepareWaves(results100) fwdB_L100 = squeeze(nanmean(nanmedian(results100.fwdBLeft,3),4)); fwdB_R100 = squeeze(nanmean(nanmedian(results100.fwdBRight,3),4)); bwdB_L100 = squeeze(nanmean(nanmedian(results100.bwdBLeft,3),4)); bwdB_R100 = squeeze(nanmean(nanmedian(results100.bwdBRight,...
01df4e28f73e0ab16530c7eece1d97e2e8ecbdd02bb7e14d46e9f2785eccf46d
MATLAB
577
26
function [output]=sh_zscore(input,varargin) % Check number of parameters if (nargin > 3) || (mod(length(varargin),2) ~= 0) error('Incorrect number of parameters'); end % Compute normalization on the specified range if nargin>1 switch varargin{1} case 'range' range= varargin{2}; ...
3f428deb1e71af0c2f5013f0045bab76b5df13aaf6cd06b64dfd2a7b2c920c6f
MATLAB
577
22
function varlist=check_matfile(varargin) % % HELP % Checking a content of a mat file, by entering a keyboard environment within a function. So instead of loading and overwriting you will do it within a function scope, in a clean way. % SYNTAX %[varlist,summary]= check_matfile() - dialog %[varlist,summary]= check_matfil...
62f9c12c323aca572b153ddd0ec67914fddfe8727c32831de7ff620617a49074
MATLAB
577
20
function stk = loadCorrectedStack(key) xy = fetch1(stack.StackMotion & key,'motion_xy'); fprintf('Loading stack...'); reader = stack.getStackReader(key); stk = reader(:, :, :, :, :); nslices = reader.nslices; nframes = reader.nframes; nchannels = reader.nchannels; fprintf('Aligning stack...'); for islice=1:nslices ...
fa483cc174475007187ab04483046739de7fac9fc9755ff2896b80400c75e6f6
MATLAB
577
8
%----------------------------------------------------------------------- % Job saved on 18-Nov-2014 09:28:14 by cfg_util (rev $Rev: 6134 $) % spm SPM - SPM12 (6225) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{2}.spm.stats.fmri_est.spmmat(1) = cfg_...
36205d091f83d936cabde1dbdeac0904deb37168a33f22a7d650944a53ad7fe6
MATLAB
578
26
function rng_seed = get_rng_seed(options) % GET_RNG_SEED - Get or generate random seed % % H1 Line: Obtain random seed for reproducibility % % Syntax: % rng_seed = get_rng_seed(options) % % Description: % Returns the random seed from options or generates a default one. % % Inputs: % options - Options structure % ...
cfaa9e2f89541b48da03ff7eae7fdbdb8186e25169e077f25f6bf38f54ce45e9
MATLAB
578
24
function [places,stimuli,place_stim] = get_place_and_stimuli(this_program) % get what stimulus was in which the chamber(s) % program name format: stimulus-location % for three chamber task, stimulus1-location1_stimulus2-location2 %% place_stim = strsplit(this_program,'_'); places = {}; stimuli = {}; for i = ...
eac7ab7f24211b928d30f3c4fe508c46124dbb96c2ba2c61ac7b882027a20607
MATLAB
578
23
function [sstate, si] = tapas_sem_multiv_get_stored_state(data, model, ... inference, state) %% Get the state that should be stored % % aponteeduardo@gmail.com % copyright (C) 2016 % sstate = struct('graph', {cell(4, 1)}, 'llh', {cell(4, 1)}, 'v', []); order = state.graph{2}.u.temperature_ordering; sstate.graph{2...
9ff99126c34d8fec62cf06bfa4114e35847efc205b8a9ed809b5bd4c71ac369e
MATLAB
579
13
%{ tuning.CaKernel (lookup) # options for calcium response kinetics. kernel : tinyint # calcium option number --- transient_shape : enum('exp','onAlpha') # calcium transient shape latency=0 : float # (s) assumed neural response latenc...
de9f648678ed9b2cb5939284b884aee73ba42daa176cdd2612dbb3338066df3c
MATLAB
579
24
function Y=temporallySmoothTimeSpaceMatrix(Y,FWHM) % Y=temporallySmoothTimeSpaceMatrix(Y,FWHM) % temporally smooths the time-by-space matrix Y with a gaussian kernel of % full width at half maximum FWHM %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Cou...
ee64dd4adf371705eab62eaea49ea1c85e1dad151897741c9654fa92845f994e
MATLAB
579
21
%% sepia_print_edit_as_string(fid,str_pattern,action_handle) % % Input % -------------- % fid : fid of the sepia config file % str_pattern : string pattern to be printed after algorParam parameter % action_handle : handle of the GUI popup % % Description: print GUI edit field value to sepia config file % % ...
76e7f19f8698fef5035a484aeb0a7c8771e8fef217b596915e8ce310fef2c28f
MATLAB
580
20
r = experiment.Session * experiment.AutoProcessing & 'session_date>"2016-02"'; while true while progress(preprocess.Prepare(), r) parpopulate(preprocess.Prepare, r) end while progress(preprocess.Sync, r) parpopulate(preprocess.Sync, r) end while progress(preprocess.Treadmill, r) ...
2951bd300a2c0171985ff0f6116e6eb2171abad22e66a628e45c2ccadf7f5b90
MATLAB
581
26
function LabelAxis(ha, xlbls, ylbls) %Puts text labels on axis of graph %example: %figure(1); plot ([1 2], [4 5]); %LabelAxis(gca,{'Low' 'Hi'}, {'four' 'five'}) if (~isempty(xlbls) & ~iscellstr(xlbls)), fprintf(2,'Need array of cellstrings for x input'); end if (~isempty(ylbls) & ~iscellstr(ylbls)), fprintf(2,'N...
8e9b06b78b693b6eb239ead7e10937e9fbf332e1c50f693f3bac9e620c4b78fe
MATLAB
581
19
function spikeAmps = getSpikeAmp(spikeWaveforms) %GETSPIKEAMP Get spike amplitude from spikeData % Detailed explanation goes here numChannels = length(spikeWaveforms); spikeAmps = cell(1, numChannels); for channelIdx = 1:length(spikeWaveforms) spikeAmps{channelIdx} = struct(); spikeDmethods = fieldnames(spi...
cab14065d7138630131e2a2ac53a5146976e5612553fdee026b3b847becc5b3d
MATLAB
581
14
function y = tapas_boltzmann(x, beta) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence (GPL), version...
16331afea4b42a14f336eea5dd037e8286bc2c58108ceee7aedcf5a18655fbd9
MATLAB
582
14
%{ experiment.FOV (lookup) # field-of-view sizes for all lenses and magnifications -> experiment.Rig -> experiment.Lens mag : decimal(5,2) # ScanImage zoom factor fov_ts : datetime # fov measurement date and time --- height : decimal(5,1) ...
d5632541a519940cdb139d217e77405047befdebeb34ca1db607f4a10d33b156
MATLAB
582
29
function result=samstr(data,result); D = data.X; x = result.proj.P; [noc,dim]=size(D); noc_x_1 = ones(noc, 1); Mdist=[]; dim_x_1 = ones(dim,1); for i = 1:noc, xD = D(i,:); Diff = D - xD(noc_x_1,:); Mdist(:,i) = sqrt((Diff.^2)*dim_x_1); end e = 0; tot = 0; for j = 2:noc, d ...
e17814a5aa002a2954429cbe75db5576e96f86c83a5c9e216d108221066dcfd2
MATLAB
583
16
%{ # visual stimulus trial buffering animal_id : int session : smallint scan_idx : smallint trial_idx : int # trial index within sessions --- condition_hash : char(20) flip_times : longblob...
16128acf85c222be1273238d14bc6f982d2b002269e4de47ec65c6571ce55caa
MATLAB
584
27
function [posterior] = tapas_sem_multiv_estimate_interface(data, model, inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % % Verify input tapas_validate_data(data); tapas_validate_model(model); tapas_validate_inference(inference); [data] = tapas_sem_multiv_prepare_d...
8696535b8b9e7c1b6fa8d09545e5b86ec82e847cdf787f7439fd6381e927b227
MATLAB
584
27
function str = createDWIHashnum(ten) for k = 1:size(ten,3), for j = 1:size(ten,3), tr(k,j) = trace(ten(:,:,k)*ten(:,:,j)')/1000; end; end; hashnum = log(1+histc(tr(:),-50:400:10000)); str = hash2Str(hashnum); function str = hash2Str(hashnum) X = 'qwertzuiopasdfghjklyxcvbnmQWER...
c39428c660b13e2b54be198f0ac235a613c66c7e0aaf584c14cc0da43039a07d
MATLAB
584
22
function RDM=squareRDM(RDM) % converts RDM to square form % % if they are in square form already they are vectorized % using the lower triangle (matlab squareform convention) and resquared, % thus fixing inconsistencies between upper and lower triangle (the lower % is used). %___________________________________________...
e2e3856f4c215e11f0981816bb3efe0a885c36dd423297ebc48568f657a82161
MATLAB
584
42
function [branch, hash] = tapas_get_tapas_revision(verbose) %% % % Input % % Output % % % aponteeduardo@gmail.com % copyright (C) 2017 % n = 0; n = n + 1; if nargin < n verbose = 1; end % Get current location f = mfilename('fullpath'); [tdir, ~, ~] = fileparts(f); tdir = fullfile(tdir, '..'); try [branch...
0a3199b0c5581ca8dfdf1da5619b100a7dd7e2d513542d958f7ab058647839b0
MATLAB
585
28
function [inference] = tapas_sem_hier_prepare_inference(data, model, inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % nc = size(model.graph{2}.htheta.T, 1); ns = numel(data); np = numel(model.graph{4}.htheta.y.mu); %k = cell(ns, nc); k = eye(np); % Create a kernel...
3a18f7675b91ca1a9c6f9dda49172395cb608736e8f9e7fab954996f30befbdb
MATLAB
585
19
function [m,dm] = meanConst(hyp, x) % Constant mean function. The mean function is parameterized as: % % m(x) = c % % The hyperparameter is: % % hyp = [ c ] % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2016-04-15. % % See also meanFunctions.m. if nargin<2, m = '1'; return; end % report ...
6f6f0f633d653c6b8a6b7c6a8b7a3159cd7d4356e8ed8b2704a863cf2a53c8d1
MATLAB
585
22
function indic = meta_fast_sphere_conv(xyzlist,xyzvox,r) % indic = meta_fast_sphere_conv(xyzlist,xyzvox,r) % % convolution with a spherical filter % output in indicator vector (vox x 1) for speed % xyzlist is a list of voxel coords of in-mask voxels % xyzvox is list of voxel coords for study (see meta_get_voxel_coords)...
c2cfb848af95f922774a01e46feffe1dade0d9549438db5ac4a7119143e815bb
MATLAB
585
27
%close all %clear all path(path,'.\FUZZCLUST') %loading the data set data.X = Z(:,[1 2]); %parameters param.c=3; %Numero de estados param.m=2; param.e=1e-4; param.vis=0; param.val=3; %normalization data=clust_normalize(data,'range'); result = FCMclust(data,param); param.c=result.data.f; %initializing with the resul...
c538d8308931a79f518323aa83ff598716528ac74ad7130b8f3b1bd49147aff8
MATLAB
585
15
function coordinates = ID2coordinates(ID, numRows, numCols) %Converts the sensor ID representation to its coordinate representation on %the CMOS chip ID = ID - 1; x = floor(ID/numRows)+1; y = mod(ID,numRows)+1; %x = floor(ID/numRows)+1; %y = mod(ID,(floor(ID/numRows)*numRows)); %coordina...
242a6ad00c46b18be3e19f07d02f0688c3add0298588a6f8088e34729aab9a53
MATLAB
586
26
%% 400 EXAMPLES OF ASSEMBLY CONFIGURATIONS WITH 0 ASSEMBLIES IN A HONEYCOMB STRUCTURED TECTUM % THERE ARE 40 CONFIGURATIONS WHICH ARE EMBEDDED IN TECTA OF INCREASING % DEGREE v = 8 , ... 17 % % THE ASSEMBLY CONFIGURATION IS LEFT EMPTY AS NULL-CONTROL % % % === Jan Moelter, The University of Queensland, 2017 ========...
54acb8e9f1baa03a101eb154371fb22b03942a2b11cd6c9fed8846ec40756d11
MATLAB
586
49
function p = Rrank(R,tol) % % [err,] = Rrank.m () % %Purpose: % % % %Input Parameters: % % % %Output Parameters: % err : 0 No Problem % : 1 Problems % % % %Key Terms: % %More Info : % % % % % Author : Gang Chen % Date : Tue Mar 23 16:31:43 EST 2004 % SSCC/NIMH/ National Institutes of Health, Beth...
c7e3390609673385f5420ab2e86502e589b9c16ebd355581ebd7c72467952234
MATLAB
586
23
clc; ROOT = input( 'ROOT = ' , 's' ); items = dir( [ ROOT ] ); items = transpose( items ); items = items( [ items.isdir ] & [ ~strcmp( { items.name } , '.' ) ] & [ ~strcmp( { items.name } , '..' ) ] ); items = items( shuffle_vector( 1:numel( items ) ) ); for I = items if( exist( [ ROOT '/' I.name '/' I.n...
1c6af49b410d7078b3e4ae4f3e02cd79066a7eec40a93e07c181d75b3dfed1f4
MATLAB
587
21
% works after the run, to get a histogram of Ho values % hard coded to work on i_density_rad15_step2.mat load i_density_rad15_step2.mat v = 4*pi*radius^3 / 3; tmp = maxd.*v; figure;hist(tmp,unique(tmp)) p = prctile(tmp,95); tmp2 = tmp(tmp >= p); hold on; h = hist(tmp2,unique(tmp2)); bar(unique(tmp2),h,'r') for i = p...
b59663c69af2197c2180e6aa39c463db6278477880a2574cdb8f52e1c0ecbd2b
MATLAB
587
18
function [rez] = merge_cluster(rez,cluster1,cluster2) id = find(rez.st(:,end)==cluster2); rez.st(id,end) = cluster1; rez.Merge_cluster(cluster2,:) = []; M_clust = length(unique(rez.st(:,end))); for i=1:M_clust spike_id = find(rez.st(:,end)==i); rez.Merge_cluster{i,1} = unique(rez.st(spike_id,3)); rez.Merg...
de99d5ce519fda65e983893bc8218d1a830158b4748beca71e8865ee478b0ac3
MATLAB
587
33
function R = qGetR( Qrotation ) % qGetR: get a 3x3 rotation matrix % R = qGetR( Qrotation ) % IN: % Qrotation - quaternion describing rotation % % OUT: % R - rotation matrix % % VERSION: 03.03.2012 w = Qrotation( 1 ); x = Qrotation( 2 ); y = Qrotation( 3 ); z = Qrotation( 4 ); Rxx = 1 - 2*(y^2 + z^2)...
ed2c1461cadc39eaf91f8b7a94479c2f0e5884376d9ab310467764071b75173b
MATLAB
587
19
function Vol = spm_write_vol_gz(Hdr, data) % FUNCTION Vol = spm_write_vol_gz(Hdr, data) % % A wrapper around spm_write_vol that writes and zips .nii files [fpath, ~, Ext] = myfileparts(Hdr.fname); Hdr = rmfield(Hdr, 'pinfo'); [~,~] = mkdir(fpath); switch Ext case '.nii.gz' Hdr.fname =...
3574e6d7af4a6c7ef639c47120b8b53743475ddd77ad7ac3fe1ef6e2a0e8fa85
MATLAB
588
13
function def_circle_size = brain3D_getCircleSize(chnls_MNI_VAL, chVals_lims, circleSizeLims) % for example, assume circleSizeLims = [5, 30] % (c) Jiri, Sep22 %% (1) linearly scale to chVals_lims from [-30 to 30] def_circle_size = linTransform(chnls_MNI_VAL(:,4), chVals_lims, [-circleSizeLims(2), circleSizeLims(2)]); ...
636c9d042a5a6158d33d7e06906e8d006c9a371e4f4da4e7f56e94210b2b33bc
MATLAB
588
22
function [nms, contrastcounts] = meta_explore_field(DB, fieldname) % [nms, contrastcounts] = meta_explore_field(DB, fieldname) % % Print a table of the peak and contrast counts for unique values of a % field. % % e.g., [nms, contrastcounts] = meta_explore_field(DB, 'Valence') labels = DB.(fieldname); nms = unique(DB....
80c0a0903a54250f62591bd3c909723894fed563e16d7ce343f7314df72019b0
MATLAB
588
16
%Compute the matrix representation of the cross product %function [V,vShift] = essential_hat3(v) %V is a [3x3xN] array of skew-symmetric matrices where each [3x3] block is %the matrix representation of the cross product of one of the columns of v %vShift is equal to permute(v,[1 3 2]). function [V, vShift] = essential_...
e9df2c16c1579b0a78817e24ecd8097e7e2a99838378bd9b3868f71495f4e845
MATLAB
588
18
function candoit = canGetDirectionalDerivative(problem) % Checks whether dir. derivatives can be computed for a problem structure. % % function candoit = canGetDirectionalDerivative(problem) % % Returns true if the directional derivatives of the cost function can be % computed given the problem description, false othe...
22219a481acd24b3518c564d950f336dedf021519016ed1d2be47b13a304bd30
MATLAB
589
22
function [S] = rm_emptyField(S) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % rm_emptyField removes empty field in a given structure. % % Argument: % S = Structure in which empty field will be removed. % % Output: % S = Structure with no empty fields. % % Example: % [S] = rm_...
8d9b180b4286a66d1f4f255ccc203d97049a7567f19229e1b72d19a70c8c5a3f
MATLAB
589
17
function obj = elbo_obs(obj) N = numel(obj.data); % Number of observations D = prod(obj.lat); % Dimension of observed space logL = obj.dot.logdet(); % Log-determinant of known precision if ~isfinite(logL), logL = 0; end obj.lbX = - N * D * log(2*pi) ... + N * logL ......
e49f6975bb0c9baaa787bc0d9b36c43b5dc886499c4adb0b025228e636078535
MATLAB
590
27
function [sstate, si] = tapas_vlinear_get_stored_state(data, model, ... inference, state) %% Get the state that should be stored % % aponteeduardo@gmail.com % copyright (C) 2016 % sstate = struct('graph', {cell(4, 1)}, 'llh', {cell(4, 1)}, 'v', []); sstate.graph{2} = state.graph{2}.y; sstate.graph{3} = state.gra...
abc6cea06e5ded3a7ae9650f0a344b8c3aed08d9dd5215c6f79775680f307cb0
MATLAB
591
29
function [] = tapas_display_table(summaries, figname) %% Display a figure with the summaries. % % Input % summaries -- Table with the summaries. % figname -- Optional. String with the name for the figure. % % Output % % aponteeduardo@gmail.com % copyright (C) 2019 % n = 1; n = n + 1; if nar...
00568a1f0895c71242d0d59216a9cab1db348c07742adb407fa93e070a114b9d
MATLAB
592
23
function out = exponUtilityFunction(beta,x) % function exponUtilityFunction(beta,x) % From Smith & Krajbich JEP Gen 2018 lambda = beta(1); try b = beta(2); catch b = 0; end % x is the difference in objective value between the 2 options to choose % from % Lambda is the steepness of the curve % This function is actual...
8a826ec706eaca089216f86885b1593fab201aea91ed65d72dddea08a46340a0
MATLAB
592
35
%Dinamica de Poblaciones LC function [Din_Pob]=DinamicP(S_Ras_active) path(path,'.\AXIS') DPb=S_Ras_active>0; %Hace 1's todos los valores mayores a cero DPb=DPb*1; %DPb=transpose(DPb); %Las células son lo importante DPc=sum(DPb); figure plot(DPc); DPb_Ren=SRasRen(DPb); %Solo tomo los picos diferentes DPb=DPb_Ren;...
ec31794c89d7efc52e50e48643aa446cdb2bda8090044aac9ee6ead95fd5aff1
MATLAB
592
28
function [S,T,map,binaryMap]=getCellSTfilters(output) % output the spatial and temporal filters of cleaned-up extract output temp=full(output.spatial_weights); temp=temp(:,:,output.cellID); S=temp; T=double(output.temporal_weights(:,output.cellID)); nUnits=min(size(T)); for i=1:nUnits tempS(:,:,i)=rescale(S(:,:,i),0...
3712de868fa8d93deb9ed94c2fd4686e7bb9aff94aeb014c5ba56d911ef3a333
MATLAB
593
16
function imdb = cnn_imagenet_sync_labels(imdb, net) % CNN_IMAGENET_SYNC_LABELS Match CNN and database labels % A CNN NET and the image database IMDB may use a different label ordering. % This function matches classes by name and reorder the labels % in IMDB to match NET. [~,perm] = ismember(imdb.classes.name...
524f0e85d67e22db382794b3df5b9717cbcc0b442daf7d5fd0f708c82aa3e3ed
MATLAB
593
29
function [loF, hiF, n] = getBandWidthFilter(F) % look-up table. Based on carrier frequency F [Hz], returns freq. band boundaries % and order n for butterworth filter % (c) Jiri, Jul12 assert(F >= 0); if F < 1.5 loF = 2/3*F; hiF = 4/3*F; n = 2; elseif F >=1.5 && F < 7 % 2 Hz bin loF = F-1; hiF ...
614112d0666a4a5c45ceac1f0031464adb037590e8f9e946ac4d22a334c84f51
MATLAB
593
14
function pstruct = tapas_condhalluc_obs3_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence...
c45f66304e69615371daa974f1c057321c9315e80173f9f7128483dc005a53a5
MATLAB
593
19
function inds = cVals2cInds(vals, clims, mapInds) % enables multiple colormaps in 1 figure % lin. scales 'vals' to 'clims' (values out of range in clims are mapped to their boundaries) % lin. scales this result to mapInds % returns indices of the colormap % (c) Jiri, Feb12, Jan17 assert(clims(1) <= clims(2)); assert(...
cfff82e93622bd821a903a7eaf32d3ed8d53bb000f4c250a7ce4d628e616ba53
MATLAB
593
13
%{ # visual stimulus trial buffer control twop_setup : varchar(256) # two photon setup name, e.g. 2P1 setup : varchar(256) # Setup name of behavior/stim computer, e.g. at-stim01 --- cmd : smallint # =0 ...
d06ff7d26a01025da6394723c66bb2207d33700990d96b457c13837f17121f04
MATLAB
593
31
function r = mtimes(p,q) %TIMES this function multiplies the x, y, and z values of the structures that I use in % the FVtool. % reassign the scalar to new variable a and the struct to new variable b % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekh...
eb1065aa54288075a519589965e4cee18f1af82e7af6205dfef7b8e00357662a
MATLAB
593
14
function pstruct = tapas_softmax_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-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 % Licence (G...
ab59b3c9627ea623402df3b9f9ee96b28a8366a425499f6d3fadbf6e4f17c4b8
MATLAB
594
38
fname = '/home/ckirst/test_iDISCO_<Z,3>.tif'; dat = syntheticConfocalData(); dat = 5 * dat; max(dat(:)) bd = 3; dat(1:bd, :, :) = 0; dat(end-bd:end, :, : ) = 0; dat(:, 1:bd, :) = 0; dat(:, end-bd:end, :) = 0; dat(:, :, 1:bd) = 0; dat(:, :, end-bd:end) = 0; max(dat(:)) isize = size(dat); g = 5 * [0.05, 0.01, 0...
e8a48f71a01c6067161bee73ebfdc2bc2dbccecb5652c3ea8d30a5e443962259
MATLAB
594
26
function [ibin] = circ_bini(x,nbin,pbin) if nargin < 3 pbin = 1/nbin; end if nargin < 2 error('Missing input arguments!'); end if ~isvector(x) error('Wrong input size!'); end quantbeg = mod(linspace(0-pbin/2,1-1/nbin-pbin/2,nbin),1); quantend = mod(quantbeg+pbin,1); xbinbeg = quantile(x(:),quantbeg); ...
f7be7f15684ff00ae64a8b97e1293cba09832bd9260054d7811d0b97679d3b8b
MATLAB
594
27
function [f,csddm,mcorre]=crsd(x,Fs,w,ov) %w:windows (ms) %ov:overlap (%) %x:signal n %Fs=sampling frequency %Xcorr:maximum of the cross-correlation w=w/1000; nw=w*Fs; npf=1+floor((length(x)-nw)/((1-ov/100)*nw)); m=length(x(:,1)); % number of signals ji=1; jf=nw; x=x-mean(x')'; for i=1:npf npf-i Xcorr=xcorr(x(...
874584c06fe8b5144618f95b7d15edb00d203f32102c189a863888fcd640840a
MATLAB
595
20
function keyCode = waitforkey(params, whichkey) % WAITFORKEY - this functions waits for a key press of a specific key indicated by the % keynumber in whichkey % Code: F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 if params.keyboard == 0 % wait for response box key clearserialbytes(para...
034bc8775095636de24dee70aad7b9c975f0eff719f473d87cd3b6df360be42e
MATLAB
596
14
function pstruct = tapas_unitsq_sgm_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-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 % Licence...
3e69955482f37281bd79b12ed558dee6ceaaa89a8062444a28ee8648e6ebf5de
MATLAB
596
45
function [pars] = tapas_sem_multivar_pars(data, model, pars) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % if ~isfield(pars, 'T') pars.T = ones(size(data, 1), 1) * linspace(0.1, 1, 8)' .^ 5; end if ~isfield(pars, 'ndiag') pars.ndiag = 1000; end if ~isfield(pars, '...
612a1a71f3b9f5bfd3e6f5c012e0ecc026a549eaadcc45b09a4d7854d4d39a6e
MATLAB
596
15
%% p = sepiatest.sepia_home() % % Description: returns the absolute path of the SEPIA repository root % (the directory containing sepia.m/sepiaIO.m), derived from this file's % own location (test/+sepiatest/sepia_home.m is two levels below repo % root) rather than assuming any particular current directory. % function p...
88264b3962a3ab58276230236e936ddbb789d5b6ecd6aecbacc462c6914c7ad7
MATLAB
596
21
function varargout = covLINiso(varargin) % Wrapper for Linear covariance function covLin.m. % % Linear covariance function with Automatic Relevance Determination (ARD). The % covariance function is parameterized as: % % k(x,z) = x'*inv(P)*z % % where the P matrix is ell^2 times the unit matrix. The hyperparameters are...
b45c4664eebdff685c66b8dade2cd5d503b2e34f50ba35c7a862842f5dbd2d2e
MATLAB
596
14
function pstruct = tapas_condhalluc_obs_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence ...
c6aeb4ce2d0bcea7baf502a68411217cec11bec5d2fd325f230eff98da8a19d6
MATLAB
596
16
function [event_onset_frames,event_offset_frames] = match_eventonset_offset(event_onset_frames,event_offset_frames) fds = fields(event_onset_frames); for f = 1:numel(fds) fd = fds{f}; if ~isempty(event_offset_frames.(fd)) this_onsets = event_onset_frames.(fd); this_offsets = event_offset_f...
c8b2b9f69f20441885b430a12d7c175a308007cf3a29f45426ecd5f2e5902403
MATLAB
596
14
function pstruct = tapas_beta_obs_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-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 % Licence (...
e753d1599ec130264c1fd858704b5e0de9c95178b3ca1ca74fd3e698c67cdf86
MATLAB
596
19
function ARTwarp_Assess_Net [filename path] = uigetfile('*.mat'); eval (['cd ' path]); eval(['load ' filename]); spp = ['Locu'; 'Lole'; 'Lopy'; 'Losc'] error = 0; for category = 1:NET.numCategories tally = [0 0 0 0]; i = find([DATA.category] == category); names = reshape([DATA(i).name], 21, length(i))'; ...
05110a2bab551275210dcf1cc5dfc7b79b48a7863185c6265403c39c7762b6bc
MATLAB
598
27
%========================================================= % %This is a prog in the MutualInfo 0.9 package written by % Hanchuan Peng. % %Disclaimer: The author of program is Hanchuan Peng % at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>. % %The CopyRight is reserved by the author. % %Last modification: April...
0dade6ac0aeceff1b96a646f4c5fa4bd329c39f61acec1462aec53e8371822e7
MATLAB
598
24
function [r_new_u,r_new_v]=RotateCoordinateSystem(up,vp,nf) %{Summary: RotateCoordinateSystem performs the rotation of the vectors up and vp %to the plane defined by nf %INPUT: %up,vp- vectors to be rotated (vertex coordinate system) %nf - face normal %OUTPUT: %r_new_u,r_new_v - rotated coordinate system %} r_...
4fd94deddd92cb9d2fbc1d3890efc1df744a1d7dcdca3fc34ca6758d09b3d5ab
MATLAB
598
26
function S = pad_strn (strg,padchar,n,loc) % S = PAD_STRN (strg,padchar,n,loc) %This function pad the string 'strg' with 'padchar' characters % such that 'S' is 'n' characters long. % if loc = 1 the 'padchar' are added to the left of 'strg' % if loc = -1 the 'padchar' are added to the right of 'strg' if (~ischar(str...
a06308b5adae2d382e55bd98182def087aba601984c6c68af56e18cb60f19bec
MATLAB
598
13
function [pvec, pstruct] = tapas_softmax_mu3_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public...
1723c699088717710c0cee3dce5fa29b915061eaccef92700c3989cb54fc1eb2
MATLAB
599
26
function h = plot_edges(edges, vertex, color) % plot_edges - plot a list of edges % % h = plot_edges(edges, vertex, color); % % Copyright (c) 2004 Gabriel PeyrŽ if nargin<3 str = 'b'; end if size(vertex,1)>size(vertex,2) vertex = vertex'; end x = [ vertex(1,edges(1,:)); vertex(1,edges(2,:)) ]; y = [ ver...
f210789aa5d8e45bb469d944858f1e3e3d7bad855bf7ca4fd8088c18e0b5b87e
MATLAB
599
14
function pstruct = tapas_gaussian_obs_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-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 % Licen...
06829dc6df99bd49978abec70facd708f5f00fbf82fa31507a841144026313be
MATLAB
600
19
function val = isricohmegfile(filename) %% The extentions, .con, .ave, and .mrk are common between Ricoh and Yokogawa systems. %% isricohmegfile idetifies whether the file is generated from Ricoh system or not. %% This function uses a function in YOKOGAWA_MEG_READER toolbox, getYkgwHdrSystem. if ft_hastoolbox('yokoga...
7f6603334fbe958ec5bf80aa775e26f42eba85724decaa561481797a1f7c2128
MATLAB
600
10
function [indmin mdall notenough]=multicenter_multimodelnlm_global(Age_gender,Brainsz,data_r,ylabelname,Plotornot,indall_select,betarealinitial,Site_info) for i=1:size(indall_select,2); Age_gender_new=Age_gender(indall_select(:,i),:); Brainsz_new=Brainsz(indall_select(:,i)); data_r_new=data_r(indall_select(:,i)); ...
ffedbc079e5401b999ed533718c8ef5763ca6c7a5c9141a825cfc1fac84b5f80
MATLAB
600
14
function pstruct = tapas_softmax_binary_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-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 % Lic...
55a473ea979e5f31bded540c32a24d5f5cf5666d0451215cb3fb00b358b660b1
MATLAB
602
18
function s = struct(this) % Struct method for GIfTI objects % FORMAT s = struct(this) % this - GIfTI object % s - a structure containing public fields of the object %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillau...
c7a6b33a617c9f18e7ed75db12e81c7e78ca21949cfcba8914e570f3d144cad5
MATLAB
602
21
function val = essential_costE2cost(X, costE) % Cost evaluation at X given function handle in the Essential matrix E. % % function val = essential_costE2cost(X, costE) % % costE is the function handle for the cost function in E. % % See also: essential_egradE2egrad essential_ehessE2ehess % This file is part of Manopt:...
dc0f69829761fc066ea45b9a035fc30438e86ead2536c68df8c4256d208600ae
MATLAB
602
29
function [ms, amp] = get_avgLatency(data, type, tf) % Get latency (ms) to first peak/trough after event onset % % INPUTS % data: 1 x 7229 event-aligned photometry data % type (string): 'peak'/'max' or 'trough'/'min' % tf: time window in seconds to find peak/trough. E.g., 0.5 % Default is 0.5s T = linspace(-5, 10, 722...
f96382eef756f4ac0465b6bf1d1f245609bf4264af795790d0985223714adb6a
MATLAB
604
18
function ViewClusters_Callback(hObject, eventdata, handles) [ClusteringData,clustAssign] = CreateClusteringData(handles, 'forClustering', false); [~, clusterName, rejected, finished, clustAssign] = clusteringGUI(clustAssign, ClusteringData); % Save the clusters if finished == 1 saveChoice = questdlg('Update file...
3b7113a879d85864ee135193e76dfc699ae44e79ec29b594beeb386a9d741dd3
MATLAB
605
13
function [pvec, pstruct] = tapas_unitsq_sgm_mu3_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Genera...
3d29168c1eba86bf1f605ee9eb5c48f4d407bcdb53b66dae38d6b486f0b14664
MATLAB
605
19
function df = estFirstDerivative(f, h) % estimate 1st derivative (velocity) using: centered difference formulas for five-point stencils % see wikipedia % (c) Jiri, Mar11 df = nan(size(f)); df(1,:) = (f(2,:) - f(1,:))./h; df(2,:) = (f(3,:) - f(2,:))./h; %c = repmat([-1, 8, -8, 1]', 1, size(f,2)); % BUG (found 21...
b0504f703b37721f5f59c44e52fe95f539dea1bae58a058eb302fa0360b61a1d
MATLAB
605
20
function [rand_nums] = randi_with_int(N,nmax,delta) % N = 10; % number of integers required % delta = 2; % minimum difference required % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2...
e20843411bfd2afd6c6c78a8c4902a5c87d1591ac0c26b70a93be424ea4c3131
MATLAB
605
14
function control_max_eig = circular_shift(SpikeCount,number_of_surrogates) control_max_eig=zeros(1,number_of_surrogates); for surr_idx = 1:number_of_surrogates ControlSpikeCount=zeros(size(SpikeCount)); for neuron_idx = 1:size(SpikeCount,1) drawnbin = randi(length(SpikeCount),1); auxbin = [draw...
fede9e48bfe87966fbf39393afd7eab89c5c93955c4c27366d909e225575f0dc
MATLAB
605
23
function tr = multitrace(A) % Computes the traces of the 2D slices in a 3D matrix. % % function tr = multitrace(A) % % For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector % tr of length N such that tr(k) = trace(A(:, :, k)); % % See also: multiprod multitransp multiscale % This file is part of M...
fadff5bbfebd8629d082ae8f5cf7321b72680334c58e03ba256ae1030bf738a7
MATLAB
606
24
function [converted, standard] = convertreward(rewardvector) % Converts all reward volumes to nominal values converted = rewardvector; converted(converted==4) = 1; converted(converted==5) = 1; converted(converted==8) = 2; converted(converted==10) = 2; converted(converted==16) = 3; converted(converted==20) = 3; conve...
abe97301d2b1c35b357d8617ba3d8913501f402f7975567738c60ca02d58f90b
MATLAB
607
23
function [ output_args ] = bestmatch( d , C1 , C2 ) %BESTMATCH( d , C1 , C2 ) Returns the BestMatch index between two %clusterings C1 and C2 for given set distance d. % % INPUT: % d [function handle]: two-argument distance function % C1 [1x? cell]: clustering % C2 [1x? cell]: clustering % % % === Jan Moelter,...