sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dd07f59baa9bc920edc7d87928de40af96dfea0187e493e82f7c99c4bdd79ac4
MATLAB
607
19
function myelin = OLIGO_APOPTOSIS(myelin, threshold_apop, threshold_stopmy) reshaped_myelin = reshape(myelin.state, myelin.oligo_dim^2, myelin.oligo_counter); indicate_destroyed_myelin = reshaped_myelin == 0; total_damage_to_oligo = sum(indicate_destroyed_myelin); index1 = find(total_damage_to_oligo >= threshold_st...
f48281006649f45f553fe490ffafc0219ed1f996400a996f0ce6434fce1cd7e8
MATLAB
607
23
%{ aodpre.Trace (imported) # imported calcium traces -> aodpre.ComputeTraces -> aodpre.ScanPoint ----- trace : longblob # traces %} classdef Trace < dj.Relvar methods function plot(self) for key = fetch(aodpre.Scan & self)' figure duration = fetch1(aodpre.Scan...
538012f82c0ba6e7ec0290cd818c92d2dc4df07308e3250fa18e2b9edc1423dd
MATLAB
608
35
function [Sd] = zdeblankall (S) % % [Sd] = zdeblankall (s) % %Purpose: % removes all blanks in a word in S % blanks are characters that return true % for the function isspace. % This includes space, tab, new line etc. % %Input Parameters: % S : a string % % %Output Parameters: % Sd : S without any blanks %...
62b67af4584bed9496478c23ab63ed8fffae5e71d8be981c55e988ee543b6f5d
MATLAB
608
19
function [ratnum ses tetrode unit] = cellid2vals(cellid) %CELLID2VALS Convert cell IDs to numbers. % [R S T U] = CELLID2VALS(CELLID) converts cell ID to 4 numbers: serial % position for the rat (R), date number in yymmdd format (S), tetrode (T) % and unit (U) number. % % See also CELLID2TAGS. % Edit log: ...
bdd4671e5fa851e23ac11020e43cb4ce1e325591fa68fc62c097462ccf4f6ef4
MATLAB
608
19
function [indices,values] = findmax(data,k) %findmax - find local maximum with a window length of k, if k<2, it %calculates global maximum % % % (C) 2016-2025 by Ralitsa Todorova % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as publish...
00d76959cda1db48fb6150a19ff96876fb043c5e725a9e76dcb8f9f150bdd717
MATLAB
609
34
function [ output_args ] = hexagonal_tiling( v ) %HEXAGONAL_TILING( v ) Returns a hexagonal tiling of degree v % % % === Jan Moelter, The University of Queensland, 2017 =================== % %z = @( N ) ceil( 0.5 * ( sqrt(4 * N - 1) / sqrt(3) - 1 ) ); narginchk(1,1); rot = @( a ) [ cos(a) , -sin(a) ; sin(a) , cos(...
c72dda533b6d0892ce34cef8d740ee8371c2c59671d66fffeab2ff16047e214a
MATLAB
609
24
function tapas_BLT_runCue(params,iTrial) % tapas_BLT_runCue shows the Cue Stimulus % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 % Show Cue if params.cue(iTrial) == 1 Screen('DrawTexture', params.screen.window, params.text.imgcue1, [], [], 0); elseif params.cue(iTr...
d25cf08c3f355fcd7ad1d79407117dc5d23877419f287f760bf67747d287871d
MATLAB
609
31
function [ptheta] = tapas_sem_seria_gaussian_priors() %% Generates standard priors for a gaussian distribution. % % Input % ptheta -- Structure with the priors. % % aponteeduardo@gmail.com % copyright (C) 2016 % ptheta = struct(); [mmu, mvu, vmu, vvu, me, ve, ml, vl, p0m, p0v] = ... tapas_sem_unified_ga...
e48a0dfa6241e8ab7516f91c1a4b70f32e6fabe67913b5a9c6cd059b31a00669
MATLAB
609
23
function y = polynomial_step_function(x, fc, tc, dta, a) %% this script is a ChatGPT translation of Ryan Greenhalgh's pyforce's equivalent polynomial_step_function within functions.py %POLYNOMIAL_STEP_FUNCTION Piecewise function: % % if x < tc: % y = 0 % elseif tc <= x < tc + dta: % y = fc * ((x - tc)/dta...
7f4744b9db5671267c12b618ca7a7cdf11470f98633a036388ca755a019d5a6c
MATLAB
610
26
function vec=map2vec(map,mask) % USAGE % vec=map2vec(map,mask) % % FUNCTION % to convert a spatial map of dimensions of array mask into space % column vector vec. mask is a logical array whose true values will % correspond to vec in number and order. % %__________________________________________...
acc997014e64341b427073034a69717d63f1b7c9583a19fb7f15d3fcdff13b4e
MATLAB
610
13
function contrastiveLoss = FD_contrastiveLossFunc(encoderNet, x1, x2, y, margin) % x1 und x2 are the data pairs, y is the label, (0 for same class, 1 for different classes) z1 = FD_clVAE_sampling(encoderNet, x1); z2 = FD_clVAE_sampling(encoderNet, x2); % Euclidean distance between the latent r...
7d995bb821fcddfe0d0c094f00b97de3503e5784e6d87395da5ac9eb14a00fad
MATLAB
611
17
% (C) Copyright 2020 CPP visual motion localizer developpers function [CONDITION1_DIRECTIONS, CONDITION2_DIRECTIONS] = getDirectionBaseVectors(cfg) % CONSTANTS % Set directions for static and motion condition CONDITION1_DIRECTIONS = cfg.design.motionDirections; CONDITION2_DIRECTIONS = repmat(-1, size...
d379cd676b0ac35ff5e927f4a4f25e1283c04f08ddf19e325374b5693dba7d8f
MATLAB
613
18
% (C) Copyright 2020 CPP visual motion localizer developpers function [CONDITION1_DIRECTIONS, CONDITION2_DIRECTIONS] = getDirectionBaseVectors(cfg) % CONSTANTS % Set directions for static and motion condition CONDITION1_DIRECTIONS = cfg.design.motionDirectionsHorizontal; CONDITION2_DIRECTIONS = cfg.d...
daf4f9f49c7851a2f0d9d3e328b86c4a0719896628d1134647c70075ae570999
MATLAB
613
18
function Wm = gram_lyaplov(A,B,T) % Calculate gram matrix by Lyaplov equation (controllable system) % % Solve Lyaplov equation: AW + WA^T +BB^T = 0 % % Inputs: A, N-by-N matrix, system matrix % B, N-by-M matrix, control matrix with M control nodes % T, Constant, control...
86a450c00ac64f6eef55d08684662a66dec224a1de41a365ac81cfe2a00a12b9
MATLAB
614
18
function display(tpl) %TEMPLATE Display a template object in Matlab window % DISPLAY(TPL) displays informations about the content of template % object TPL: % Template Object: root '.', 2 files, 9 keys, comment unknowns. % root element of template files, number of template files, number of % keywords defined a...
d5339f0264850be47ce1a9bddca696e8b45d07df3478be44cae1b7a7186e09e4
MATLAB
614
21
function [old_dirs,old_stps,Hdiag] = lbfgsUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) ys = y'*s; if ys > 1e-10 numCorrections = size(old_dirs,2); if numCorrections < corrections % Full Update old_dirs(:,numCorrections+1) = s; old_stps(:,numCorrections+1) = y; else ...
f3e0c2684c67235609ea94351f46f9a25a13e3661fa71ab132d33620611f43ad
MATLAB
614
26
%% name = getFilenameWithoutExtension(filepath) % % Input % -------------- % filepath : file path (.nii or .nii.gz) % % Output % -------------- % name : filename without any extension % % Description: get fielname without extension % % Kwok-shing Chan @ MGH % kchan2@mgh.harvard.edu % Date created: 14 Ju...
4620e8092dd88fe32b13b2b4e94a52ac8249b2a24d14b73a26b9fc1a8769b209
MATLAB
615
30
function [ptheta] = tapas_sem_prosa_gaussian_priors() %% Generates standard priors for a gaussian distribution. % % Input % ptheta -- Structure with the priors. % % aponteeduardo@gmail.com % copyright (C) 2016 % DIM_THETA = tapas_sem_prosa_ndims(); ptheta = struct(); [mmu, mvu, vmu, vvu, me, ve, ml, vl, p0...
bda5955d046c44f1b952411617259672e3d1887aee5383f8444e9ee3c81b08bc
MATLAB
616
23
function newMatrix = resampleMatrix(ogMatrix, ogFs, newFs) %RESAMPLEMATRIX Resample matrix given original and new sampling rate % INPUT % ----------- % ogMatrix : (numTimePoints, numVariables) % Reference: % https://uk.mathworks.com/help/signal/ug/resampling-uniformly-sampled-signals.html [p, q] = rat(newFs / ogFs); ...
0be0ef5e27c553265975d90ca45a58feb34c9b8badd22fc463ca8b2d42dc0426
MATLAB
617
14
%% this simple script loads in a world coordinates calibration file % and saves into structures used by DANNCE. % % Use: navigate to folder containing a calibration file in Jesse format, then run this script. load('worldcoordinates_lframe.mat') for camerause = 1:6 RDistort = params_individual{camerause}.RadialDis...
226d6a0d36438bd2105675af2366fca63ed0d763bbaa8d1447669819ed8c8169
MATLAB
617
24
function [normalized_data, spike_trains] = preprocess(data, window_size) % Sliding window normalization normalized_data = zeros(size(data)); for i = window_size:length(data) mu = mean(data(i-window_size+1:i)); sigma = std(data(i-window_size+1:i)) + 1e-6; normalized_data(i) = (data(i)-mu)/sigma; end % GRF...
848f6055bb6df65ed3c82076af5a8c75a266cab00755fe895fef63d40ec11b5a
MATLAB
618
17
% EMPRISE: project directories % _ % Joram Soch, MPI Leipzig <soch@cbs.mpg.de> % 2023-05-17, 10:33: first version % 2023-05-25, 11:11: renamed "work_dir" to "prep_dir" % 2023-07-04, 14:43: adapted tools directory % create project directories stud_dir = 'C:\Joram\projects\MPI\EMPRISE\'; data_dir = strcat(stud_dir,'dat...
dcffa4188c6934a790ac67e0ff4d1ed22751ad44b1fb8277a3d4e50af99150dc
MATLAB
618
31
function x = pythag(y,z) %PYTHAG Computes sqrt( y^2 + z^2 ). % % x = pythag(y,z) % % Returns sqrt(y^2 + z^2) but is careful to scale to avoid overflow. % Christian H. Bischof, Argonne National Laboratory, 03/31/89. [m n] = size(y); if m>1 | n>1 y = y(:); z=z(:); rmax = max(abs([y';z']))'; id=find(rmax==0); if...
0bea444b7e3592784c13f39221e3868345828dbe714b6412cd3c88e0aefceda2
MATLAB
619
8
SPM_PATH='/home/data/eccolab/Code/GitHub/spm12'; CANLABTOOLS_PATH='/home/data/eccolab/Code/GitHub/CanlabCore'; CANLABMASKS_PATH='/home/data/eccolab/Code/GitHub/Neuroimaging_Pattern_Masks'; BRAINSTEMNAV_PATH='/home/data/shared/BrainstemNavigator/0.9/2a.BrainstemNucleiAtlas_MNI/labels_thresholded_binary_0.35'; % gbvs has...
1378a5df98ccbfdf5b78c7a3c557c04ec7d80de9671547cd329945706415f57b
MATLAB
619
30
function plotmed_all(Tmed, outDir, varargin) if nargin < 2 || isempty(outDir) outDir = 'plots'; end outDir = char(outDir); if ~exist(outDir, 'dir') mkdir(outDir); end n = height(Tmed); for i = 1:n row = Tmed(i,:); plotmed(row, varargin{:}); if all(ismember({'Epoch','Eigen'}, ...
33d2025a8a36ff6c12e0c24e5656720c64bb50a1d9e4b56c8a8d807e42058c88
MATLAB
619
15
function pstruct = tapas_condhalluc_obs2_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...
777a91b6aab6c4bb287abad45974b02f67068cb4c1fa8c437f3c78d620d6336e
MATLAB
619
32
function [t, tr, b, w] = sero_srr_sampling_conventional_slice_shift(ts, n, a, z, do_interleaved) if nargin < 1 [ts, n, z, a] = sero_srr_default_image_pars(); [t, tr, b, w] = sero_srr_sampling_conventional_slice_shift(ts, n, a, z, 1); clf sero_srr_plot_sampling_stats_v2(tr, b, w) return en...
cc6e0905711bb411a0aadb98164c23b77ce0d1afed42478d8115facc36c37fb9
MATLAB
620
28
function arr = map2arr(map,roi) %Author: Eve LoCastro, Weill Cornell Medical College, Department of Radiology, IDEAL Imaging Lab, November 2011 %assume map is a 3d map in LXMxNxT form if 4d timeseries with T timepoints, %arr will be Tx(L*M*N) form dim = size(map); % if length(dim) < 4 % idxlen = dim(1)*dim(...
166f94081221d125de999ecefa92910eac8a77dccd7a3a9aa07ca49873f7e516
MATLAB
622
16
%Evaluate cost function for closest representative search given coefficients %function ft=essential_distMinAnglePair_ft(t,m1,p1,c1,m2,p2,c2) %Evaluates the cost function used by essential_distMinAnglePair to find the %closest representative in the equivalence class of a QREM %If m2,p2,c2 are omitted or empty, get value...
1f5ca76705155f4ec90818cd7178f4726748c924859938769a2ee32e16574170
MATLAB
622
24
%{ # Spike-triggered average receptive field maps -> stimulus.Sync -> fuse.Activity -> tune.StimulusType --- nbins : tinyint # number of bins bin_size : decimal(3,3) # (s) total_duration : decimal(6,2) # total ...
d18d0c118dfb186998e2514f5b4dbcfaa4c10ea12fcfa9e89b10c86d70bbc8dc
MATLAB
622
26
function Pipeline_getMov(params, m) % This function extracts image data and stores it as a matrix file ExpInfoFn = getFileName(params, 'ExpInfo'); analysisDir = getAnalysisDir(params); load(fullfile(analysisDir, ExpInfoFn)); if m.opto mov = getOptoImageData(params, fn, m); else mov = getImageData(pa...
d3fa8706ae5b652bbaee3038bddeed6c1083d116210a4aad8c0b74f27904ca06
MATLAB
622
32
function s=unsplit_string(c, sep) % 'zips' a cell with strings and a seperator symbol; the inverse of % SPLIT_STRING % % S=UNSPLIT_STRING(C,SEP) takes a cell with strings C and a seperator % string SEP, and returns the string [C{1} SEP C{2} SEP ... SEP C{end}]. % % It is assumed that C and SEP are strings with exactly ...
b09fd1cab32965256c5f3861e028a012f05f398f91c20d4603d89f09ea4ccacf
MATLAB
623
15
function pstruct = tapas_rw_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 % Licence ...
ee1a219b2495e23f8f62decd839bca16cefc0449a8bc187d311e96b18aeabb42
MATLAB
623
22
function MRSCont = osp_interactive_mrsi_mask(MRSCont,kk) if nargin < 2 kk =1; end spec = op_freqrange(MRSCont.raw{1},4.0,5.5); mask = squeeze(sum(squeeze(abs(real(spec.specs))),1)); mask = mask/(max(max(max(mask)))); mask(mask > 2 * mask(1,1)) = 1; mask(mask < 1) = 0; out = figure('Wi...
fc31cffd694a9b366894c4ae008806e869a897e0e2c6cc372c2dc105c73369b7
MATLAB
623
15
function pstruct = tapas_gaussian_obs_offset_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 % Lic...
49a2da67799fdb583032414abc9410dbd123b92f6303576728023c9a1bbd2384
MATLAB
624
28
function strlabel = tapas_uniqc_str2label(str) %converts (cell of) strings into nice label for title, xlabel, Ticks etc. % % strlabel = tapas_uniqc_str2label(str) % % IN % str string or cell of string % % OUT % tapas_uniqc_str2label % % EXAMPLE % tapas_uniqc_str2label % % See also tapas_uniqc_str2f...
4e37c3ebee3da7067fd8e25e1e4c2947f26d9ebda9d5f75908d12f814f55505c
MATLAB
624
32
function [b] =... regress_modelRPE_vs_rew(A, RPE, nback, hit_arg, allblocks) if nargin<5 allblocks = 0; % use mixed block only by default end if hit_arg==1 R = log2(A.reward).*A.hits; else R = log2(A.reward); end if allblocks==0 usethese = A.block==1; R(~usethese) = nan; end % Create design ...
0b90a37e42285564eb4f3309c8d2385c195fcb391acd69234f3f0e445ef8622c
MATLAB
625
37
function [Rmean, Pmean, frq, Pmean2] = NormedSingleCurveLengthWindowed(x,winlen,shiftlen,lag,fs,nrmdegree) beVerbose = false; % shiftlen is winlen - overlaplen M = floor((length(x) - winlen) / shiftlen ) + 1; Psum = zeros(1,2*lag+1); Rsum = zeros(1,lag+1); for ii = 1:M xseg = x((ii-1)*shiftlen+1:(ii-1)*shif...
5a7edac22c735de41df16ab4ed37da6618c5cf7f6a5d7c29b820fc65cf9a3b44
MATLAB
625
15
function pstruct = tapas_softmax_mu3_wld_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...
5fb568eb600b47576ba26ec7a8404da44830e19544714a451ae5a1a20cbbee22
MATLAB
625
22
function [area_between_class,area_between_Beh,x,rescale_y,y,STD,Beh] = Calculate_SharpeningMetric(N_PCR, TimeBins,x_axis,Beh,c,STD) % set(gca,'Tickdir','out') % Fits an exponent to the PCF at each timebin as a measure of % sparsification x=x_axis; y = N_PCR'; rescale_Beh=(Beh-Beh(end))/(Beh(1)-Beh(end)); rescale_y=(y-...
833b1a2abc1032ceef0c141f9380e458821d12afa8f94419f965c056ca35542e
MATLAB
625
24
function [output] = volumesmooth(input, fwhm, str) % VOLUMESMOOTH is a helper function for segmentations % % See also VOLUMETHRESHOLD, VOLUMEFILLHOLES if nargin==3 fprintf('smoothing %s with a %d-voxel FWHM kernel\n', str, fwhm); end % check for any version of SPM %if ~ft_hastoolbox('spm') % % add SPM8 to the pat...
83f989425b2ed930612f4d6e33f69911f417cb0250b8a6f1c2188bfa9638a603
MATLAB
625
20
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = preTrialSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to prepare some structure before each trial [cfg, iBlock, iEvent] = deal(varargin{:}); % set block name and if it is a target ...
19c82fe27331d6e28b72a288f921fe1f58fa991603d597553a4c86c184aa6127
MATLAB
626
32
function cellvar = internalCells(phi) % this function extracts the internal cells from variable phi, which % icludes ghost cells. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % cellBoundary % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % check the size of the ...
317c77ab4a629667321d78eb95ea909ad84621b22fdd2c0c5398605acd9f64fb
MATLAB
626
25
function [converted, standard] = convertreward(rewardvector) %converts all reward volumes to reward levels %CG moved here 11/5/21 converted = rewardvector; converted(converted==4) = 1; converted(converted==5) = 1; converted(converted==8) = 2; converted(converted==10) = 2; converted(converted==16) = 3; converted(conve...
8473e979974bc6d0cc8b5d39304eec89303e8399e930e27743e5d563ea7ca9da
MATLAB
626
32
function RHS = constantSourceTerm1D(phi) % RHS vector for a Explicit source term % % SYNOPSIS: % RHS = constantSourceTerm1D(phi) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % extract data from the mesh structure Nx = phi.domain.d...
cf752cdd2bf2048f113740217c0b52828033276d66eee62522c8f728d34771f2
MATLAB
626
26
function spikeTimes = spikeMatrixToSpikeTimes(spikeMatrix, fs) %{ spikeMatrixToSpikeTimes converts spike matrix to spike times Parameters ---------- spikeMatrix : matrix matrix with size (numSamples, numElectrodes) fs : int sampling frequency Returns ------- spikeTimes : cell numElectrodes x 1 cell wher...
27de124f1012a590bbb4ba95ea620a4aa1a506ae5fa3b0d3ada21dce47f1e8ac
MATLAB
627
29
%clear all %close all % path(path,'.\AGORA\FUZZCLUST') %the data data.X = Z(:,[1 2]); %parameters param.c=ii; param.m=2; param.e=1e-6; param.ro=ones(1,param.c); %normalization data=clust_normalize(data,'range'); param.val=3; result = FCMclust(data,param); result = validity(result,data,param); %modvalidity para todos...
d02be31b1c913dfd13e63c682e1b4553788889be7439ac72c629074bef3fedfa
MATLAB
627
21
function severity = calcSeverity(normDiff) if abs(normDiff) >=0.30 severity=0; elseif abs(normDiff) >= 0.10 && abs(normDiff) <0.30 severity = 1; elseif abs(normDiff) > 0.05 && abs(normDiff) <= 0.10 severity = 2; elseif abs(normDiff) > 0.035 && abs(normDiff)<= 0.05 severity = 4; elseif abs(normDiff) >0...
7aab16a06bb222ae0e544d36073390d31bade75a6f73228950a1b4d9c362605a
MATLAB
629
27
function S = randherm(n, N) % Generates random Hermitian matrices with normal entries. % % function S = randherm(n) % function S = randherm(n, N) % % S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a % random Hermitian matrix formed by % % S = (randsym(n, N) + 1i*randskew(n, N))/sqrt(2); % % By...
ccfbcd451dac414b0fbcefa79b161425a3b7b6519ba9f57af1a7f34927f2f131
MATLAB
629
21
function pvpmod(x) % PVPMOD - evaluate parameter/value pairs % pvpmod(x) assigns the value x(i+1) to the parameter defined by the % string x(i) in the calling workspace. This is useful to evaluate % <varargin> contents in an mfile, e.g. to change default settings % of any variable initialized before pvpmo...
f234db6ca004d1c5be43e8caea0bdbe4596bf5ac0cafadebceab635d0ead4b25
MATLAB
629
31
function [ISD,E,C] = ISD_calculation(FC) arguments FC double end n = size(FC,1); FC = FC(~isnan(FC(:,1)),~isnan(FC(:,1))); [V, D] = eig(FC); [eigValues, idx] = sort(diag(D), 'descend'); V = V(:, idx); lambda1 = eigValues(1); u1 = V(:, 1); FC_regressed = max(0,FC - lambda1 * (u1 * u1')); FC(1:n+1:e...
f300751b659814057cd3ab393f2b6adf0269b0ca94c9011b11f09d752d7fb6db
MATLAB
629
21
% subfunction checking the number of local copies % ----------------------------------------------- function ncopies = checkcopies_local(obj, arg); ncopies = 0; if isstruct(arg) for ilen = 1:length(arg) for index = fieldnames(arg)' ncopies = ncopies + checkcopies_local(obj, arg(ilen).(index{1}))...
a87ac3fdaf9ef853bdcba01f73fd5a5c9a06b3999170d0902344a92835cc74d4
MATLAB
630
28
function autoqc_acquisition(sessix) % Check if EPI and fieldmaps have the same SliceLocation nsdsetup; rec = []; rec2 = []; bb = matchfiles([datadirs{sessix} '/dicom/MR*gre*']); for q=1:length(bb) cc = matchfiles([bb{q} '/*.dcm']); a = dicominfo(cc{1}); rec(q) = a.SliceLocation; end bb = matchfiles([datadirs...
b888b01561a97e9193ed1f3609a8990d1d8d3b59be4107c6fd79392e94aa4209
MATLAB
630
20
function [ output_args ] = normalisePatternEnumeration( input_args ) %NORMALISEPATTERNENUMERATION( input_args ) Returns a enumeration of the %input pattern Given the input pattern [ 2 4 3 1 1 3 4 2 ] this function %turns is into [ 1 2 3 4 4 3 2 1 ] keeping the overall pattern unchanged %but imposing a normalised enumer...
f7028c2152a08414c0394fbaa1324ad2bd2025386f70587058d0c77b149369e7
MATLAB
630
18
function save_tiff_stack(saveDirAndName,stackData) % This function requires "Fast_Tiff_Write.m" to be in the path % Make the fTIF object fTIF = Fast_Tiff_Write(saveDirAndName,1,0); % The writer's 3rd dimension is reserved for color, so we need to permute % the input data's 3rd dimension into the 4th dimension....
fa133b1b70a6e088d4be45c744e15fc7b2e5229d5f490414cb959111fbb894fb
MATLAB
630
29
function [vertex,face] = check_face_vertex(vertex,face, options) % check_face_vertex - check that vertices and faces have the correct size % % [vertex,face] = check_face_vertex(vertex,face); % % Copyright (c) 2007 Gabriel Peyre vertex = check_size(vertex); face = check_size(face); %%%%%%%%%%%%%%%%%%%%%%%%%%%%% f...
0edad5a7dea16b7d5bfff79c600f547284c9253662ecdeee2c8a1de143a9b811
MATLAB
631
31
function RQI_Qi_bfgs_test() n = 12; p = 7; A = randn(n, n); B = randn(p, p); M = stiefelfactory(n, p); problem.M = M; problem.cost = @cost; problem.egrad = @egrad; % Cost function function f = cost(X) f = 0.5*norm(A*X - X*B, 'fro')^2; end % ...
21b22fdf30a3230cdd60cdcb0dc19c369235ed5f0325360ab629e228082f0d9c
MATLAB
631
11
%----------------------------------------------------------------------- % Job saved on 18-Jul-2014 13:13:47 by cfg_util (rev $Rev$) % spm SPM - SPM12b (5672) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.coreg.write.ref = '<UNDEFINED...
8f7b3a34cdb77bb28f08d6d63039ea92558d62e6617a05670328c2ad010611d3
MATLAB
631
28
function compilefma % compilefma - Compile C/C++ functions in FMAToolbox % Move to the 'FMAToolbox' directory, compile, and move back path = fileparts(which('FMAToolbox')); currentDir = pwd; cd(path); processDir; cd(currentDir); function processDir files = dir; for i = 1:length(files), if strcmp(files(i).name,'.')...
f8fd406143e155546bf8bcf6c0ba2fe46d9e0ab871ecff7d19dee430cab1a330
MATLAB
631
26
function [sstate, si] = tapas_sem_mixed_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', []); % Use the temperature ordering. order = state.graph{2}.u.tempe...
3af7c59af3a11269bcd38c1e57086af8f981f717490b86684ef229ec5e423426
MATLAB
632
15
function [pvec, pstruct] = tapas_bayes_optimal_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 General...
dbdaf858865b1c83996a1fcc3157d37d8835809e78e336c6f89fa5b4dafbcb9f
MATLAB
632
20
function d = calcu_d(EA, x0, xf) % Calculate the distance between the final point % and the desired point without input energy. % % d = x_f - \prod_{i=M}^{1} e^(A_i \Delta t_i) x_0 % % Inputs: EA, N-by-N-by-M matrix, where contains M matrix e^(A_i \Delta t_i) % x0, N-by-1 vector, wh...
0bdcb47903ddd62eec4dda40d6dc63dd7d840dd64abd4cdd9fe4d94d8cf8c426
MATLAB
633
23
%{ pre.Segment (imported) # cell segmentation -> pre.AlignMotion -> pre.SegmentMethod --- segment_ts=CURRENT_TIMESTAMP: timestamp # automatic %} classdef Segment < dj.Relvar & dj.AutoPopulate properties popRel = pro(pre.AlignMotion*pre.SegmentMethod) ... & (pre.ManualS...
50e9aa00bfafe820169f68b207acbc5f889eeee0fc6ae5de4b4f8cdfd8f7a17c
MATLAB
633
27
function tapas_uniqc_strip_fields(opts) %strip fields of a structure into workspace variables of calling function % % output = tapas_uniqc_strip_fields(input) % % IN % opts structure variable % % OUT % % SIDE EFFECTS % creates variables with field names in workspace of calling function % % EXAMPLE % tapas_un...
a96034eb2050dba128aa3405c20c5d818976b328bfe3888fd3d825c056ce902f
MATLAB
633
14
%{ rf.FOV (lookup) # field-of-view sizes for all lenses and magnifications -> rf.Lens mag : decimal(5,2) # ScanImage zoom factor --- height : decimal(5,1) # measured width of field of view along axis of pipette (medial/lateral on mouse) width ...
d3bf3bc52bf9aa33bb520d893fe3e6b4fb60a3bfbb1303080df9ed431e68e26e
MATLAB
633
28
function uniqueStrings = unique_cell_string(c) % unique string from a cell-array containing only strings, ignores all % non-strings. nonStringCells = []; for i=1:length(c) % remove non-string cells if ~strcmp(class(c{i}),'char') nonStringCells = [nonStringCells i]; end end c(nonStringCells) = []; uniq...
304aa5d671ad7289eafc7e14eabf8f2e1e35721c839c27f1d2b2933b8e1360c3
MATLAB
634
15
function obj = elbo_latent_precision(obj) if ~isfinite(obj.nA0) || obj.nA0 == 0 obj.lbA = 0; else obj.lbA = 0.5 * obj.nA0 * (brca.utils.logdetPD(obj.A) - brca.utils.logdetPD(obj.A0))... + 0.5 * obj.nA0 * obj.M * (log(obj.nA0) - log(obj.nA)) ... - 0.5 * obj....
56797f522016ddd16f4bc6492bf9e5a23fdd5faecf666c4c8911098e53625046
MATLAB
634
20
function [Q, R] = stiefelgeneralized_retraction_MGS(B, X, U, t) % Retraction for generalized Stiefel based on Modified Gram-Schmidt. % When used just as a retraction, only the output Q is relevant. % NB, Dec. 16, 2018. if ~exist('t', 'var') || isempty(t) A = X + U; % t = 1 by default else A = ...
78f693dc453a0b015c6c78d594e3ac16d4de0d92497e5ac1e911093b1cdb5abe
MATLAB
634
30
function [llh] = tapas_dlinear_hier_llh_sn(data, theta, ptheta, s1, s2i, s2j) %% Likelihood of the nodes of a model with diagonal precision matrix in a % single cell. % % Note that this is the likelihood of several parameters theta 1 to n with mean % mu and precision matrix diag(pe). This is applied to the theta in th...
8b84e8466eae9b97f3beaf7eef5dad554bdc83223e525a4d111214ee28709598
MATLAB
634
22
function [modelITI, modelValue, ratTrial, modelRPE] = ... run_vanillaTD(datadir, modeltype, alpha, scalingfactor) % Load behavior data of all DA rats ratList = loadRats(datadir, 'da'); modelITI = struct; modelValue = struct; ratTrial = struct; modelRPE = struct; for r=1:length(ratList) ratname = ratList{r}; ...
8e0d74a7d69cec15c61358f76876357b42344b19fc37061d2b1592e5f8746586
MATLAB
635
24
function TMSWriteNii(dat,vm,outname) % Modified from DynamicBC 201810Version if length(size(dat))==2 dat = reshape(dat,vm.dim(1),vm.dim(2),vm.dim(3)) ; end % jgj added in 2023-0=3-2 datdims = size(dat); if length(datdims)==3 v1 = vm(1); v1.dt = [16,0]; v1.n=[1,1]; v1.fname = outname; spm_write...
abc56f983cfa3096d32b179212be89aec0d5188b9c5e51fbed78edc9164e06f0
MATLAB
635
21
subjix = 1; load(sprintf('~/ext/figurefiles/nsd/onofffirSPECIAL_subj%02d.mat',subjix),'timecourses','R2'); % 1mm: (82,24,73) offset = 13; offset = 2; % just a few xx = 82+offset:-1:82-offset; figureprep([0 0 1500 400]); for ii=1:length(xx) subplot(1,length(xx),ii); hold on; temp = squish(timecourses(xx(ii),1,73...
c6ae24b48e9801902e5003f6a7051ddd867bc4b27f5257e85e471771dd8f8500
MATLAB
635
15
function [pvec, pstruct] = tapas_cdfgaussian_obs_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2015 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Gener...
4c52be7231e935ed6f172474af7b413d8fbe6f49116e70d4b9d2f00ba9261810
MATLAB
636
16
function Vol4d=TMSdetrend(Vol4d) CUTNUMBER=10; Dim1=size(Vol4d,1) ; Dim2=size(Vol4d,2) ; Dim3=size(Vol4d,3) ; Dim4=size(Vol4d,4) ; Vol4d=reshape(Vol4d,[],Dim4)'; theMean=mean(Vol4d); SegmentLength = ceil(size(Vol4d,2) / CUTNUMBER); for iCut=1:CUTNUMBER if iCut~=CUTNUMBER ...
875997e607dae6757220a985c37699882c7a0be50b54f10b27b3dc0ea883c5a5
MATLAB
636
35
function WGHT = sero_srr_mask2wght(M, TR, mode) % This function needs some love since it behaves in unpredictable ways if nargin < 3 mode = 2; end WGHT = zeros(size(M,1), size(M,2), size(TR,1)); for i = 1:size(M,1) for j = 1:size(M,2) m = squeeze(M(i,j,:)); if ~any(m) continue ...
a13564c8ae92b23a42dcee0e511fdbb32d8b62145c676e0044816681dce70c7d
MATLAB
636
21
%{ vis.BaseNoise128 (lookup) # base noise movies for generating stimuli of size 128 x 128 noise_seed : smallint # randon number generator seed ----- noise_image : longblob # 128 x 128 %} classdef BaseNoise128 < dj.Relvar methods function fill(self) nx = 128; ny = 128; ...
a70dd3cf9fb4638911f0abdc1ecead9d6e9cc1e7369331fd77b92d1bd5ef3604
MATLAB
636
21
function cvnlookupwrite(rgbimg,rawimg,common,ext,wantomit) % function cvnlookupwrite(rgbimg,rawimg,common,ext,wantomit) % % <rgbimg>,<rawimg> are from cvnlookup % <common> is a filename path % <ext> is the specific file name % <wantomit> (optional) is whether to omit the .nii.gz % % imwrite the <rgbimg> as .png and sa...
67fcfa25d410e5757674f0f95131320dc3cdc84f02d53259401cc7f6d6a03334
MATLAB
638
21
function class_calc = knnclass2(neighbors_class,neighbors_distance,num_class,K) % find class on the basis of K neighbors for g = 1:num_class freq(g) = length(find(neighbors_class == g)); end unique_class = find(freq == max(freq)); if neighbors_distance(1)<1e-5 class_calc=neighbors_class(1); elseif length(uni...
2946cb769e03a2ba2f7c65b1adcb7d5e27aaa000d7171b3bb98913ca9c2ffda9
MATLAB
639
22
%{ # pixelwise responses to full-field directional stimuli -> tuning.OriDesignMatrix -> `pipeline_preprocess`.`_prepare__galvo_motion` --- regr_coef_maps : longblob # regression coefficients, widtlh x height x nConds r2_map : longblob # pixelwi...
56ba148bbef8b89003726799d433ed29af1e44e5974572401ffe3b8c792c390c
MATLAB
639
15
function [pvec, pstruct] = tapas_bayes_optimal_binary_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 ...
8865f1ac5c80b4ef773b0f67683c4405ac477c98ffce09c268537420b9120d33
MATLAB
639
16
function twopActivityMatrix = get2pActivityMatrix(F, denoisedF, spks, spikeTimes, resamplingRate, Info, Params) %GET2PACTIVITYMATRIX Summary of this function goes here % Detailed explanation goes here % twopActivityMatrix (numTimeSmaples, numUnits) if strcmp(Params.twopActivity, 'F') twopActivityMatrix = double(F...
dc69eeadd77ed959f8aaf73ac9a77f0a5ccd2976b5f6a4cb71d36b08c10b77ba
MATLAB
639
32
function X = make_nn_diag(N,K) % Make N x N matrix with K-principal dimension % X = make_nn_diag(N,K) Adiag = 0.2; Z = rand(N,K); Z = repmultiply( Z, 1./sqrt(sum(Z.^2,1)) ); X = Adiag * eye(N) + Z * Z'; return %%%--- END ---%%% % Make N x N matrix whose n-th diag elements have correlation with neighbor ...
362054b8e832e3b88f2f4d0d70082f2d8cbe9a2e97d201ad9963d24ff7e2dabb
MATLAB
640
23
function [newnode,newelem]=removedupnodes(node,elem) % % [newnode,newelem]=removedupnodes(node,elem) % % removing the duplicated nodes from a mesh % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % elem: integer array with dimensions of NE x 4, each row contains % the indices of all the nod...
672a94ad01b546ff67d436ee1e0dea286a5f2c3c88889a0d92e065df6aa7f256
MATLAB
640
26
%{ preprocess.EyeposCluster (computed) # my newest table # add primary key here -> preprocess.EyeTrackingFrame radius : smallint # radius of the cluster (camera pixels) center_x : smallint # x coordinate of the cluster's center (camera pixels) center_y : smallint # y coordinate of ...
69985feac611c7509db838ef074c4ed704deb5c0ff949ea0b82b596647da8838
MATLAB
640
21
function [rez] = separate_cluster(rez,template,M_clust) M_clust = M_clust + 1; for i=1:length(template) id = find(rez.st(:,3)==template(i)); rez.st(id,end) = M_clust; end % M_clust = length(unique(rez.st(:,end))); % for i=1:M_clust % spike_id = find(rez.st(:,end)==i); % rez.Merge_cluster{i,1} = uniqu...
7f5b7c9f7cc122f1e5d25419eee9ba2ea02c99fb78377bf3f75a28642b134b36
MATLAB
640
22
function [ output_args ] = random_assembly( v , S , n , N ) %RANDOM_ASSEMBLY( v , S , n , N ) % % % === Jan Moelter, The University of Queensland, 2017 =================== % T = hexagonal_tiling( v ); m = @( x ) sqrt( x(1) ) * [ cos( 2 * pi * x(2) ) sin( 2 * pi * x(2) ) ]; uniform_transform = @( x , X ) ( max( X ) ...
9640f89cfc9cd7e953fb52cfe59c9623ec779c4e0a1735f74d4b5e610ac29e22
MATLAB
640
14
function [ext, platform] = mexexts %MEXEXTS List of Mex files extensions % MEXEXTS returns a cell array containing the Mex files platform % dependent extensions and another cell array containing the full names % of the corresponding platforms. % % See also MEX, MEXEXT % Copyright (C) 2003 Guillaume Flandin <Guill...
0ef23d951531b35153c8108916aeb076bd00dec25eff9677aaaccd55e1eae878
MATLAB
641
37
function tapas_sem_plot_fits(fits, dt) %% Plot the fits of the model. % % Input % data -- Structure of the data of a single subject. % fits -- Fits struct array % dt -- Factor to normalize the area % Output % % aponteeduardo@gmail.com % copyright (C) 2019 % n = 1; n = n + 1; ...
a430e737b4b5a733d227314c82ca36f5983cbefa4f76d8cafdd88377f98094da
MATLAB
641
27
function S = randskewh(n, N) % Generates random skew Hermitian matrices with normal entries. % % function S = randskewh(n) % function S = randskewh(n, N) % % S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a % random skew-Hermitian matrix formed by % % S = (randskew(n, N) + 1i*randsym(n, N))/sq...
c9a7b0c52cb3cbe97c2841abc459979a0ce52f597a1081aafdff62d683206b87
MATLAB
641
16
function [presence_frames,avg_lkl] = get_mouse_presence_frames(juv_bodyparts,thresh) % infer when the mouse is present in the video from the avg. bodypart % likelihood. Mouse is probably not present if likelihood<thresh fds = fields(juv_bodyparts); fds = fds(contains(fds,'_lkl')); lkl_vals = cellfun(@(x)juv_bodypa...
f6c2212819841ea1a2be1ab70b0aa5404463de223c96bb41a3ae30119327c378
MATLAB
641
19
%{ # scanimage scan info -> experiment.Session scan_idx : smallint # number of TIFF stack file --- -> experiment.Lens -> experiment.BrainArea -> experiment.Aim filename : varchar(255) # file base name depth=0 : int ...
4555514cdf5e55cd010412fcddf3eff5e1c894ce94242c3eb6ff6482e5d05ad4
MATLAB
642
16
%Several EEGLAB plugins (not included by default) are available to import %specific data formats. To download these plugins use EEGLAB menu % %File > Manage EEGLAB extensions % %The FILEIO and BIOSIG toolboxes interface also allow to import in EEGLAB a wide variety %of EEG/MEG data file formats -- including those impo...
8539fb3ea346acac8d27af891d189186cf99f66b57ad0a82e8384796e1cdb75e
MATLAB
642
15
function [pvec, pstruct] = tapas_bayes_optimal_whatworld_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 G...
92b5724bf5d689bbd4a338154de0228a23d680f8f91ca9f3d819d0ccdfe42136
MATLAB
642
19
function [verbose] = tapas_physio_plot_peak_detection_from_automatically_generated(t,c,... cpulse, verbose) % Helper function to create peak detection plot. % IN: t, c, cpulse % Author Johanna Bayer, (C) 2023 verbose.fig_handles(end+1) = tapas_physio_get_default_fig_params(); stringTitle = 'Preproc...
996943afef40e1d019b78bafbfb7e14d6e709e2727fb479d908988d6f0e18009
MATLAB
642
23
%{ # treadmill velocity synchronized to behavior clock -> `pipeline_experiment`.`scan` -> `pipeline_experiment`.`scan` --- treadmill_raw : longblob # raw treadmill counts treadmill_time : longblob # (secs) velocity timestamps in behavior clock treadmi...
c123cb4b4dd095962c603c624dad56f143324dba7ed1867b2e8e3449fc340d4b
MATLAB
642
17
% read movie function [movie,movie_AVG] = read_movieLX(filename,width,height,numberframes,startframe,binning,InfoImage,nb_planes) % binning = 2; movie = zeros(height,width,numberframes/binning); for i = 1:numberframes/binning if mod(i,50) == 0; disp(strcat(num2str(i*binning),12,'frames read')); end if binning...
d218c188b91ccd085c27f271ad0d4dcf118497ab3ef87a9d2e1842c078ec2018
MATLAB
642
19
function v = hlp_matlab_version() % Get the MATLAB version in a numeric format that can be compared with <, >, etc. persistent vers; try v = vers(1); catch v = strsplit(version,'.'); v = str2num(v{1})*100 + str2num(v{2}); vers = v; end % Split a string according to some delimiter(s). Not as fast as hlp_spl...
d97edfec70058c5f5ec4a3cf994dd194c52e2d94e83c770f9fec5db54473afd3
MATLAB
642
26
function all_SU_removed = removeRewardfromHmat(goods, all_SU,all_S,all_index) xvec = all_SU{goods(1)}.xvec.COFF; all_SU_removed = all_SU; %nan things that are after the next event for a= 1:length(goods) S = all_S{all_index{goods(a),4}}; SU = all_SU{goods(a)}; %find delay wt = S.wait_time; wt(isnan(wt)) = 0; wtT = []; ...
4fe16cfb8df8c042a08bbdd18ff58a8c2e0ab9a6c990c3aa5b58380dafea1d80
MATLAB
643
15
function [pvec, pstruct] = tapas_bayes_optimal_whichworld_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 ...
963a24d46c9a61ca78deece04fb1c55560864f66bd268709a4db961fd70085ce
MATLAB
643
22
function candoit = canGetEuclideanGradient(problem) % Checks whether the Euclidean gradient can be computed for a problem. % % function candoit = canGetEuclideanGradient(problem) % % Returns true if the Euclidean gradient can be computed given the problem % description, false otherwise. % % See also: canGetGradient get...