sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
345f6b7281f1123897676cf37f47cf620994e097cdbd6c1e385500f303be1339
MATLAB
396
15
function S_final = get_finalTrainingStageSessions(S) % get training stage 9 days in S struct and remove everything else usethese = cellfun(@(s) isstruct(s), S.pd); S_final = S; S_final.pd = S.pd(usethese); S_final.peh = S.peh(usethese); stage = cell2mat(cellfun(@(sess) sess.TrainingStage(1), S_final.pd',... Unifo...
40d2b879ad40a7dc5d2f36d0a7c9dc3afcd2153c21ffa424ecedc9dc9c2bfd39
MATLAB
396
19
function openface=volface(t) % % openface=volface(t) % % find the surface patches of a volume % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2009/10/13 % % input: % t: input, volumetric element list, dimension (ne,4) % % output: % openface: list of faces of the specified volume % % -- this function is...
458b59bd8ff97e4cf8f6b95ff71b1cce28ee52f08ca7ee02d17813d61c3e81f0
MATLAB
396
11
clear; close all % Read the table from the CSV file data = readtable('[path-to...]/pruningComparisonsMatlab/stats/bright/overall/pruneChannelInfoTableCV.csv'); %% Average Channels and ROI_SNR by Age % Calculate the average 'Channels' and 'ROI_SNR' for each unique value of 'Age' averageData = groupsummary(data, 'Age',...
7fa74f8a60e0d8f53277911614cd406adc189c041fe20c4e3071e533e544bff6
MATLAB
396
24
function [lpp] = tapas_ti_lpp(y, x, u, theta, ptheta) %% General prior probability. % % aponteeduardo@gmail.com % copyright (C) 2016 % flpp = ptheta.method_lpp; ns = size(theta, 1); nc = size(theta, 2); lpp = zeros(1, nc); for i = 1:nc tlpp = zeros(ns, 1); for j = 1:ns tlpp(j) = flpp(y{j, i}, x{j, i...
8fb4b3f9b8056918aeab25db3db4c0e6cc146e1b182472bff9e960cdd9b7f407
MATLAB
396
15
function plot_fig1f(datadir) % Plot event-aligned head speed and head angle relative to the central nose % port for an example session. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. load(fullfile(datadir, 'data-published-DLCdata', ... 'J063_AChDA_202302...
242ba9caa860e92dd817fdfc4e90002bdf0a275c12480d8bbfcd8bae7d1314bb
MATLAB
397
12
%% p = sepiatest.test_root() % % Description: returns the absolute path of the test/ folder (parent of % the +sepiatest package), used to locate test/references, test/tier1_smoke, etc. % function p = test_root() thisFile = mfilename('fullpath'); % .../test/+sepiatest/test_root packageDir = fileparts(thisFile); ...
64125fcf558d362efb4ffc30e90e20d6e84227efc2fb7f6fc8721443994004c2
MATLAB
397
20
function sh_TimexCorr(G_t,R_t,Fs) step=1; nstep=length(G_t)/(step*Fs); for i=1:nstep [r(:,i),lags] =xcorr(G_t(1+step*(i-1)*Fs:step*i*Fs),R_t(1+step*(i-1)*Fs:step*i*Fs),2*Fs,'coeff'); end time=(1:nstep)'; fig=figure('defaultAxesFontSize',18); imagesc(time,lags/Fs,r) ylim([-1 1]) colorbar caxis([-1 1]) xlabel...
9d35f3a931f9bbd7e67fa66d7baf7d7bc3c0641be8e4c0d72a6f717871ca8839
MATLAB
397
14
function SL = calcu_S(EA) % S = (\prod_{i=M}^{2}e^{A_i\Dleta t},...,\prod_{i=M}^{t+1}e^{A_i\Dleta t},...I_N) % Inputs: EA, N-by-N matrix, e^{A_i\Dleta t} % Outputs: SL, N-by-N*M matrix [row,col,num] = size(EA); SL = eye(row,col); panel = eye(row,col); for k = 0:num-2 p = num-k...
a260d2cf053871e59035fa22af6757c1c0f0565f3fcc94f70a13b5a05bfd4cf0
MATLAB
398
6
function stream = request_analog(stub, node_name) request_builder = javaMethod("newBuilder", "org.pesaranlab.thalamus_grpc.ThalamusOuterClass$AnalogRequest"); selector_builder = javaMethod("newBuilder", "org.pesaranlab.thalamus_grpc.ThalamusOuterClass$NodeSelector"); request = request_builder.setNode(selector_bui...
b71e1cf45879bfcd73db1626d14ce3d02245272f0c2faeef88eb4efed58fee74
MATLAB
398
19
function [alpha,lamda]=ImageAnalysis(app) Name=[app.imfolder,app.ImageDropDown_4.Value]; C=imread(Name); J=imcomplement(C); Max_pvalue=255;% double(max(J(:))) imshow(J) AUX=imcrop; ECS=AUX<90; struct=AUX>=90; count_ECS=sum(ECS,'all'); count_struct=sum(struct,'all'); alpha=(count_ECS/count_struct)*100; alpha...
c4a837cf6de44fde286ffcb4f23abed491222c1ddfab60d405525a9259166432
MATLAB
398
18
function [DataF]=sh_bpFilter(Data, Fband, Fs) % Fband=[0.5 100]-band or [inf 100]-low or [1 ing]-high % updated SH-20210210 % Often single type are passed trough... Data=double(Data); if Fband(1)==inf [b,a]=butter(4,Fband(2)/(Fs/2),'low'); elseif Fband(2)==inf [b,a]=butter(4,Fband(1)/(Fs/2),'high'); else ...
2d91eb2157611d1f5cf9899a19b054078c37c02a49695fb97233372a53a9ea3b
MATLAB
399
15
function str_short = getAbbreviation(str_long) % return abbreviation (str_short) for long string (str_long) if found in the list below, % else returns str_long % (c) Jiri, Oct23 if strcmp(str_long, 'Default') str_short = 'DMN'; elseif strcmp(str_long, 'Dorsal Attention') str_short = 'DAN'; elseif strcmp(str_...
3d9ecf599e198e9697332e768db28ec6c218dc7b2701e1ac6808e90209af05f5
MATLAB
399
20
% This is just a quick test for sanity of "permcca.m". % For the main simulation function, see "ccainf.m". N = 50; Ny = 8; Nx = 12; Nz = 15; Nw = 3; nR = 200; nP = 200; pfwer = zeros(nR,8); for rep = 1:nR, fprintf('%d\n',rep); Y = randn(N,Ny); X = randn(N,Nx); Z = randn(N,Nz); W = randn(N,Nw); [...
fe8942636f772a2216c52544ef7af157748ea914047d0728f01999fe16e7620b
MATLAB
399
17
function v = randomlyPermute(v) % randomly permutes the elements of the input vector (v). %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.* import rsa.rdm.* import rsa.sim.* import rsa.spm.* import r...
3b17437fbddc92126b812f599de7119820df5a75571f8f9c62e7217430d95544
MATLAB
400
19
function [reservoir, beta, H] = oesnn_uad(features, max_neurons) reservoir = []; for i = 1:size(features,1) candidate = features(i,:); reservoir = [reservoir; candidate]; if size(reservoir,1) > max_neurons reservoir(1,:) = []; % remove oldest end end % ELM hidden_neurons = 100; W = rand(size(...
4e22134b6566c3cae515a3eebd9796bc46393b228be912f1de2ead271f2e0347
MATLAB
400
19
%{ # fitted parameters for the autoregressive process (nmf deconvolution) -> reso.ActivityTrace --- g : blob # g1, g2, ... coefficients for the AR process %} classdef ActivityARCoefficients < dj.Computed methods(Access=protected) function makeTuples(self, key) ...
907d6e97382763c912fe35172fea7441ea4ecb8272fa5a948d49ac33c6f9ba17
MATLAB
400
19
%{ # fitted parameters for the autoregressive process (nmf deconvolution) -> meso.ActivityTrace --- g : blob # g1, g2, ... coefficients for the AR process %} classdef ActivityARCoefficients < dj.Computed methods(Access=protected) function makeTuples(self, key) ...
0135106286eb4e5ed780da67a982869752b62fcdf1895ae563fdae6e54b95db6
MATLAB
401
19
%{ # Fitted parameters for the autoregressive process (CNMF) -> preprocess.ExtractRawTrace --- g : longblob # array with g1, g2, ... values for the AR process %} classdef ExtractRawARCoefficients < dj.Imported methods(Access=protected) function makeTuples(self, key)...
53f2f1f1d08d5d6e8617b34f2342a57b5c94926fbfd2979c7eb7155b2961a352
MATLAB
401
19
%USING_HG2 Determine if the HG2 graphics pipeline is used % % tf = using_hg2(fig) % %IN: % fig - handle to the figure in question. % %OUT: % tf - boolean indicating whether the HG2 graphics pipeline is being used % (true) or not (false). function tf = using_hg2(fig) try if nargin < 1, fig = gcf; end...
6b9e00a660d3e00830786b37abb42d52144e4dae19422b17d942c4ad683e8869
MATLAB
401
15
file_prefix='Default_AttFar_ori_Ori1_0_Con1_0d5__'; data_folder = '/ix/chuang/des307/'; Ntr = 38000; N = 2e4; X = zeros(Ntr,N); data = load([data_folder file_prefix 'cond1_1_1.mat']); X(1:Ntr/2,:) = double(data.X1); data = load([data_folder file_prefix 'cond2_1_1.mat']); X(Ntr/2+1:Ntr,:) = double(data.X2); fr = mean...
6c3e5e1a81fb83f18dd746e3731e1aaa710fed1f069e41087423a006af6ecf9a
MATLAB
401
18
% this is an interactive script to determine crop ranges. % download mean.nii locally cd ~/Desktop % load gradunwarp results a1 = load_untouch_nii('mean.nii'); vol = double(a1.img); imagesc(max(vol,[],3).^.4); axis image; imagesc(squeeze(max(vol,[],2)).^.4); axis image; temp = {[12 110] [20 104] [4 83]}; % test ...
6db36ec087dd0ed3abf6ffd89786fae74d8a95436bd84771a70c710200cb7e8b
MATLAB
401
16
function H = poiss_entropy(lambda,kmax) %calculates entropy of a poisson distribution with rate lambda and max %number of events k % %inputs: lambda: n x 1 set of rate parameters % kmax: max number of events that can occur in single time bin Hsum = 0; for j = 1:kmax Hsum = Hsum + lambda.^(j)*log(factorial(j...
891af98d988464e7fd07e5a6a8acee16e660bc0a535b472a12b165a6aa34fb49
MATLAB
401
16
function TD = getMeanTD(P) % Calcola la media della durata target per ciascun soggetto nella struttura P % Gestisce sia durata in cell array che vettore TD = nan(numel(P),1); for s = 1:numel(P) d = P(s).dur; if isempty(d) TD(s) = NaN; elseif iscell(d) TD(s) = mean(vertcat(d{:}), '...
9b96c7325796c4a64fcaa850d28415677c3fa30efafd9bf6b3a65c7c1a6b2e2d
MATLAB
401
17
function Q2r=essential_closestRepresentative(Q1,Q2,varargin) [tMin,~,Q2]=essential_distMinAngle(Q1,Q2,varargin{:}); NQ1=size(Q1,3); NQ2=size(Q2,3); if NQ1>1 && NQ2==1 Q2=repmat(Q2,[1 1 NQ1]); end NQ=max(NQ1,NQ2); Q2r=zeros(size(Q2)); for iQ=1:NQ t=tMin(iQ); Rz=[cos(t) -sin(t) 0; sin(t) cos(t) 0; 0 0 1]; ...
82de8864323a0402267fcc6c6dd1b912e07f23776519d0260657e3037c1a617f
MATLAB
402
18
load surf_single_subj_T1 figure; p = patch('Faces',faces,'Vertices',vertices) view(135,30) set(p,'EdgeColor','none') lighting gouraud; alpha(.5); lighth = lightangle(45,30); axis off; set(p,'FaceColor',[.2 .4 .7]) % camh = camlight; daspect([1 1 1]); %set(gcf,'Color',[0 0 0]) hold on %a = ones(200,150); %a = a + 75; ...
8cfeef84278de7e99e10be8ebf0b322aa5abbb1189c980b0f4ea141da4288520
MATLAB
402
19
function [t, tr, b, w] = sero_srr_sampling_direct(ts, n, z, do_interleaved) if nargin < 1 [ts, n, z] = sero_srr_default_image_pars(); [t, tr, b, w] = sero_srr_sampling_direct(ts, n, z, 0); clf sero_srr_plot_sampling_stats(tr, b, w) return end if nargin < 4 do_interleaved = 0; end a ...
8ea93eb0dbd2cca851c5f633e4bb037662f022a0a46b4384eda6072187576c27
MATLAB
402
13
%{ preprocess.MethodAod (lookup) # -> preprocess.Method --- description : varchar(60) # high_pass_stop=null : float # (Hz) low_pass_stop=null : float # (Hz) subtracted_princ_comps : tinyint # ...
9a6e23057b6771d4a14156b0afe35588abbbbf02dcb299f9e6a5d4431fc10d37
MATLAB
402
18
function meta_check_contrasts(DB,testfield) % meta_check_contrasts(DB,testfield) % % Checks to see if each unique Contrast has one and only one level of the % selected variable. for i = 1:length(DB.Contrast) tmp = DB.(testfield)(DB.Contrast == i); if length(unique(tmp)) > 1, fprintf(1,'Warning! Cont...
d4301887d0657a4689c3ff12a75fb94143ebdfe5b8f4ca25eaf441523e0ea678
MATLAB
402
16
classdef nnspnorm < nntest methods (Test) function basic(test) h = 13 ; w = 17 ; d = 4 ; n = 5 ; param = [3, 3, 0.1, 0.75] ; x = test.randn(h,w,d,n) ; y = vl_nnspnorm(x, param) ; dzdy = test.rand(h, w, d, n) ; dzdx = vl_nnspnorm(x, param, dzdy) ; test.der...
fabd7c163451c87d55d8bd518cfd705aea12c73e1dd1d223a2f706b24f8d9d13
MATLAB
402
16
function grid_mreg_short(namei) try load(...) % load data frex = logspace(log10(0.01),log10(5),50); mregvoxels = randperm(68100,3405); % Uniform sampling non repeating conv_bold = morlet_convolution(mreg_ts(:,mregvoxels)',10,frex,8); conv_res = mean(abs(conv_bold).^2,3); save(sprintf('...convmr...
3ae7d6984654077447a4d1c379050720d80c21296ea9d09e9b49fb23ff4276e1
MATLAB
403
20
function str = num2string_fixeddigit(num, d) % num2string_fixeddigit - convert a number to string with a fixed number of digits % % str = num2string_fixeddigit(num, d); % % examples for d=3: 12.3->'012', 99->'099', 999->'999', 1200->'1200' (overflow). % % Copyright (c) 2004 Gabriel Peyré num = round(num); str...
689bd13ac5096b4fbe669d2df535e551a85cd5d3b2714de65cb3e10395a72950
MATLAB
403
15
function output = loadTargetClassifier(dataPath, mouse, session) % Wrapper around targetClassifier % Load preprocessed data % This data is already subsampled to the best 100 neurons and the desired % time points load(sprintf('%s%s_%s_cueLocked', dataPath, mouse, session), 'neurons', 'M') % Params config = M.config; co...
b66901409dc818268804c9de585b4dfd5008285eddaa1bd748bd50faf5dab0e6
MATLAB
404
22
%{ # single unit in the scan -> reso.ScanInfo -> shared.SegmentationMethod unit_id : int # unique per scan & segmentation method --- -> reso.ScanSet -> reso.FluorescenceTrace %} classdef ScanSetUnit < dj.Computed methods(Access=protected) function makeTuples(self, ke...
e612162fe69b18380f0b8fad308c4c6e7053a890fd4ea352f89d214e95344cf3
MATLAB
404
10
function [MYsoundTargets_matrix] = soundtargetsRepeated(soundTargets) cfg.design.soundTargets=zeros(size(soundTargets,1), (size(soundTargets,2)+size(soundTargets,2))); for t=1:size(soundTargets,2) cfg.design.soundTargets(:,2*t-1) =soundTargets(:,t); cfg.design.soundTargets(:,2*t)=soundTargets(:,t);...
fdbb5ce31a6047859563d46dbc53d5017ce68599c6d3d932c2ef098da4f92e77
MATLAB
404
22
%{ # single unit in the scan -> meso.ScanInfo -> shared.SegmentationMethod unit_id : int # unique per scan & segmentation method --- -> meso.ScanSet -> meso.FluorescenceTrace %} classdef ScanSetUnit < dj.Computed methods(Access=protected) function makeTuples(self, ke...
0f0566560021fa56f1460fb99c06a9203daa872b6dd3860e30fb96589420de88
MATLAB
405
18
function [R, B] = generate_reward(nswitches) [R, B] = deal(cell(nswitches, 1)); for i = 1:nswitches R{i} = [randsample(1:5, 40, true),... randsample(1:3, 40, true),... randsample(1:5, 40, true),... randsample(3:5, 40, true)]'; B{i} = [ones(40, 1)*1;... ones(40, 1)*3;... ...
592ab89209bfd92738d5f4acf97efb9b474fd4c89d3e34bf1d618a8eff6a856a
MATLAB
405
9
function S = sero_srr_add_noise(S, SNR) % function S = sero_srr_add_noise(S, SNR) % ADD NOISE % This application has the following interpretation. % Given that the true signal is 1, the high resolution image has a signal % to noise ration equal to SNR. The low resolution image has an snr that is % higher by a factor of...
8b1151740781ca5dffc3fb3ccbbf17289f0dd3b7ccd93306152d3b939ca1ac5f
MATLAB
406
17
%{ # parameters for computing unit retinotopy unitret_id : int # method id for generating unit retinotopy --- sigma : decimal(4,2) # sigma used for gaussian smoothing, 0 for no smoothing %} classdef UnitRetParam < dj.Lookup properties contents = { 1 0 ...
2a6c70404c177f4e6cf246486682c2f98830bf69eacd6bc8a7932e513ce84339
MATLAB
407
16
function clims = getColorLimits(threeDimArray) % returns color limits from 'threeDimArray' % (c) Jiri, Jan11 yVals =[]; for ch1 = 1:size(threeDimArray) for ch2 = 1:size(threeDimArray,2) for ch3 = 1:size(threeDimArray,3) yVals = cat(1, yVals, threeDimArray(ch1,ch2,ch3)); end end end...
747c443bf214c14fd3892eb0d23ed231b7848324afb8975ff4fc768fe0b8f8cb
MATLAB
407
17
function indic = meta_stochastic_mask(xyzlist,n,r) % indic = meta_stochastic_mask(xyzlist,n,r) % % Makes convolved spheres at n randomized locations within analysis mask % Works in indicator (indic) format for speed % % tor wager v = size(xyzlist,1); wh = ceil(rand(n,1) .* v); xyzvox = xyzlist(wh,:); %indic = meta_f...
a8f57e1fade550b9235bd4d02b2db8627fc96321ef633631ad58d87b1c38fcfd
MATLAB
407
11
function ce = CE(T) %This function calculator is an estimate for a time series complexity [1] (A more complex time series has more peaks, valleys etc.). % References [1] c, Gustavo EAPA, et al (2014). c. Data Mining and Knowledge Discovery 28.3 (2014): 634-669. % original ce = sqrt(sum(diff(T).^2)); % %ce = sqrt(sum...
c4dca3af13c116e9e01538257c3a246a5768894c07e2642e275792f065d4c095
MATLAB
407
19
function [b] = get_rand_idx(num_idx,N,delta) % Produce set of random integers with minimum intervals % N = 10; % number of integers required % delta = 2; % minimum difference required a = randperm(num_idx); idx = 1; b = a(idx); while(length(b) < N && idx < length(a)) idx = idx+1; c = abs(b - a(idx)...
65f8348abbb02fffe48f9f9963dcb6665b766007e31c65cf25e94e785c566206
MATLAB
408
19
function varargout=fear_getLFPpath(lfpPath) [lfpDir,sesName,~]=fileparts(lfpPath); if ~exist(lfpPath,'file') lfpDir=fullfile('/Volumes/My Passport for Mac/lfp/',sesName); lfpPath=fullfile(lfpDir,[sesName,'.lfp']); if ~exist(lfpPath,'file') error('LFP file not found for %s',sesName) end end...
8724f0e0be0fe4753b0b8c9caa4041200a48615fec1f8d30ea0710f41cd76923
MATLAB
408
21
clear all; close all; clc; % July 8, 2018, NB n = 5; p = 3; k = 2; M = rotationsfactory(n, k); %, true); % M.retr = M.retr_qr; % M.invretr = M.invretr_qr; M.retr = M.retr_polar; M.invretr = M.invretr_polar; X = M.rand(); S = M.randvec(X); S = M.lincomb(X, randn(1), S); Y = M.retr(X, S); V = M.invretr(X, Y); fprintf...
c1dabe55016d971c87ddba3fb996c3d6386ccbee29c4eeefee2d085a3f9774d4
MATLAB
408
17
% This is the timer function to update the figure. % Save as timerCallbackFcn.m function timerCallbackFcn(hTimer, eventData, hfig, I, map) figure(hfig); % i is the frame index persistent i; if isempty(i), i=1; end % display the i-th frame in the GIF imshow(I(:,:,i),map); % increm...
f08892f815d1f74e1cd2d296a2015fb03e5b38ee4501e076204d57a8ffd6a191
MATLAB
408
24
function x=nets_demean(x,dim) % nets_demean(X) % Removes the Average or mean value. % % nets_demean(X,DIM) % Removes the mean along the dimension DIM of X. if(nargin==1), dim = 1; if(size(x,1) > 1) dim = 1; elseif(size(x,2) > 1) dim = 2; end; end; dims = size(x); dimsize = size(x,dim); dimr...
a9d650d279c5e8cc4a8bf3d2030379ee0e9b1a1b9150cc6d8a94f97576b40585
MATLAB
409
30
function y = isinteger(x) % ISINTEGER - True for natural numeric arrays % % test = isinteger(x) % % Where % % X is a numeric array. % % TEST is true if all the elements of X are integer numbers. Otherwise, % TEST is false. % % % See also: isnatural y = isinteger(x); if y, return; end y =...
d067d92f08d5147201c3f60b9a6b9ad7fba52cc0ca664f3271a7f681fc8fceb5
MATLAB
409
15
%{ experiment.LaserCalibration (manual) # stores measured values from the laser power calibration -> experiment.Rig calibration_ts : timestamp # calibration timestamp -- automatic --- -> experiment.Lens -> experiment.Person -> experiment.Software pockel : mediumint # pockel setting n...
f5374475cf725c92e85a3af9ee30528f33c5b229c64907538b70c6b17026379e
MATLAB
409
12
%{ # spike_method : tinyint # spike inference method --- name : varchar(16) # short name to identify the spike inference method details : varchar(255) # more details language : enum('ma...
4249a51ef11f74cbba9d82e2bf9124a189ce74891f913332833eba96a1e3bbb2
MATLAB
410
23
%{ # set of units in the same scan -> `pipeline_experiment`.`scan` -> `pipeline_shared`.`#pipeline_version` -> `pipeline_shared`.`#field` -> `pipeline_shared`.`#channel` -> `pipeline_shared`.`#segmentation_method` --- -> fuse.Pipe %} classdef ScanSet < dj.Computed methods(Access=protected) function makeTuples(se...
65a999cb55ec6bb99c5518cb3447cf55e974829ce3b3e0bfba62e9739a4c0e22
MATLAB
410
16
function patchMatchCost(Patch1,Patch2,dInput, outputCost) % compute the distance between patches from two subjects % A1 = load(Patch1); A2 = load(Patch2); load(dInput); A = zeros(size(A1.Patch,1),size(A2.Patch,1)); for i=1:size(A1.Patch,1) for j=1:size(A2.Patch,1) A(i,j) = d(A1.Patch{i,5},A2.Patch{j,5})*...
5c51ffa21c2dec1a07024c1b0a01de0afb84ca7c9f92006a032225fe45aa2936
MATLAB
411
16
classdef SoftMax < dagnn.ElementWise methods function outputs = forward(self, inputs, params) outputs{1} = vl_nnsoftmax(inputs{1}) ; end function [derInputs, derParams] = backward(self, inputs, params, derOutputs) derInputs{1} = vl_nnsoftmax(inputs{1}, derOutputs{1}) ; derParams = {} ; ...
9fa07eab34bb058b6bd428c295c1ea2d5eda366d1bfaef9828d5bcc621567e5b
MATLAB
411
15
function output = loadTargetXTClassifier(dataPath, mouse, session) % Wrapper around targetXTClassifier % Load preprocessed data % This data is already subsampled to the best 100 neurons and the desired % time points load(sprintf('%s%s_%s_cueLockedXT', dataPath, mouse, session), 'neurons', 'M') % Params config = M.conf...
962069e1d706e696612dee3dbacecd449ee11a8dbeca5058a2e43e3df5aa8e41
MATLAB
413
23
function x=demean(x,dim) % DEMEAN(X) % Removes the Average or mean value. % % DEMEAN(X,DIM) % Removes the mean along the dimension DIM of X. if(nargin==1), dim = 1; if(size(x,1) > 1) dim = 1; elseif(size(x,2) > 1) dim = 2; end; end; dims = size(x); dimsize = size(x,dim); ...
b2b0a87048b0dfa3fc479d15ca12e01fe15e44834837b44caf3ca9b9c10a66c4
MATLAB
413
10
function AddJavaClassPathInfoDynamics() % Adds the path required for the infodynamics toolkit % Required for the parallel workers, which don't always inherit the proper % javaclasspath computeDir = which('TS_Compute'); splits = regexp(computeDir,filesep); hctsaDir = computeDir(1:splits(end-1));...
4ad858e8abe458109a3bef3af64f508905a9591c9bdbf5ab7938206942f67270
MATLAB
414
16
classdef SoftMax < dagnn_bc.ElementWise methods function outputs = forward(self, inputs, params) outputs{1} = vl_nnsoftmax(inputs{1}) ; end function [derInputs, derParams] = backward(self, inputs, params, derOutputs) derInputs{1} = vl_nnsoftmax(inputs{1}, derOutputs{1}) ; derParams = {}...
62b29f9c29d86bf456f23c0138ef1490bf3952aa24b5a937f37bbb1cba7b7c00
MATLAB
414
13
function values = scaleSpectogram(values, spectrogramType, windowsize, samplerate) switch spectrogramType case 'Power Spectral Density' win = hamming(windowsize); values = abs(values).^2; values = 1 / (samplerate * norm(win,2)^2) * values; values(2:end-1) = 2*values(2:end-1); ...
7da21fca023a27108339b3fa7db2376b1f0a5dd7911f20cdd5db502e7159324a
MATLAB
414
17
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = postInitializationSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to finalize some set up after psychtoolbox has been % initialized cfg = deal(varargin{:}); % Convert some values f...
b992b40cd739e1716b53c51fa42def23e4761d2316d333ea3848baa158e3a510
MATLAB
414
22
function [ibin] = bini(x,nbin,pbin) if nargin < 3 pbin = 1/nbin; end if nargin < 2 error('Missing input arguments!'); end if ~isvector(x) error('Wrong input size!'); end xbinbeg = quantile(x(:),linspace(0,1-pbin,nbin)); xbinend = quantile(x(:),linspace(pbin,1,nbin)); ibin = false(numel(x...
cf2dc0df6be186e6210c0811bf174d100052125f447b49934460e3d5aba6b10e
MATLAB
414
13
function adjM = genRandSmallWorldNetwork(numNodes, K_edge, beta) G = WattsStrogatz(numNodes, K_edge, beta); % generates symmetric (undirected) small-world network adjM = full(adjacency(G)); numEdges = sum(sum(adjM == 1)); edgeWeights = rand(numEdges/2, 1); adjM_U = triu(adjM); adjM_U(adjM_U == 1) = edgeWeights; adjM...
da178c7a8e0f1294e728552b6ad34eed6c21f7afe54709d4ffe3a6a4cfc06190
MATLAB
414
21
function [ix_dim,ix_tau,jx_act] = embed_trans_index(ix_act,M,D,mode) if ~exist('mode','var'), mode = 0; end; flg = zeros(M,D); flg(ix_act) = 1; % find active X-dim ix_dim = find( sum(flg,2) > 0 ); % find active t-dim if mode==0 ix_tau = find( sum(flg,1) > 0 ); else ix_tau = 1:D; end % find activ...
eb3f80cba7143eb3fdb45b60ec0312f71a3c69b2ac1ebc3507ebbec953f675eb
MATLAB
414
22
function ListSubjName(SubjsDir) if nargin==0 SubjsDir= uigetdir([],'select a input folder') ; end [DirPath, fileN, extn] = fileparts(SubjsDir); list = dir (SubjsDir) ; if exist ([SubjsDir,filesep,'SubjList.txt']) delete ([SubjsDir,filesep,'SubjList.txt']) ; end cd(DirPath) for i = 3 : length(list) ...
065a0b0eb3823401f4895a774e2fa65a191ef0585accabd29ba97aee619efed9
MATLAB
415
15
% combineOnOffResponses.m - threshold and sum on-off RF phase responses function complexResp = combineOnOffResponses(respP1,respP2,threshold) % default: threshold opposing responses instead of squaring and summing if ~exist('threshold','var'); threshold = 1; end if threshold respP1(respP1<0) = 0; respP2(resp...
6c78230bec562725e5096e24f3e44083fa6fe79a293f786e9f5a38c3153221b1
MATLAB
415
13
% This script is taken from the old 'callback2' variable. It is called when % the radio button 'resample' is selected on the main ARTwarp GUI figure, % and enables the user to enter a value to the 'sample interval' field % (un-dims the field) h1 = findobj('Tag','resample'); h2 = findobj('Tag','sampleInterval'); s1 = g...
dd2d53a76fee2c7a16df1a33cda1af7284d0ed372d6247362972e0ce2e47d3ea
MATLAB
415
19
%%%make averaged EMG % SR, stampSR = kHz % sttime,endtime = ms % function [edata] = avEMG(data,SR,stamp,stampSR,sttime,endtime) if SR == stampSR else stamp = round(stamp.*SR./stampSR); end emg_row = []; for trial = 1:max(size(stamp)) st=stamp(trial)+sttime*SR; et=stamp(trial)+endtime*SR; if st>1 &&...
e282b601ff777efccbf26303abc9ab349d039cac280c96a9ece119494879cc0c
MATLAB
415
12
function stop = myoutput(x,optimvalues,state,ops) % MYOUTPUT: a function to call during optimization for periodic saves % % ops must be a struct containing "savefreq", number of iterations % between saves % savefreq = ops.savefreq; stop = false; iteration = optimvalues.iteration; if rem(iteration...
4a2e08e1f9002c4457968ab2df4bc26d85056ea6fe4c390996e0c14d44292e39
MATLAB
417
16
function [rez] = Chan_template(rez,criteria) N_clust = length(unique(rez.st(:,3))); U = rez.U(:,:,1); Chan = cell(N_clust,1); Chan_score = cell(N_clust,1); for i =1:N_clust U(:,i) = U(:,i)/max(U(:,i)); id = find(U(:,i)>=criteria); [~,chan_order] = sort(U(id,i),'descend'); Chan{i} = id(chan_order);...
890a9aa8e4bab6f9a57b225e1be61ab361e25178272e0a92ba0704089716880b
MATLAB
417
20
function printConsoleSection( input_args ) %PRINTCONSOLESECTION( input_args ) % % INPUT: % input_args [string]: section title % % EXAMPLE: % printConsoleSection( 'Hello World!' ) % % === Jan Moelter, The University of Queensland, 2017 =================== % S_Z = 80; fprintf( 1 , [ repmat( '_' , 1 , S_Z )...
e5dc5266a06171192cca6b68e8417cdd3e8963b86605d9de704b1e16dfaa6228
MATLAB
418
17
function eta=eta_squared(z) %Compute similiarity between rows of z %z=rand(10,100); %z(2,:)=z(1,:)+randn(1,100)*0.3; N=size(z,1); p=size(z,2); eta=zeros(N,N); for i=1:N mu=(repmat(z(i,:),N,1)+z)/2; mu_bar=mean(mu,2); eta(:,i)=sum((repmat(z(i,:),N,1)-mu).^2 + (z-mu).^2,2); eta(:,i)=1...
afd8d1ca249d784ce5a2b865ebe15e6d5edbb1ecc4e2ec2563012b9654b8157a
MATLAB
419
25
% (C) Copyright 2021 Remi Gau clear; clc; % Sets up the environment for the analysis and add libraries to the path initEnv(); %% Set options opt = demoGetOption(); checkDependencies(); %% Run batches reportBIDS(opt); bidsCopyRawFolder(opt, 1); bidsSTC(opt); bidsSpatialPrepro(opt); % The following do not run on ...
b9130ce05fd31b36daf6502f660ed0ad03e1b7355f95ad5ba6fedd56f3da122a
MATLAB
419
16
function [rez] = Chan_cluster_M(rez,criteria) N_clust = length(unique(rez.st(:,end))); U = rez.U(:,:,1); Chan = cell(N_clust,1); Chan_score = cell(N_clust,1); for i =1:N_clust U(:,i) = U(:,i)/max(U(:,i)); id = find(U(:,i)>=criteria); [~,chan_order] = sort(U(id,i),'descend'); Chan{i} = id(chan_orde...
ca243985829d7adc334ef7bdfdfacdc16457e5dccb290916aa3c8f0f2911d0c2
MATLAB
419
20
function [region, sensor] = standardizeInputs(region, sensor) if strcmpi(region, 'dms') region = 'DMS'; elseif strcmpi(region, 'dls') region = 'DLS'; elseif strcmpi(region, 'nacc') region = 'NAcc'; end if strcmpi(sensor, 'da') sensor = 'DA'; elseif strcmpi(sensor, 'ach') sensor = 'ACh'; elseif strc...
9440e363a730627c148e31e8a2604edcf4177005304c8ffc1fd885b46315af61
MATLAB
420
13
function [P] = likelihood_fun_inv_curve(Ai,x0i,ni,Amean,Astd,x0mean,x0std,nmean,nstd,noiseStd,r,conc) er = @(A,x0,n) r - A./(1+exp(-n.*(conc - x0))); Per = @(A,x0,n) sum(log(1./sqrt(2 * pi * noiseStd.^2)) - 1/2 * er(A,x0,n).^2./noiseStd.^2); PA = @(Ai,Amean,Astd) log(1./sqrt(2 * pi * Astd.^2)) -1/2*(Ai - Amean).^2/A...
56dd6e6f321ce3a89fe7b6d2a2476c6275a51c0f857c422e298559603fbec947
MATLAB
421
17
function [out]=istensor(M) % ISTENSOR True if input is a 3D array. % ISTENSOR(M) returns logical 1 (true) if M is a 1-by-n or n-by-1 vector, % and logical 0 (false) otherwise. % % See also ISSCALAR, ISROW, ISCOLUMN, ISMATRIX, ISNUMERIC, ISLOGICAL, % ISCHAR, ISEMPTY, SIZE. % 2020-06-01: created by ...
8b9611a4c2a20385ec401fb33676ea7ae94562fa7149b7607115489c712882cc
MATLAB
421
12
function [yfit,beta] = fitExponUtilityFunction(x,y,plotFlag) % function [yfit,beta] = fitExponUtilityFunction(x,y,plotFlag) % % This function fits the logistic function implemented in the code % exponUtilityFunction.m using ordinary least sqaures. startBeta = [1 1]; func = 'exponUtilityFunction'; beta = lsqcurvefit(fu...
960bd2e1aef0b103177629c4ac0f750860f9d8234a89a36e0dd44505a80c9e57
MATLAB
421
13
function reset(obj) %RESET Reset the DagNN % RESET(obj) resets the DagNN obj. The function clears any intermediate value stored in the DagNN % object, including parameter gradients. It also calls the reset % function of every layer. obj.clearParameterServer() ; [obj.vars.value] = deal([]) ; [obj.vars.der] = deal...
060994da9cb2ceff6da729558476dbad227f1704eb05a3d451259ce1b1dcc7f6
MATLAB
422
21
function plotSkeleton(posXYZ, plotParams, view) % Configure plot fig; hA = gca; hA.View = view; axis(hA, 'equal'); axis off hA.ZLim = [-18, 17]; hA.XLim = [-5, 65]; hA.YLim = [-25, 20]; % Loop over time points, adding offsets for t = 1:size(posXYZ,1) pos = posXYZ(t,:,:); pos = pos - pos(:,:,15) + repmat([t * ...
bfedc58524440253e7b94203dbae9c47b10a27faf32741cfc157361448ca8e41
MATLAB
422
20
function [high_rats, low_rats, T] = HiloAcrossRats(thirdrew_arg,... ratlist, Pstruct, Bstruct) high_rats = cell(length(ratlist), 1); low_rats = cell(length(ratlist), 1); for rat = 1:length(ratlist) ratname = ratlist{rat}; disp(ratname) [high, low] = hilo_one_event(Bstruct.(ratname), ... Ps...
c1b4428c2f0c5ddfddfd2a0e946a1afa0251392b2d7cf155e161e913f7eb8136
MATLAB
422
15
function [ahr, binvals] = bincell_to_submat(ahr_cell,binvals_cell) % [ahr, binvals] = bincell_to_submat(ahr_cell,binvals_cell) % % summarizes celled ahr data into subject matrix % % jbh 2/26/21 N = length(ahr_cell); binvals = unique(vertcat(binvals_cell{:}))'; ahr = nan(N,length(binvals)); for ss = 1:N ...
c2d09ec11682e11f109aae3b6c059c4d7e2f28ec12695243486a97878d502538
MATLAB
422
25
classdef euclidean < brca.dot.base % FORMAT dot = brca.dot.euclidean() % % Euclidean inner product (dot) properties Lattice = 1 end methods function obj = euclidean() end function x = solve(~,x) end function x = dot(~,x,y) x = x(:)'*y(:); ...
ca8068f74e303e170c3c844aea22e64594b9115568bd0092b5d02b604435c865
MATLAB
422
21
function [itiMdl, itiOpt, V, rpe, alpha, G] = generate_ph_mdl(... R, alpha0, D) [V, rpe, alpha, G] = deal(nan(size(R))); V(1) = 2.5; for tt = 1:length(R) if tt == 1 G(tt) = 1; else G(tt) = abs(rpe(tt-1)); end alpha(tt) = min(alpha0*G(tt), 1); rpe(tt) = R(tt) - V(tt); V(tt+1...
0555e2eaf48e6d9008e335775f471e93246d5cf7250e5cb5144d6789de5d1775
MATLAB
423
15
function [bval_arr_new, dwi_img_new] = bvalOrderFix(bval_arr,dwi_img) disp(['Reordering B0 to start of imaging sequence']) if size(bval_arr,1) > size(bval_arr,2) bval_arr = bval_arr'; end % bval_arr_new = [bval_arr(end) bval_arr(1:end-1)]; [bval_arr_new,idx] = sort(bval_arr); % dwi_img_new = cat(...
136991f694d0c1db0624eee6639367f922266846c174301b844cfc5b53962d03
MATLAB
423
15
function [ output_args ] = meanActivityPattern( activityPatterns , activityThreshold ) %MEANACTIVITYPATTERN ( activityPatterns , activityThreshold ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % %% AVERAGE ACTIVITY PATTERNS output_args = mean( cell2mat( activityPatterns ) , 1 ); %%...
1bb9bd9435451239c7f7fee10dc259bf6152734100ac2dcbfef2232a6f20c25f
MATLAB
423
18
% Compute the log intensity for the inverse link function g(f) = exp(-exp(-f)). % Output range: 0 <= g(f) <= 1. % % The function can be used in GLM likelihoods such as likBeta. % % Copyright (c) by Hannes Nickisch, 2016-10-04. function [lg,dlg,d2lg,d3lg] = glm_invlink_expexp(f) lg = -exp(-f); if nargout>1 dlg ...
ff8bf7f002b08331dd72b9ff8e71179955d507d47f2fb5bb49c90671d77fca5e
MATLAB
423
25
function [htheta] = tapas_sem_seria_htheta() %% Returns the standard hyperpriors. % % Input % % Output % htheta -- Standard parameters of the sampler. % htheta.pk is the precision kernel. % aponteeduardo@gmail.com % copyright (C) 2015 dim_theta = tapas_sem_seria_ndims(); % Precision kernel hthe...
894cc3575744409fdbb2ecb62d022addf2c0f8ee4d8be8a3ec8db84f02273520
MATLAB
424
14
% info name = 'ICLabel'; filetext = fileread('eegplugin_iclabel.m'); version = regexp(filetext, 'vers = ''ICLabel(\d+\.\d+\.?\d*)'';', 'tokens'); version = version{1}{1}; % enumerate files/directories files = dir(); file_names = {files.name}'; file_names = file_names(cellfun(@isempty, ... regexp(file_names,['^\.|\...
a83f888576f6619e739e14bca01cf4871d2ca40d8f5557283be5fc13ab119461
MATLAB
424
26
% plot_predict(ytest,ypred) % time range for plot %Tlim = [200 500]; [N,T,Ntr] = size(ytest); yt = reshape(ytest,[N,T*Ntr]); yp = reshape(ypred,[N,T*Ntr]); % Plot prediction for test data NY = 2; NX = 1; nfig = 0; for n=1:N nfig = nfig+1; if nfig > NX*NY, figure; nfig=1; end subplot(NY,NX,nfi...
e5551b59b153d8a0c3005a04543fba1a0c52122133f05e02881cee73f40789ee
MATLAB
424
21
% Make this a script 1; function res = logging_genStackTest(v) if v > 4 res = strfcallstack(); return; end res = logging_genStackTest(v+1); return; % Check that genStackTest produces the preamble v = logging_genStackTest(1); teststr = sprintf('Stack trace:\n\tat'); assert(v(1:16) == teststr); % Chec...
6e627acd5bd0fb46d15d1220ca3431e98491ace0c9d4dc25e1f03ca5a3d06f29
MATLAB
425
12
function [VRon] = VRmask(y, ythreshold) % Creates a mask [VRon] for a given trace that is 1 if the Virtual Reality % is turned on (0 if off). % y: a vector of recorded positions indexed by frame numbers. % Note that 1 unit of y equals 2 meters of real-world distance (as in the ball-VR system) % ythreshold = y va...
746bff392b973c94d90f39413d6584365b4cb677645360be985a513e1dddbbe8
MATLAB
425
23
function out = gaussblur(im, rad) out = zeros(size(im)); N = round(rad*5); if mod(N,2)==0 N = N+1; end gaus2 = zeros(N,N); midx = (N+1)/2; midy = midx; for x = 1:N for y = 1:N gaus2(x,y) = exp(-((x-midx)^2+(y-midy)^2)/(2*rad^2)); end end gaus2 = gaus2./sum(sum(gaus2)); for i =...
0e4b0129552a66bf8104d5a7da5a06966270c19c49b0631800b7268bdef7a825
MATLAB
428
12
%{ preprocess.SpikeMethod (lookup) # spike_method : smallint # spike inference method --- spike_method_name : varchar(16) # short name to identify the spike inference method spike_method_details : varchar(255) # more details about language ...
1f4da7a3a06953518a68058f459cc5bb5f0cc5388907e3ba4ff7b0017dc3ac78
MATLAB
428
25
%Numero de picos significativamente diferentes. LC function [Y_Ren]=Npeaks(Y) N=size(Y,2); %Número de picos j=1; for i=1:(N-1) Ya=Y(:,i); Yb=Y(:,i+1); Yab=Ya-Yb; Yab=abs(Yab); if (sum(Yab)<=0.001) %Porcentaje de similitud if (i==(N-1)) Y_Ren(:,j)=Ya; end e...
123bb2cf42006a91208f05c25884e2f0e2b1fc65e9a32fa2fe2fb70b817d5001
MATLAB
429
16
function r = genRandMatrix(vals, nRows, nCols) % given vector of values vals, generates a matrix with elements randomly % chosen from vals % (c) Jiri, Apr11 % indexes inds = 1:length(vals); % matrix r = nan(nRows,nCols); for c = 1:nCols r(:,c) = vals(round(linTransform(rand(nRows,1), [0 1], [min(inds)-0.5, max(i...
b0896e4aa0febf3efc937b6068b2fcbe7f1dc741fafb90eb9d1dd0d58a66d859
MATLAB
429
21
function dWU = alignWU(dWU, top,nt0min) [nt0 ,~, Nfilt] = size(dWU); dWU(isnan(dWU)) = 0; for i = 1:Nfilt if(isempty(nonzeros(dWU(:,:,i)))) else [~, imax] = min(squeeze(dWU(:,top(i),i))); dmax = -(imax - nt0min); if(dmax>0) dWU((dmax + 1):nt0,top(i), i) = dWU(1:nt0-dmax,top(i), i); else...
e0de7cab3bbc97536c4c790b00f89f1cb9081043ec5134bc682e1c5e66e55ad3
MATLAB
429
23
function outvec = gauss(frames,sds) % GAUSS - return a smooth Gaussian window % % Usage: % >> outvector = gauss(frames,sds); % % Inputs: % frames = window length % sds = number of +/-std. deviations = steepness % (~0+ -> flat; >>10 -> spike) outvec = []; if nargin < 2 help gauss return end if ...
e9d158b6eb74b564577611b6989e1f310e1f0bd47615222988a7efd136a3a815
MATLAB
430
18
function vec_out = my_vector_shifter(vec_in,shift) if abs(shift)>numel(vec_in) error('the shift value you specified is bigger than the size of the vector!'); end if shift==0 vec_out=vec_in; elseif shift<0 end_point = vec_in(end); vec_out = [vec_in(1-shift:end) end_point*ones(1,-shift)]; elsei...
240b2ade46293be72f0262e119cffe30d4b67cf2f822b9726c35418361f89fbe
MATLAB
431
21
%{ # Pixelwise orientation response map -> tune.OriDesign -> tune.CaMovie --- response_map : longblob # pixelwise normalized response activity_map : longblob # root of sum of squares %} classdef OriMap < dj.Computed methods(Access=protected) ...
5a21167ff6277559ab795c460f468730f25724e004963bf6d433b5e2f9043681
MATLAB
431
17
%{ aodpre.PreprocessMethod (lookup) # trace preprocessing preprocess_id : tinyint # pre --- preprocess_name : char(8) # brief description to be used in switch statements, etc %} classdef PreprocessMethod < dj.Relvar methods function fill(self) ...
8dcf1610da3e2d323a7ff5dfd7a3e0f64e915c79b1934653d03b5a52f2da4734
MATLAB
431
19
function savePDF(figureHandle,name,directory) if isempty(directory) error('Sorry.. dont know where to save it...'); else fullname=fullfile(directory,name); if isfile(fullname) % File exists. delete(fullname); else % File does not exist. orient(figureHandle,'landsca...
1d5253cd7c3eac351cf23840ab31f526524e2101c4854b2a0ad2a443e33f624e
MATLAB
433
12
% create a channel map file Nchannels = 32; connected = true(Nchannels, 1); chanMap = 1:Nchannels; chanMap0ind = chanMap - 1; xcoords = ones(Nchannels,1); ycoords = [1:Nchannels]'; kcoords = ones(Nchannels,1); % grouping of channels (i.e. tetrode groups) fs = 30000; % sampling frequency save('C:\DATA\Spikes\...