sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
789d11953f491f041882be19cc6a695c3a3a32ed0cd9526dd9c29941f2eb93d9 | MATLAB | 930 | 26 | %RunElectodesClassificationMatlabFunc
clear all
matlabImpute = true;
imputeIters=20;
NumTreesVec = [10,20,40,80];
averageAllBoutsFromSession = true;
%ElectodesClassificationMatlabFunc(unifyContextClasses ,averageAllBoutsFromSession ,...
% NumTrees,TakeJustTheta,TakeJustGamma,matlabImpute,imputeIters)
for uni... |
9224f54342de2c0397b6a750998c154402cc1859135e15387a9c1eb134590e82 | MATLAB | 930 | 34 | classdef Test_LineScanVel_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% =======================================... |
54f3a5625d280fed12e113e295e18ce7a34df230d31bc22e3a7e82cf108e84f1 | MATLAB | 933 | 30 | function R=shuffwei_partial(W,frac)
% R = shuffwei_partial(W,frac)
% Shuffle a fraction frac of the weights in connectivity matrix W to give
% random matrix R, preserving adjacency matrix (i.e., zeros do not move).
%
% Inputs
% W = weighted connectivity matrix
% frac = scalar 0<frac<=1, shuffle thi... |
82faf251a711c25f1802d1ee1cc0f0515cf63d4ef7e89369a20967346ccf0d39 | MATLAB | 934 | 33 | function tabChange_Callback(obj,src,~)
% Runs when user selects a new tab
%
% zapit.gui.main.controller.tabChange_Callback
%
% Purpose
% Implements GUI updates related to tab changes.
currentTab = src.SelectedTab.Title;
switch currentTab
case 'Calibrate Scanners'
toggleOver... |
2213c8ea49dcc0b73c99c4af1cb8e9d2688bb54bd4d473c5a4260269396eea7d | MATLAB | 937 | 38 | function B = Bin1D(A,Dim,BinSize)
%% Bin A in the dimention of DIM (1---default)
% BinSize must be a positive integer (2---default)
%
%
% YC at ES lab
% Created on Sep. 30, 2005
% Last modified on Apr. 17, 2008
%% Check input/output arguements
if ~exist('Dim','var')
Dim = 1; % default
end
if ~exist... |
3aae05640b48f7ab601f045f8b91412a951c008a7ffb2007dc8c55d4d2d6fc93 | MATLAB | 937 | 27 | % clear, clc
% load('Anxiety_Lucy_noshock_n44.mat')
%load('Discovery_dataset1.mat')
load('Anxiety_Lucy_noshock_n44.mat')
% load('Anxiety_Lucy_noshock_novisual_n44.mat')
%load('subj_index.mat')
svrobj = svr({'C=1', 'optimizer="andre"', kernel('linear')});
dataobj = data('spider data', double(rating.dat)', rating.... |
7a2172ef380125ca448d6b0aa3b55b79e9bbd5391f61ba53982e08ab152f2e69 | MATLAB | 937 | 34 | classdef Test_LineScanDiam_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ======================================... |
bf7398e9c70315949ba1a7204c41ca71c5102f820a692c442ce7ebd85306d259 | MATLAB | 937 | 34 | function plotScatterRmse_breakout(y,r,t,ptrain)
if size(y,2)>size(y,1)
y = y';
end
if size(r,2)>size(r,1)
r = r';
end
figure; hold on;
% plot unity
mn = floor(0.9*min([y;r])); mx = ceil(1.1*max([y;r]));
plot(mn:mx,mn:mx,'b');
% plot the test set prediction and ... |
4ae12c7e85f97b5fcc3f9e4ffa75c37024bd2c62174a522c30cf459c32c9356b | MATLAB | 938 | 43 | function B = RotateMatrix(A,Angle)
%% Rotate the first 2 dimention of A with Angle (deg)
% Origin is the center of the first 2 dimention of A
% Clockwise is positive
%
%
% YC at ES lab
% Created on Jul. 3, 2008
% Last modified on Jul. 15, 2008
%% Parameters
SizeA = size(A);
Width = SizeA(2);
Height = ... |
729e25a210b8e485b42a5315d3bab4015e952cbafd9cd556f669b11fcc65147e | MATLAB | 938 | 42 | % [Fet, nFeatures] = LoadFet(FileName, BufSize, CluSubset)
%
% A simple matlab function to load a .fet file
function [Fet, nFeatures] = LoadFet(FileName,varargin);
[BufSize, CluSubset] = DefaultArgs(varargin,{inf, []});
Fp = fopen(FileName, 'r');
if Fp==-1
error(['Could not open file ' lsFileName]);
end
nFeat... |
3d4d0f88bb7ce113989051141ad83f3ee6e073ad4e2463823b53154a88b1f127 | MATLAB | 942 | 34 | classdef Test_Metadata_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ==========================================... |
1d9e5f4a274b806c1dca23680ddf35db5fbced6c0c31a2a694e45425edd95849 | MATLAB | 948 | 36 | %% check_smoothbranch
%% test 1
clf; hold on;
N = 20;
for ge = 1 : 3
for te = 1 : 3
X = (0 : N)' + rand (N + 1, 1);
Y = randn (N + 1, 1) * 10;
Y = convn (Y, ones (5, 1) /5, 'same');
Z = randn (N + 1, 1) * 10;
Z = convn (Z, ones (5, 1) /5, 's... |
3ba249545b55dd564a3e8cb0139009767d37e0df72da7a7119681eaf7a85d920 | MATLAB | 950 | 26 | function sortedCountries = sortByCorrelation(DataMatrixObservationsInRows)
DataMatrix = DataMatrixObservationsInRows;
curCorrMat = corrcoef(DataMatrix);
diagInd = find(eye(size(curCorrMat)));
curCorrMat(diagInd) = -inf;
[maxVal,maxInd] = max(curCorrMat(:));
[maxI,maxJ] = ind2sub(size(curCorrMat),maxInd);
sorte... |
0db7bfce0c31a4f550c1a8bb90497875fc2cf512a4fa8badbec8a249d108e459 | MATLAB | 956 | 27 | function initialize_network(masterFolder)
addpath('/lustre04/scratch/nbrake/code/simulation_code');
count = 1;
C = zeros(100,100,3);
dp = zeros(2001,3,10000);
for arrayID = 1:10
for j = 1:10
i = 10*(arrayID-1)+j;
folder = fullfile(masterFolder,['run_' num2str(i,'%.3d... |
1481828d49c1d801ebc2f904a22de6e6f099bedc68063a2601b04df23d243d2e | MATLAB | 956 | 49 |
function [outlist] = ReadList(inlist)
inlist = strtrim(inlist);
if iscell(inlist)
[pathstr, name, ext] = fileparts(inlist{1});
if strcmp(ext,'.txt')
inlist_file = inlist{1};
if ~exist(inlist_file,'file')
error('Cannot find file: %s \n', inlist_file);
else
outlist = GetList(inlis... |
44587d57788c36d8063d1836968e9577ed4c68242596e37ef7f303b7d9df4b84 | MATLAB | 956 | 59 | function r=getFWHM(hZP)
% TODO -- this code is duplicated from some in getLaserPosAccuracy.
% This is currently a throwaway function
im = hZP.returnCurrentFrame;
mpix = hZP.settings.camera.micronsPerPixel;
bw = im > max(im(:))*0.9;
c = regionprops(bw,'Centroid');
c = c.Centroid;
% Cut it along rows and columns
... |
5ff2f3c9de96b791071458a8b3d55e6598682151e226f31e170852cf505a7169 | MATLAB | 956 | 39 | function model = updateModel(df,model,fold,params)
% fields = fieldnames(model{1});
% tm = model{1};
% for ef = 1:length(fields)
% fields{ef}
% end
tmp = df(fold);
model{1}.x0 = tmp.x0;
model{1}.y0 = tmp.y0;
model{1}.sigma = tmp.sigma;
model{1}.exponent = tmp.exponent;
model{1}.beta = tmp.beta;
model{1}.varexpf... |
2486d4c497f4a09439ba85ad4ac3b0d503c7973e0fc815f836e82b1af2e36cf2 | MATLAB | 957 | 35 | function [x y]=bresenham(x1,y1,x2,y2)
%Matlab optmized version of Bresenham line algorithm. No loops.
%Format:
% [x y]=bham(x1,y1,x2,y2)
%
%Input:
% (x1,y1): Start position
% (x2,y2): End position
%
%Output:
% x y: the line coordinates from (x1,y1) to (x... |
1796c66d2cf95b6cabcde28e640fa390f4e65ef6e8346977690e19c7d9feabb9 | MATLAB | 958 | 47 | function hgfPict = DisplayPicture(fnPict)
%% function hgfPict = DisplayPicture(fnPict)
%
% Display a picture file
%
% Input:
% - fnPict is the picture filename, incliding pathname.
% If it doesn't refer to an existing file, a dialog will open.
%
% Output:
% - hgfPict is the handle of figure for picture
%
%
%... |
6ca9f766d8fccc1bdadfa996dccd7ea96b708d510362f77537fc0838b3196e52 | MATLAB | 959 | 37 | function sW=strengthcorrect(W,ss,nreps)
% sW=strengthcorrect(W,ss,[nreps])
%
% Iteratively rescale weights in connectivity matrix W to make the strength
% sequence converge onto desired strength sequence ss
%
% Inputs
% W = weighted connectivity matrix
% ss = desired strength sequence
% nreps ... |
b1ad928d39f1cbd580717b690d9cdd457bf45ed539074e64195ddcd82b0f5d06 | MATLAB | 961 | 43 | function errorDisplay(ME)
% Neatly display a caught error message
%
% function daqDemosHelpers.errorDisplay(ME)
%
%
% Purpose
% We don't want to rethrow errors, but we do want to know what they
% are. This funcion displays a MATLAB error message structure to
% the command... |
ed65a5bcf517accffa617fa4934829b7010ea54a0e03a3164f8bd31243af7a18 | MATLAB | 961 | 37 | function paintBrainBorder_Callback(obj,~,~)
% Use the laser to draw the brain outline onto the sample
%
% function zapit.gui.main.controller.checkScannerCalib(obj)
%
% This is a callback from a state button so it will run the scanners until unchecked
if nargin>1
% Only set GUI s... |
e5dfc1ff7a6b8fe70af09802db01190e8a1b86c4640f9f349f7f08a17105e1e8 | MATLAB | 962 | 14 | function summStruct = BoutEffect( dataMat, preScan, boutScan, postScan )
scanMean = @(x,s)( mean(x(s,:,:),1,'omitnan') );
meanPre = cellfun( scanMean, dataMat, preScan, 'uniformOutput',false );
meanRun = cellfun( scanMean, dataMat, boutScan, 'uniformOutput',false );
meanPost = cellfun( scanMean, dat... |
06170b5d6cf9777f400ad8c1fa731b13dcb8db8b6965a7735d4e641841350347 | MATLAB | 963 | 26 | function display = setDefaultDisplay
% display = setDefaultDisplay
%
% Most of our expTools code relies on a display calibration. If no
% calibration file is specified or available, then set some default
% values. These are the default values.
%
display.screenNumber = max(Screen('screens'));
[width, height... |
5aa9db5103f0b888273d7682b36b8824ff614450b29120ce9e241b1218c07a2b | MATLAB | 963 | 50 | function [color] = ColorIt(input)
%
% creates RGB values for more pleasing data plotting colors
%
% input can be a single letter (first letter of color name) or full color
% name: reb, orange, yellow, green, blue, purple
% or an index between 1-8
switch input
case {'r','red',1}
color = [ 228 ... |
b5a007bc005f47f23ec3f5831961da08eeeb769fee5aaf72814055605439f67b | MATLAB | 964 | 47 | function hZP = getObject(quiet)
% Returns the Zapit object from the base workspace regardless of its name
%
% hZP = zapit.utils.getObject(quiet)
%
% Purpose
% Used by methods to import Zapit without requiring it to be passed as an input argument.
%
% Inputs
% quiet - false by default. If true, print no messages to scre... |
1bdc5869acd5f7b9834b311f58c52aafeac20826684bb38d655a3ec242c76d7f | MATLAB | 965 | 40 | function out = connectAuxDaq(devID)
% Connect to digotal line and return task and digital writer class
%
% out = connectAuxDaq(devID)
%
% Purpose
% Connect to DAQ for DO so a separate function can rapidly switch the DAQ
%
% Inputs
% devID - [optional] by default 'Dev2'
%
% Ou... |
4997b20e334b3481093912acbaf83637ca81e3ef54f2b855e68dfa8eaed75060 | MATLAB | 965 | 28 | function [max_output] = liverAcc(x_train,x_test,y_train,y_test,rho1,max_iter)
size_train = size(x_train);
size_test = size(x_test);
acc_test = ones(1,max_iter);
for ii = 1:max_iter
true_count = 0;
trainmtx = zeros(size_train(1), 36);
parfor i = 1:size_train(1)
x = x_t... |
0d61f1f994afe5dcd551223b517824fdc3a9711c8cc91c11ffab50515385d065 | MATLAB | 967 | 22 | function [D]=opti1DDecode(resp,stimtype)
%This function computes the decoding accuracy given some measured 1-dimensional responses
%to repeated trials of two types of stimulus
% 'resp' is a vector of length 2n, where n is the number of trials for each
% type of stimulus, each entry of 'resp' is a measured re... |
ab413c542e025a1e63fc05156189a9b4a043317866da7af3d6c5d19aefd92767 | MATLAB | 969 | 46 | function pasteBrainAtClick(atlas_data)
% Test adding the brain border with bregma on the mouse click location
uF = uifigure;
uA = uiaxes('Parent',uF);
b = atlas_data.whole_brain.boundaries_stereotax{1};
uA.DataAspectRatio = [1,1,1]; % Make axis aspect ratio square
pan(uA,'off')
zoom(uA,'... |
18f16ccce38b91f46bb6ab945849a1e09e66831753ebe2683dfa2bee2c72e629 | MATLAB | 970 | 48 | function SavePDF(hgfFig,fnPDF,Orientation)
%% SavePDF(hgfFig,fnPDF,Orient)
% save figures into a pdf file
%
% hgfFig is a vector of figure handles
% fnPDF is the file name of pdf file including path name
% Orient is the orientation of page
%
%
% YC at ES lab
% Created on Jun. 7, 2018
% Last modified on Jun. 10, 2018
... |
3993c5cd68aeb7eaa2d0d24a9483426f8056e6c178db1de5ee413260dde17d85 | MATLAB | 970 | 37 | function [fh] = visualisedt_v15(tinsp1,cp1,tlabv,tv,RH,totf,stmp,xlim,Quantity)
% Visualize measured data
fh = figure;
%% Signal + concentration graph
subplot(2,1,1)
yyaxis left
plot(tinsp1/60,cp1);
title('Overview plot of the experiment at 80 °C');
xlabel('{\it T} (min)','fontweight','bold')
if strcmp('Extinction',... |
8ca30ed8e65285bb3a40b716464a81a02a4b1cc98c982f6e34574d5dd1735bf2 | MATLAB | 971 | 32 | function [usePMTind, usePMTname, useChan] = DeterminePMT(requestColor, sbxInfo)
% Which PMTs are available (PMT gain > 0)?
PMTname = {'green','red'};
pmtGain = [sbxInfo.config.pmt0_gain, sbxInfo.config.pmt1_gain];
pmtOn = pmtGain > 0;
pmtAvail = PMTname(pmtOn);
% Which PMTs were requested?
if ~isempty(pmtAvail)... |
8fcbafdc41d2399b268cf3343675c650a94a251183fe28261021386e9dad817d | MATLAB | 972 | 24 | function mask = choose_mask_polygon(self, imgType)
%choose_mask_polygon - Protected class method to choose an individual
% polygon mask
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU G... |
90a331d400105b0235634857b2f542e7ac1b7a36b7a49a961f04e387a0a88062 | MATLAB | 973 | 30 | function f = LK_PlotRippleERP(mycfg)
%
% LK_PlotRippleERP plots the ERP across multiple ripples.
%
% The input is a structure with multiple fields.
%
% The ouptut is a figure handle.
%
% Lukas Kunz, 2021
%% baseline correction
cfg = [];
cfg.baseline = mycfg.param.ripple.twoi4BaselineERP;
erpRipple ... |
a237a3f1e23d74ec11a30cc633be7b0eaf8b8ab6216385acb513adbf97722ec1 | MATLAB | 973 | 37 | function ranovaResults = perfrom_bootstrap_stat(param_to_test,roiList)
%% boostrap stat test
rng("default")
% param_to_test=window;
n_voxel = 1000;
n_boot = 100;
all_sample = zeros(n_boot,length(roiList));
voxel_sample = zeros(n_voxel,length(roiList));
for i = 1:n_boot
for r = 1:length(roiList)
w = (cel... |
b5cedc9d801e4217f0e67dc51f314967a0586cf0a3adf4eff97199d88a1560cc | MATLAB | 973 | 41 | function testROI
uF = uifigure;
uA = uiaxes('Parent',uF);
uA.DataAspectRatio = [1,1,1]; % Make axis aspect ratio square
pan(uA,'off')
zoom(uA,'off')
roi = images.roi.Rectangle('Parent',uA,'Position',[0.1,0.1,0.8,0.8]);
roi.Label='Adjust then double-click';
% The only way I can fi... |
f9df547e116397f4c27fbcf842b869ee09f077402c7d2e7c21efbc84e1debeea | MATLAB | 974 | 41 | function [Corr1D, Dist1D] = CaluclateSpCorr(DataTrial, SizePxl)
%%
% [Corr1D, Dist1D] = CaluclateSpCorr2D(DataTrial, SizePxl)
%
% Calulates spatial correlation of the supplied DataTrial matrix (HxWxT)
% to pixel size SizePxl. Returns 1D correlation with corespoonding distance.
%% Calculate distance matrix
[Width,He... |
f991b921d75379b8c5bf1c95322e4a5b0c2032db5a971ac497c4e0af07186269 | MATLAB | 975 | 39 | % test out the camera functionality
% cause the camera to acquire frames, process these frames trivially,
% and set the camera accept an exposure trigger
videoInputName = 'hamamatsu';
vid = videoinput(videoInputName, 1);
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
vid.TriggerRepeat = Inf;
triggerconfig(... |
8b7aeffeeb6ecf63211e5db0b2b2e00e89463c91f3b470587c36c8798c337e6e | MATLAB | 977 | 24 | function mask = choose_mask_ellipse(self, imgType)
%choose_mask_ellipse - Protected class method to choose an individual
% ellipsoid mask
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU... |
668f16b1cdd40d32a95c0e25682bf64254f7dd02476f798bc09ed708b2f23a33 | MATLAB | 979 | 36 | classdef Test_StreakScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ============================================... |
ddba867e6d854786c412c262e6ea06e20d137985baa0a5c2c6781353ef10d578 | MATLAB | 979 | 50 | function C = CalculateConv2D(A,B,nB)
%% function C = CalculateConv2D(A,B)
% Calculate 2D convolution of A and B
%
% Use fft2, so much faster than conv2 in matlab
% A and B must be 2D
% C has same size as A
%
%
% YC at ES lab
% Created on Sep. 29, 2009
% Last modified on Jan. 1, 201
if (~exist('nB','var'))
nB = 1;
e... |
0b846a31fb22f452c0a83fecd4682bc1cd45490aa85f8ecd10d8f17e2aa0d282 | MATLAB | 980 | 135 | %first column = numbering of channels on probe PCB connectors looking from
%the top.
%second column = numbering of channels on head stage amplifiers.
headstagewiring=[
1 26
2 27
3 28
4 29
5 30
6 31
7 32
8 25
9 24
10 23
11 22
12 21
13 20
14 19
15 18
16 17
17 16
18 15
19 14
20 13
21 12
22 11
23 10
24 9
25 8
26 7
27 6
2... |
2ed3bbd653d447db33413480786d80aab8ab2c06522d32d26ec16ad9b8a7b567 | MATLAB | 980 | 24 | function mask = choose_mask_freehand(self, imgType)
%choose_mask_freehand - Protected class method to choose an individual
% freehand mask
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GN... |
8e012e851b9ce437fb67a3c321f467f40f5523c42abc22befa97616b90597c9f | MATLAB | 980 | 26 | %RunElectodesClassificationMatlabFunc
clear all
matlabImpute = true;
imputeIters=80;
NumTrees = 20;
substractMouseMean = true;
%ElectodesClassificationMatlabFunc(unifyContextClasses ,averageAllBoutsFromSession ,...
% NumTrees,TakeJustTheta,TakeJustGamma,matlabImpute,imputeIters)
usedMouseId = [32 33 37 38... |
1052ebb525965474b69bab26e08f4347c4d55d12b92c1e33998fbe931f73cd5c | MATLAB | 981 | 39 | muPerPix = 800/512;
disp('Rematching Targets')
for ind=1:numExps
fprintf('.')
stimDepth = All(ind).out.exp.stimDepth;
allDepth = All(ind).out.exp.allDepth;
stimCoM = All(ind).out.exp.stimCoM;
allCoM = All(ind).out.exp.allCoM;
numRois = numel(stimDepth);
numCells = size(allCoM... |
427d6d2eb54f503e38e91b2581dcf85ffaa6b4095e1338378e1e01fd0b4224b0 | MATLAB | 982 | 27 | function DataMatrix = SubstractMouseMean(DataMatrix, StimuliLabels, MouseIDs,Days,sessionNames)
uniqueSLabels = unique(StimuliLabels);
uniqueMouseID = unique(MouseIDs);
meanPerMouse = zeros(size(DataMatrix,1),length(uniqueMouseID));
for m=1:length(uniqueMouseID)
meanCurMouse = 0;
cnt = 0;
for l ... |
75b412582f2e81b97082cb195d59db6a27c9c151fd09ec8f132af5e37969bedd | MATLAB | 982 | 24 | function mask = choose_mask_rectangle(self, imgType)
%choose_mask_rectangle - Protected class method to choose an individual
% rectangular mask
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of t... |
b32ea21bf17f300255727d6d7402c2f816461b8ba087d35ab1cae9bafebbb3e4 | MATLAB | 982 | 29 | function [clabel,dval] = test_liblinear(cf,X)
% Applies a LIBLINEAR classifier to test data and produces class labels
% and decision values.
%
% Usage:
% [labels,dval] = test_liblinear(cf,X)
%
%Parameters:
% cf - classifier. See train_liblinear
% X - [number of samples x number of features] ... |
43465fe248db98096ecb50ce95c32cdc5a0fff73fc59f37d4ae8c2552ce2bb1d | MATLAB | 983 | 135 | %first column = numbering of channels on probe PCB connectors looking from
%the top.
%second column = numbering of channels on head stage amplifiers.
headstagewiring=[
1 32
2 31
3 30
4 29
5 28
6 27
7 26
8 25
9 24
10 23
11 22
12 21
13 20
14 19
15 18
16 17
17 16
18 15
19 14
20 13
21 12
22 11
23 10
24 9
25 8
26 7
27 6
2... |
b7dccbe22ae99bd9b6001a59d0f585bf9437335d6c0da8689152dd3abcbe0bfb | MATLAB | 983 | 42 | function st_viewTC(DT,voxelNumber)
figure('position',[500 500 1200 600])
% CST model
subplot(321);
plot(DT{1}(voxelNumber,:).tc)
model =DT{1}(voxelNumber,:).tmodel{1};
title(sprintf('%s noiseless',model));
xlabel('time'); ylabel('amp');
subplot(322);
plot(DT{1}(voxelNumber,:).ntc)
title(sprintf('%s + noise',model))
x... |
d865e310b73413922c5746fb5dfc0a1c3681c5bc5ad837b1b52b7422da2082d6 | MATLAB | 984 | 38 | function Z = FuncWoNGaussian2D(P,Coordinates)
%% function Z = FuncWoNGaussian2D(P,Coordinates)
%
% 2-D Gaussian function WithOut Normalization
% Note: to create orientation, the whole coordinate is rotated.
%
% P = [Amp,X0,Y0,Base,Ort,SigmaMinor,SigmaMajor] --- parameters
% Coordinates.X --- X vector
% Coordi... |
d1011c75886673bb1caff70beb938e8df40a3398a82e31d63c08618f7183ad38 | MATLAB | 985 | 48 | function sff = sffTriangulate(sff)
%SFFTRIANGULATE calibrate and triangulate
% input and output: sff structure
%
% Raphael Sarfati
% raphael.sarfati@aya.yale.edu
%% launch calibration
if ~sff.prm.flag.clb
disp([datestr(now,31) ' -- Calibration started...'])
% time calibration
sff = sff_d... |
60206fc2743e8396a3d8a52c91e584c7649b38400f0f45dd01b71237d76ca964 | MATLAB | 987 | 24 | function ShowConfMat(confMatrixVal, titleStr, classesVec)
f=figure,
colSum = sum(confMatrixVal);
confMatrixValNorm = confMatrixVal./repmat(colSum,[size(confMatrixVal,1),1]);
meanAccVal = mean(diag(confMatrixValNorm));
imagesc(confMatrixValNorm),%title(['conf-mat validation,JustT',num2str(TakeJustTheta),' JustG... |
83afc2542bc1701f62460bb2eadfdfb5ef61bd546b5e07e3cb29607e063d7711 | MATLAB | 987 | 34 | classdef Test_RawImgComposite_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ===================================... |
5aec60399d7965b6680a5feb77044a2c389005b074c709914c834cdcda9e8aa0 | MATLAB | 988 | 49 | clear all
close all
load(['expertDecoderWithoutRecenter.mat'])
[a,b]=mdmDecoder(decoder,decoder.classification.model.parameters{1});
default=b(1);
contri=[];
for ch=1:22
decNew=decoder;
C1=decoder.classification.model.parameters{1};
C2=decoder.classification.model.parameters{2};
C1(ch,:)=0... |
13f375bada57c12ae7c6b1cbfced38eb2dd6975e12c30fe0b951c5e277315fa8 | MATLAB | 990 | 25 | function trajs = calc_trajs(self, varargin)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 th... |
96f59f54648f6f3bbfc00ddbc9769ef59427751d1314c469b5210ba262d0fe86 | MATLAB | 993 | 35 | function F = root_gNMDA_nu_omega( gNnu )
% MF & LS equations for solving population firing rates,
% NMDAR conductances, and oscillation frequency at critical point lambda=0
%
% Input: 4 unknowns
% gNnu(1) - modulation strength of NMDAR conductances
% gNnu(2) - E population rate
% g... |
fcd9c3a7977f07603eba4c9517f335fd6d96ee95deb2d7d9561c9c8c86df76d1 | MATLAB | 994 | 41 | function Q=Kmatrix(Xz,M,G,D,c,j)
% function for calculating the matrix Q
d=length(D);
if nargin==6
dd=d-1;
else
dd=d;
end
Q=zeros(G,M*d);
if ~isempty(c)
for i=1:dd
if c(i)==1
Q(:,M*(i-1)+1:M*i)=Xz.^D(i); % Type: power
elseif c(i)==2
r=exp(Xz.^D(i)); % Type: power sigmo... |
889e669105d66a9cdd9b6858347f9b71702d057881d45ddc21321217f78cc7fa | MATLAB | 997 | 35 | classdef Test_MultiChImg_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ========================================... |
1ba16da689c6fbcb53c6f9c5a995b17cf375816e0c1ac80dcf6bb5f2caed9ceb | MATLAB | 1,000 | 37 | %% check_jitter_tree
%% test 1
clf;
tree = resample_tree (sample2_tree, 1);
jtree = cell (1, 10);
for counter = 1 : 10
jtree{counter} = jitter_tree (tree, counter / 20, 10, 'none');
end
dd = spread_tree (jtree);
for counter = 1 : 10
HP = plot_tree ( ...
jtree{counter}, ... |
79eedfa161994ec069022f17968cc19cba7e49b43f4d6d0996bc7ac873a8e30b | MATLAB | 1,000 | 32 | function params = displayParams
% For Scanner NEC LCD2080UX display
% Driven directly by Powerbook laptop via a labelled DVI-VGA cable, a VGA F-F adapter,
% a Y-shape VGA splitter, with the other end hang empty, a VGA-5 BNC converter, 5 BNC
% connectors at control room<->scanner room panel, 50ft BNC cables, and 5 BNC-V... |
fd02f3b88f10496c3f759c5510f2c791b9a6375aab78b73da94d7d9ec522ea89 | MATLAB | 1,000 | 33 | % the pattern separation toolbox: analyse spike train ensembles
% Copyright (C) 2022 Alexander D Bird
function [output_spiketimes] = spike_thinner_nth(input_spiketimes,n_rep,n)
%SPIKE_THINNER_NTH Removes spikes from input trains if they are within 'n'
%of the previous allowed spike.
if nargin<2 || isempty(n_rep... |
b9bdfacc3a025b3c5b6b4f3a7fb9170ae9f259b16aa9cd1813b11e846252870e | MATLAB | 1,003 | 35 | classdef Test_ArbLineScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% =======================================... |
3da8b450af1eb4bfb285539cf0f86589196e3de1e6df318390f56f596af9bc09 | MATLAB | 1,004 | 25 | function [hFig, plotName, idxStart] = check_plot_args(self, args)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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, ... |
8e73f809736df438c384499df6a40900a3be2d3520c1d02e7f70e654d6686cca | MATLAB | 1,004 | 36 | function name = parseXmlOptoStim(filename)
if ~exist(filename, 'file'), error(['Could not find file: ' filename]); end
%%
% Import the XPath classes
import javax.xml.xpath.*
% Construct the DOM.
% filename = which('demos/demos.xml');
try
tic;
experimentDoc = xmlread(filename);
elapsedTimeXmlRead = toc;
... |
79c1ec7a597c4d7b7f6ffd7c9e4fab1b6b5b3fdf5c9fefc88e6100ffa9d47c55 | MATLAB | 1,005 | 29 | function [] = LK_save(saveFile, saveVariable, saveFlag)
%
% LK_save replaces the MATLAB function save to be able to save variables
% within a parfor loop.
%
% Input:
% saveFile --> path and name under which the variable shall be
% saved
% saveVariable --> variable to save (without qu... |
62044c46b759cfd1fa066d6351b12828d6ed2f6a1ed7c9cc6e04dd4ff2de4edd | MATLAB | 1,006 | 33 | function highlightSelectedStimCond(obj)
% If stim points are being overlaid, the selected set in the dropdown are highlighted
%
% zapit.gui.main.controller.highlightSelectedStimCond
%
% Purpose
% Highlights in a different color the points selected by the dropdown.
%
% Do not highlight ... |
cdc51386757b1b537e08113e6a85b0bdc697642bc0331b97871960217be76a0a | MATLAB | 1,006 | 47 | clear
load('../data/2020_07_connectomes90_AllFC.mat')
rng(42)
ss = readtable('../data/subs_pop.csv');
ss = table2cell(ss);
is_sub = zeros(1,size(sub,2));
tes = zeros(1,size(ss,1));
for i = 1:size(sub,2)
if any(strcmp(ss(:,1),sub{i})) && any(strcmp(ss(:,2),ses{i}))
tes(find(strcmp... |
7ef3dfb81a8d07ebd335889ce476975a08614839e114909cf06e54f3ad5a5679 | MATLAB | 1,007 | 33 | function combine_unitary_spectra
addpath('/lustre04/scratch/nbrake/code/simulation_code');
baseFolder = '/lustre04/scratch/nbrake/data/simulations/mixed_input';
[sa,X] = network_simulation_beluga.getHeadModel;
inputType = {'baseline', 'high_aperiodic', 'high_both', 'high_oscillation','oscillation_only','aperiodic_o... |
0ddff8a8d2810158716591f426b90891795d7ebb38ab9e37610b15b86e0c61da | MATLAB | 1,008 | 24 | % GRAPHICAL OUTPUT
%
% functions for visual output and various hulls
%
% Files
% chull_tree - Convex hull around whole or part of a tree.
% dA_tree - Displays the adjacency matrix of a tree.
% dendrogram_tree - Plots a dendrogram of a tree.
% gdens_tree - Density matrix of a tree.
% hull_tre... |
470dde52f728b60040e02da2824b51498d05d0210582750476d6b398177980aa | MATLAB | 1,014 | 26 | function [DataMatrix, Labels,MouseIDs,Days, sessionNames] = GetLFPData(TakeJustTheta,TakeJustGamma)
%dataFileName = 'C:\David\Phd2020\ElectordesClassification\Data for David - LFP power_average (sessions).xlsx';
dataFileName = 'C:\David\Phd2020\ElectordesClassification\Data for David - LFP power_average (sessions)_... |
5f8aa09417ad48ef357093b62c6ce70573c966b16abfab7a0665099fc223e9f3 | MATLAB | 1,015 | 25 | function f = LK_PlotTrialPeriodDurations_20231005(dt)
%
% LK_PlotTrialPeriodDurations_20231005 plots the durations of the trial
% periods.
%
% Input is a structure with multiple fields.
%
% Output is a figure handle.
%
% Lukas Kunz, 2023.
% create figure
f = figure('units', 'centimeters', 'position', [2, 2, 5, 5]);
%... |
7295246db84274a20e7e1980803aad3e1a039afa9c29b8bcc11ae6cfd7672b78 | MATLAB | 1,017 | 27 | function f = LK_PlotMemoryPerformanceNormTime_20231004(dt)
%
% LK_PlotMemoryPerformanceNormTime_20231004 plots the subjects' memory
% performance as a function of normalized time.
%
% Input is a structure with multiple fields.
%
% Output is a figure handle.
%
% Lukas Kunz, 2023
% create figure
f = figure('units', 'cen... |
9d29d94e213b5ba7666dda767582864b0770c805674f0e0c37a61a17739e8f4e | MATLAB | 1,018 | 36 | classdef Test_downsample_params < matlab.unittest.TestCase
% Test_downsample_params Summary of this class goes here
% Detailed explanation goes here
% ================================================================== %
properties (TestParameter)
dsamp = {[2, 1], 2, [3, 4]};... |
3eb3dfe33db8a13740b2b08e14cadb1dc31d1a32441545c2721b422b8d24a63d | MATLAB | 1,024 | 30 | function [ structOut, cellArray, fieldNames ] = FlattenStruct( structIn, fieldPrefix )
% FLATTENSTRUCT flattens a hierarchical structure array into a flat version.
% field names are concated with _
cellArray = struct2cell( structIn );
fieldNames = fieldnames( structIn );
fieldInd = 1;
while fieldInd <= numel(... |
5d00748edf5e4188750614005e5c4dced912fdec417e94f210293e18f37a383f | MATLAB | 1,024 | 36 | function data = loadNiftiPair(phaseFile, magnitudeFile, rotate90)
%LOADNIFTIPAIR Load phase and magnitude fMRI NIfTI files.
arguments
phaseFile {mustBeTextScalar}
magnitudeFile {mustBeTextScalar}
rotate90 (1,1) logical = false
end
data = struct();
data.phaseFile = string(phaseFile);
data.magnitudeFile = s... |
66b1944f2ba5d7213715c874ec74929c597944739d4e8fec5a2176f71770a10f | MATLAB | 1,026 | 30 | function [max_val] = abaloneforoptim(x_train,y_train,x_test,y_test,rho,n_iter)
acc_test_SVM = ones(1,n_iter);
size_train = size(x_train);
size_test = size(x_test);
for ii = 1:n_iter
true_count = 0;
trainmtx = zeros(size_train(1), 24);
parfor i = 1:size_train(1)
x = x_... |
7c39324e3cdd133111f0c21cb911cd1bdaba052d75e0b3fbf4f959b636d96a2d | MATLAB | 1,026 | 25 | % EEGfMRIPav_GLM3A_labels.m
% Create labels for each contrast of GLM3A.
%
% EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN.
% J. Algermissen, 2018-2023.
% Should work in Matlab 2018b.
% we are here:
% cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/
% clear all; close all; clc
GLMlabels = {
... |
d748363e91a959d5276c07345f1ad8a4bb393eb7f81b03e069b8714707711e91 | MATLAB | 1,027 | 35 | % EUCDIST 2D Euclidean distances between two sets of points.
% (scheme package)
%
% M = eucdist (X1, X2, Y1, Y2)
% ----------------------------
%
% Calculates a distance matrix M between two sets of points described by
% their x and y coordinates.
%
% Input
% -----
% - X1 ::N1x1 vector: x-coordinates of first set of ... |
dee27310efcd03997e60bdc60907c712b909cf43f74ab844364c70cf825b67a8 | MATLAB | 1,027 | 40 | clear all
thetaRight = [67.5 112.5 157.5 157.5 -157.5 -112.5 -112.5 ...
-67.5 -22.5 -22.5 22.5 67.5];
thetaLeft = [-67.5 -22.5 22.5 22.5 67.5 112.5 112.5 ...
157.5 -157.5 -157.5 -112.5 -67.5];
thetaFB = (0:30:330) + 15;
% Parameters from data fit
a = 29.2282;
b = 2.1736;
c =... |
f0a9eb745144738b78d0f06db8d5cc0df20e7f202b07d7dfb88624ca72e1e5e8 | MATLAB | 1,028 | 45 | function [PSD, fv] = calc_PSD(x, fs, varargin)
% Step0: Argument parsing
defaultNFFT = 0;
checkSign = @(x) x>0;
defaultSides = 'single';
validSides = {'single', 'double'};
checkSides = @(x) any(validatestring(x, validSides));
p = inputParser;
p.KeepUnmatched = false;
addRequir... |
6f3c47084c4ea5d828af1fbf74d80a3fa654ff8d122911a629c3483b26d4344f | MATLAB | 1,029 | 26 | function initialize_network(masterFolder,S)
addpath('/lustre04/scratch/nbrake/code/simulation_code');
count = 1;
C = zeros(100,100,3);
for arrayID = 1:10
for j = 1:10
i = 10*(arrayID-1)+j;
folder = fullfile(masterFolder,['run_' num2str(i,'%.3d')],'simulation');
... |
c09f3d32402f7bfd303404812f203c063d9a296d03a65761a2fdb7182d0b75ca | MATLAB | 1,030 | 26 | function cmap = get_ROI_cmap(nROIs)
%get_ROI_cmap - Helper function to the get the colormap for the ROIs
%
% This function is not intended to be called directly.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it un... |
0abc0aa275def2864afe9844624bfd3ebc8db1a8124b3796649a2c266565a6ef | MATLAB | 1,032 | 31 | function f = LK_PlotRipplePowerSpectrumAcrossChannels_20231030(dt)
%
% LK_PlotRipplePowerSpectrumAcrossChannels_20231030 plots the power
% spectrogram of ripples across channels.
%
% Input is a structure with multiple fields.
%
% Output is a figure handle.
%
% Lukas Kunz, 2023
% create figure
f = figure('units', 'cent... |
ba44d35eb342bebc1d9508ad6fef66a092b1a3f87f0d4aadaa037a88836db05d | MATLAB | 1,034 | 34 | function [pAnova,pMC] = anovaRM2W_BH(data1,data2)
% Performs repeated measure 2-Way ANOVA assuming sphericity. Calculates
% multiple comparisons using a non-paired ttest with Bonferonni correction.
% Anova p-vaule matches Prism output for predictor variable (X/Learning
% Type).
%
% Inputs: (must have same number of ti... |
66bd419c9f9e9b07fa1d7abd24f56b70464f5723eb4472e61e104426f6091039 | MATLAB | 1,035 | 32 | %COPPER2 Black-copper-white colormap
%
% Examples:
% map = copper2;
% map = copper2(len);
% B = copper2(A);
% B = copper2(A, lims);
%
% A variation of MATLAB's copper colormap, which continues on to white.
% This colormap converts linearly to grayscale when printed in black &
% white.
%
% The function can addi... |
92b3084238bf7d3785fdea16774a3a9a6e29fd5a9c72dbd7a2a5deced71290d6 | MATLAB | 1,038 | 35 | function [pAnova,pMC] = anovaRM2W(data1,data2)
% Performs repeated measure 2-Way ANOVA assuming sphericity. Calculates
% multiple comparisons using a non-paired ttest with Bonferonni correction.
% Anova p-vaule matches Prism output for predictor variable (X/Learning
% Type).
%
% Inputs: (must have same number of time ... |
ffce8c5a980a1c5cb31ad80a1f9ab2231dd6a0760054c7613a2bcb73bae024b7 | MATLAB | 1,039 | 28 | function choose_streaks(self)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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
... |
1e2ab563ff630e534b168505ee1873d5d6ebfc60da65a7ec8544da1c2ee90a6b | MATLAB | 1,042 | 44 | function varargout=focusNamedFig(figTagName)
% Bring to focus a figure window identfied by its tag property
%
% zapit.utils.focusNamedFig(figTagName)
%
% Purpose
% Brings to focus the figure with the tag name 'figTagName'.
% Creates the figure if it does not exist
%
% Inputs
% fi... |
6f25967fae102fc1c0c3eb25fd3ed08bacfbb26b5498fd45023fa1bafd183cbc | MATLAB | 1,043 | 25 | function mask = choose_mask_square(self, imgType)
%choose_mask_square - Protected class method to choose an individual square
% mask
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Gene... |
6f57e73ba1eb249138e50262b14e6c61caad45df9d6d6a63a75826f6e6bd3b19 | MATLAB | 1,043 | 37 | classdef Test_FrameScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% =========================================... |
ba7c19cae99510088a8baa9a3e2fe36a608e1db940987f99a0966aec257292b7 | MATLAB | 1,043 | 25 | % EEGfMRIPav_GLM2_labels.m
% Create labels for each contrast of GLM2.
% For GLM2without7, just copy and rename .mat output file.
%
% EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN.
% J. Algermissen, 2018-2023.
% Should work in Matlab 2018b.
% we are here:
% cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/
%... |
e1869cb79399c34dc64b5cd847c2a71b4eccb995dc3014cdd36e25bb64c4f55e | MATLAB | 1,043 | 24 | % EEGfMRIPav_GLM1C_labels.m
% Create labels for each contrast of GLM1C.
%
% EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN.
% J. Algermissen, 2018-2023.
% Should work in Matlab 2018b.
% we are here:
% cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/
% clear all; close all; clc
GLMlabels = {
... |
ed2285cb3753f59501d7ad47d187a510819b1804a6549bb5026ed6fbbb34fc05 | MATLAB | 1,043 | 24 | % EEGfMRIPav_GLM1B_labels.m
% Create labels for each contrast of GLM1B.
%
% EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN.
% J. Algermissen, 2018-2023.
% Should work in Matlab 2018b.
% we are here:
% cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/
% clear all; close all; clc
GLMlabels = {
... |
be7ceaab49c811d5d51536dbaf2d6b36891909ded34b594f8bf57b6b5c6b7cce | MATLAB | 1,044 | 32 | %SEPIA Black-brown-white colormap
%
% Examples:
% map = sepia;
% map = sepia(len);
% B = sepia(A);
% B = sepia(A, lims);
%
% A colormap designed to replicate the sepia tones of old photographs.
%
% The function can additionally be used to convert a real-valued array into
% a truecolor array using the colormap.... |
f96e5a5beea0b7a15c51793b41329a10ca1610943c21fdfb66a8891eb1b71c2f | MATLAB | 1,044 | 35 | % script to run through all subjects
% also makes a table to summarize key information
% set up paths
scriptname = matlab.desktop.editor.getActiveFilename;
[codedir,~,~] = fileparts(scriptname);
cd(codedir);
addpath(codedir);
cd ..
dsdir = pwd;
cd ..
% this assumes you have the istart-sharedreward directory in the s... |
871bb9053cd496ecf884e28b5a14bd6fddd52a6fa7da58876d70b089533220b5 | MATLAB | 1,046 | 34 | function combine_unitary_spectra
addpath('/lustre04/scratch/nbrake/code/simulation_code');
folder = '/lustre04/scratch/nbrake/data/simulations/trend_peak_interaction2';
count = 1;
rhythm = [];
combo = [];
for i = 1:5
for j = 1:5
saveFolder = fullfile(folder,['rhythm' int2str(i-1)],['combo' int2str(j)]);
... |
ea11edc5c343b48387a59a7c7bb58b4bf5944486b482cdfd3386098d4408a28e | MATLAB | 1,046 | 35 | function [outVars] = identifyDuplicateHolos(All,outVars)
disp('Identifying Repeated Holograms')
numExps = numel(All);
c=0;
repeatIdentifier = [];
for ind = 1:numExps
us = unique(All(ind).out.exp.stimID);
thisExpROIs=All(ind).out.exp.rois;
for k=1:numel(us)
s = us(k);
sidx = find(us==s... |
18de16a890daea22a5d520426302504407fc740c27fdda3e082e42ef49ff31d3 | MATLAB | 1,047 | 30 | function cgui_mousewheel_tree (src, evnt, action)
global cgui
modifier = get (cgui.ui.F, 'Currentmodifier');
if isempty (modifier), % zoom axis
% second of three vis_ panel mouse actions: zoom
% this function is activated by mouse wheel turning
% simply adjust camera angle:
angle = get (cgui.ui.g1, 'cam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.