sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a51c854f11d267018be634440314903722c28b8f01856dc894a6bdd1c7de0cbc
MATLAB
501
31
function r = le(p,q) % this function compares the less than or equal to condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVaria...
27eef283900aab4384c53a542bcdafeebd0297d55ee3adc7ec88283586cc581b
MATLAB
502
35
function [llh] = tapas_linear_llh(data, theta, ptheta) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % y = data.y; u = data.u; theta = theta.y; [np, nc] = size(theta); llh = zeros(np, nc); ln2pi = log(2 * pi); % Precision pe = ptheta.pe; lpe = log(ptheta.pe); for j = 1:nc; for i = 1:np x = ...
86550640445e3c9df1675c715294a07a8cbe285dfa8f152913fb75139120c865
MATLAB
502
23
% performs transformation from geometry of % recon-code to output of spm_read_vols % % % INPUT % Y - congruent with FullImReconStackData & imagesc-orientation % % OUTPUT % newY - from spm_read_vols function newY = tapas_uniqc_transform_matrix_analyze2matlab(Y) nSlices = size(Y,3); nVolumes = size(Y,4); ...
a189678e23884d5bda98dbc03e056399761c3637db79b2cff2a1dcaa889b116d
MATLAB
502
16
%% Figure 6 S1 YOURDATAPATH = ''; savePath = [YOURDATAPATH '/' 'models' '/']; %% Load model outputs load(sprintf('%sall_classifier,target', savePath), 'outputsLR') load(sprintf('%sall_classifier,targetPartial', savePath), 'outputsPartialLR') %% PANEL A % Classifier performance over time for target decoder plotTargetC...
d60ae4ca3718580448ddaa4af76f59325f0b386b814fc28751cfc603b948a208
MATLAB
502
15
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Requires: https://github.com/anders-s-olsen/psilocybin_dynamic_FC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; clc; ROI_sig = readmatrix('time_series.txt'); ROI_sig = ROI_sig(:,1:5); T = {size(ROI_sig,1)}; % one subje...
832a78308841bb6bdf2279c7313c12a4e68cab7021f604d2b421527674e6de41
MATLAB
503
20
function b=brightness(RGBrows) % given triples of RGB values, returns the overall brightness vector. This % is performed on each row of the input (RGBrows) independently. %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council import rsa.* import rsa.fi...
0338c4348fbfd75a5c193b745e7b077268ce75cca5778ede3b6f94c46b9af0d9
MATLAB
504
31
function r = ge(p,q) % this function compares the greater than or equality condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVa...
324ba9587eb4f015ff3ba35b2db287c02e35c18a5a559d58688cbde92ac27f50
MATLAB
504
23
function RDMs=wrapAndNameRDMs(RDMs,names) % wraps the RDMs in argument RDMs into a structured array and assigns the % names in arguments names. %__________________________________________________________________________ % Copyright (C) 2012 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.* impo...
2a20e2149994dcc511a4dd96f722e38f7139b767bd81805ddca146af7e36e043
MATLAB
505
10
%----------------------------------------------------------------------- % Job saved on 02-Jul-2014 11:27:33 by cfg_util (rev $Rev$) % spm SPM - SPM12b (5672) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.smooth.data = '<UNDEFINED>'; ...
95287b05b602f8f82ca2fad5e3b3368828c6c4654ee3691597fef456c2eebe3e
MATLAB
505
20
% Compute the log intensity for the inverse link function g(f) = f^2+a. % Output range: 0 <= g(f). % % The function can be used in GLM likelihoods such as likPoisson, likGamma, and % likInvGauss. % % Copyright (c) by Hannes Nickisch, 2021-02-16. function [lg,dlg,d2lg,d3lg] = glm_invlink_square(a,f) f2a = f.*f+a; l...
9a9e872234a018f4864f16604684479c5841e8e2d8bb3df6e19fbea36e17e415
MATLAB
505
19
function options=setIfUnset(options,field,value) % if options.(field) is empty or doesn't exist, this function sets options.(field) to value. %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.* import ...
c0d10159edc17eff24165ccc9ecb0381bf838d1aa0686e5e758991ba93105246
MATLAB
505
13
function varargout = ft_read_vol(varargin) % This function is a backward compatibility wrapper for existing MATLAB scripts % that call a function that is not part of the FieldTrip toolbox any more. % % Please update your code to make it future-proof. oldname = mfilename; newname = 'ft_read_headmodel'; ft_warning('%s...
e03d01f6756f95f6a13267e24e3531530084213c7c70a5f1952aa56ad7435f36
MATLAB
505
21
function out_str = extractFromString(inp_str, type) % extracts string or number from input string % (c) Jiri, Apr16 if strcmp(type, 'string') out_str = []; for c = 1:size(inp_str,2) if isnan(str2double(inp_str(c))) out_str = cat(2, out_str, inp_str(c)); end end elseif strcm...
0fdda76b3401f1839c45933e70ba57f4fff905ef2b71826c7255349ea7ec8aff
MATLAB
506
19
function tapas_BLT_runPause(params) % tapas_BLT_runPause shows a pause (fication cross) % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 % Show fixation cross for pause Screen('DrawTexture', params.screen.window, params.text.imgiti, [], params.screen.fit, 0); Screen('Flip'...
f3221dfc04fc19ce1afd05b3cbf76c38edff85c75908f5dcd22cc033a6260e64
MATLAB
507
15
function plot_amp(rez,i) Spike_id = find(rez.st(:,end)==i); f=figure; channel = rez.Merge_cluster{i,5}; Nchan = length(channel); for k=1:Nchan amplitudes = rez.best_channel_M(Spike_id,channel(k)); [Ncount,edgesS] = histcounts(amplitudes); subplot(Nchan,1,k) ...
1c8674a1c612ce0a8e1cf2ba65a39caac99209ec571b1f0dc4b4b465cdd55ad8
MATLAB
508
17
%% stats % betaVal = [betaEstMotion1, betaEstStatic1,betaEstMotion2, betaEstStatic2,... % betaEstMotion3, betaEstStatic3,betaEstMotion4, betaEstStatic4,... % betaEstMotion5, betaEstStatic5,betaEstMotion6, betaEstStatic6, betaEstMotion7, betaEstStatic7]; %% one-sample ttest clear h clear p for iCol=1:size(betaVa...
4e9e2ea7108b9714ad73b0d9abdcce2b24ac08b2aa32e77d83758936a5d27f57
MATLAB
508
23
function [F,p,df1,df2] = compare_rsquare_noprint(r2full,r2red,dfful,dfred) df1 = dfred - dfful; df2 = dfful; num = (r2full - r2red) ./ df1; % percentage increase per df lost if num < 0, error('Full model error df should be smaller than reduced!');,end denom = (1 - r2full) ./ df2; % unexplained v...
5c8d118128a7fdb3bebf09ff71a7b6e6ca75f9ca6f97719892aba64d2e844d82
MATLAB
508
20
function vp = getVPvalues(x,th,bw) if ~exist('th','var')||isempty(th) th=0.01/2; end if ~exist('bw','var')||isempty(bw) bw=0.25; end [xv,yv]=ksdensity(x,'bandwidth',bw); xv=xv/max(xv)/2; vp.y=[yv,fliplr(yv)]; vp.x=[xv,-fliplr(xv)]; subMed=median(x); vp.median...
7dd502a0f954e753c27cb38d6de1c2a325053f260fb8396367e18f450dfe8ba3
MATLAB
508
21
%{ # -> tune.STAQual --- x=null : float # x coordinate (mean of Gaussian fit) y=null : float # y coordinate (mean of Gaussian fit) radius=null : float # 2*sigma border of major axis of Gaus...
bfd2c17f24f15cba1ee2526681e0ae4d3819443ed56af80349990627e4228544
MATLAB
508
12
%{ vis.MadAlexFrameSet (lookup) # holds training and testing frames for MadAlex stimulus frame_set_id : tinyint # identifier for the frame set --- uniques : longblob # integer array with unique image ids repeats_shared : longblob ...
c231e8ce92b691c1483317dec143ffb3cc488847b489a5983efd8f4032105ff4
MATLAB
508
15
function randSpikeTimes = randomiseSpikeTrain(spikeTimes, duration, method) if strcmp(method, 'wrap') minTime = 0; maxTime = duration; cutTime = (maxTime-minTime) .* rand(1,1) + minTime; beforeCutTimeIdx = spikeTimes < cutTime; afterCutTimeIdx = spikeTimes >= cutTime; ...
d67738e38cbeed122ed7b4ec4cba5fea76e325796c8fd2ac9f8c3bd72ec9e361
MATLAB
508
26
function [E,E_indiv] = multilevel_efficiency(FC,thres_list) arguments FC double thres_list double end n = size(FC,1); FC(1:n+1:end) = nan; ML_efficiency = nan(n,numel(thres_list)); E_indiv = nan(n,1); for threshold = 1:numel(thres_list) d = (1./(distance_bin(FC>thres_list(threshold)))); ...
da6415920f5fdc76f09ba1ae5b382d2bdb664e59d7b886e1eef4781bf76944c6
MATLAB
508
28
clear all session = '/media/data-313/Rat399-20190402/HPC/Rat399-20190402.xml'; SetCurrentSession(session); dHPC = [25, 26, 30, 39]; vHPC = [22, 29, 31, 34, 35, 37, 38, 42]; s=GetSpikeTimes('all', 'output', 'full') s(s(:,3)==0|s(:,3)==1,:)=[]; ClusNumb=unique(s(:,3)); Mf=[] for i = dHPC g=s(find(s(:,2)==i),:) ...
04faf9fa3de235fb6ee1642e592c8749e1d8ff13ad97c613c5473cd6421402bf
MATLAB
509
25
function fd = dicom_open(strFilename) % % Gets a file descriptor to a DICOM file and check % it vaguely for DICOM like properties... % fd = fopen(strFilename, 'rb'); if -1 == fd fprintf('\nFailed to open DICOM file.'); return; end % loose the header hdr = fread(fd, 128, 'uchar'); if strcmp(sprintf('%c', f...
799ff178eb6aecb6861bd8972c3fdecd977cdca19b7a51582fa8539a1b05aea8
MATLAB
509
25
%Data 1 SUSHI Data11=Data1.*10^3; % Convert Data to uM Data11=Data11+0.001; for i=1:length(Data11) aux=Data11(:,:,i); aux(Sushi400_400==0)=0; Data11(:,:,i)=aux; end %Data 2 Avrg. Volume Data12=Data2.*10^3; % Convert Data to uM Data22=Data12+0.001; for i=1:length(Data22) aux2=Data22(:,:,i); ...
dfe3f18d55489d12f1a56c25ea558f852ee6fc9938301d43d4e8be1a742a0cd5
MATLAB
509
24
function vring = compute_vertex_ring(face) % compute_vertex_ring - compute the 1 ring of each vertex in a triangulation. % % vring = compute_vertex_ring(face); % % vring{i} is the set of vertices that are adjacent % to vertex i. % % Copyright (c) 2004 Gabriel PeyrŽ [tmp,face] = check_face_vertex([],face); nv...
2c75e390fc98f8d1e0d87c00ef4aafb6e192795a523e0b40d985b5ecc2ce8b57
MATLAB
510
21
%{ # raster correction for bidirectional resonant scans -> meso.ScanInfo -> meso.CorrectionChannel --- template : longblob # average frame from the middle of the movie raster_phase : float # difference between expected and recorded scan angl...
a8a721cee3cdd641c7667fec36edf96be978bc53707bbaa1a99bc2badc79bae1
MATLAB
510
25
function h = plot_dots(xVals,inCell) % h = plot_dots(xVals,inCell) % plots each value in inCell as dot jittered artificially in x dim. each % cell is x coord per xVals % % jbh 2/27/21 if nargin == 1 inCell = xVals; xVals = 1:length(inCell); end xCell = cell(size(inCell)); xw = min(diff(xVals)).*....
b506a5fdaf5595b148fee39918d60e384bba7f20a67840eaa956b7aa3276ee4a
MATLAB
510
20
function [p,tval] = ttest2fast(x,y) dim = 1; nx = size(x,1); ny = size(y,1); s2x = nanvar(x,[],dim); s2y = nanvar(y,[],dim); xmean = nanmean(x,dim); ymean = nanmean(y,dim); difference = xmean - ymean; s2xbar = s2x ./ nx; s2ybar = s2y ./ ny; dfe = (s2xbar + s2ybar) .^2 ./...
e072abeba307ac15c53513aee6fc107748c666f2c8c64d11b6e2b45762fc9c6f
MATLAB
510
21
%{ # raster correction for bidirectional resonant scans -> reso.ScanInfo -> reso.CorrectionChannel --- template : longblob # average frame from the middle of the movie raster_phase : float # difference between expected and recorded scan angl...
7a569b99d6575b234752c07254fd23e72abed28e54714f84c46f66066821b856
MATLAB
511
15
function [C] = spm_cov2corr(C) % returns the correlation matrix given the covariance matrix % FORMAT [R] = spm_cov2corr(C); %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Karl Friston % $Id: spm_cov2corr.m 1143 2008-02-07 19:33:...
d8ce8c0e6268953a9318717e8bfeb42188aae3ee8149727ec63145abf0b24582
MATLAB
511
24
function [blockInd, indEx, indRef, indSat] = sero_pulseq_shotToBlockInd(seq, n) % function [blockInd, indEx, indRef, indSat] = sero_pulseq_shotToBlockInd(seq, n) if numel(n) == 1 %#ok<ISCL> n = [n n]; end if all(n==0) n = [1 numel(seq.blockEvents)]; end [indEx, indRef, indSat] = sero_pulseq_getRFBlockInd(seq...
f2d031d84cd8f0849af244680a8fd1e3e7587d71d744765727a8d87afde1ac3a
MATLAB
511
15
function [traceX, traceY] =getTraces(beforeROI, afterROI, roiPosition) if ~isempty(roiPosition) beforeROI = beforeROI(roiPosition(2):roiPosition(2)+roiPosition(4)-1,roiPosition(1):roiPosition(1)+roiPosition(3)-1,:); afterROI = afterROI(roiPosition(2):roiPosition(2)+roiPosition(4)-1,roiPosition(1):roiPosition(1)+roiPos...
3025c6b036e3a043bbf65b0fd971f570dd944f9d56ffe731e3f4b8d9ba389c25
MATLAB
512
18
% Define global variables for testing (needed to display default values for % uimenu objects, but cleared at the end of this script) global warpFactorLevel vigilance bias learningRate maxNumCategories maxNumIterations sampleInterval resample % Set warpFactorLevel to 3 by default warpFactorLevel = 3; % Load the rest o...
6cfa7b08ce8b19e0d24fe47166fca242afbd0d4983b011b5f73720d4aa223c10
MATLAB
513
16
%{ # Monitor luminance calibration -> experiment.Scan --- pixel_value : mediumblob # control pixel value (0-255) luminance : mediumblob # luminance in cd/m^2 amplitude : float # lum = Amp*pixel_value^gamma + offset gamma : float # ...
a3427aa5fe107afd34e6856fa6381059176b64e6886659878e48656314111d96
MATLAB
515
12
%{ experiment.PMTFilterSet (lookup) # microscope filter sets: dichroic and PMT Filters pmt_filter_set : varchar(16) # short name of microscope filter set --- primary_dichroic : varchar(255) # passes the laser (excitation/emission separation) secondary_dichroic : varchar...
ccf0f5cce56ceb150d90562c00b9dbac4811d028f2ac1ba0e8b475da5a210075
MATLAB
515
19
function candoit = canGetEuclideanHessian(problem) % Checks whether the Euclidean Hessian can be computed for a problem. % % function candoit = canGetEuclideanHessian(problem) % % Returns true if the Euclidean Hessian can be computed given the problem % description, false otherwise. % % See also: canGetHessian getEucli...
e0b35d451a91f524cfbb5b050b06354436e64392a7c713ecb71eb211eb35869f
MATLAB
515
16
%% process HCP data with Brainstorm hcp_dir = '/path/to/megdata/and/results/'; reports_dir = strcat(hcp_dir, 'brainstormReports/'); loadedsubj = load(fullfile(hcp_dir, 'myMEGList.mat')); subjList = split(loadedsubj.myMEG, '_'); subjList = subjList(:,2); channels = load(fullfile(hcp_dir, 'myMEGbadChannels')); badChann...
27004c959f6b41431aa6afeacfeac23ea82e9c584ec85bb160dbb1c04a18705e
MATLAB
516
17
function [fwMax,bwMax]=wavesHunterAllFreqs(data,samplingRate) numberElectrodes=size(data,1); yElec=1:numberElectrodes; durationSignal=size(data,2)/samplingRate; %it's in second. dF = 1/durationSignal; fx = -samplingRate/2:dF:samplingRate/2-dF; fy=(size(data,1)...
37dd22ee2f09d07e10cb3bdb8e469447af9210769e5aa47fb0118fd7e190b7f3
MATLAB
516
19
classdef ElementWise < dagnn.Layer %ELEMENTWISE DagNN layers that operate at individual spatial locations methods function [outputSizes, transforms] = forwardGeometry(self, inputSizes, paramSizes) outputSizes = inputSizes ; transforms = {eye(6)} ; end function rfs = getReceptiveFields(obj) ...
8ada50d97d9b93fd044de94a84746b36bddf759eccc7f2f8a156c4c6d2819227
MATLAB
516
16
function Wm = gram_definite_integral(A,B,T) % Calculate gram matrix by definite integral % Slow but also works on uncontrollable system % % W = \int_{0}^{T} e^{A t}BB^Te^{A^T t}dt % % Inputs: A, N-by-N matrix, system matrix % B, N-by-M matrix, control matrix with M control nodes % ...
261a2081355ca2b25fc0d2b30272974cf5199a1ab2ec85dc7f0891520089e773
MATLAB
517
23
function [tMin,fMin,tBreak1,tBreak2,Q2,tMinAll]=essential_distMinAnglePair(Q1,Q2,kFlip) switch kFlip case 1 %nothing to do case 2 Q2([2 3 4 6],:)=-Q2([2 3 4 6],:); case 3 Q2([4 5],:)=-Q2([4 5],:); case 4 Q2([2 3 5 6],:)=-Q2([2 3 5 6],:); otherwise error('Valu...
51fcfdbc41af9076c8528c5e763cde9ff3a5fe152d276274ea4089b417d08d9d
MATLAB
517
12
function [stat,xcorr_m] = gp_xcorr(AllData,tICAData, lagdices) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here xcorr_m=zeros(lagdices*2+1,size(AllData,1)); for j_parcels=1:size(AllData,1) [xcorr_m(:,j_parcels), ~] = xcorr(normalise(AllData(j_parcels,:)'),normalise(tICAData(j_parcel...
75cd9a7d52061a0dd699185f56e67574c8d5d539a01dea7f6c1cf2a434ecadae
MATLAB
517
24
function writeGCFtoPDF(f) def_fn = 'Default.pdf'; [file, path] = uiputfile('*.pdf', 'Select File Name', def_fn); if ~file return; end set(f, 'Renderer', 'Painters'); set(f, 'Units', 'inches'); figpos = get(f, 'Position'); set(f, 'Units', 'Normalized'); aspect = figpos(4)/figpos(3); if (aspect<8/1...
7cae4f6673d6e0a492f3eee3629920189989400adfc31b199da4e185b58058e4
MATLAB
517
22
figure(10) plot(cos(linspace(0, 7, 1000))); xlabel('x (\mum)') ylabel('sin(x)') title('Test export') set(gcf,'color','w') % axis square set(gcf, 'Position', [100 100 400 300]); set(gca,'FontSize',10) set(gca,'Fontname','Arial') set(gca, 'TitleFontSizeMultiplier', 1) % xlhand = get(gca,'xlabel'); set(xlhand,'fontsize',1...
93c42447c7797da51a5e5fa5af83578210f7462c211879b2fa42d60e5372d9c0
MATLAB
517
28
% Main experiment script clc; clear; % Example synthetic data (replace with NAB/CIC files) N = 10000; data = randn(N,1); labels = zeros(N,1); labels(500:520) = 1; window_size = 200; % Preprocess [normalized, spikes] = preprocess(data, window_size); % Spiking CNN features = spiking_conv(spikes); % Reservoir + ELM ...
abf34de7b7eacebd612d118094d7f9fa95510e694d702ad3db1620dc37f2c2c3
MATLAB
517
12
function control_max_eig = bin_shuffling(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) ControlSpikeCount(neuron_idx,:) = SpikeCount(neuron_idx,randper...
f16907d46e3b9a444757af67ff1c348b703942ee784a7ae1203b891cb56682f0
MATLAB
517
21
function [posterior] = tapas_linear_estimate_interface(data, model, ... inference) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % % Verify input tapas_validate_data(data); tapas_validate_model(model); tapas_validate_inference(inference); [data] = tapas_linear_prepare_data(data, model, inference); [model]...
2c35387a5dea67d8e4c2abe569225d04df5367ec223a0e9ebf2fd0e4bc81ff97
MATLAB
518
18
function Us = get_PCproj(S1, row, col, wPCA, maskMaxChans,nt0min) [nT, nChan] = size(S1); dt = -nt0min + [1:size(wPCA,1)]; inds = repmat(row', numel(dt), 1) + repmat(dt', 1, numel(row)); clips = reshape(S1(inds, :), numel(dt), numel(row), nChan); mask = repmat([1:nChan], [numel(row) 1]) - repmat(col, 1, nChan); Mas...
30dd58ee22a2ef7b8be83c454cfacad60c8578e9d7cbb7b3ba90d605d707d81b
MATLAB
519
22
function interactive_PROMAX_ASSEMBLY_DETECTION_VALIDATION() 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 ) ) ); ...
65c812cd61b6bb8f6f1aab42862afaf714956579db42f7656fa35686ff4f4bbd
MATLAB
519
19
classdef ElementWise < dagnn_bc.Layer %ELEMENTWISE DagNN layers that operate at individual spatial locations methods function [outputSizes, transforms] = forwardGeometry(self, inputSizes, paramSizes) outputSizes = inputSizes ; transforms = {eye(6)} ; end function rfs = getReceptiveFields(obj)...
7c9c5e8d667c2ac1c7217edc597b9c307c31dcfedbb0b799fe1fc6b7894d320e
MATLAB
519
18
% extract eye position traces function [pos_x pos_y] = extractEyePos(animal_id, session, scan_idx) s = struct('animal_id', animal_id, 'session', session, 'scan_idx', scan_idx) ; rv = preprocess.EyeTrackingFrame & s ; tuples = fetchn(rv, 'center') ; pos_x = zeros(length(tuples),1) ; pos_y = zeros(length(tuples),1) ; fo...
e613d7771b6ff2ede81d5a17b86fe2824e3ff0fefb6f2b06898bd93cbfb08d65
MATLAB
519
18
clear all close all figure;clf subplot(2,2,1);ylabel('ylabel1');title('title1') subplot(2,2,2);ylabel('ylabel2');title('title2') subplot(2,2,3);ylabel('ylabel3');xlabel('xlabel3') subplot(2,2,4);ylabel('ylabel4');xlabel('xlabel4') [ax1,h1]=suplabel('super X label'); [ax2,h2]=suplabel('super Y label','y'); [ax3,h2]=su...
b6d544373873b0f1c9a90c3bac6974d6aa5c74c53594da6f22f12170b9202cd3
MATLAB
520
23
function [Result] = Feta(eta,y,sig2); %Implemented by Christian Beckmann if nargin<3 sig2=1; end; bm=sig2*(1-sqrt(y))^2; bp=sig2*(1+sqrt(y))^2; Result=zeros(size(eta)); teta=bm:1/1000:bp; feta=zeros(size(teta)); feta=((2*pi*y*teta).^(-1)).*sqrt((teta-bm).*(bp-tet...
eb55e0792499d9b0abd37071314698964805812cdefabd93058d2ea2c07983a2
MATLAB
520
21
function [posterior] = tapas_vlinear_estimate_interface(data, model, ... inference) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % % Verify input tapas_validate_data(data); tapas_validate_model(model); tapas_validate_inference(inference); [data] = tapas_linear_prepare_data(data, model, inference); [model...
1e60674665b781ade84c0686fe6e5ba189e235aa74ef50850410126e7fdaf974
MATLAB
522
30
function dH = hausdorff(A, B, d) % A, B: two subsets(patches) % d: geodesic distances between all vertices on cortex % A=A(A>=0); % B=B(B>=0); dH = max(compute_dist(A, B,d), compute_dist(B, A,d)); end % Compute distance function dist = compute_dist(A, B,d) m = size(A); n = size(B); d_vec = []; D = [];...
24affc8aebe4d3b34ff582778cfb5bb028a85286f58894804b70d559d99b2677
MATLAB
522
18
function [MNICen MATCen]=TMSMNICenter(imagedir) % images = spm_select(1,'image','masks'); [ hdr dat] = TMSReadNii(imagedir); dat = reshape(dat,hdr.dim(1),hdr.dim(2),hdr.dim(3)); [dx dix] = sort(dat(dat>0)); DX = unique(dx); for i = 1:length(DX) DAT = zeros(size(dat)); DAT(dat==DX(i)) = 1; STATS = ...
b277ea1ae51677bb966afd2043756348a6646ca04604daaee7358f5bacf1a758
MATLAB
522
39
function y = choosvd( n, d) if n <= 100 if d / n <= 0.02 y = 1; else y = 0; end elseif n <= 200 if d / n <= 0.06 y = 1; else y = 0; end elseif n <= 300 if d / n <= 0.26 y = 1; else y = 0; end elseif n <= 400 if d / n <= 0.28 ...
6f6ccdb8aadf37952298dfe82294f8db37e86414fd4bc65f462510f5e40cea07
MATLAB
523
21
function RDMs=concatRDMs_unwrapped(varargin) % concatenates dissimilarity sets (ltv or square RDMs). All inputs should % have the same number of dissimilarity entries. %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Council import rsa.* import rsa.fig.*...
5634ee74153b22d88ac3ea3a8507afee7622a988f63cc6d8a922939d5f1adcff
MATLAB
524
15
function obj = elbo_residual_precision(obj) D = prod(obj.lat); if ~isfinite(obj.nl0) || obj.nl0 == 0 obj.lbl = 0; else obj.lbl = 0.5 * D * obj.nl0 * log((obj.lam/obj.nl)/(obj.lam0/obj.nl0)) ... + 0.5 * D * obj.nl * (1 - (obj.lam/obj.nl)/(obj.lam0/obj.nl0)) ... ...
424bc753ae558f668c977b6200b761afb92da16ff7e061165bb9b943649e668a
MATLAB
525
16
function names = fieldnames(this) % Fieldnames method for GIfTI objects % FORMAT names = fieldnames(this) % this - GIfTI object % names - field names %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: f...
531dc997e8b154784336e87d0a029710f2738d71fa71e518326fd9f73d131dbc
MATLAB
526
32
function [y] = tapas_sem_trapp_int(u, theta, ptheta, sloppy) %% Integrate the model of Trappenberg. % % Input % u -- Input % theta -- Parameters % slopp -- Optional, if true the input is not checked. Defaults to false. % % Output % y -- Simulated signal. % % aponteeduardo@gmail.com % ...
54042f06203b7fac924533a0665443ade80319c724f5945c4a91848b31928878
MATLAB
526
15
function ret = findScaledMADOutliers(data) % Determine if an array contains values that are outside of three scaled MAD numElems = numel(data); if numElems < 1 return end deviations = data - median(data); absDeviations = abs(deviations); mad = median(absDeviations); % Scale the MAD b...
8eae0b452078e7347fa822fc22a93edd5c385175d20394da476d6e8271b5b2c3
MATLAB
526
12
%This function gives the matrix with the targets(paired). This is used in %expDesign function [MYfixationTargets_matrix] = targetsRepeated(fixationTargets) cfg.design.fixationTargets=zeros(size(fixationTargets,1), (size(fixationTargets,2)+size(fixationTargets,2))); for t=1:size(fixationTargets,2) cfg.desig...
793b8ee6a3257209e5e69dc145f57c768201382f7698989804f82c677aa244a2
MATLAB
527
16
function [x_lim, y_lim] = ZoomToSelectedRectangle(I) % JB 17/06/2021 %ZOOMTOSELECTEDRECTANGLE Interactive choice of zoom window which can be %different shape to input image % After you have selected and adjusted your zoom rectangle, right click % and select "Crop image" to continue %figure %ShowImag...
c67ecfcbaccc0ab36efa41ceb0c9f7ff2e3cf8015cc93c9d3715e024de761670
MATLAB
527
14
function showGlyph(bDir,data1) K = convhulln(double(bDir')); %data = data / max(data(:)); data = data1; data(data<0) = 0; d = bDir.* (ones(3,1)*(data(:))'); patch('Faces',K,'Vertices',d','facecolor','interp','edgecolor','none','FaceVertexCData',data(:),'CDataMapping','scaled','facealph...
003fbedce5423e23841d18cf9a16a579e2ba9a1db985ecbf668c73fa45335043
MATLAB
528
26
function y = subset(x, varargin) if nargin < 3 || isempty(varargin{2}), varargin{2} = 1:size(x,2); end if nargin < 2 || isempty(varargin{1}), varargin{1}= 1:size(x,1); end if iscell(x), y = cell(size(x)); for i = 1:numel(x) y{i} = misc.subset(x{i}, varargin{:}); end else ...
02add6bb8c994fd07d809deaf63eed9e6e7acf865e576fdfac77cc57cf2030e7
MATLAB
528
12
function control_max_eig = bin_shuffling(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) ControlSpikeCount(neuron_idx,:) = SpikeCount(neuron_idx,r...
29910dca45c21ab841894cfa3759035971a92f0e59fdf06ce27f87a217fe5c3c
MATLAB
528
16
function [attack_onset_frames,attack_offset_frames] = get_onset_frames(attack_frames) if ~isempty(attack_frames) onset_frame_idx = find(diff(attack_frames)>1)+1; onset_frame_idx(onset_frame_idx>length(attack_frames)) = []; attack_onset_frames = [attack_frames(1);attack_frames(onset_frame_idx)-1]; ...
bd9fbd04f7e30a5edeabcd7a364dd7954bcf9e09e2fa25aa99eda6abc4216211
MATLAB
528
48
%script Test_BrikLoad % % % %Purpose: % % % %Input: % % % %Output: % % % % % %Key Terms: % %More Info : % % % % % Author : Ziad Saad % Date : Fri Dec 15 20:19:14 PST 2000 % LBC/NIMH/ National Institutes of Health, Bethesda Maryland %Debug Flag DBG = 1; BrikName = 'ARzs_CW_avvr.DEL+orig.BRIK'; [err, V, I...
e14d8a87f20855a7e36b9c27ee2acc8edc8b328b3dc429b8c7ece6dab5ae189a
MATLAB
528
14
function valid = ll_validate(EEG) valid = false; [fA, fB] = uigetfile('.','Select an EDF file','*.edf'); edfPath = [fB fA]; EEG = pop_bidsload(edfPath); [EEG, transform] = warp_locs( EEG,'derivatives/EEG-IP-L/code/misc/standard_1005.elc', ... 'mesh', 'derivatives/EEG-IP-L/code/misc/...
0ff16e152b914e844ed7f36bb3f3e7aba7eee7e0a0d3e66821237d2684c9f66e
MATLAB
529
19
function call_copy() % clicking on axes within a figure, opens a new figure with only the % clicked axes in it. % Usage: % ff = findobj('type','axes'); % set(ff,'ButtonDownFcn','call_copy'); % (c) Tonio copyobj(gca,figure); set(gca,'Position',[0.13 0.11 0.775 0.815]); set(gca,'ButtonDownFcn',''); h_child=get(gca,'Chi...
5937fac5a11c0d67593be9950b6f5baee72751a52d9e36df65985112e8b0ce12
MATLAB
529
21
% minFunc printf('Compiling minFunc files (octave version)...\n'); ## working around the lack of an -outdir option in octave's mex function mexme(fn) cmd = sprintf("mkoctfile --mex --output ../compiled/%s.mex %s.c", fn, fn) ; [ status output ] = system(cmd) ; if status!=0 error("Executing command %s\...
75ca7906845b54c3b232dc412fb88395761362b506ceededb1461db06669449c
MATLAB
529
15
function tapas_print_logo() %% Print the logo of tapas. % % aponteeduardo@gmail.com % copyright (C) 2017 % disp( '_______ _____ _____ _____ ____ '); disp( ' | | | |_____| | | | '); disp( ' | ...
87c6c7d24fa7f3cce8908cc733a859f35cdc302de7001a16198678f2571914be
MATLAB
529
18
function candoit = canGetSubgradient(problem) % Checks whether a subgradient can be computed for a problem structure. % % function candoit = canGetSubgradient(problem) % % Returns true if a subgradient of the cost function can be computed given % the problem description, false otherwise. % % See also: canGetGradient ...
8986a20a6a0ec044238df283d63eacc374df88452052a147a5407ffe8e1be04a
MATLAB
529
15
function data_out = sero_pulseq_coilCombineAdaptive_multiShot(data) % function data_out = sero_pulseq_coilCombineAdaptive_multiShot(data) % Assume data is in format [xvox, coil, yvox, shot]. % Needs to be in format [coil, yvox, xvox, shot] for converter. siz = size(data); data_out = zeros(siz([3 1 4])); for i ...
8aae67fcbec6f913ea01a1e3bd98e4d7b1b09822cbfc0906e33a7de1f7158925
MATLAB
529
17
%{ # directional drift trials -> tuning.Directional drift_trial : smallint # trial index --- -> vis.Trial direction : float # (degrees) direction of drift onset : double # (s) onset time in rf.Sync times offset ...
ed27c7325b18de502f1a27639436361509db21bea39f7ce5d0038942688dee5f
MATLAB
529
21
function D = compute_distance_to_points(X,seeds) % compute_distance_to_points - compute euclidean distance to a set of points. % % D = compute_distance_to_points(X,seeds) % % 'X' is a [d,n] matrix, X(:,i) is the ith point living in R^d. % 'seeds' is a [d,k] matrix. % D(i,j) = |X(:,j)-seeds(:,i)|^2. % % Copyr...
094efc1209f09f0aeb295f7a0817a7b8011e2cefa7e94bb1dc00592024b6691a
MATLAB
530
17
function new = write_xxx(string,old) % Dynamic changing of regular expressions with regexprep. % Overwrites strings within a string with the same number of X. % % Author: Dr. Georg Oeltzschner % Johns Hopkins University, 08/23/2016 % % History: % 2016-08-23: First version of the code. % 2018-09-13...
7458853d20f9945caed903794cc8e459c3ecb64044b5eee9324988b0f8fd518a
MATLAB
530
20
function [Nrank] = get_rank(dWU, variance) [~, ~ ,Nfilt] = size(dWU); Rank = []; j = 1; for i=1:Nfilt if(isempty(nonzeros(dWU(:,:,i)))) else j = j+1; [~,Ds,~] = svd(dWU(:,:,i)); %To get the correct sign for the peak deep normsqS = sum(Ds.^2); %// total variance ...
88be696492cf01f15e458badb75afd475e2042948aca0beaf12fbf6da7bdb88e
MATLAB
530
19
function candoit = canGetLinesearch(problem) % Checks whether the problem structure can give a line-search a hint. % % function candoit = canGetLinesearch(problem) % % Returns true if the the problem description includes a mechanism to give % line-search algorithms a hint as to "how far to look", false otherwise. % % S...
70f68817adca57c72fec77c4bdbffd90fc2f4fd34b4f1782ca739ff6f5e4b21a
MATLAB
531
24
% Example function to demonstrate surface alignment for surface-based voxel % selection % set directory d='/Volumes/organized/116_surfing_toolbox/fingerdata-0.2/'; % set up variables C=struct(); C.action='all'; C.subjid='s88'; C.origvolfn=[d 'glm/anat_al+orig']; C.fssurfdir=[d 'fs/s88/surf/']; C.aligndir=[d 'ref/']; ...
e826d72010a889b36358760515a886599e3740fd88dadbbf85052614ee524c15
MATLAB
531
21
function [img_new]=full2cropped(img_pca) % Convert full size image in MNI space to cropped image %[~,img_pca]=read(FullImage); %Dimensions of full image ins_msk=~~img_pca; %Bounding box tmp=squeeze(sum(ins_msk,1)); [y,z]=find(tmp); max_y=max(y); min_y=min(y); max_z=max(z); min_z=min(z); tmp=squeeze(sum(ins_m...
195b989be80dd97b211440760abc13a4612308232474b4896ce1a76146d931bd
MATLAB
532
21
%{ # raster correction for bidirectional resonant scans -> stack.CorrectionChannel -> stack.StackInfoROI --- raster_phase : float # difference between expected and recorded scan angle raster_std : float # standard deviation among raster pha...
6970ddfff8102ebcc8a26270ac5fca5ca8c319514d3be8614c2f6cba954129d1
MATLAB
532
15
[kendrick@surly ~/nsd/ppdata]$ ls -la *prffloc/GLMdenoise_floc_figures/FinalModel.png a = matchfiles('~/nsd/ppdata/*prffloc/GLMdenoi*figures/FinalModel.png'); a = a([1 2 3 4 5 6 7 8 9 11 10 12 14 13]); % to match order in nsdsetup.m (FINALVERSION HAS RIGHT ORDER) mkdirquiet('~/Dropbox/KKTEMP/ok/'); for p=1:le...
db2ede30675d617d4936dd0b9d85eafb784d525f80c925ba096dfae2d3cc1beb
MATLAB
532
21
%{ # mask produced by segmentation. -> meso.Segmentation mask_id : smallint # --- pixels : longblob # indices into the image in column major (Fortran) order weights : longblob # weights of the ma...
e33d33105f55d12561e6e1d8ad7f6c018987415117dfecc9a85249baa3be6407
MATLAB
532
21
%{ # mask produced by segmentation. -> reso.Segmentation mask_id : smallint # --- pixels : longblob # indices into the image in column major (Fortran) order weights=null : longblob # weights of the ma...
f0fd73d353177fc993e0c5573f7413047c7befcceec6390d47c85b4dffef9089
MATLAB
532
15
function sero_pulseq_plot_ktraj(seq) [ktraj_adc, t_adc, ktraj, t_ktraj, t_excitation, t_refocusing, slicepos, t_slicepos] = seq.calculateKspacePP(); % plot k-spaces subplot(2,1,1) plot(t_ktraj, ktraj'); % plot the entire k-space trajectory hold on; plot(t_adc,ktraj_adc(1,:),'.'); % and sampling points on the kx-axis...
1e7c9e1b8c3671d7803ba48939b2f4cbadd5b809286a20a15b05cb24081062de
MATLAB
533
28
function [ m ,bdm] = cal_info_s( A,L) r=0; c=0; for it=0:1 [AA,rown,coln]=mat_extend(A,it); if rown~=0 r=log2(rown)+2.43502031602103; end if coln~=0 c=log2(coln)+2.43502031602103; end [I_ID]=get_mat_ID_INFO(AA,L); B=I_ID(1,:); y = unique(B); temp = sum(unique(I_ID(2,:))); II=y; N = numel(y)...
50f2448a0f28415c15f36a81bb1cef1e145507eb034a8fc8e223ab1004f9decb
MATLAB
533
25
function sformatted = mrvParamFormat(s) % Converts s to a standard mrVista parameter format (lower case, no spaces) % % sformatted = mrvParamFormat(s) % % The string is sent to lower case and spaces are removed. % % Example: % mrvParamFormat('Exposure Time') % % See also: any of the get functions should have th...
ca1f3882b3a7658a05416bc9d681af1562cb702cd55ad422f5bbc4a3d6e0398d
MATLAB
533
41
function [pars] = tapas_sem_hir_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, 'seed'...
558a07ebcfbbad987511d108b26097e9142fec137b9fa3817fb219f35633e554
MATLAB
534
26
function varargout = tapas_uniqc_example_slider4d() %creates 4D dataset numerically and runs tapas_uniqc_slider4d to show capability of it % % tapas_uniqc_example_slider4d() % % IN % % OUT % % EXAMPLE % tapas_uniqc_example_slider4d % % See also % Author: Lars Kasper % Created: 2013-05-15 % Copyright (C) 2013 In...
6d75bf1540dc73aa568b9913ec37d3ddc55dd1a1d3ef60d875d981bab7b889ef
MATLAB
534
17
function indices = findmin(data,k) %findmin - 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 published by % the...
8e13d9cf84882a68b46eea83b12fa374ea715612b4b1918d3681d97f8a813c8b
MATLAB
534
20
function [fval_1,x2_new,fval_2]=nested_contraction_obj(x1,x2) %% the function f(x)=(x+a)^(1/1.01) is a contraction % example a) to use arguments that update themself within the routine, % and b) of a nested contraction approach. global counter_global count=0; while 1 count=count+1; x2_new=(x2+1/x1)...
94719e85773840b081b6c17aa422eefcabf980e9c461e711ab022c6a4e55d24e
MATLAB
534
21
function window = my_hann(length) % % a hann windowing function (i.e., a cos^x function) for windowing with the % CW regression toolbox. needed if you do not have the signal-processing % toolbox!! % if rem(length,2) % Odd length windowindowindow x = (0:((length+1)/2)-1)'/(length-1); window = 0.5 - 0.5*cos...
c1a6cfef52eb1965334cead1b450751cf8e7017c814cc6dff9f0f25611499b3b
MATLAB
534
20
function Z = dzip(M) % DZIP - losslessly compress data using gzip % FORMAT Z = dzip(M) % M - byte stream to compress % Z - compressed output % % See also DUNZIP % This function uses the public domain ZLIB Deflater algorithm. % Carefully tested, but no warranty; use at your own risk. % Michael Kleder, Nov 2005 % Mo...
4b5409469d4918c23027456a166004e122c307c9c6d23966cbb72ae6bbc3f934
MATLAB
535
19
function [ params ] = nmri_get_dataset_params( params, dataset_mapping ) % will modify the params according to dataset mapping if ~isempty(dataset_mapping) if ~isstruct(dataset_mapping) % should be a file then if ~exist(dataset_mapping,'file') error(['could not find ' dataset_mapping]) end % check if has pa...
d9d1615efa88548dc4af850c64186f327446c4dded013ce02fd0a542cecc4212
MATLAB
535
20
function [err,rcor] = mean_sq_error(y,z) % Normalised mean squared error and correlation coefficient % [err,rcor] = mean_sq_error(y,z) % % err = sum((y-z).^2)/sum((y - <y>).^2) % rcor = sum((y - <y>).*(z - <z>))/sqrt(sum((y-<y>).^2)*sum((z-<z>).^2)) % GoF = 1 - err [N,T,Ntr] = size(y); y = reshape(y,[N,...
e0c1ef63b94375fa46479f4db5d938afd18e814150e2491c73e3c76de440497d
MATLAB
536
25
function runFinemapFromFiles(a_mat_path, glmt_mat_path) %rng(32193213, 'twister') D1 = load(a_mat_path); D2 = load(glmt_mat_path); A = D1.a; glmt = D2.glmt; M = size(A,1); assert(isequal(size(A),[M M]), 'A must be square'); assert(numel(glmt)==M, 'glmt length mismatch'); theta = FinemapMiXeRv0(A,glmt); ...
e8ab4bb0b80464994f6736ad866370b17b5b76ce55b975b38be451aa980db1a8
MATLAB
537
16
function [T P] = TMSttest2_cov(DepVar,GroupLabel, Covs) % DepVar=[1 2 34 4 5 4 5 11 44]' % GroupLabel=[1 1 1 1 1 2 2 2 2]' % Covs = [1 2 1 2 4 5 3 3 4 ; 1 2 1 1 1 1 1 1 2]' Df_E=size(DepVar,1)-2-size(Covs,2); [b,r,SSE_H] = rest_regress_ss(DepVar,[ones(size(DepVar,1),1) , Covs]); % Calul...