sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c959c6c4204b04b4406ca9af3755209a2c9778342a6658268db506333f3784bd
MATLAB
2,024
77
function [weiBM,avgWeiBM,binBM,avgBinBM,sizesMat] = get_block_mat(cij,ca,noNan) % given an adjacency matrix + community affiliations, return a block matrix % % inputs: % cij: adjacency matrix % ca: community affiliation vector % noNan: do not count nan edges when getti...
12735bbf6f7403ad1340d424f17673a6f40398734ec309835683362eed109c42
MATLAB
2,025
55
%% clear all close all run(['..' filesep 'def_local']) addpath(genpath(path_mTRF)); addpath('ERBfilter'); addpath(path_fieldtrip) ft_defaults run make_stimuliList.m %% all_CorrEnv=[]; StimProfiles_freq=[2 8]; Lists={'A','B'}; Types={'SWS','_voc_7Bds',''}; for nStim=1:80 for nList=1:length(Lists) StimPro...
6a70f5a6bdd764a2ee0f78e65b486657f2c338026f3f7de40f9045c220a9e434
MATLAB
2,028
70
function headingEsts = runCDModel(nameValueArgs) %RUNCDMODEL Run Competitive Dynamics model through all or select stimuli arguments nameValueArgs.sampleNums (:, 1) double = -1; % -1 means all nameValueArgs.settings struct = readSettings() nameValueArgs.runParallel logical = false end settings = ...
10588105dad48e74bfbdce115b565a3a4826c199a7afa0e50dcb3c236c541a56
MATLAB
2,031
70
classdef( Abstract ) Flex < handle %uix.mixin.Flex Flex mixin % % uix.mixin.Flex is a mixin class used by flex containers to provide % various properties and helper methods. % Copyright 2009-2020 The MathWorks, Inc. properties( GetAccess = protected, SetAccess = private ) ...
83ce84129667f6d19cfa4005e9ee33b4299a1d0705a87597c070c7628d9ef5e9
MATLAB
2,033
59
function plotPSTH_fig1(dataM,idxstimsubset,P,subplt,wpatch,scale,col,line) %%% Expect a format dataM: time bins x stimulis x animals if ~exist('wpatch','var') wpatch = 1; end if ~exist('scale','var') scale = 0; end if ~exist('col','var') col = P.SndColors; end i...
a17030d68682ca34212b1bc84b8c888d89dae89f2c283619765ede32f85c078c
MATLAB
2,033
87
%% Realign and then smooth functionals % Subjs = getSubjects; Subjs = {'Bass','Butch'}; F = getFncDirs'; clear e r e.quality = 1; e.sep = 1; e.fwhm = 2; e.rtm = 0; e.interp = 5; e.wrap = [0 0 0]; e.weight = ''; % r.which = [2 0]; % r.interp = 5; % r.wrap = [0 0 0]; % r.mask ...
a3ef9a36f7e4bbc5839533a7e500663ad5767e0d1f516d2675dfade4bf0f15f5
MATLAB
2,038
70
function [AdjM,cn] = AdjMtx(Surf,maskvtx) % AdjM = AdjMtx(Surf,maskvtx) % % This function finds the adjacent vertices for all vertices along the % surface. % % Input % Surf: Surface. It is a structure with Surf.tri = t x 3 matrix of triangle % indices, 1-based, t=#triangles and Surf.coord = 3 x nv matrix of % coord...
a575a2eb708c63ef884f2b846f86faf246115685170de800b99bc9ae0254125d
MATLAB
2,047
58
% Written by Sham Tlili and edited by Timothy Saunders % Code for aligning data of CNS from SPIM data to detwich embryo % Reads data in "images_original" % tstart= first time point to be aligned % tend = final time point to be aligned % dbin = binning of data % optimizer allows control of iterations, step lengt...
38cff30c7bac1387808f3197a93d14880b5d8a6f4014babfdd04d7289fec2d92
MATLAB
2,048
63
function progress(count,N,step) % % progress(count,N,step) % % Placed within a loop, a call to the PROGRESS function displays a progress % message and some time estimate. This estimate is only exact if each run % of the loop takes roughly the same amount of time. % % Prior to the loop, call the function without argumen...
4b11cd2327722dfd0f3ea40fcccc7c9ef99aaaf6ce3526e5f361e9647ac3a77f
MATLAB
2,048
71
function [map] = cr_coherence_vs_psd(val, PeakPos, PowerSpec, CBF) % This function goes with cr_coherence_ref % Take the previous reference pixels and scatterplot the coherence versus PSD for that given pixel % OBS: I need to save the ?? %% Heatmaps of reference pixels map = zeros(CBF.x, CBF.y, length(C...
65b602ea253bd34ef25a28f9079e5350425ad74c39b71f92a27ca87d7b885bb1
MATLAB
2,053
57
function params=tpreadconfig( tpdirname ) %TPREADCONFIG read twophoton experiment config file % % % PARAMS. = % params.Main.Total_cycles (total number of cycles) % params.Main.Scanline_period__us_ (scanline period, in us) % params.Main.Dwell_time__us_ (pixel dwell time, in us) % params.Main.Frame_period__us_ (...
363a7ecec77b60d8e240cb5c48e94c2b397a8884283c3f51390cdff4de9a7552
MATLAB
2,055
56
function [J_x J_A] = MVAR_JacCSD(A,x_ext,p) %Complex Step Differentiation (CSD) for computing the Jacobian matrix % % Arguments and variables: % CH: number of channels % p: MVAR model order % x_ext: (CH*p x 1) Input vector of the MVAR model, x_ext(k-1) = [x(k-1); x(k-2); ...; x(k-p)] % A: (CH*p x CH*p) All MVAR...
a4c63d8bb997ac5a0d376d2dabfbcc2be50b24d41d0dc8e1bde563720ce91f8a
MATLAB
2,055
74
function gr = lme_Gradient(X,Zcols,W,invH,L,phi,re,ni) % gr = lme_Gradient(X,Zcols,W,invH,L,phi,re,ni) % % Gradient vector for the restricted log-likelihood. % % Input % X: Ordered design Matrix (according to time for each subject). % Zcols: Vector with the indices of the colums of X that will be considered % as rando...
1d7bf44f22e68053d18072b644578cf99889627128e194636ee9c3ee566ef86b
MATLAB
2,061
62
function [accVid,accSnd,p] = plotDecoding(acc,decP,sideTransec,chanceLevel,pltInset) if ~exist('pltInset','var') pltInset = 0; end idxviddim = size(acc,3); % usually the way it goes idxsnddim = 1; p(1) = signrank(acc(1,:,idxviddim),chanceLevel(1),'tail','right'); p(2) = si...
e6f10185505c0af1dd12ae294fdae0474b09af250e55b22af6872a4726990ba4
MATLAB
2,062
88
function [wfa, wfb] = dib_wf_pte() % function [wfa, wfb] = dib_wf_pte() % % By Filip Szczepankiewicz % % Planar tensor encoding (PTE) % for the "data in brief 2019" project. %% PTE wfa = [ 0 0 0 0 -0.7301 0.6840 0 -0.7289 0.6853 0 -0.7263 0.6880 0 -0.7222 0.6924...
9563b5496a4b5fde625abec688c3e72a0d34b8d38ce019dbe6701b1afc1173cd
MATLAB
2,063
51
function [spikes, new_clust] = break_minicluster(spikes, mini) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % break_minicluster - splits a mini cluster into two mini-clusters % % Usage: % [spikes, new_clust] = break_minicluster(spikes, mini) % % Description: % Splits a mini-cluster int...
cfa9015e2f5ca64277bc13418d949a2340e7980d56f2c952a1c2cb864c279e70
MATLAB
2,063
40
function fiberCenter = remove_fiber_overlap(fiberCenter, fiberR, placedFiberCenters, placedFiberRs, availableArea, minFiberDist, fibp) rhRatio = 1/cos(pi/fibp); % Ratio of radius on apotheme of inscribed reg. polygon. % [x, y] = centroid(availableArea); % destCentroid = [x, y]; availableAreaFib = availableArea; w...
d86e1eb12335eafa642d883ee92cfff8bcbfc641f98d55d19db3c91c547bcf72
MATLAB
2,066
64
function [im,params]= previewprairieview(dirname, numFrames, firstFrames, channel) % PREVIEWPRAIRIEVIEW - Preview PrairieView image data % % IM = PREVIEWPRAIRIEVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAM...
fcfe177ebda846dedd21c8bfc217c3706601ef7e958e5bfad905ca228f7fbe32
MATLAB
2,069
67
%===================================================== % FileName: extract_online_traces.m % Designby: Zhe % Modified: 03/09/2021 % Describe: Extract fluorescence traces from the calcium image dataset. % Suppose C: Number of cells; T: Number of frames % traces <C,T> %===============================...
1d650f058a9007bff37a7dde7b82b082ba14313b9737c104c45b242c0253683f
MATLAB
2,071
76
%% Script to generate Figure 8 clear all close all runs = 10; epochs = 1000; hunits = {'4', '8'}; runsstrings = {'Run1','Run2','Run3','Run4','Run5',... 'Run6', 'Run7','Run8','Run9','Run10'}; rmseGRUT = zeros(runs,epochs,length(hunits)); rmseGRUV = zeros(runs,epochs,length(hunits)); % All GRU for hu = 1:length(h...
a2037726afde3dd2f1ebf7eb2ed30d2fac709a9768a980d5c84283d990a6b4dd
MATLAB
2,071
67
function model = qtip_data2fit_NLLSdc(model,signal,bten,ind) % function m = qtip_data2fit_NLLSdc(model,signal,bten,ind) % % fits the QTI parameters using NLLSdc if (nargin < 4), ind = ones(size(bten,1),1)>0; end signal = signal(ind); bten = bten(ind,:); bt2 = convert_1x6_to_1x21(bten); model = double(model...
227d9d19693ad955a2a70fb1d5bc724bbe1cf5b1d439489f03cfabe6acb3e78f
MATLAB
2,072
68
function [phi, v0, v_direction, fullStruct] = orderParameter(vx, vy) % Function to calculate order parameter, from equation 1 in Collective % Motion by Vicsek & Zafeiris. % VX and VY must be NxMxtime vectors giving the x and y components of the % vector field. If VX and VY have more than 3 dimensions, extra dimensions ...
524bc655c02caaaff240e00842982824e4810e3f5801266a986d0581c490ea2a
MATLAB
2,073
79
function plotSnapshotsAndVfs(snaps, vfx, vfy, allPatternLocs, isPhase, plotSeparate, nsnaps) % Function to plot consecutive snapshots with their corresponding velocity % fields. VFS can either be a complex matrix where real gives x-coords and % imag gives y-coords, or can be input as two varibles. Default is to overla...
28af5ea5451def502f41e14a9b6e23c423cfe1dcba1edd0ee2354d1c48ffc9bc
MATLAB
2,074
76
%% Two arbitrary partitions p1 = [1 2 3 3 2 1 1 3 3 1 2 2]; p2 = [3 2 3 2 2 1 1 2 3 1 3 1]; % Compute the unadjusted rand index ri = rand_index(p1, p2); assert(ri == 7/11); % Compute the adjusted rand index ari = rand_index(p1, p2, 'adjusted'); assert(ari == 1/12); %% Two perfect partitions p1 = [1 1 1]; p2 = [1 1 1...
3301af8101e921d93832bc3de66164aa7b9cc12815199ad7d9c783fb451f1e09
MATLAB
2,075
66
function Assemblies = MakebestEnsembleAssemsCrossShufflePosthoc(UnitsReal, Ltrials_,Rtrials_,MaxSize,CorrsToDestroy,noTrials,nReps,unitSelection) Assemblies= struct; %@TODO: add shuffling of trial labels between cells to non- trial-resampled version InfoCriteria = 'max'; nReps = 50; noTrials ...
480cdccf6b05d6f3db3ad2b63c1520a2af29d208bc6d68ff8875f3fdacd2b1f4
MATLAB
2,075
61
% function for randomizing spike times % Spike times are randomized within and across MEA channels % Arguments: % tb = table containing all the metadata % index = row of tb to run (i.e. recording number) function fx_randomize_spike_times(tb, index) % Get all the relevant metadata for recording file_id...
9daec457a2a746a8fe4a8ec8f1b7bd91a6868dbf5c6ea91f4ea86020e6d7ed56
MATLAB
2,075
70
function res = estPsychFnc(Data) % res = estPsychFnc(Data) % % Fit Psychometric function and plot using the psignifit toolbox % https://github.com/wichmann-lab/psignifit.git % % Input: % Data ... Structure of Data from running the NHP joystick sound % localization task. % % Output: % res ...
2b9a5f7e38138f0c8402c1dcc28089f97be32fb2ef79a817d508e29d797e4caa
MATLAB
2,076
77
function step1_tempConverter(rootDir) % % Convert weird temp files from TC Central into table with same file name % (but different extension) try % Define paths if nargin == 0 rootDir = Cloudstation('Vowels\Noise\Cooling\Data'); % rootDir = Cloudstation('Vowels\Spatial_Unmasking\Cooling\Data'); end % % sour...
cd16c826b67aaf5f87f0cc0f4b64fb845b4884e2384f3fa3b053c4fa2fb63322
MATLAB
2,076
56
% Convert bin-epoched EEG to a bin-organized EEG structure % may be useful for subsequent decoding scripts % axs 2020 % % Inputs: % EEG - an EEG set, which must have been processed with ERPLAB, with % valid EventList, and be bin-epoched EEG data % write_file_path - optional full path to write file to, str...
ae65bc15dd8873a2e756054c0351ffb3da5aeab27448534c0d78ce43395d07c1
MATLAB
2,081
84
close all; clear all; netName = "squeezenet"; net = eval(netName); inputSize = net.Layers(1).InputSize(1:2); classes = net.Layers(end).Classes; layerName = activationLayerName(netName); im = imread('ngc6543a.jpg'); imResized = imresize(im,[inputSize(1),inputSize(2)]); imageActivations = activations(net,imResized,lay...
dd9ffa533187d32a4887ea8365577df92511d1037b325a0c1e4f43d43a07e45c
MATLAB
2,081
74
function [ciu,Aall,anull,A,ciall] = get_SCmodules_MRCClite(K,sam1,sam2,maxC,r1,r2,tau) % % INPUTS: % K: network data % sam1: samples communities first loop % sam2: samples communities second loop % maxC: max num communities % r1: initial gamma low % r2: initial ...
0a9d7de0254de62281ccac614beab273eae990de1cdd7994e43d459f683b07f0
MATLAB
2,082
67
function [pgonOut, G, graphNodes] = edges_to_polyshape(segments, useXor) arguments segments useXor = false end % Generate graphs of the segmented points and edges edgeCoords = reshape(segments, [size(segments, 1)*2 3]); graphNodes = unique(edgeCoords(:, 1:2), 'rows'); nEdges = size(segments, 1); G = ...
72b9eb7169e1293d0e86994fc004c04a71db8b175912cd3ad893f903be8d1216
MATLAB
2,084
67
% Quality control Q1a % Check imaging parameters and plot them across all the participants % Xin Di, July 13, 2022 clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\sub*'); % Read image information for every participant for subji = 1:length(subjfolder) fprintf('Processing subject %d ...',subji)...
e85f594010a70125bd4f84cbe800058f8868bb316797dad1d03476cd556bbd06
MATLAB
2,085
50
function pw = lme_plannedPower(Zi,ZiCol,Dhat,phisqhat,effsz,dr,sz1,sz2,alpha) % pw = lme_plannedPower(Zi,ZiCol,Dhat,phisqhat,effsz,dr,sz1,sz2,alpha) % % Power calculation for a planned ba...
cd7359013023e4e5aae1746f36ecf642d60386a4755014b9b3f9476677a775aa
MATLAB
2,086
62
function [phase_patch,pos] = calc_phase_patch(data, complist, CBF) % This function calculates the phase angles for a given patch at the peak % frequency of that patch % data = the raw data (usually aligned) % complist = patch border information from the frequency segementation code % CBF = the parameter structur...
947e20874d36bcfba5976b0da0ece91556efaeab334631fbbc42d05bec398763
MATLAB
2,087
70
function [xgp,wt] = generalized_phase_vector( x, Fs, lp ) % % GENERALIZED PHASE VECTOR calculate the generalized phase of input vector % % INPUT: % x - data column vector (t,1) % Fs - sampling rate (Hz) % lp - low-frequency data cutoff (Hz) % % OUTPUT: % xgp - output datacube % wt - instantaneous frequency estimate ...
fea8be81812158ad1c6cd6914d6e2fe75dc46e643f696002a110693a75461273
MATLAB
2,087
86
function [ netsimile ] = netsimile_dist_wu(amat,bmat) % weighted implementation of netsimile algo for comparing networks % https://arxiv.org/abs/1209.2684 % get the netsimile of each network ns_a = feat_extract(amat) ; ns_b = feat_extract(bmat) ; % canbera distance canbdist = @(a_,b_) sum(abs(a_-b_)./(abs(a_)+abs(b_)...
b6622314bd54ff9143dc63488c349231fc7e566d01c3e06a63477b6b820fd0be
MATLAB
2,088
65
function SOEA20_Liley(M,run_number,population_size) % Script runs the sinlgeobjecitve evolutionary algorithm SOEA20. See paper % for details. % Load data load('Control_EEG_data.mat') data = Control_EEG_data(M,:)-mean(Control_EEG_data(M,:)); data = zscore(data); data = filter_b_f(data, 2, 256,'high',4);% 2 Hz...
d8e9bce20d2449cb1f60e90144e035a3286174b32c3271f49053b418155725c7
MATLAB
2,091
64
function [h,T,perm] = polardendrogram(Z,varargin) %POLARDENDROGRAM plots a polar dendrogram plot, taking same options as %dendrogram and giving same outputs. % Example: % X= rand(100,2); % Y= pdist(X,'cityblock'); % Z= linkage(Y,'average'); % [H,T] = polardendrogram(Z,'colorthreshold','default'); %Plot a normal dendrog...
37a9c626d83dfef40087dd306364fe09ad348616b5985b1bf49d3f3e5a86f92e
MATLAB
2,093
54
function Xhat = decode_beamformer(cfg0, decoder, Y) % [Xhat] = decode_beamformer(cfg, decoder, Y) % Estimate the activity of latent components using a linear decoder, obtained from an % appropriate training function. Several components may be estimated independently. % % decoder The linear decoder obtained...
20a9ac9ebd5703c5b51fbfbf7f7eda8d288d2733dbacd904092bebe70a82cbcc
MATLAB
2,094
66
% Add information on erroneous behavioural outcomes for import scripts if missing % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % clear all close all target= 'physostigmine'; if ispc home = 'C:\'; % [getenv('HOMEDRIVE') getenv('HOMEPATH')]; pat = [home 'Analysis\AssemblyAnalysis\raw\'...
d94da2984017ad555a035d68936527da8a4057e6ea963355f56d9cfccbc39acc
MATLAB
2,096
65
tr=4; for p=0:5 fileLoc = '\\158.182.15.58\test2\Junhao'; % % File name fileName = ['result_of_p' num2str(p) '_trial' num2str(tr) ]; cd(fileLoc) load(fileName) % Sampling frequency (in Hz) Fs = 100; % Spatial selection of recording to keep (set to empty or zero to use full % recording) keepRows = 1:50; keepCols = 1:50;...
04116a93ce01b48050dcbe19b120d981a6494019e4fa9b4455aabb6f5d69f14f
MATLAB
2,098
62
function out = convert_1x21_to_6x6(in) % function convert_1x21_to_6x6() % % converts a tensor from a 1x21 to a 6x6 representation % % in_1x21 = [ % [xx*xx yy*yy zz*zz] % [xx*yy xx*zz yy*zz] * sqrt(2) % [xx*yz yy*xz zz*xy xx*xy xx*xz...
70dc18a89d58473c47961b0974a5c57b15f353ca15e2c6c892a8369f9c4097fb
MATLAB
2,098
65
% % Script to show a demographic overview of the included patients in this % study. This is based on the patients from whom the detected N1s are saved % in a folder called derivatives/av_ccep/. This is performed in script % ccep01_averageCCEPs.m % % Dora Hermes, Dorien van Blooijs, 2020 % %% Set paths clc clear myDat...
e7671b159307e77a47eeee846cd6f01b88e421ead54e45457031fe8da53c016c
MATLAB
2,098
68
function crop_static_lightfield(cropped_size, overlap, source_path, save_path) overlap_px = floor(overlap * cropped_size); wrap_content = false; if mod(overlap_px, 2) == 1 overlap_px = overlap_px + 1; end file_list = dir(source_path); file_num = length(file_list); ...
0c1f8d61b0a4592072623247dee2a1b5c4244929c7d8b4a604aa95d56812e152
MATLAB
2,102
85
%% Bar sweeps tank = 'DILL_VISUAL_1'; block = 2; win = [0 1]; data = TDT2mat(tank,sprintf('Block-%d',block),'type',[2 3],'silent',true); % % emap = [17 31 19 29 21 27 23 25 18 32 20 30 22 28 24 26 1 15 3 13 5 11 7 9 2 16 4 14 6 12 8 10]; % emap = []; emap = [1 3 5 7 2 4 6 8 10 12 14 16 9 11 13 15 17 19 21 23 18 20 2...
4bbc75282746bb9991bdb2eb1fb509672e94cd2c1baf4009a30a35dc09ac6e10
MATLAB
2,102
87
function [H] = generateH(R, prior_setup, generate_with_t, use_log_scale_for_mean) if(nargin < 3) generate_with_t = false; end if(nargin < 4) use_log_scale_for_mean = false; end if(prior_setup.include_rank_constant) nd = sum([prior_setup.T(:).on]) + prior_setup.V.on; rank_scale = -log(R)/nd; else r...
ede1b5e6219d5b9fd3a2b0caaba0b2bf5d9918645859c6bcf41d3b08858b252b
MATLAB
2,105
41
function plotAllSounds(mainFigDat,behFigDat) neurTrace = squeeze(zscore(nanmean(mainFigDat.dataMPC(:,:,1,:)-nanmean(mainFigDat.dataMPC(mainFigDat.mainFigP.bins<0,:,1,:)),4))); behTrace = squeeze(zscore(nanmean(behFigDat.dat(find(strcmp({behFigDat.dat.name},'Body motion'))).dataMPC(:,:,1,:)- ... nanmean(...
4b64353f421742d6f80bec0c5f076140fab95d74c1cb81dfa4815d1957b9ef49
MATLAB
2,107
83
function visualiseActivationMap(act_map, occ_map, newfig) % This function plots the activation map provided. NaN values are % interpreted as obstructions, and -1 values are interpreted as unactivated % locations %%% COLORMAP SET UP % Load in the plasma colour map load('extra_colormaps.mat','plasma'); % D...
4131543bcffc9e077e0ab2162a71890a03fdb239008389a44c927f94c54c04e1
MATLAB
2,110
63
%% An object in OH/OHA/TOH/TOHA at a specific moment in time. % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or...
166f873b9409f97ca8c848075f8acbe3f2cb16cfcaf8a9d5abcc79133ec86e25
MATLAB
2,111
62
function find_placement_by_fiber_count(nerveModel) % find_placement_by_fiber_count('Subject1') electrodeType = 'TIME4H'; [numFibersAtPercepThreshold, placements, percepThresholds] = num_fibers_for_perception(nerveModel, electrodeType, false); % Find the average number of fibers recruited at the perceptual thres...
8e3ff82b2f8660e6252e5c7a284e5c3754bc6e82e2d911d3062e93f20dde8ff5
MATLAB
2,113
83
function plot_evLFP(W,P,param,cfg) % plot_evLFP(W,P,param,cfg) % % For use with DB_QuickPlot % % DJS 2013 win = [cfg.win_on cfg.win_off] / 1000; % ms -> s svec = floor(win(1)*P.wave_fs):round(win(2)*P.wave_fs); % Organize by stimulus onsets onsamp = round(P.VALS.onset * P.wave_fs); % Reorganize ...
5b7d49c7b7f22d492bb97b6b1aa8074e7e1e308a77b85a402314522de377003e
MATLAB
2,115
69
clc;clear;close all; Figb = figure(); Ntrials = 5000; %total number of time steps (learning cycles) N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) N_psn=7; %number of post-synaptic neurons %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
9c890d0acf7df39d1752b51e45695cfc6b4abfeae6ad66db250fc5a61a346ea7
MATLAB
2,116
65
function speech=newMakeVowel2009(dur,sampleRate, F0, f1,f2,f3,f4) % y=jansMakeVowel(dur,sampleRate, F0, f1, f2, f3); % makes a very simple artificial vowel % adapted from Slattery's auditory toolbox makevowel.m % dur is duration in seconds % sample rate is in Hz % F0 is the fundamental (pitch) % f1-f3 are t...
42100a3087c49e1f5e7bb1f2bff08b2211e33ab7639f15b30fbfd21a648ec049
MATLAB
2,117
63
function [startIndices, endIndices, outputArray] = findRuns(... binaryArray, minLength, maxLength, ignoreZeros) % FINDRUNS finds the start and end indices of runs of consecutive 1's in % BINARYARRAY that are longer than MINLENGTH (default is 0) and shorter % than MAXLENGTH (default infinity). IGNORENZEROS is an opt...
39f61707a7b9c8c82a1d26bc14068677ccc0e3813b3b9698eafe018972797671
MATLAB
2,118
81
clear all; addpath('~/-pimmos/decoding/'); % Gives me: X (labels), Y (data), time tmp = load('../examples/testdata_2class.mat'); Y = tmp.Y; % Y: features x time x trials X = tmp.X'; time = tmp.time; label = tmp.label; numF = size(Y, 1); numT = size(Y, 2); numN = size(Y, 3); % Select time points, senso...
e162e630b931cd2379a29a4621c0a126cf2fdca840b5ff91cdec522a2f262c61
MATLAB
2,118
25
% REMOVE BAD CHANNELS - Display % function channel_exclusion_table = bst_ast_remove_bad_channels_display(channel_amp_data_Cutoff_logical, channel_grad_data_Cutoff_logical, low_sig_range_all_channels_val_logical,output_channel_names) %Prepare the bad channels for display channels_removed_amp_display_labels = t...
6fb25c0c1892686c7c1269a0e1b2c9ef4a4bfb49be21b00eb161f7b85731109a
MATLAB
2,119
56
% Script to find all patterns in a sequence of velocity vector fields and % display some of their properties %% Set pattern detection parameters params = setPatternParams(Fs); % %% Find all patterns % [patterns, pattTypes, colNames, pattLocs] = ... % findAllPatterns(real(vfs), imag(vfs), params); % change from si...
d998032dea27ea1ef0afd550722a34abe46a476eb1ea9ff92134a1ad2c75c7e3
MATLAB
2,120
65
function speech=newMakeVowel2009(dur,sampleRate, F0, f1,f2,f3,f4) % y=jansMakeVowel(dur,sampleRate, F0, f1, f2, f3, f4); % makes a very simple artificial vowel % adapted from Slattery's auditory toolbox makevowel.m % dur is duration in seconds % sample rate is in Hz % F0 is the fundamental (pitch) % f1-f3 a...
6cba955b81b08f6ba574fae6e45dc37179e5b8014d7255874d4e7f9e2fbd7c91
MATLAB
2,123
76
%========================================================= % FileName: linear_classifier_train.m % Designby: Zhe % Modified: 09/02/2021 % Describe: Training linear classifier for the position decoding % from FPGA recorded traces. %========================================================================= cle...
57110126818eca028ca7821cdef5a7b802210094c48397af37f008fed5b8b78a
MATLAB
2,124
82
function [r, c, error] = circle_approx(poly, a, center, plotc) % CIRCLE_APPROX Approximates a concave polygon with a circle of radius the % mean of the vertices distances to center. % Units are the same as input units. % % [r, c, error] = circle_approx(poly, a, center, plotc) % % Inputs: - poly: vector of x a...
b3edb044daf391f87263d3a9571ff8e0276e9b2d49234be0bc2892bc5ff0aa03
MATLAB
2,124
71
function valve_WE(n, time_on, pulseN) % % This script allows you to control the solenoids for any length of time % and number of pulses. It's designed with the ACME 2000 in mind, but may % be suitable for expansion in the future. % % bit - bit number for required solenoid (e.g. left = 4; right = i; center = ...
17c4e8841a86653366943b5f0b9258113d81129dd202a6b172f5e449e69825a5
MATLAB
2,125
69
% % Downloaded from MathWorks File Exchange (LB 2020/01/11) % % Log: % First log by LB on 2020/08/10- nothing changed. function runs = contiguous(A,varargin) % RUNS = CONTIGUOUS(A,NUM) returns the start and stop indices for contiguous % runs of the elements NUM within vector A. A and NUM can be vectors of % i...
8435a8b8a8bed0e80848d801bb2e7a640fac91c8fe81078e7808641739e7b5e5
MATLAB
2,125
62
function spindleActivation = compute_spindle_activation(muscleState) % Input: % muscleState is a table with columns 't' [s], 'Elongation' [relative] and % activation [normalized EMG] % Output: % spindleActivation is a table with columns 't' [s], 'Recruitment' [%], % and FiringRate [Hz] % Creation of auxiliary variab...
7fbce3e61013306c119430a90f33cb096117ea605cec4a45171a8fa6940b24e0
MATLAB
2,129
48
function fibersCompartmentalized = get_comp_coords(fibersPerFascicle, ... fascIdsByAs, MRG, log) % GET_COMP_COORDS place the individual fiber compartments on a spline fit % to the fiber coordinates, in fascicles reached by an active site % fibersCompartmentalized = GET_COMP_COORDS(fibersPerFascicle, MRG) % ...
f6cbffaf5809ad1911eadd72b07b09fb1121f17abb3335aa569d0f49a54f9d7c
MATLAB
2,129
62
function [dataMPC,M,dataMPC_odd,dataMPC_even,dataA] = getMainFigData(db,P,mainFigP) %% get PCs for all mice P.focusOn = mainFigP.focusOn; dataMPC = nan(numel(P.bins),P.nGroupsSnd,numel(mainFigP.pc2Keep),P.nMice); dataMPC_odd = nan(numel(P.bins),P.nGroupsSnd,numel(mainFigP.pc2Keep),P.nMice); ...
aaa270717c53fec6d71f868db8bc186c1076d3da04af3bf92ae0e9b27ac7e233
MATLAB
2,135
52
function DM=MakeDM(Subject_Details,MDI,AnalType) % Computes a design matrix DM used in subsequent analyses (RunAnalysis.m). % % INPUTS: % - Subject_Details: structure of demographic information for the analysis cohort e.g. age, % gender, brain volume,... % - MDI: Motion Degradation Index values for each...
9525a23cde15d66842c298d38f67e267107d10070d7c1d67189370f347152775
MATLAB
2,136
89
function SaveResults(self, varargin) if self.VerboseLevel > 1 fprintf('Saving results...\n') end Results = self.Results; Clips = struct; Clips.Train = CreateClipDataToSave(self.NetworkData.Train); Clips.Validate = CreateClipDataToSave(self.NetworkData.Validate); Clips.Test = CreateClipDataToSave(self.NetworkData....
d6f67a031f69412ed4bb3ccc42422fd3b8310cf0c25baddc3091b263696f38ac
MATLAB
2,137
75
clc; clear; close all Fig5e = figure(); Ntrials_5=10000; %Ntrials_2: number of learning cycles to learn the background containing a new embedded pattern (step 5). %(Note initial conditions in this step come from step2) N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simula...
0fa90341b75b5257e111f54723275046a94990a1fc3b03aef6ae426269635eb5
MATLAB
2,138
88
function [H] = generateH(R, prior_setup, generate_with_t, use_log_scale_for_mean) if(nargin < 3) generate_with_t = false; end if(nargin < 4) use_log_scale_for_mean = false; end if(prior_setup.include_rank_constant) nd = sum([prior_setup.T(:).on]) + prior_setup.V.on; rank_scale = -log(R)/nd; % rank...
0212e40df1410e934afa13761fcf7f87ab5c3921f0f8d583f96652eabde7cc1f
MATLAB
2,139
82
%% plot hemifield function [] = plotHemifield(ax, dir, major_dir_eb, color_vec, color_region) hold(ax, 'on'); dirs = dir + [0 180]; %plot region if(nargin > 3 || ~isempty(color_region)) rr = 1.2; %% region 1 cs = color_region(1, :); theta = linspace(ma...
5c01dfe8ebf3bf843be61b3d7b18dc0267bfb8ed03532ad620d8a596e9024c15
MATLAB
2,139
90
function [ netsimile ] = netsimile_dist_bu(amat,bmat) % weighted implementation of netsimile algo for comparing networks % https://arxiv.org/abs/1209.2684 % enfore binary amat = amat > 0 ; bmat = bmat > 0 ; % get the netsimile of each network ns_a = feat_extract(amat) ; ns_b = feat_extract(bmat) ; % canbera distanc...
c99e01dffe4f025be79edbca01e0f869193e9a114599e86866a0c4b2d1b74df5
MATLAB
2,140
59
function [subject, session, channel, Spikes] = pp_launch_manual_sort(Pname,subject,session,channel,Spikes) % % pp_launch_manual_sort( subject, session, channel ) % Basically just launches the splitmerge tool from UMS. But if called % with output arugments, will add all relevant variable to workspace, % which ...
e9fbdde15f8553c1afd4b53ec3faba802edf4b8911cf472e341ead7df9699b88
MATLAB
2,140
66
function speech=newMakeVowel(dur,sampleRate, F0, f1,f2,f3,f4) % y=jansMakeVowel(dur,sampleRate, F0, f1, f2, f3); % makes a very simple artificial vowel % adapted from Slattery's auditory toolbox makevowel.m % dur is duration in seconds % sample rate is in Hz % F0 is the fundamental (pitch) % f1-f3 are the f...
05c52201de5460311526766d694cb165f2ae1a0bb7474ce124dcfc3ed3c5d76f
MATLAB
2,145
65
function [evtB,Clr]=ShowMSUA(Tmtx,iFR,CL,iFRred,ret,TrCol,sc) % Plot a heatmap timeseries showing the firing rates of all single units % % (c) 2014 Daniel Durstewitz, Bernstein Center for Computational Neuroscience, CIMH/ Heidelberg University % Edited by Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac...
3042bad7de5386a3e233f22859768dc879875f1354988dca6cc61975c5314bbe
MATLAB
2,145
71
clc close all clear variables %date: 6th Feb 2021 %VM font = 14; linewidth = 2; format long; %addpath('/Users/varunmannam/Desktop/Spring21/Research_S21/Feb21/SPIE_SR/old_SR_files/mse_plots/'); addpath('/Users/varunmannam/Desktop/Spring21/Research_S21/Feb21/0702/SR_new_results/mse_loss/'); %new simulations lr1 = load...
ea0a1663548663b8532d463ea1585888391decdd1c2acef37cf49f71a63d1f2f
MATLAB
2,146
56
function [pc1_ipsi,pc1_contra,lags_xc] = getPCIpsiContra_1ms(db,P,ipsiContraP) window = ipsiContraP.window; psthBinSize = ipsiContraP.psthBinSize; mouseRefUni = unique(P.mouseRef); pc1_ipsi = cell(1,numel(mouseRefUni)); pc1_contra = cell(1,numel(mouseRefUni)); lags_xc = cell(1,numel(mouseRefUn...
f3c74974f0ae062181f42939b76d8b83797979427b3081f93e04dc3e698d59ec
MATLAB
2,147
75
function SCRATCH_view_block_FRFs(unitid) %% Plot all FRFs from currently selected block in DB_Browser if nargin == 1 && ~isempty(unitid) IDs = mym('SELECT * FROM v_ids WHERE unit = {Si}',unitid); else IDs = getpref('DB_BROWSER_SELECTION'); end U = mym(['SELECT v.unit,u.pool,c.channel FROM v_ids v ', ... ...
f166235198236a134e45a4cc118e44bf4833ebae5b3267cd414f04f170ab9a48
MATLAB
2,148
85
function DB_CheckAnalysisParams(n,d,u,conn) % DB_CheckAnalysisParams(n,d) % DB_CheckAnalysisParams(n,d,u) % DB_CheckAnalysisParams(n,...,conn) % % check to see if necessary parameters already exist on db_util and add if % not there % % Where n is a cellstr array of parameter names and d is a cell string % arra...
5460e18c83d8bdb174d4cfdde58aaf78ddebcb421b577bfc37ed9e899e098f40
MATLAB
2,149
60
function [D, ni] = find_nn(X, k) %FIND_NN Finds k nearest neigbors for all datapoints in the dataset % % [D, ni] = find_nn(X, k) % % Finds the k nearest neighbors for all datapoints in the dataset X. % In X, rows correspond to the observations and columns to the % dimensions. The value of k is the number of neighbors t...
fe9b4092a431321364194d2e1842b91b6a6dabd3339d103e9e7fc45b455324ba
MATLAB
2,149
101
function [fit1,a5,a6,d4,eegz4] = fitness_calc(A1, numreps,subject) % function simulated model Liley_params; % Load data load('Control_EEG_data.mat') data = Control_EEG_data(subject,:)-mean(Control_EEG_data(subject,:)); data = zscore(data); data = filter_b_f(data, 2, 256,'high',4);% 2 Hz high pass filter dat...
e57faf1eca66e51467a072d750770581d6266c0742d0e78951107b9e35c283b5
MATLAB
2,152
71
function signalGrid = interpolateDeadElectrodes(signalGrid, deadElectrodes, angleFlag) % Interpolate dead electrodes to be the median value of surrounding nodes. % Input signalGrid can be a 2D matrix with dimension [X Y] or a 3D matrix % with dimension [X Y T], where t gives time. badElectrodes is % an array containing...
33d3eae5614cf1ff71748bef8be387a3e37e67fa14441abf68681751e65c5d6f
MATLAB
2,154
76
% Sets public properties of a MatLab object using a name-value list. % Properties are traversed in the order they occur in the class definition. % Copyright 2008-2009 Levente Hunyadi function obj = constructor(obj, varargin) assert(isobject(obj), ... 'Function operates on MatLab new-style objects only.'); ...
e60bbb41aa50fcaf43077baf2f6876de9bf8d6284ee91c02461bf02259bc8627
MATLAB
2,155
75
function [BC,nApplied]=ApplyDispPIV(dx,PIV,Set,X,X0) % Applies displacement of PIV data. PIV struct contains: % PIV.X(i,:): x annd y positions of PIV node i % PIV.U(i,:): x annd y displacement of PIV node i % X(i,:) : x coordinates of mesh node i. 3rd dimension is computed. nPIV=size(PIV.X,1); BCu=zeros(0,3); nn...
a225c8b18f5c3695eddd803da5edcdde25f09fc199d4c602a1247720b5442a60
MATLAB
2,156
99
function Pout = MySPM_BatchMasking2(P,Pm) % Pout = MySPM_BatchMasking2(P,Pm) % % Input: % P ... Path(s) to NIfTI files in a cell array % Pm ... Path to one mask file % % Output: % Pout ... Resulting masked images prefixed with 'm' % % NOTE: If this function does not work for 4D files, then you may hav...
b8a3b5ca1b9ebc940791b6fa1e9a0a4a258d5e67966f063ee4c8e487863b0991
MATLAB
2,156
60
% Example 3: Feature selection using iterative procedure % % In this Example, feature selection using CAMs is performed in an iterative % manner. There are 3 steps in the iterative procedure: % 1) conversion of tabular data to image % 2) estimating/validating CNN net using training and validations %...
cc7a309e38a4c57341b7c5e284a0e374378308674a47159863f8491e231db019
MATLAB
2,157
79
function step1_tempConverter(rootDir) % % Convert weird temp files from TC Central into table with same file name % (but different extension) try % Define paths if nargin == 0 rootDir = Cloudstation('Vowels\Noise\Cooling\Data'); % rootDir = Cloudstation('Vowels\Spatial_Unmasking\Cooling\Data'); e...
a9feb6691a351c63451a92d3fd2ff3389833b42f66448682fde0343f01559aad
MATLAB
2,159
86
function LMER_ALL_PID_RAW_reduced % Function to prepare the regression table for Linear Mixed-Effects Regression Model % in R % The metric variables are d here % % Fran Hancock % Dec 2021 % fran.hancock@kcl.ac.uk % % % Function to investigate the relationships between time varying measures % of CHI OCC HC and PID and t...
65576795b2a27f13e890b6d056d02fe86434765717c4ef0e86a59ada4e6512f4
MATLAB
2,161
50
function [B,C,K,n,m,p,Bnorm,commsizes] = comm_mat(W,ci) %COMM_MAT Returns the block matrix of the community structure of a graph W with given membership vector ci % % Inputs W, undirected weighted/binary network. % ci, membership vector % % Outputs: B, block matrix of community structure....
e79b0fd0ca04cfd352ac8f8240711ca8b006c2c5fae9441184941c4a17cf5d7d
MATLAB
2,161
64
function manipulate_prairie_data(dirname, channel, shift, rotation) disp(['Warning! This script manipulates prairie data with shifts or rotations']); disp(['Warning! This should be used only on a COPY of original data, for diagnostic purposes.']); disp(['Warning! Document which directory is manipulated, so no o...
6718ded3117a2b04f417b753c02af624d7ea5aa27534116dc06693c591647ef1
MATLAB
2,162
60
function [ colormap ] = ReadColorsFile( filename, varargin ) %READCOLORSFILE Returns a colormap with [ID R G B A] entries mapped to an ID optargin = size(varargin,2); %Parse the optional arguments DefaultAlpha = 1; if optargin > 0 DefaultAlpha = varargin{1}; end colorm...
b3ed21301052ee8c91b9172861675bc85805fc622dc6ef22cf5a31cdd124cfa0
MATLAB
2,168
30
% REMOVE BAD CHANNELS - VARIABILITY METHOD Formula % function [channel_amp_data_CombinedCutoff_logical, channel_grad_data_CombinedCutoff_logical, low_sig_range_all_channels_val_logical] = ... bst_ast_remove_bad_channels_variability_formula(all_amp_data, all_grad_data, chanAmpDevThreshold, chanGradDevThreshold) ...
f4c550c08a6ddfe17e786f7e82b804093e13896256fd64e48b2c046bed77066c
MATLAB
2,171
65
function [ha hb hc] = shadedplot(x, y1, y2, varargin) % SHADEDPLOT draws two lines on a plot and shades the area between those % lines. % % SHADEDPLOT(x, y1, y2) % All of the arguments are vectors of the same length, and each y-vector is % horizontal (i.e. size(y1) = [1 N]). Vector x contains the x-axis va...
efdb141bcaaed2736534c2e770bfc4d3d75fba690ee827eb7a4e2ecb674a7dd3
MATLAB
2,172
66
function [startIndices, endIndices, outputArray] = findRuns(... binaryArray, minLength, maxLength, ignoreZeros) % FINDRUNS finds the start and end indices of runs of consecutive 1's in % BINARYARRAY that are longer than MINLENGTH (default 0) and shorter % than MAXLENGTH (default infinity). IGNORENZEROS is an option...
d4a8b1f752acd70a705d334155e5564a4ad728602a995ccb1329d072300a83bb
MATLAB
2,175
55
function [] = compileCUDAMexLibs(idx) [~, CUDAdirectory, ~, ~, sourceDir, objDir] = kgmlm.CUDAlib.myCUDAPaths(); fNames = {[sourceDir 'kcBase.cu ' sourceDir 'kcGMLM_dataStructures.cu ' sourceDir 'kcGMLM_computeBlock.cu ' sourceDir 'kcGMLMPop_computeBlock.cu ' sourceDir 'kcGMLM.cu ']; [sourceDir 'kcBase.cu ' ...
a7f18abaeba306554fd3b37cab2157619ea47eb099b5bb080fa9510e80424dc7
MATLAB
2,177
53
function [fiber_c] = store_fiberCenter(section_pop, fiberCenterx, ... fiberCentery, grid_x, grid_y) % STORE_FIBERCENTER Convert fibers center in the cross-sectional area % from a x and y cartesian coordinates to percentage x, y coordinates: each % center coordinate is normalized on the total x and y grid ava...
ef6210ce5dcb483372f6eaacca105b4cea08e76e908c7a99657955cadc284e49
MATLAB
2,177
69
function handles = updateSoundLevelandFreq_SanesLab(handles) %handles = updateSoundLevelandFreq_SanesLab(handles) % %Custom function for SanesLab epsych % %This function updates sound level and frequency in the rpvds circuit. % %Input: % handles: GUI handles structure % %Written by ML Caras 7.28.2016 global AX RUNTI...
30562064e49cce2d058fc3e56ffa8e4c8662199a820671d117f03e9ee3eee8cd
MATLAB
2,178
70
%% Response Latency function RL = NHP_PlotResponseLatency(Data,ax) persistent Lo IND = NHP_decodeResponseCode([Data.ResponseCode]); Angle = [Data.Behavior_Speaker_Angle]; uAngle = unique(Angle); rl = cell(size(uAngle)); for i = 1:length(uAngle) ind = uAngle(i) == Angle; ind = ind & ~(IND.Abort | IND.NoR...
18c91661aa58daa135e87a1c722f5a739481fd75d905702036282fcd109b02e1
MATLAB
2,180
42
function t3_calibrate addpath('../code'); % Here we go over how to calibrate the adaptive procedure to obtain consistently reliable thresholds. % % This is a bit of a hack that I've worked on through trial and error across 3 published psychophysics experiments % and across too many pilot sessions to count. It works...
e566509899db809ceefaf181f047046cdfbe37a8c51e5c0b7c5c4b720a8812e7
MATLAB
2,180
69
function [score]= Emeasure(FM,GT) % Emeasure Compute the Enhanced Alignment measure (as proposed in "Enhanced-alignment % Measure for Binary Foreground Map Evaluation" [Deng-Ping Fan et. al - IJCAI'18 oral paper]) % Usage: % score = Emeasure(FM,GT) % Input: % FM - Binary foreground map. Type: double. % GT - Binary ...