sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9742263f0751b91d23ca91a40d33bd97e8d698e5ca54a705bd96d5e98b6e15a0
MATLAB
643
16
function pstruct = tapas_ph_binary_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2015 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)...
f48cf3e06f1931ddbc1ce630b3a064939975fd148168caf515760b294dce2fd6
MATLAB
643
23
function E = regional_activation_energy(FC) % Compute the regional activation energy for every regions under whole % brain control. % This function need to import the function in % functional_controllability/Energy Efficiency % % inputs: FC, N-by-N, connectivity matrix % % outputs: E, N-by-1 vector,...
4ee299663e0256f2f91b7ee5c2a9277a2e4c317c0c3fa4539282cd78f1d64dce
MATLAB
644
15
%{ rf.Stack (manual) # scanimage scan info -> rf.Session stack_idx : smallint # number of TIFF stack file --- -> rf.Site bottom_z : int # z location at bottom of the stack surf_z : int # z location of surfac...
d268af45704b7d9d3c36418fc70ea7c538972021f5d60ed090f5d4a00b76a6e8
MATLAB
644
15
function [pvec, pstruct] = tapas_bayes_optimal_categorical_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...
d863e279c38542c33f43815f06a6e43b75492854d319a073e444d85304a743b6
MATLAB
644
37
function r = plus(p,q) % this function adds the 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, 'FaceVariable')&&isa(q, 'FaceVariable')) r=...
fe34f9131d1637cab6c7ec60790ca4005fdf68d0e4b9632a04d8854a83475975
MATLAB
644
20
function a = vl_taccum(alpha, a, beta, b) %VL_TACCUM Compute A = alpha A + beta B % A = VL_TACCUM(ALPHA, A, BETA, B) computes efficiently A = alpha A % + beta B. For GPU arrays, it performs its computation in place, by % modifiying A without creating an additional copy. % Copyright (C) 2016 Andrea Vedaldi. % Al...
116bac545f363eeb4c1246aa5cae08b27bdf113f5d7e7cdada68746d1f3a07c2
MATLAB
645
15
function [output_traces] = get_trace_within_range(input_traces,glb_frame_ranges,sub_session_frame_range) num_frames = sum( cellfun(@(x)numel(x),sub_session_frame_range)); num_sub_sessions = numel(sub_session_frame_range); num_cells = size(input_traces,1); output_traces = nan(num_cells,num_frames); for s = 1:num_su...
d0a35bf5f1748006c0df9f8946ecaab4bbeba16d4fc470e878326e2fd9303404
MATLAB
645
24
function conn = computeConductanceMatrix(potentials, masked_atlas) %%% Compute global connectivity matrix % % Author: Aina Frau-Pascual roi_list0 = unique(masked_atlas); % consider 0 is background roi_list = roi_list0(roi_list0>0); nroi = size(roi_list,1); conn = zeros(nroi, nroi); for p1=1:nroi for p2=1:...
e153c4eb5a190449f5c885ac6755243679d01c89d36833f8bad61da51980c794
MATLAB
645
15
%{ table_name : varchar(255) # className of the table key_hash : char(32) # key hash ----- status : enum("reserved","error","ignore") # if tuple is missing, the job is available key=null : blob # structure containing the key error_message="" : varchar(1023) # error me...
01a76b960a8c5481f509c31357c3ad742917160b8b47df75704eb6a211457baf
MATLAB
646
24
% From: % https://en.wikipedia.org/wiki/Otsu%27s_method function level = otsu(histogramCounts) total = sum(histogramCounts); % total number of pixels in the image %% OTSU automatic thresholding top = length(histogramCounts); sumB = 0; wB = 0; maximum = 0.0; sum1 = dot(0:top-1, histogramCounts); for ii = 1:top wF =...
1283da0cf9dad7235064a6e46f6c308aa574d13a851ee1af492eb63a04a0fa68
MATLAB
646
35
function phiBC = cellBoundary(phi, BC) % This function calculates the value of the boundary cells and add them % to the variable phi % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % extract data from the mesh structure...
5824ebab9a2ced65d4d6e28b989ecbf04a4d070e665a24fb4060dde451aab3fb
MATLAB
646
16
function pstruct = tapas_softmax_wld_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2019 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 (GP...
ed00f939ad9cb49be2b13bddbd5370b4c1f674d976db453964c3152e1e6be4bb
MATLAB
646
37
function r = or(p,q) % this function compares the 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, 'FaceVariable')&&isa(q, 'FaceVariable')) ...
f7c803db17d990dc3ecd3ca87176e003560839ee433beafe33f06f8191f554bd
MATLAB
646
16
function [neworoldforcecurve] = forcecurveneworold (filename) % checks, if the forcecurve is new or old % forcecurveneworold checks, if the first item on in the file specified by % filename is "index" (new files), or "xPosition" (old files). forcecurve = fopen(filename); firstline = fgetl(forcecurve); k = strfind...
5dd628514a51d0a564c29afc813a006367f79b74d8214fcb45704fc96fdaf73f
MATLAB
647
22
function myshuffledMatrix = sub_shuffleAdjacencyMatrix(matrix) %This function takes an adjacency matrix and shuffles the weights between %the nodes to produce a random connectivity matrix % Adham Elshahabi 3rd july 2013 myshuffledMatrix = zeros(size(matrix)); carrieriVector = []; rng('shuffle') for i = 1:size(matrix,...
748c43f0913a6b05fdb3c829b8dcbfa83a0171b743d83b8b60864ad158d73168
MATLAB
647
37
function r = and(p,q) % this function compares the 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, 'FaceVariable')&&isa(q, 'FaceVariable')) ...
7b0be4cc0228b076a181a220f195d8952b6a2893498f5c4e4e7a5a808d589756
MATLAB
647
18
function spikes = GetSpikes(units,varargin) %GetSpikes - Get spike timestamps. % % NOTE % % This function is provided for convenience. It simply calls <a href="matlab:help GetSpikeTimes">GetSpikeTimes</a> % using the same parameters. See this function for details. % Copyright (C) 2004-2017 by Michaël Zugaro % ...
bda89a3c9e6a3e3547d449324c0a55ece201c960a29952f7b3c7ee0102ad5485
MATLAB
647
16
function importOpenField(rootName,dec) %% loads the LFP and position data for a session and saves it all in a .mat file %% rootName - file name common to all files. This will be 'rec01' or 'rec02'. %% dec - factor by which to decimate the data xml = LoadXml([rootName '.xml']); f = dir([rootName '.lfp']); a = me...
486a91598517912dbc86b8b901d3823a12ee389437d2ca93adbdba29b9fe8c2c
MATLAB
648
25
function epis = preprocess_nsd_fixepi(epis,sessix) switch sessix case 35 % subj01-nsd02 epis{2}(:,:,:,128:152) = repmat(epis{2}(:,:,:,128),[1 1 1 152-128+1]); case 40 % subj08-nsd02 % 04b, 5, and 6 need to be scaled by 0.78/0.4 epis{5} = (0.78/0.4) * epis{5}; epis{6} = (0.78/0.4) * epis{6}; epis{7} = (0...
4a6b8448f66484cd59febcedf9c109d004a072db16d018766fdfb5c1fccbd259
MATLAB
648
27
function [state] = tapas_vlinear_init_state(data, model, inference) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % [state] = tapas_linear_init_state(data, model, inference); nc = numel(model.graph{1}.htheta.T); % No need of kernels because of the Gibbs step state.kernel{3} = []; % The state now has a mean a...
6682a290abfbdab03b99c0bca6e6732a5371a8d4b1994429ea960b8f4500a6b8
MATLAB
648
26
function [p,h] = signrank_onesided(x); % returns the p-value from a one-sided Wilcoxon signed rank test comparing % against zero. The exact method is chosen to get the p-values with greater % resolution. %__________________________________________________________________________ % Copyright (C) 2012 Medical Research Co...
697eee5a4d288d205ce85b677b5eda977357b0a53dabdfead39a4248d0a1b7e3
MATLAB
648
18
function [neurons, M, config, kinematics] = loadLock4Classifier(mouse, session, config) % Loads and locks: % kinematics: eventLockKinematics struct (ignored if not needed) % neurons: smoothed deconvolved events % Load R struct with RADICaL for neural [R, M, Rconfig] = loadData(mouse, session, 'R', 'DLC3', config.d...
83595d566d681bec387490d93bcc508bb9c5255febc90f8dfbdaf9dc9f88ff3a
MATLAB
648
30
function plot_core_cells(ax,core_cells,clims) % 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/2020.10.12.335901v1 % Rubén Herzog October 2020 cla(ax); hold(ax,'on'); [N,nens] = size(co...
979bc3d801a2e0161c70ea1063591bdb897388883e608a613a3fcfa6f47a1a24
MATLAB
648
20
%set the filename identifier Identifiers = {'AAzst1avir.N02.*.HEAD', 'AAzst1avir.N05.*.HEAD'}; %Modify here [err, ErrMessage, List] = zglobb (Identifiers); %loop across all Bricks found Nel = length(List); for (i=1:1:Nel), Input = List(i).name; fprintf(1,'\nNow processing: %s ...', Input); [ans, I_Prefix, View] = P...
99fb6670f68dcc9cebdd06a16500f764c98e543df1f770fb14a7fe116bc857ca
MATLAB
648
12
function [MeanMatDat,STDMatDat]=matmean(MatDat) % compute matrix mean and STD of 4D matrices with first 2 dimensions as indices and % last two dimensions as the matrix % it eliminates zero matrices MatDatres=reshape(MatDat,[size(MatDat,1)*size(MatDat,2),size(MatDat,3)*size(MatDat,4)]); ind=find(sum(MatDatres,2)~...
ee1d02d64c913298b50fe6ef531ed69aa45a145d4846c46a19c50c146acd9480
MATLAB
648
38
function [llh] = tapas_dlinear_hier_llh(data, theta, ptheta) %% Likelihood of the nodes of a model with diagonal precision matrix. % Note that this is the likelihood of several parameters theta 1 to n with mean % mu and precision matrix diag(pe). % % % aponteeduardo@gmail.com % copyright (C) 2016 % y = data.y; u = da...
aa3609742495d813a0346507c7c0b75f9be6a6c04e0cdda1d1cd9ef5d3a4fd50
MATLAB
649
20
function cleanup_read_avw_img_slice(tmpfname) % tmpfname = CLEANUP_READ_AVW_IMG_SLICE(tmpfname) % % This will delete the temporary files created by an earlier % call to prepare_read_avw_img_slice. % It is intended to be used together with read_avw_img_slice % routine to avoid doing the conversion once per slice. % ...
f46819eaf6fea60a6a40693674b1018a3421c933fbc4a289dbad87acadcb8faf
MATLAB
649
28
function merged = merge_structs(struct1, struct2) % MERGE_STRUCTS - Combine two structures % % H1 Line: Merge fields from two structures % % Syntax: % merged = merge_structs(struct1, struct2) % % Description: % Combines fields from two structures, with struct2 fields % overwriting struct1 fields if duplicates exi...
50d318ac1e00ef5238a2a3c3847aaaf6898cb69a8a23cc494d34c1aedc8e9ee3
MATLAB
650
34
function BC = createBC(meshvar) % function BC = createBC(meshvar) % Creates a boundary condition structure from a mesh structure % for a 2D mesh. The boundary conditions on all boundaries are Neumann; % The index of each boundary condition is defined as: % 1: Dirichlet % 2: Neumann % 3: Mixed % % SYNOPSIS: % % % PARAME...
5d1cfc85be9d35854c4476e14e854f634b39e4978b7ab88be57e248b1c7c416f
MATLAB
650
26
%% Script to convert hdr/img files to nii. %This script uses SPM function, so you need to install SPM5 or later. %Kiyotaka Nemoto 05-Nov-2014 %% directories outDir = 'D:\outputResults\niftiBrains'; currDir = pwd; cd(outDir); %% select files f = spm_select(Inf,'img$','Select img files to be converted'); %% convert ...
5eec1c4632f34f52a654721112b2d91a28fe0276047ecbde9ba69384910d56b1
MATLAB
650
17
function[OutName] = osp_RemoveSuffix(Name) %% function[OutName] = osp_RemoveSuffix(Name) % Function to remove suffix from filenames while respecting key-value pairs % as defined in BIDs specification. % i.e. RemoveSuffix('MyDataSet_acq-press_act') = MyDataSet_acq-press % while RemoveSuffix('MyDataSet_acq-press') = MyD...
9348b68cf1108abba0c73363157de642623135707fc37d50682e2ec64ddafe17
MATLAB
650
22
function [rsc_mean, rsc_std] = get_rsc_mean_std(spktr) % GET_RSC_MEAN_STD % Syntax: % [rsc_mean, rsc_std] = get_rsc_mean_std(spktr) % Description: % Compute mean and standard deviation of pairwise correlations among % neurons given spike-count matrix. % Input: % spktr : [N x T] spike-count matrix (rows = neuron...
f941e407cf4cd0942c65f7937a038ea0a8e0386e892c971f6e082ee7ebf74b8c
MATLAB
650
30
function [posterior] = tapas_sem_mixed_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); % Does not need to be change...
6aeb6caa1898c5fc14e66ec71ccb0d84e4b9e3f429daeb102e11a2da26dab612
MATLAB
651
25
function [cmd,r]=surfing_afni_runbinary(cmd) % Quick wrapper to either run a binary or get the command to run it % % FULLCMD=SURFING_AFNI_RUNBINARY(CMD) % % INPUT: % CMD Command to run % OUTPUT: % FULLCMD Command preprended with some initialization stuff; currently % only running .bash_prof...
416f0df1f6bf434646eceeff2e49b0d7b8227acf976505febfd30a285dc86119
MATLAB
652
19
function removeLayer(obj, layerName) %REMOVELAYER Remove a layer from the network % REMOVELAYER(OBJ, NAME) removes the layer NAME from the DagNN object % OBJ. NAME can be a string or a cell array of strings. % Copyright (C) 2015 Karel Lenc and Andrea Vedaldi. % All rights reserved. % % This file is part of the VLF...
33a25e6055da1633c17cc8a33367e4f58f126d8feea02fc8994280df36358e3d
MATLAB
653
16
function [Pools_OSI, Cells_OSI] = orientation_pools(sis_query,OSI,Cells_edos) %Indice de selectividad a la orientacion de las celulas que participan en %cada estado y en cada pool. LC05Feb14 La idea es relacionar los stoixeion %con las celulas que son mas selectivas. OSI es un renglon que contiene el %indice de selecti...
343f95e96cf6046c0d2b316cdb8194a861a0b4582d4c9a7f8f5cf3fc677f25b3
MATLAB
653
14
%{ tuning.DotRFMethod (lookup) # options for dot maping. rf_method : tinyint # method number --- onset_delay : float # response onset delay in msec response_duration : float # response window in msec rf_filter : float ...
3519d3a1de66672d8158cb89c4366311e60f7aaf718f9273a78768b3858620b4
MATLAB
653
23
function varargout = covPERiso(varargin) % Wrapper for PERiodic covariance function covPER.m. % % Periodic covariance function from an arbitrary covariance function k0 via % embedding IR^D into IC^D. % The covariance function is parameterized as: % % k(x,z) = k0(u(x),u(z)), u(x) = [sin(pi*x/p); cos(pi*x/p)] % % where ...
f073dc91f8f18ebe180f1a46e25aa555cfab4dd14623734249bd58b88564c60b
MATLAB
653
15
% Extract the numerical values from "s" into the column vector "v". The % variable "s" can be of any type, including struct and cell array. % Non-numerical elements are ignored. See also the reverse vec2any.m. function v = any2vec(s) v = []; if isnumeric(s) v = s(:); % numeric values are r...
0cdb2c8fba4ab5c2470962f7f8e235aca68ca406450da53d563924d63dcfcceb
MATLAB
654
15
%% clear workspace clear all; close all; clc; %% find the location of this code folder_project = fileparts(mfilename('set_up_paths_and_data_directories.m')); %% Add paths (change this to where you have the dependencies installed) addpath(genpath('C:\Users\pkragel\OneDrive - Emory\Documents\GitHub\Neuroimaging_Patter...
14dc6a7efcb3217170cc403c3a275c43823ca0372e9fb7f586a79cd3b32f6d26
MATLAB
654
41
%% (a) % create a panel in gcf. % % "p" is called the "root panel", which is the special panel % whose parent is the figure window, rather than another % panel. clc close all clear all load 'c305a.mat' p = panel(); % pack a 2x2 grid of panels into it. p.pack(2, 2); %% (b) % plot into the first three panels for m = ...
e30f2e6c7459e0bcdc53afde2d056f19783dd9313f6d498fdc2d938fa972e0f5
MATLAB
654
24
%{ aodpre.Spikes (computed) # traces of infered firing rates -> aodpre.ExtractSpikes -> aodpre.Trace ----- spike_trace :longblob %} classdef Spikes < dj.Relvar methods function makeTuples(self, key) dt = 1/fetch1(aodpre.Set & key, 'sampling_rate'); [X, traceKeys] = fetchn(aodpr...
93dc655ec47ac2ac67cf224acc5b17289039f057dc8bc5f24976f611b3ab98c1
MATLAB
656
30
function osp_onOsp( ~, ~) %% osp_onOsp % Callback function on osprey button click. Opens mail contact. % % % USAGE: % osp_onOsp( ~, ~ ); % % % % % AUTHORS: % Dr. Helge Zoellner (Johns Hopkins University, 2020-01-16) % hzoelln2@jhmi.edu % % CREDITS: % This code is based on numerous functi...
cc406183eda83526219e727ce059032dc7f89cc84fcb19b7ce2551f99237a70e
MATLAB
656
22
function [m,dm] = meanLinear(hyp, x) % Linear mean function. The mean function is parameterized as: % % m(x) = sum_i c_i * x_i; % % The hyperparameter is: % % hyp = [ c_1 % c_2 % .. % c_D ] % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2016-04-15. % % See also meanFunctions.m....
e48a60c326775c4e197290a7a3449c9afaeec039c0882866eb21aea78d3bb747
MATLAB
656
32
function [state] = tapas_sampler_mc3(data, model, inference, state) %% Sampler form population mcmc (mc3) % % aponteeduardo@gmail.com % copyright (C) 2016 % % Number of nodes nn = numel(model.graph); % Number of chains nc = size(state.llh{1}, 2); llh = sum(state.llh{1}, 1); lpp = zeros(1, nc); % Get the joint for ...
1d27d3cc32bb870ac8cd2508cddd664c43ec07104e7a24f0cc313aeb7f8f02cc
MATLAB
657
22
%% Setup script for EIF network simulation % Define project root and key directories rootDir = pwd; dataDir = fullfile(rootDir, 'data'); utilsDir = fullfile(rootDir, 'src', 'utils'); figDir = fullfile(rootDir, 'src', 'figure'); simDir = fullfile(rootDir, 'src', 'simulation'); simScriptDir = fullfile(rootDir...
915b3f1bf5d77565a2e54d274c08e7cb76d6e56f83231763840c3be55a686d64
MATLAB
657
26
function d = dist_to_surface(coords, vertices) % Euclidean distance of each of a set of [x y z] coords from a surface defined by a list of [x y z] vertices % % e.g., % coords = [-22 0 -12]; % vertices = vertices = get(p(1), 'Vertices'); % % coords = [-22 0 -12; 30 30 30; 42 12 3]; % d = dist_to_surface(coords, vertices...
c5d945a4c16f23b17eada0c81887c69dfe91504142e50ff99f6d3648191f7779
MATLAB
657
27
function MM = markovmodel(X, N) %% MARKOVMODEL % Return an Nth order Markov model representation of the state sequence % X where X is a row vector of length L or a matrix (L row * M columns) % by Greg if nargin < 2 N = 1; end [C1,~,S1] = unique(X,'rows'); M = []; for(t=1+N:length(S1)) M = [M; S1(t-N:t)']; en...
c82a27ca2e59302a2586af9a079cb618a9b0c2f38c2299e04a8e6adfa6ccb219
MATLAB
657
19
function [myelin] = DEMYELINATION(myelin,C3) % C3: create tall 2 column array where col 1 is x pos, col 2 is y pos C3_pos = [C3.x; C3.y]' ; % Find where C3 cells occupy same place as myelin [~,index_my,~] = intersect(myelin.colarray,C3_pos,'rows'); % Degrade the health of occupied myelin by 1 grade myel...
dd8898739e0f2b8924c1c236a91588b981c51a21a6016d9ef30e863c43545b41
MATLAB
657
30
function [ output_args ] = read( filename ) %READ( filename ) Reads a text file and returns a cell array of the lines. % % % === Jan Moelter, The University of Queensland, 2017 =================== % % Alternative implementation: % % i_ = fopen( filename , 'r' ); % while( ~boolean( feof(i_) ) ) % out...
3a71540e2b0197998f451b6bc5066b20189bc60ecfb8a410d1439ab7711dc135
MATLAB
658
27
%% sepia_print_checkbox_value(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 % % Output % -------------- % val : (optional) output % % D...
345e4ea6c126d8605fa3f70822d78cfd1390b60bd61f9dd7e8942c26bd2c64e3
MATLAB
659
21
function residuals = Residuals(variable, factor) % Computes the residuals of a variable after removing the part that is % explained by a factor (second input) using a linear fit. % % SEE CorrResiduals % % % Copyright (C) 2024 by Ralitsa Todorova % % This program is free software; you can redistribute it and/or modify ...
5d8eba32fe4cc140a3077c92d09532bc1e72f11cec82a9298db2c75deccb2c59
MATLAB
659
18
function trace = remove_50Hz(trace,fs) % Remove 50 Hz and harmonics from a given trace of sampling rate fs fn = fs/2; % Nyquist frequency f0 = 50:50:fn; % For 50 Hz and harmonics freqRatio = f0/fn; notchWidth = 0.1; for n = 1:length(f0) notchZeros = [exp(1i*pi*freqRatio(n)), exp(-1i*pi*freqRatio(n))]; ...
73c6a42030af488fcc4800fe8de10f82be920ee6a45f968e0fd0a592c4b1bbf3
MATLAB
659
14
function TMSDicomConvert(DicomDir,NiiDir) [ProgramPath, fileN, extn] = fileparts(which('TMStarget.m')); DicomDir NiiDir if ispc eval([['!' ProgramPath,filesep,'DCM2NII',filesep 'dcm2nii.exe '],... [ '-b ' ProgramPath,filesep,'DCM2NII',filesep,'TMSdcm2nii.ini'],... [' -o ',NiiDir,' ...
fb946d365b9db2edd38d60c6a0d0dcd667fdb5b19439371cbd3d0f7338719f6f
MATLAB
659
20
function a = vl_taccum(alpha, a, beta, b) %VL_TACCUM Compute A = alpha A + beta B % A = VL_TACCUM(ALPHA, A, BETA, B) computes efficiently A = alpha A % + beta B. For GPU arrays, it performs its computation in place, by % modifiying A without creating an additional copy. % Copyright (C) 2016 Andrea Vedaldi. % Al...
d83645bbcdc8f8853204261275e3c19127bd60ac366d812224ae02bd3fb001da
MATLAB
660
30
function SOMResults_view_connections(studyByCluster,cl,wh) % function SOMResults_view_connections(studyByCluster,cl,wh) % a) find clusters significantly connected to this one wh_conx = studyByCluster.sigbonf(wh,:); wh_conx(wh) = 0; wh_conx = find(wh_conx); cluster_orthviews(cl{wh},{[0 0 0]}); %studyByCluster.colors(...
169f7795c796ce6bdf4e2049b447f981d43f069131dc152ac839a2ccc01afb17
MATLAB
661
33
function FigureS10(datadir, codedir) %FigureS10 - Sub-optimal inferential model with lambda % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... codedir, 'IgnoreCase', ispc); if ~onPath addpath(genpath(codedir)) ...
3ea8cbe97661fbcb741dd717c5767ac792884aed3485f1db2014e348e2dfb083
MATLAB
661
31
function ordering = time2peak(X,ops) %gives sample ordering by time to peak [nn,nt] = size(X); %ordering, per alignment peakrange_start = [1,nt]; peaktimes = zeros(1,nn); %time to peak if isfield(ops,'useZScore') if ops.useZScore data_zscore_k = zeros(nn,nt); %for data for j = 1:nn da...
866feeca7f8b70e80e2980d4aaecc87c3b5bded67ebc6cbced5c2fe545699ce2
MATLAB
661
18
function cfnParams = UpdateClassifierText(cfnParams) switch cfnParams.whatClassifier case {'linear','linclass','fast-linear'} cfnParams.classifierText = 'simple linear classifier'; case 'diaglinear' cfnParams.classifierText = 'linear naive Bayes classifier'; case {'svm','svm-linear'} ...
b1c98a8d3f4e9f877dfea7a2773b5a4d45e0bb581570eb41bf487971a4f80ca5
MATLAB
661
20
function plotPretty(x, y, color, errortype) % Plot mean and shaded errorbar. Default error type is sem sem = @(xx) nanstd(xx) ./ sqrt(size(xx,1)); if size(y,1) > 1 if nargin<4 shadedErrorBar(x, mean(y, 'omitnan'), sem(y), 'lineprops', ... {'color', color, 'linewidth', 1.25}) elseif strcmpi...
4cbf591501d6923bc8a8289eec2cacc208a6f7572eb71c0ee694deacf9b45169
MATLAB
662
29
function [scut] = calc_scut(data) % calculate threshold of similarity values from shuffled data num_shuff = 100; p = 0.88; dims = size(data); % make shuffled data data_shuff = zeros(dims(1),dims(2),num_shuff); for n = 1:num_shuff data_shuff(:,:,n) = shuffle(data,'time'); end % calculate similarity matrix war...
a780064dcbfd89d132c1389839fb512c3b9b30945b1d1d07722553157bac5938
MATLAB
662
21
function [rez]=autocorrelogram(rez) edges =-50:1:50; M_clust = length(unique(rez.st(:,end))); rez.PETH = zeros(100,M_clust); for i=1:M_clust Spike_id = find(rez.st(:,end)==i); M1 = rez.st(Spike_id,2); M2 = M1; TrialN = length(M2); C = zeros(TrialN,length(edges)-1); SpikePETH_M = zeros(...
dbb1ff2739e2ec812acb244d72e3faacc30c0974179193cf745684f9aace238e
MATLAB
662
25
classdef (Hidden = true) baseScaler < handle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % baseScaler is a base classs for scalers. % % Emin Serin % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% properties fitParams end...
1a20cd5b7e0ef220dad81573b1caec605db46ac055c92d252cb7357ed85cf5ad
MATLAB
663
31
function coeffmap=rcunmx(V,R,fps) coeffmap=zeros(size(V,1),size(V,2)); Iv=squeeze(mean(V,[1,2])); [Fhemo,optsHB]=unmixing.FindHBpeak(Iv,'FrameRate',fps,'VerboseMessage',false,'VerboseFigure',false) Fhemo Fh=Fhemo.Location; for ii=1:size(V,1) ii/size(V,1) for jj=1:size(R,2) Iv=squeeze(V(ii,jj,...
1fe251033d140f68255659ce4368a5b5feaef3b84482ef63ea14cdf422a50544
MATLAB
663
18
function TMSFlipImageLR(ImageDir,OutputDir) if nargin<1, ImageDir = spm_select(1,'Image','Selecting the iamge need flip...') OutputDir = spm_select(1,'Dir','Selecting the output dir...') end ImageHeader =spm_vol(ImageDir) ; [ImageVol,ImageXYZ] = spm_read_vols(ImageHeader) ; Dim1 = size (ImageVol,1) ; Dim2 = ...
68b88908fbb403408ccb5f4842ad57362c8eee7898c248d94ed0421ce9630208
MATLAB
663
25
function isdir_or_mkdir(p) % ISDIR_OR_MKDIR Checks that a directory exists, or if not, creates the directory and % all its parent directories. % % See also FOPEN_OR_ERROR % add trailing file separator (slash or backslash) p_full=[p filesep]; % we are looking for strings not containing the file separator, these are %...
d253c495ff2ec374e72ab1ebdf3f706bf1680d7ebd127281dc766879ae77888c
MATLAB
663
36
function roi = getXCROI(im, time_series, thresh, filt) xmin = 1; ymin = 1; xmax = size(im, 2); ymax = size(im, 1); xpix = xmax-xmin+1; ypix = ymax-ymin+1; ref = time_series; ref = ref-mean(ref); frames = size(im,3); corrs = zeros(ypix, xpix); for i = ymin:ymax tsrow = MySmooth(double(squeeze(i...
01228419b62fb3b1adb976c1947ca3a47604862cb43c4b0f02ae7d8d6daa8ac7
MATLAB
664
19
% Load the matlab file containing an example T1 map fn = 'sampleT1map.mat'; data = load(fn); im = data.sampleT1; loLev = 400.0; upLev = 2000.0; % Call the relaxationColorMap function % This (slightly) processes im into imClip, by setting all values 0<x<loLev to loLev+eps, and all values x>=loLev to x. % It also retu...
4a772773e2b8e0ee40969abb941fdd544fd4b8517056a70ed6e9cb37093b75a5
MATLAB
664
31
classdef image properties fname_list = {}; end methods function obj = image(varargin) obj.fname_list = varargin; end function value = subsref(obj,S) S.type = '{}'; value = subsref(obj.fname_list,S); end ...
58cc5a9a028ae4606d590022fe372a54b921c97fdc73695f581ff72ae6742272
MATLAB
665
32
function x = make_sin_out(T,Sdim,parm) % Sinusoidal signal if isfield(parm,'Tstart'), Tstart = parm.Tstart; else Tstart = rand(1); end % period Tmin = parm.Tmin; Tmax = parm.Tmax; if Sdim==1, Tperiod = Tmax; elseif isfield(parm,'Tperiod') Tperiod = parm.Tperiod; else Tstp = (Tmax - Tmin)/(Sdim...
7f2575e804ddc17825ae4abd7ee3d2f7b540dd8c53a5a203ae02436f0ce04a5e
MATLAB
665
23
%{ # eye velocity and timestamps -> experiment.Scan --- -> preprocess.EyeQuality eye_roi : tinyblob # manual roi containing eye in full-size movie eye_time : longblob # timestamps of each frame in seconds, with same t=0 as patch and ball d...
9a504a6c5523be912881c0e807eeee09a582279414450b1beb705d129153f00e
MATLAB
665
37
function r = times(p,q) %TIMES this function multiplies the 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, 'FaceVariable')&&isa(q, 'FaceVariab...
e3f3ba91b33dc44e39b719f983017962d5918b63c40306a969cf6b2f86a20e79
MATLAB
665
21
% undistort stack function [movie_undistort,pixel_size] = undistort_stack(movie,zoom) moviex = undistort(movie(:,:,1),zoom); width_undistored = size(moviex,2); width = size(movie,2); [pixelsize_x, pixelsize_y] = pixelsize_xy(zoom,width,width_undistored); x1 = 1:size(moviex,2); x2 = linspace(1,size(moviex,2),size(moviex...
4b423d00d1af0f1936b5983ddf944d1c4f570d58c1b78b59512f18a2d08af299
MATLAB
666
29
%{ preprocess.ComputeTraces (computed) # compute traces -> preprocess.ExtractRaw --- %} classdef ComputeTraces < dj.Relvar & dj.AutoPopulate properties % Twitch traces are populated in Python popRel = preprocess.ExtractRaw & (experiment.SessionFluorophore & 'fluorophore!="Twitch2B"'); end methods(Acce...
64df760efe1ebcefd8e74d3a57562564fd9035a092d9da1205eb7a4c90058441
MATLAB
666
37
function r = rdivide(p,q) %RDIVIDE this function divides the 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, 'FaceVariable')&&isa(q, 'FaceVaria...
942d32a43b357160dcb5a952a033703064a1aab3fe853bced3159168dabb2b96
MATLAB
666
15
function control_max_eig = shift_thetacycle(SpikeCount,number_of_surrogates,binspercycle) 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)/binspercycl...
bdc801ebdd31c41344066abc14a453b4be909dfdeca8682c685fb20ad582259a
MATLAB
666
16
function y = tapas_logit(x, a) % -------------------------------------------------------------------------------------------------- % 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 (GPL), version 3...
c791de79d3e751ccc6cf6e2a17c406cb3cc36c72c90d721db11f39c57775cec8
MATLAB
666
20
function aesthetics() set(gca, 'box', 'off') % remove borders set(gcf,'color','w'); % white background set(gca, 'TickDir', 'out') ax = gca; try ax.Colorbar.TickDirection = 'out'; ax.Colorbar.FontName = 'Arial'; ax.Colorbar.FontSize = 12; catch end % set(gca, 'Box', 'off', 'TickDir', 'out', 'Tick...
bb3ad27d4a9581e333fbb4d3491ec42f61629d9c9619532eb41016d7f14a42ef
MATLAB
667
37
function r = power(p,q) %RDIVIDE this function power (.^) the 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, 'FaceVariable')&&isa(q, 'FaceVari...
bf6918fd8398687797ca4b73dedd8054f8df5d6bb65058520b4b2e11580a58f9
MATLAB
667
24
function rejectData(params, varName_prefix) % rejects outliers in data based on normal distribution % (c) Jiri, Apr16 % load data varName = [varName_prefix '_prc']; load(params.storage.sessionCacheFiles{params.thisSess}, varName); d = eval(varName); r = logical(zeros(size(d))); % normal distrubution fit sigmaThr = ...
3d5b900ffe7149ceb49ee421a2e92abedd5cfd604e1079384772e75e3ab7e32a
MATLAB
668
22
function [results] = analysis02G1(config) % Runs analysis02G: Evolving populations of reservoirs by selecting for % -alpha*P(S)+(1-alpha)*P(E) for varying alphas. % set a unique random number generator seed! rng(config.seed) % turn struct input into name-value pair cell config.populationProperties = struct2NV(config....
f0cc6ff6bc98c9dd19c76218cd8a5b3ec97f164c81100e268b71b1e1de660d59
MATLAB
668
27
function [ params ] = nmri_get_params( analysis_dir ) %[ params ] = nmri_get_params( analysis_dir ) % Returns the params for a specific analyis dir or pwd (if not specified) if ~exist('analysis_dir','var') analysis_dir=pwd; end % check the params struct if exist(analysis_dir,'dir') prev_dir=pwd; cd(analysis_dir...
4cab0868785f24db0c36d8fb3f81351fd7f9d36daff78c32f3cb215be2786070
MATLAB
669
22
function [psi, vmi, xmi, debiased] = computeEmergence(o, R, tau, nbsurr) % Computes psi, vmi, xmi for the reservoir output o, produced by states R. % Optionally, performs debiasing of psi results. % compute emergence if length(size(R)) == 2 [psi, vmi, xmi] = EmergencePsi(R', o', tau); else [psi, vmi, x...
a28245a96a5a11867eaebc2a2af6435c0c93e8e0122fbf8acbfcf64609a1ed9e
MATLAB
669
37
function r = lt(p,q) % this function compares the less than 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, 'FaceVariable')&&isa(q...
f2745dffa0553ee99bc3660bf728568001405edc9287cf6688dff3f4f1516c47
MATLAB
669
23
%{ # master table with general data about the stacks -> experiment.Stack -> stack.Version --- nrois : tinyint # number of ROIs nchannels : tinyint # number of channels z_step : float # (um) d...
f3257d51dc99829e046860c60295b3929c22b37360b365bcaa71620369d8a2c4
MATLAB
669
27
function fid = fopen_or_error(filename, permission, varargin) % FOPEN_OR_ERROR Opens a file, like fopen, but throws an exception if the open failed. % % This keeps you from having to write "if fid < 0; error(...)" everywhere % you do an fopen. % % See also FOPEN, ISDIR_OR_MKDIR if nargin < 2 || isempty(permission) ...
fe7bfd6cb79d7c35f7446fa85f5cbbaa2944be3b3922044be7e2c001e61d0c4d
MATLAB
669
35
%Grafica las variables desde el Workspace. LC %Hace todas las graficas del Stoixeion exepto Dunn�s index path(path,'.\AGORA') clear Z col=size(LLE_Z,2); Z=LLE_Z(:,col-1:col); clear centros ii=size(Pk_edos,2); figure(1) FCMcallLC; %------------------------------------------------% ii=centros; figure(3) KmedoidcallLC; ...
1ee8bd846c1dba8623e48b21c052e1e07a33a6aa8b8e15fce97f751cac024acd
MATLAB
671
37
function edges = compute_edges(face) % compute_edges - from a list of faces, compute the list of (unique) edges. % % edge = compute_edges(face); % % Copyright (c) 2004 Gabriel Peyré if isempty(face) edges=[]; return; end [tmp,face] = check_face_vertex([],face); if size(face,1)~=3 error('Problem'); e...
a75981b51baf324480349df1e7fb7c450ada129edbcc8ba1b17e1ac9a98baa2d
MATLAB
671
22
function [NEW_WINDOW]=getBestWindow(SIGNAL_LENGTH, TIME_WINDOW, SAMPLING_RATE) % get the best window in sec for a given signal length to trunc it in % approaximatly equal length (exept the last section for which the % remainder will be add up) % All input-output are scalars % [NEW_WINDOW]=getBestWindow(SIGNAL_LENGTH, T...
49c539bdb855bc9bd5c1fa2bde103dc90fd6377cc11c2a6075885d6abb7c7721
MATLAB
672
37
function r = gt(p,q) % this function compares the greater than 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, 'FaceVariable')&&is...
57af962f07f52275ac101aa7a0e8e3b25cfc5eaa31c4a6f945dfa779638bb66d
MATLAB
672
25
function d = getdict % Dictionary of GIfTI/NIfTI stuff %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: getdict.m 2271 2008-09-30 21:19:47Z guillaume $ persistent dict; if ~isempty(dict) d = dict; ...
f891115da6a5c2ec0e33baa0bc82ae69ef105d6cf6e1987a077fc6d88d2a2d73
MATLAB
673
20
function result = SLM(x, c0, c1, c2, alpha, dta, r, f0) %% this is ChatGPT's translation of Ryan Greenhalgh's slm_hyp1f1 from functions.py in pyforce %% created 7/4/2025 % Function to calculate the given expression in MATLAB % Initialize the function value func = c0; % Add the exponential and...
03ff00e9cbe97b039b0de2a1ec393f058d6d373d5d09378241f6798bf4faa6bc
MATLAB
674
27
function varargout = covSEproj(d,varargin) % Wrapper for Squared Exponential covariance function covSE.m. % % Projected squared exponential covariance. The covariance function is % parameterized as: % % k(x,z) = sf^2 * exp(-(x-z)'*inv(P)*(x-z)/2) % % where the inv(P) matrix is L'*L with L of size (d,D) and sf^2 is t...
4051a3cb1576c51b939e6422133df424941375854d3067e3b08eea0eecb2b756
MATLAB
674
21
% undistort stack function [movie_undistort,pixel_size] = undistort_stack(movie,zoom) moviex = undistort(movie(:,:,1),zoom); width_undistored = size(moviex,2); width = size(movie,2); [pixelsize_x, pixelsize_y] = pixelsize_xy(zoom,width,width_undistored); x1 = 1:size(moviex,2); x2 = linspace(1,size(moviex,2),size(moviex...
cce997f7dbc613653778432ef74cf21b5626fe21251961b7dcfc817626b10eb5
MATLAB
674
21
function [nbRepetitions, nbEventsPerBlock, maxNbPerBlock, nbBlocks] = getDesignInput(cfg) % % [nbRepetitions, nbEventsPerBlock, maxNbPerBlock, nbBlocks] = getDesignInput(cfg) % % % (C) Copyright 2020 CPP visual motion localizer developers nbRepetitions = cfg.design.nbRepetitions; if strcmp...
fd078ad50cc57af50b9d1df7a65f1115929aba2fad167ee35c339c7a03b2da1d
MATLAB
674
22
function roi=mask2roi(mask) % gives the oordinates of the marked points in an input matrix mask. % this function assumes that any non-zero entries are part of the roi. % For example when the input is a 3D binary mask, the output would be % triplets containing the coordinates of the points (in matrix space) where % the...
26a7a14b3e01dac7d19b71d82273f5ad560cabc5dcd5c1085cdde62fff6a3b20
MATLAB
675
29
function [sigma, shrinkage]=covdiag(x) % function sigma=covdiag(x) % x (t*n): t iid observations on n random variables % sigma (n*n): invertible covariance matrix estimator % % Shrinks towards diagonal matrix %authors: N Kriegeskorte, M Stokes % de-mean returns [t,n]=size(x); meanx=mean(x); x=x-meanx(on...
8fcf0a0548d2d440fd813d281ed0690ff8cbb26673d369b36895cdfb040e46d9
MATLAB
675
33
function f = translatevmetric(x) % function f = translatevmetric(x) % % <x> is a matrix of "v metric" values % % Convert the <x> values to SNR units. f = 1-x.^2; f(f<0) = 0; f = sqrt(f) ./ x; % OLD: % % Use the simulation results to map the <x> values % to SNR units. We carefully handle corner cases (see code). %...
e57d77acfc4664aa7645e77942f55d4fb3ba337abfb1240d24278eaa71ac3c4b
MATLAB
675
44
function [auc,p] = rocauc(x,y,minmax) if nargin < 3 minmax = false; end if nargin < 2 error('Missing input argument(s).'); end auc = []; p = []; x = x(:); y = y(:); xall = unique(x); yall = unique(y); if length(xall) < 2 auc = 0.5; p = Inf; return end if length(yall) ~= 2 e...
93057c13bda6bdab6a76f30ae35815b1bfb9bfbde906ffca071ca8bfebb5e1b2
MATLAB
676
23
function BrainNet_vtk2nv(inputfilename,outputfilename) fid = fopen(inputfilename); tmp = textscan(fid,'%s',8,'CommentStyle','#'); vertex_number = str2double(tmp{1}{7}); coord = reshape(cell2mat(textscan(fid,'%f',3*vertex_number)),[3,vertex_number]); tmp = textscan(fid,'%s',3); ntri = str2double(tmp{1}{2}); tmp =...