sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
01e42d759467fb049703a6cca592c84088fed4f5b8f2ae1505b6adb68b07a8a1 | MATLAB | 328 | 10 | function [vcondition]=load_condition_hc(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_hc.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.Turbulence_range(wG,:)=(Turbulenc... |
803e832b13da628155138175e5599d47aacb144f8882e8cada8d00233a306d3f | MATLAB | 328 | 14 | function [x,y,xi,yi,tri,X,Y,dt]=setup_plot()
% set up the plot
[X,Y] = meshgrid(-1:0.01:1, -1:0.01:1);
xq = X(:);
yq = Y(:);
rTest = sqrt(xq.^2 + yq.^2);
ckUnit = rTest <= 1;
x = xq(ckUnit);
y = yq(ckUnit);
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
xi = dt.Points(:,1) ;
yi = dt.Points(... |
05d826df5f12541f47a592c74f71b46d284f260aa7c469de1a52f0d392aa4b3b | MATLAB | 330 | 24 | function it = items(O)
% returns cell arry of key/value pairs in O
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
keys = O.keys;
values = O.values;
l = length(keys);
it = cell(l,1);
for i = 1:l
it{i} = { keys{i}, values{i} };
end
... |
b648cbff81eff2b1f53c2fa695ed6e14095dd91990756a14ab53c55ca2cd59d1 | MATLAB | 330 | 12 | function stat = betweenGroupVar(smpl,match)
groups = unique(match,'rows');
for i=1:length(groups)
if size(match,2)==1
aves(i,:) = mean(var(smpl(match==groups(i),:)));
else
ind = find(sum(match==groups(i,:),2) == size(match,2));
aves(i,:) = mean(smpl(ind,:));
end
stat = mean(aves)... |
e505a195a3540ef0ad9f05d6f44a9996e1736fa8e0dd264bebe4bfbd10f9c860 | MATLAB | 330 | 10 | function [vcondition]=load_condition_tbi(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_tbi.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.Turbulence_range(wG,:)=(Turbule... |
1fc596da7085b8273c7d28f16935891ba91df5d0f417a0864d02c0f165557c8e | MATLAB | 333 | 16 | function [xo] = remove_nan_rows( x )
% *WAVE*
%
% REMOVE NAN ROWS removes any rows from a two-dimensional matrix which
% contain a NaN
%
% INPUT
% x - data matrix (r,c)
%
% OUTPUT
% xo - data matrix, NaN rows removed
%
assert( ndims(x) == 2, 'data matrix input required' )
xo = x(~any(is... |
369be7cf14d904dfcbc76b1a9f784d603b986de36f45135670c8520c4d2d10c0 | MATLAB | 334 | 13 | function end_eyetracker(Experiment)
if strcmp(Experiment.Mode.eyetracking,'Yes')
WaitSecs(0.1);
% stop the recording of eye-movements for the current trial
Eyelink('StopRecording');
Eyelink('Command', 'set_idle_mode');
WaitSecs(0.5);
Eyelink('CloseFile');
Eyelink('ShutDown');
en... |
f9c09885d6f2d9d6d55cbf80256cb035651a7e89c11270e7ca3f43b61733810c | MATLAB | 334 | 18 | function [st,en] = LoadEvtFile(fbasename)
fname = [fbasename];
if ~exist(fname,'file')
error('No ''cel'' evt file!')
end
fid = fopen(fname,'r');
evt = textscan(fid,'%f %s %s');
fclose(fid);
nbC = length(evt{1})/2;
if round(nbC)~=nbC
error('Number of cel events must be even')
end
st = evt{1}(1)/1000;
en = ev... |
1985c15d7a49aae31f89f1b169d4ce8cab286bee9da7627650a753b812b77d2b | MATLAB | 336 | 10 | function [vcondition]=load_condition_hc_tp2(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_hc_tp2.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.Turbulence_range(wG,:)=(T... |
68d74db459f99c40624d829e1661430b59e2bc6fa34b54de794dd058ccb209ad | MATLAB | 336 | 10 | function [mask_coords] = convert_mask_idx_to_mask_coords(mask, mask_idx)
% MASK_IDX is a vector of indices into MASK. Returns coordinates for
% each of these indices.
%
% See CONVERT_MASK_COORDS_TO_PAT_IDX for a description of the form
% that MASK and COORDS must take.
[x y z] = ind2sub(size(mask), mask_idx);
mask_co... |
9f244085963d45e8dc05443d0740303f55530338b31041046e95d8eefaba71c0 | MATLAB | 336 | 22 | function [success errmsg] = test_train_bp()
% [success errmsg] = test_train_bp()
success = -1;
errmsg = 'Script unfinished';
return
success = 0;
errmsg = '';
nFeatures = 100;
nTimepoints = 1000;
nOuts = 2;
pat1 = rand([1:nFeatures/2 nTimepoints]);
pat2 = rand([1:nFeatures/2 nTimepoints])*2;
pat = [pat1; pat2];
%... |
9e5effcde3d303713d2ff68a67c90d3c7bac29de83dff1b53e8a8014bd9d5b5c | MATLAB | 337 | 26 | function [hbTypeStr, hbTypeIdx] = GetHbType(handles)
hbTypeStr = {};
hbTypeIdx = [];
if nargin==0
return
end
if isempty(handles)
return
end
idx = get(handles.listboxPlotConc, 'value');
s = get(handles.listboxPlotConc, 'string');
if idx==0
return;
end
if isempty(s)
return;
end
hbTypeStr = s(idx);
hbTypeI... |
f15fa749f7418c9b782725a2bed327301ff7c6ca78c0763a1e24001659106b5e | MATLAB | 337 | 6 | function [fractional_occupancy, mean_life] = compute_occupancy_and_mean_life_subject_wise(temporal_evolution_of_states, max_nstates)
n_subjs = length(temporal_evolution_of_states);
for subj=1:n_subjs
[fractional_occupancy(subj,:), mean_life(subj,:),~] = summary_stats_fast(temporal_evolution_of_states{subj}, 1:ma... |
d60447ee3e99bcd40c28296c43de5e7b179f77ef71248c5db5cf01279fd4e7ab | MATLAB | 338 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function tau_u = tau_u(v)
vx = 7;
tau_u = (30.8 + ((211.4 + exp((v+vx+113.2)/5)) / (1 + exp((v+vx+84)/3.2)))) * (1... |
8f1591dff68df0d07584b6a07cf4ba8b1d39b910577c8691a06ebd87b9673235 | MATLAB | 339 | 14 | function [f,gf] = onehump(x)
% ONEHUMP Helper function for Tutorial for the Optimization Toolbox demo
% Copyright 2008-2009 The MathWorks, Inc.
% $Revision: 1.1.6.2 $ $Date: 2009/05/07 18:25:30 $
r = x(1)^2 + x(2)^2;
s = exp(-r);
f = x(1)*s+r/20;
if nargout > 1
gf = [(1-2*x(1)^2)*s+x(1)/10;
-2*x(1)*x(... |
a2657b306f85c91718f43e58182d4c96d379ca82cd6dc47fd2861a390955f80c | MATLAB | 339 | 15 | function t0 = get_trigger(Experiment)
% Get Trigger
% Input: Struct 'Experiment' with fields 'Keys'
% Output: Time of first MRI trigger
Keys = Experiment.Keys;
keysOfInterest = zeros(1,256);
keysOfInterest(Keys.mriTrigger) = 1;
KbQueueCreate([],keysOfInterest);
KbQueueStart([]);
t0 = KbQueueWait([]);
KbQueueStop([])... |
ddd445e3851cfd1294f597020ef18b7060d0089c3a4f8325a890091a79e92c9f | MATLAB | 339 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function mhFunc = mhFunc(v, mhPre, dt)
dh = (fhinf(v) - mhPre) / tauFunc(-100, 0.073, 0.7, 1.7, v);
mhFunc = Euler(... |
e4aa343437284eef61c762560159d103910bf522c367c08b1b3910708ef7e5a5 | MATLAB | 339 | 18 | grayed_data=rgb2gray(data);
grayed_data=double(grayed_data);
maximum_intensity=max(max(grayed_data));
grayed_data(grayed_data<=maximum_intensity*0.05)=0;
N = nnz(grayed_data);
total_intensity=sum(sum(grayed_data));
intensity_mean=total_intensity/N;
imagesc((grayed_data));
colormap('jet');
axis ... |
06c637d513611f769d08c59017dcc7e261d162e1b6dc1c12f7f0db327cb3e9b5 | MATLAB | 341 | 12 | function [errmsgs warnmsgs] = unit_traintest_bp()
% [ERRMSGS WARNMSGS] = UNIT_TRAINTEST_BP()
%
% Runs GENERIC_UNIT_CLASSIFIER with the bp class_args
class_args.train_funct_name = 'train_bp';
class_args.test_funct_name = 'test_bp';
class_args.nHidden = 0;
class_args.epochs = 40;
[errmsgs warnmsgs] = generic_unit_cla... |
13de6ea20e620ee6d932af4f873102fbe6b3ba19b4a753e5369cc206363329bb | MATLAB | 341 | 19 | function ix = findAlignment(D, tstmp)
% tsArray/findAlignment
% ix = findAlignment(D, tstmp)
%
% Returns an index i= such that D(ix) occurs
% at timestamp tstmp
% Finds closest index.
% ADR
% version: L4.0
% status: PROMOTED
nIX = length(tstmp);
ix = zeros(size(tstmp));
for iIX = 1:nIX
ix(iIX) = binsearch(D... |
6802e5510730346e0953a8efff75df67e3cd8de31023aa2bcfd9810cf6540915 | MATLAB | 342 | 10 | function [vcondition]=load_condition_tbi(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_tbi_mask2SD_bin.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.Turbulence_range(wG... |
85eb7b31546b61d5eae87b1d746d368cdd6e9698a7f993dbff37c9b2a49eac8f | MATLAB | 343 | 22 | function display(O)
% display(O) deals with displaying dictArrays
k = O.keys;
v = O.values;
format compact
fprintf(1, '\n{');
for i = 1:length(k)
fprintf(1, ' %s: ', k{i});
if ~isempty(v{i})
disp(v{i});
else
fprintf(1, '\n');
end
fprintf(1, ' ');
end
fprintf(... |
36fd7d32aa39e24620692880622f45d8e1af066a2b869f3d006c3c02d9c015a3 | MATLAB | 344 | 10 | function f=autocorr_index(p,x)
% f=autocorr_index(params,x)
% f=(p(1)*(sin(2*pi*p(4)*x)+1)+p(2))*exp(-abs(x)/p(5))+p(3)*exp(-abs(x).^2/p(5)^2);
% theta index: p(1)/p(2)
% c.f. Royer et al., 2010
f=(p(1)*0.5*(cos(2*pi*p(4).*x)+1)+p(2)).*exp(-abs(x)/p(5))+p(3).*exp(-abs(x).^2/p(6)^2);
%f=(p(1)*(cos(2*pi*p(3).*x)+1)+p(2... |
4dc4321b87ebfdd84d0aec318621e7aa088b79817fd2cfa55619bc3846f1ac60 | MATLAB | 344 | 9 | function weightedCounts = HistcountsWeighted(data, weights, edges)
if ~isequal(size(data), size(weights))
error('"data" and "weights" not the same size.');
end
[~, ~, bins] = histcounts(data(:), edges);
weightedCounts = zeros(1, length(edges) - 1);
for i = 1:length(weightedCounts)
weightedCounts(i) = sum(weig... |
61e3e33e1733ea978c7841bfcbdf7fe8b00d8013f5e8184b9976064176dc1eb3 | MATLAB | 344 | 12 | function p = pcolorCentered(hBin,vBin,data)
%PCOLORCENTERED Plots a pcolor figure using the bins as the center of each
%data point
% hBin and vBin are the center locations of data
data(end+1,:) = 0;
data(:,end+1) = 0;
dH = mean(diff(hBin));
dV = mean(diff(vBin));
p = pcolor([hBin hBin(end)+dH] - dH/2,[vBin vBin(end)... |
c6f27c36714327909dcb411f72237da6a418466e3847800ec12acd59b5f300f7 | MATLAB | 345 | 20 | function [VX, VY] = Vel2d(X, Y)
t = Range(X, 'ts');
ty = Range(Y, 'ts');
if length(ty) ~= length(t)
error('X and Y don''t have the same length');
end
if any(ty ~= t)
error('X, and Y don''t have the same times.');
end
dt = diff(t);
vx = diff(Data(X)) ./ dt;
vy = diff(Data(Y)) ./ dt;
VX = tsd(t(1:end-1), vx);
V... |
d2a03f9c220a4c39705dd8e1e66ecebf2f558b881ef902cf4990137b07b12f6f | MATLAB | 345 | 15 | function yrange = GetAxesYRangeForStimPlot(hAxes)
if ~exist('hAxes','var') || isempty(hAxes)
hAxes = gca;
end
ylim = get(hAxes, 'ylim');
% Fill up the ylim range with the stim by adding and
% subtracting a tiny amount so that the ylim isn't
% automatically changed
d = (1e-4)*(ylim(2)-ylim(1));
% d = 0;
yrange = ... |
3e89caf333293801bc3e2c119a5fcf04f68d68a9680303b827bcf88cd3c043d7 | MATLAB | 346 | 10 | function out = RenormalizeImage(input, varargin)
input = double(input);
if isempty(varargin)
out = (input - min(input(:)))/(max(input(:)) - min(input(:)));
else
out = (input - prctile(input(:), varargin{1}))/(prctile(input(:), 100 - varargin{1}) - prctile(input(:), varargin{1}));
out(out(:) > 1) = 1;
ou... |
ee66b8c43c367038bbe643005373c066edf79517a75dbb9485f04cf1361b0080 | MATLAB | 346 | 10 | function [vcondition]=load_condition_tbi(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_tbi_mask1halfSD_bin.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.Turbulence_rang... |
239b63fb0fffb5b5043fa0e59ad0abd5f4532b2246fcd5bccad65f811d5a839a | MATLAB | 347 | 9 | function y = Srange(x)
%RANGE The range is the difference between the maximum and minimum values.
% Y = RANGE(X) calculates the range of the input.
% For matrices RANGE(X) is a vector containing the range for each column.
% Copyright 1993-2000 The MathWorks, Inc.
% $Revision: 2.7 $ $Date: 2000/05/26 18:53:... |
2f24fbd51c3676357ac15af4418a7e9d8646344b925b0e82039afe2a7cadd871 | MATLAB | 347 | 21 | function t = unique(tsa)
% Eliminates points with the same timestamps
%
% USAGE:
% t = unique(tsa)
%
% INPUTS:
% tsa: a tsd object
% copyright (c) 2006 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
tim = Range(tsa);
[tt, ix, j] = unique(tim)... |
3b2a7d5f5f89593349d08dcb13e7da6c42f1932cb7a9a6d6484fc7025879cb6e | MATLAB | 347 | 22 | function O = time_units(inp)
if isa(inp, 'time_units') % copy constructor
O = inp;
return
end
if isa(inp, 'units')
if strcmp(quantity(inp), 'time')
P = inp;
else
error('must be a time unit');
end
else
P = units('time', inp);
end
O.t = 'time_units';
O = cla... |
c4930e9ac688464c00f6f8428ef5740dbca97b8d20253f0ffff845675a6318ac | MATLAB | 347 | 19 | % msave - save an integer matrix in an ascii file
%
% msave(filename,matrix)
%
function msave(filename,matrix)
[m,n] = size(matrix);
formatstring = '%d';
for ii=2:n,
formatstring = [formatstring,'\t%d'];
end
formatstring = [formatstring,'\n'];
outputfile = fopen(filename,'w');
fprintf(outputfile,formatstring,matri... |
69d25c366dd4364ace5383d15c1b8ee532cfd9c0f1d06b07548e1009f70b2a23 | MATLAB | 348 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function mCaFFunc = mCaFFunc(v, mCaFPre, dt)
dCaF = (Funcinf(-600, 0.0467, v) - mCaFPre) / taumCaFFunc(v);
mCaFFunc= E... |
c97fdf463ff632164a7abc87726e4d09c8f88c388321ef7ffd0ab9b71390762d | MATLAB | 348 | 16 | function sliderMoving_tracks_s_2
global framenum
global slice
global text_timepoint
global text_slice
global I
global wholestack_s
global shown_fig
set(text_timepoint,'String',['time = ' num2str(framenum)])
set(text_slice,'String',['slice = ' num2str(slice)])
I=wholestack_s(:,:,slice,framenum);
shown_fig... |
42ac95040a7b2342494ac2145635ada821dcd493723cc7be72d379d9e60e2f5b | MATLAB | 349 | 16 | data_cropped=data_up(1:397, 1575:1997);
maximum_intensity=max(max(data_cropped));
data_cropped(data_cropped<=maximum_intensity*0.05)=0;
N = nnz(data_cropped);
intensity_total=sum(sum(data_cropped));
intensity_averaged_by_pixel=intensity_total/N;
imagesc((data_cropped));
colormap('jet');
caxis([0 230... |
07ee15bd32c87e38eeacd03ef5d91bbac44e40cb975bea493f9a556e2aa52671 | MATLAB | 350 | 18 | function y = RoundDecimalPlaces(x,n,direction)
if( nargin == 2 )
direction = 1;
end
p = 10^n;
x = x * p;
switch( direction )
case -1 % Round down.
y = sign(x) .* floor(x .* sign(x));
case +1 % Round up.
y = round(x);
en... |
70dfb197b1fd83a17734d52b3a786c56618dfaed74c2f5bed8797a760b020a2b | MATLAB | 350 | 15 | function img = scale0To255(img)
%This function converts a float number to a scale between 0 to 255.
%0 is reserved for nan.
lowerbound = min(img(:));
upperbound = max(img(:));
img(img>upperbound) = upperbound;
img(img<lowerbound) = lowerbound;
img = img - lowerbound;
img = img/(upperbound - lowerbound);
img = uint8(... |
5299635da546743cef05db444f78c97efb621633bbce85cc6b923480633c56f1 | MATLAB | 351 | 10 | % rotate ext_dir_initial
angle=45;
% place array here:
ext_dir_initial_data=[];
layer_size=sqrt(size(ext_dir_initial_data,2));
ext_dir_initial_data2=reshape(ext_dir_initial_data,layer_size,layer_size);
ext_dir_initial_data3=imrotate(ext_dir_initial_data2,angle,'bilinear','crop');
ext_dir_initial_data4=reshape(ext_dir... |
e45e75d1b6b637c5cacd932a8fa86f8dc50adfcad6250f5e15b1a720bfee78c4 | MATLAB | 351 | 12 | function scatter_plot=plotspots(ax, scatter_plot, spots, sizes, z, zratio, factor, colrs)
if nargin < 8
colrs=[1 0 0];
end
if ~isempty(spots)
R = sizes(1).^2 - ((z-spots(:,3)).*zratio).^2;
R(R <= 0) = 0.01;
R = sqrt(R);
hold(ax,'on');
scatter_plot=scatter(ax,spots(:,2),spots(:,1),R.*factor,colrs,'LineWidth',fa... |
f293d6292cdaf52c36c46960fcb39b43ca20f5f1b3a29ea5f08b4f19201b6dc6 | MATLAB | 351 | 17 | function a = abs(tsa)
% Absolute value of the data
%
% USAGE:
% tso = abs(tsa)
%
% INPUT:
% tsa: a tsd object
%
% OUTPUT:
% tso: a tsd of absolute value
%
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
a = tsd(tsa.t, abs(tsa.data... |
342aefa0f67c8664b11465ab3ca585e3bd20b8b2068c25088d3a9c2fe114636d | MATLAB | 352 | 24 | function S1 = Restrict(S0,is)
% Returns a tsdArray restricted in a given intervalSet
%
% USAGE:
% tsO = Restrict(tsa,is)
%
% INPUTS:
% tsa - a tsdArray
% is - an intervalSet
% copyright (c) 2009 Adrien Peyrache adrien.peyrache@gmail.com
S1={};
for i=1:length(S0)
Sr = S0.C{i};
S1 = [S1;{Restrict(Sr,i... |
f7a397ac61bdef86092eb12d54b4f2b48611dfce8bdf30413dbdd2b9924c0c99 | MATLAB | 352 | 11 | function data= extract_imetronic_events(data, recording_config, imetronic_DB)
r = recording_config;
n = size(r,2);
for i=1:n
tmp = r{i};
if strcmp(tmp{1},'Imetronic_Event')
events = tmp{3}(imetronic_DB);
cmd = sprintf('data.%s.%s.on_ts=events/1000;',tmp{4},tmp{2});ev... |
f81ebf360ba16f8f8b54741d28f515c3815bde5d10ec42b4ecbb847dafc3fdaa | MATLAB | 352 | 13 | function lstAct = mlAct_Matrix2IndexList(mlAct, ml)
lstAct = [];
for iCh = 1:size(ml,1)
if size(ml,2)==4
k = find(mlAct(:,1)==ml(iCh,1) & mlAct(:,2)==ml(iCh,2) & mlAct(:,4)==ml(iCh,4));
else
k = find(mlAct(:,1)==ml(iCh,1) & mlAct(:,2)==ml(iCh,2));
end
if mlAct(k,3)==1
lstAc... |
6cc604ea3930361c22d1b4ef7608362ebaef439f154cfc997e31f454be082de6 | MATLAB | 353 | 16 | % kernel unit test
%
% linear kernel
tol = 10e-10;
% Random data
N = 20;
F = 15;
X = randn(N,F);
X(1,:) = X(1,:) + X(2,:);
%% linear_kernel(X) and linear_kernel(X,X) should yield the same result
K1 = linear_kernel([], X);
K2 = linear_kernel([], X, X);
print_unittest_result('linear_kernel of (X) and (X,X) should be t... |
08f6dceea0bca3299ded89388578b16723f5f504b194221b8a9f9ed02419370f | MATLAB | 354 | 23 | function [modRatio,p,H,X,X1]= modRatioFit(phase,prefPh)
% [modRatio, prefPh, fitCurve, H]= modRatioFit(phase)
% Adrien Peyrache 2007
nbSpk = length(phase);
[H,X] = hist(phase,2*pi*[0:0.01:1]);
X1 = cos(X-prefPh);
[p S] = polyfit(X1,H,1);
modRatio = abs(p(1)/p(2));
if 0
figure(3),clf
hold on
bar(X,H)
plot... |
a953edbfe701a1bfad901601c60cf853a595bf4fc63e57792769c6dbc3f5ef48 | MATLAB | 354 | 20 | function m = mean(tsa,epoch)
Returns the mean of data in tsd object
USAGE:
m = mean(tsa)
INPUTS:
tsa: a tsd object
OUTPUTS:
m: the rate
% copyright (c) 2004 Francesco P. Battaglia,
% modified 2009 by Adrien Peyrache adrien.peyrache@gmail.com
% This software is released under the GNU GPL
% www.gnu.org/copyleft/... |
ad210485672f33eec06f07eda7b5cd5e967f5cb4cc8981cc2f8cd1c8392d82a9 | MATLAB | 357 | 15 | % output = transres_other(decoding_out, varargin)
%
% This function returns other output that was generated (in the field
% decoding_out.opt)
%
% To use it, use
%
% cfg.results.output = {'other'}
%
% Martin, 2014-01-20
function output = transres_other(decoding_out, varargin)
% return the optional outp... |
b844797f59acf0a384a1a172191abb5e4fb015302722b27ea8dda52c795dd65d | MATLAB | 359 | 14 | function k = plotDataTimeSeries(y, iS, iD, iDt, option)
if ~exist('option','var')
option = '';
end
ml = y.GetMeasurementList('matrix');
k = find(ml(:,1)==iS & ml(:,2)==iD & ml(:,4)==iDt);
if ishandle(1)
if ~strcmp(option,'keep') && ~strcmp(option,'keepopen') && ~strcmp(option,'open')
close(1);
end
e... |
c91b63f8f1906c8f4dacbced70673bf1bb195761f0c1a95612a286d0ddf7bb5c | MATLAB | 359 | 13 | function [Hv] = autoHv(v,x,g,useComplex,funObj,varargin)
% [Hv] = autoHv(v,x,g,useComplex,funObj,varargin)
%
% Numerically compute Hessian-vector product H*v of funObj(x,varargin{:})
% based on gradient values
if useComplex
mu = 1e-150i;
else
mu = 2*sqrt(1e-12)*(1+norm(x))/norm(v);
end
[f,finDif] = funObj(x +... |
10e3d514a6a225d4dde7aac1f7e0abd5fe8d477f3ac7db5a3cc81662e0459707 | MATLAB | 360 | 10 | function [vcondition]=load_condition_tbi_mask2SD_weight(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_tbi_mask2SD_weight.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.T... |
217813cc4e68b4b813afee73fe31cf945dcfe67446a548644951b2799288634c | MATLAB | 361 | 10 | function [vcondition]=load_condition_tbi(G,sbj,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_sub_%d_ON_tbi_mask1halfSD_bin.mat',wG,sbj,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vcondition.... |
bf515c34161fd9099c1c09af2f319b4cbb6c7d3449c32551d9e619aadc8c07e9 | MATLAB | 361 | 9 | function [Num_frames] = SecondsToFrames(Num_seconds,SecPerFrame)
%SecondsToFrames converts seconds to frames
% Num_seconds: the number of seconds
% SecPerFrame: the conversion factor - the number of seconds per frame
% Num_frames: the number of frames (rounded up to the nearest whole
% number)
Num_frames ... |
eac92153fd98ba16399caed62238b4e022a18e0a7b83d114493b3beac1f71240 | MATLAB | 361 | 21 | classdef PsthDistanceClassifierPDDistModel < PsthDistanceClassifierModel
properties
PD
end
methods
function mdl = PsthDistanceClassifierPDDistModel(PD)
mdl.PD = PD;
end
function dist = evaluate(mdl,X,y)
preds = mdl.predict(X);
dist = mean(angleDistance(pre... |
10b417f494fccc9a6d44be7c5bf4306f41d5ddfa507a26d9618d2a65c015d509 | MATLAB | 362 | 23 | function sz = size(TSA)
% Size of the TS object (unmber of timestamps)
%
% USAGE:
%
% sz = size(tsa)
%
% INPUTS:
%
% tsa: a TS object
%
% OUTPUS:
%
% sz: number of timestamps
%
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copylef... |
611b2c1ccbe31f706d6e33a0465bb4937ce14b33e7143151d842782893136a2c | MATLAB | 362 | 20 | clc; clear all; close all;
d=importdata('Exp_90deg_rawdata.txt');
grayed_data=d;
maximum_intensity=max(max(grayed_data));
grayed_data(grayed_data<=maximum_intensity*0.05)=0;
N = nnz(grayed_data);
total_intensity=sum(sum(grayed_data));
intensity_mean=total_intensity/N;
imagesc((grayed_data));
... |
6faedce266e1ac5d93d935710c4d465f650250c0f8fe27e71c40b00d64285619 | MATLAB | 362 | 9 | function [glu_hurwitzZeta, glu_dhurwitzZeta] = loadhurwitzZetaLookup()
x_fn = load('avalanches_matlab_code/analysis_results/hurwitzLookup_20220118', 'spl_hurwitzZeta', ...
'spl_dhurwitzZeta');
%%
% global glu_hurwitzZeta
glu_hurwitzZeta = @(a, x) x_fn.spl_hurwitzZeta(a, x);
% global glu_dhurwitzZeta
glu_dhurwitzZe... |
f63ecab2ec8aafb7a0b06eacab7c79553375769f84dee4240c9df05cd1781174 | MATLAB | 364 | 10 | function [vcondition]=load_condition_tbi_1halfSD_weight(G,cond)
for wG=1:G
load(sprintf('WG_%03d_%d_ON_tbi_mask1halfSD_weight.mat',wG,cond));
vcondition.err_hete_range(wG,:)=(err_hete);
vcondition.InfoFlow_range(wG,:,:)=(InfoFlow);
vcondition.InfoCascade_range(wG,:)=(InfoCascade);
vconditi... |
22f8e66ebf951f6d6608e18d69b52c46baa1acd00adad0aa67fdb7d7ed3d98ed | MATLAB | 365 | 17 | function [mask_idx] = convert_pat_to_mask_idx(mask,pat_idx)
% [MASK_IDX] = CONVERT_PAT_TO_MASK_IDX(MASK,PAT_IDX)
%
% Inverse operation of CONVERT_MASK_TO_PAT_IDX
keep_idx = find(mask);
if ~exist('pat_idx','var')
pat_idx = 1:length(keep_idx);
end
pat_to_mask_idx = zeros(size(mask));
pat_to_mask_idx(keep_idx(pat_i... |
8dbc26a9a26abd0527e60b7525f5906164541afcad1b595ab8abd8531031576c | MATLAB | 365 | 15 | % script to plot real animal data and get gridscore
% select data to use
load filenames;load tetrodes;load cells;
% file_number 15 = small, 23 = medium, 17 = large
file_number=15;%15;%23;
run_real_recordings=1;
plot_subsect=1;
grid_size=33;
plot_size=31;
restrict_time=0;
keep_vars=1; % avoid clearing variables set h... |
a33eaf6c94d7bb5ddce8f17714e01b0cd69781508d636c1bd03882ec19e38e1c | MATLAB | 365 | 9 | function [regFrame] = register_frame(frame,mean_im,yx_px,linesPerFrame,pixelsPerLine,rescaleFact,dftArg)
regFrame = 0*frame;
cycx = yx_px - round(dftregistration(mean_im,fft2(imresize(frame,rescaleFact)),dftArg)./rescaleFact);
Iyx = cycx < [0 0 linesPerFrame pixelsPerLine] & cycx > 0;
regFrame(Iyx(:,3),Iyx(:,4)) = fra... |
0f73ba45db7920c200456df0ddfdda6837a4812f18cfe01d7a87f26cccf639bc | MATLAB | 366 | 14 | % function ind = uniqueq(x,sortedvector)
%
% Much faster than unique for vectors, and even faster when indices are
% already sorted and provided as nx1 vector (when any second input is
% provided, the function assumes this format).
function ind = uniqueq(x,sortedvector)
if nargin == 1
x = x(:);
x =... |
6657bfd3420577161935d09c6256d18bc19e83b074f8282d64cb97286c137e1a | MATLAB | 366 | 21 | function [istart, iend] = ThreshVector(V, threshold, interval, pos)
if pos
c1 = find(V > threshold);
else
c1 = find(V < threshold);
end
dc1 = diff(c1);
istart = c1(find(dc1 > interval)+1);
istart = [c1(1); istart];
iend = c1(find(dc1 > interval));
iend = [iend; c1(end)];
ds = iend - istart;
ds = find(ds > int... |
6aaee26463ff14ac0e71086cebed8f29f27cbb55fe8444d30f56a1cb4bd795aa | MATLAB | 366 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function hCaSFunc = hCaSFunc(v, hCaSPre, dt)
dCaS = (Funcinf(360, 0.055, v) - hCaSPre) / tauFunc(-250, 0.043, 0.2, 5.25, v... |
a74003e8c8c24ab6b93f94fe02082389cc82b124ca18eb48d37b79b90818d0f8 | MATLAB | 366 | 14 | function dist = euclidean2(x,y)
% what corr(x',y') is, but using euclidean distance
ssqx = sum(x.*x,2);
ssqy = sum(y.*y,2);
try % if exist('bsxfun','builtin')
dist = sqrt(max(bsxfun(@plus,ssqx,ssqy')-2*(x*y'),0));
catch
szx = size(x,1);
szy = size(y,1);
dist = sqrt(max(repmat(ssqx,[1 szy]... |
23072e2a8923c41d870986349664ba7b46062608914decef5deb04f261ad8234 | MATLAB | 367 | 13 | function S = SpkTrainGenerator(r,dt)
% S = SpkTrainGenerator(r,time)
r = r(:);
rng('shuffle') % Seed random number generator
% We want a mean firing rate of r Hz. So we want r spikes in
% 1 second. There are 1/dt points in 1 second so we want r
% spikes every 1/dt points.
pspike = r*dt; % Probability of Spiking at ... |
49a7055e603cc1ecb8b427c1d13ee674fe5e1d8ebe367996bb5a0e1223256410 | MATLAB | 367 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function hCaFFunc = hCaFFunc(v, hCaFPre, dt)
dCaF = (Funcinf(350, 0.0555, v) - hCaFPre) / tauFunc(270, 0.055, 0.06, 0.31, ... |
68acdd3efaad6399b190605d597989344c4f7bf01f7fd208832a77450ee88d9f | MATLAB | 367 | 9 | function varargout = get_filenames(software,varargin)
% get_filenames varargin:
% inputs: file path (1 x n string), possible filenames with wildcards (e.g. *.img or rf*.img)
% output: filenames as n x m char array (n = number of files)
check_software(software);
fname = [mfilename '_' lower(softwa... |
4e6c1c519ad9520ff017dfdbd2e4b998ed87e5dbda9ecac04eced0cbb6064b51 | MATLAB | 368 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function tau_p = tau_p(v, TauMax)
tau_p = TauMax / ( 3.3 * exptable((v+35)/20) + exptable(-(v+35)/20));
%tau_p = TauMax /... |
dc9b09168eef134b2651bb42a368079650a3c9b459e92034740f489975926879 | MATLAB | 370 | 16 | % loading stack
% load('.\..\wholestack.mat');
% loading cleaned tracks
% load('.\neurons_cleaned.mat');
% specifying output folder
outputpath='E:\GNAO experiments\E246K\v1\';
% outputpath='.\';
% running the identification step
identification_step(wholestack, neurons_cleaned, outputpath, [0.267 0.267 2])... |
42da6985aa0d2764f4ad3ab9b5696fbb6c5ae5ef635c10eb7604eb0dd4be6b8e | MATLAB | 371 | 20 | function [D, dd, xyz00]=collinearity_check(xyz)
xyz0 = mean(xyz,2);
A = xyz-xyz0;
[U,~,~] = svd(A);
d = U(:,1);
t = d'*A;
t1 = min(t);
t2 = max(t);
xzyl = xyz0 + [t1,t2].*d;
X1=xzyl(:,1);
X2=xzyl(:,2);
D=0;
for i=1:size(xyz,2)
X0=xyz(:,i);
D=D+sqrt(sum(cross((X0-X1),(X0-X2)).^2)/sum((X2-X1).^2));
... |
64c9ee74efd29a5e89689785ce3d895142b85be647724d9e3a50514702570255 | MATLAB | 371 | 17 |
function mdl = classifierFactory(classifierType,PD)
switch classifierType
case 'PsthDistance'
mdl = PsthDistanceClassifierModel;
case 'PopulationPsthDistance'
mdl = PopulationPsthDistanceClassifierModel;
case 'Knn'
mdl = KnnClassifierModel;
case 'PsthDistanceFromPD'
mdl... |
36b241b2e8f8e6c77a477fd203d124a42ffe9975e51cdc401a0fd5529e320778 | MATLAB | 372 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function mCaSFunc = mCaSFunc(v, mCaSPre, dt)
dCaS = (Funcinf(-420, 0.0472, v) - mCaSPre) / tauFunc(-400, 0.0487, 0.005, 0.... |
a7a062ec3707c70c77668ced4c89c3bf4e1d59c5c78a75eec9de6d5be2c666d6 | MATLAB | 373 | 17 | function [xo] = angular_rotation( xph, angle )
% *WAVE*
%
% ANGULAR ROTATION rotates the angular data in the datacube xph a given
% angle
%
% INPUT:
% xph - datacube (r,c,t) (probably complex)
% angle - rotation angle
%
% OUTPUT
% xo - output datacube
%
assert( ndims(xph) == 3, 'datacub... |
04d7c90e2efc36db2dcfe4e36f0a8e8f651267a931d6a00a0cdbfb80353408b9 | MATLAB | 374 | 17 | function Make_TSToolbox()
objDirs = dir('@*');
dirNames = {'@intervalSet';'@tsd'};
parent_dir = pwd;
for ii=1:length(dirNames)
fprintf('In %s \n',dirNames{ii})
cd([dirNames{ii} filesep 'private'])
cfiles = dir('*.c');
for jj=1:length(cfiles)
jj
fprintf('Compiling %s \n',cfiles(jj).name)
... |
0f694dc9ebfc06590d68f366a508266a801c51158dbfd3a6c81c1f46a0f46adc | MATLAB | 377 | 17 | function [lapS] = rand_label(explap)
%RAND_LABEL ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
nlap1 = numel(explap.explap1);
nlap2 = numel(explap.explap2);
lapnum = nlap1 + nlap2;
explap1s = randperm(lapnum,nlap1);
explap2s = 1:lapnum;
explap2s(explap1s)=[];
lapS.explap1 = explap1s;
lapS.explap2 = expla... |
9ff1091267bd16bc81b13807c0bb0795b5a2dcc78d6347f64673af358bc6c854 | MATLAB | 377 | 8 | % This function tells you the location for demos for prevalence_inference.
% You should find them in decoding_toolbox/statistics/prevalence_inference
if isempty(which('decoding_defaults')), error('Please add TDT'), end
display(['See demos in' char(10) ...
' ' fileparts(which('prevalenceTDT')) char(10) ...... |
059d41046cac8c00820808fb9d4671bd9b374498bca9c96ced0865cd19429117 | MATLAB | 378 | 12 | function [z] = mtimes2x2(x, y)
% compute x*y
% and dimensionatity is 2x2xN
z = complex(zeros(size(x)));
%xconj = conj(x);
z(1,1,:,:) = x(1,1,:,:).*y(1,1,:,:) + x(1,2,:,:).*y(2,1,:,:);
z(1,2,:,:) = x(1,1,:,:).*y(1,2,:,:) + x(1,2,:,:).*y(2,2,:,:);
z(2,1,:,:) = x(2,1,:,:).*y(1,1,:,:) + x(2,2,:,:).*y(2,1,:,:);
z(2,... |
45a12d820799d62176cbb5d6b238502a7950f927bc8a0c038608c784721dccdb | MATLAB | 379 | 24 | function [c]=grad_co
co=lines;
c=[];
%black
c(1,:,1)=[0 0 0];
c(1,:,2)=[.4 .4 .4];
c(1,:,3)=[.8 .8 .8];
%orange
c(2,:,1)=co(2,:);
c(2,:,2)=[236 169 140]/255;
c(2,:,3)=[247 221 209]/255;
%purple
c(3,:,1)=co(4,:);
c(3,:,2)=[164 109 176]/255;
c(3,:,3)=[216 192 221]/255;
%green
c(4,:,1)=co(5,:);
c(... |
882a97861fae8304ff1d46f5a667fd6ac8b5870d47fe0c36ad48b551acf58426 | MATLAB | 379 | 12 | function scatter_plot=plotspots(ax, scatter_plot, spots, sizes, z, zratio, factor, colrs)
if nargin < 8
colrs=[1 0 0];
end
if ~isempty(spots)
R = sizes(1).^2 - ((z-spots(:,3)).*zratio).^2;
R(R <= 0) = 0.01;
R = sqrt(R);
hold(ax,'on');
scatter_plot=scatter(ax,spots(:,2),spots(:,1),R.*fac... |
1da3045e106fdd655b98a8b909562808f4326198880c626d03dea6468b9b48a7 | MATLAB | 380 | 8 | function [coords] = getNeighbors(i,j,N_vals_1,N_vals_2)
%GETNEIGHBORS i,j,N_vals_1,N_vals_2
% Returns grid coordinates of neighbors for the given cell (i,j)
coords = [i-1,i,i+1,i,i-1,i-1,i+1,i+1; j,j+1,j,j-1,j-1,j+1,j+1,j-1];
% coords = [i-1,i,i+1,i; j,j+1,j,j-1];
coords = coords(:,coords(1,:)>=1 & coords(1,:)... |
340643d31663551b395eace00117ced04c4cbafe426b15357e29dad9385717c5 | MATLAB | 380 | 13 | function [p dv] = nsvm_test(dd,AA,model)
% dd: labels
% AA: test data vector
% model: result of training
dv = AA*model.w-model.gamma; % decision values
p=sign(dv); % predicted labels
% not necessary for our toolbox, but in case you want the accuracy too
% activate this and pass as thir... |
793d03047656ae964254a4c837ae4b5c4e754f4b7f4aed72ef86d36810445501 | MATLAB | 382 | 18 | function [xo] = analytic_signal( x )
% *WAVE*
%
% ANALYTIC SIGNAL put a datacube into its analytic signal representation
%
% INPUT:
% x - datacube (r,c,t)
%
% OUTPUT:
% xo - output datacube
%
assert( ndims(x) == 3, 'datacube input required' );
[dim1,dim2,dim3] = size(x);
x = reshape( x, [dim1*dim2, dim3] );
xo = h... |
8292eafa12cd505e72f7c94f5ce5d2c0d0af428622258dcef65aaddf2f32bfff | MATLAB | 383 | 12 | function h = makeMyFigure(W,H)
% makeMyFigure(W,H) makes a figure that is W cm x H cm
% if one argument, use golden ratio.
if nargin == 1
H = W;
W = W*(1+sqrt(5))/2;
end
h = figure();
set(gcf, 'PaperPositionMode','manual', 'PaperUnits','centimeters', ...
'PaperSize', [W H], 'PaperPosition',[0 0 W H... |
cea8979c44ef5315b666cf9638355668554e863afac6d5ad0a4fc6af9eabc9c0 | MATLAB | 383 | 14 | nSubjs = length(Ycell);
wa = zeros(nStates,nStates); wpi = zeros(1,nStates);
for ns = 1:nSubjs
phthtpgV1T1 = Qnss{ns}; phtgV1T1 = QnsCell{ns};
wa = wa + sum(phthtpgV1T1,3);
wpi = wpi + phtgV1T1(1,:);
end
Wa = wa + repmat(ua,[nStates 1]);
Wpi = wpi + upi;
stran = exp( psi(Wa) - repmat( psi(sum(Wa,2)) ... |
f33f83df8344fd84c6edebc07e3336bab1bce0053148fc1c3c43938848a04ff2 | MATLAB | 383 | 12 | %Calculate the expected shape ratio given the estimated distance that
%people were holding thier phone.
dist_cm = 35; %distance from eyes to phone
mag = 1.038; %monocular magnification
IPD_cm = 6.3;
EstSlantPercieved = atand( ( (mag-1)./(mag+1) ) .* ((2*dist_cm)./IPD_cm) );
[ratioPercieved,Rat... |
fef75f345688cc811d4dd45a59580e1e307dedef55441860e42d225db981447d | MATLAB | 383 | 14 | function [omega] = mad(x, dim)
% MAD computes the median absolute deviation across dimension dim.
% Implementation according to Wilcox; Robust Estimation
% and Hypothesis Testing (page 35)
if nargin<2,
dim = find(size(x)>1, 1, 'first');
end
pvec = [dim setdiff(1:ndims(x), dim)];
x = permute(x, pvec);
x =... |
258cb803ae2498ca93e94fbde0e873287e39ca59ee9af6849ba77c2a4c966d68 | MATLAB | 385 | 10 | function tracksOut = IsolateTracks(tracksIn, mask)
[ix, iy] = find(mask);
y = [min(ix), max(ix)];
x = [min(iy), max(iy)];
badIdxs = [tracksIn(:, 1) < x(1), tracksIn(:, 1) > x(2), tracksIn(:, 2) < y(1), tracksIn(:, 2) > y(2)];
badIdxs = unique(tracksIn(sum(badIdxs, 2) > 0, 4));
tracksOut = tracksIn;
for i = 1:length(b... |
87616ab19ab7488dd957ef52a4401c2f8e71061eb10e4b97acdd987789affcaf | MATLAB | 385 | 14 | function [trials,varargout] = convert2SD2(trials,mlActAuto)
origIdxToRemove = [29,33,39,40,41,42];
trials(origIdxToRemove,:,:) = [];
switch nargin
case 2
origIdxToRemove = [origIdxToRemove origIdxToRemove+42];
mlActAuto(origIdxToRemove,:) = [];
varargout{1} = mlA... |
cf86d49038112d9776d3f923002057676caa6109fe11267e0cc0a4ccdae7a9c2 | MATLAB | 385 | 15 | function [tiffImage]=tiffRead(imagePath)
% Determine Image Properties
InfoImage=imfinfo(imagePath);
% Pre-allocate Memory
tiffImage = zeros(InfoImage(1).Height,InfoImage(1).Width,length(InfoImage),'uint16');
% Iteratively Load the Image
TifLink = Tiff(imagePath, 'r');
for i=1:length(InfoImage)
TifLink.setDirecto... |
f2442f256bd586d68e64cbea01bdd962e158863889e11d8ee6cf631c811dc015 | MATLAB | 385 | 9 | function [vx, vy] = CutQuiverVectors(vx, vy)
buffer = 2;
[x, y, ~] = ndgrid(1:size(vx, 1), 1:size(vx, 2), 1:size(vx, 3));
xNew = x + vy;
yNew = y + vx;
xNew = double(xNew > (size(x, 1) - buffer)) + double(xNew < 1 + buffer) > 0;
yNew = double(yNew > (size(x, 2) - buffer)) + double(yNew < 1 + buffer) > 0;
vx = vx.*dou... |
dcae49b6858d1252f75b8029fbfff6c3d02ff4991445724a44f15493abcf3802 | MATLAB | 386 | 11 | function varargout = read_image_spm5(varargin)
% read_image:
% input: header (struct variable generated with read_header)
% output: image in neurological space (left = left, view from top)
if nargin >= 2
error('Second input for subvolumes provided. SPM2 cannot deal with 4D data. Please change... |
f068fcc4913110685bb5573ea970a6116a4348bf726355a043f99adbf81cf861 | MATLAB | 386 | 11 | function varargout = read_image_spm2(varargin)
% read_image:
% input: header (struct variable generated with read_header)
% output: image in neurological space (left = left, view from top)
if nargin >= 2
error('Second input for subvolumes provided. SPM2 cannot deal with 4D data. Please change... |
c7c1a4fdff40a88011b4091153b0d57b6b8c4a2c59b9265ee5b3c8c508133479 | MATLAB | 387 | 6 | addpath /comp_neuro/Software/Github/CMBHOME_github/
load('/media/nmsutton/StorageDrive7/comp_neuro/holger_data/180815_S1_S2_lightVSdarkness_merged.mat');
root.cel = [2,5];
c_ts = CMBHOME.Utils.ContinuizeEpochs(root.cel_ts);
x = root.x; y= root.y; t = root.ts; hd = CMBHOME.Utils.ContinuizeEpochs(root.headdir);
pos = [re... |
fa46b0216356b5134adec2484f070e4151f2f11cfa9b426db8d57e5cc575d17a | MATLAB | 388 | 18 | function [events,description] = LoadEvents(fbasename)
fname = [fbasename];
if ~exist(fname,'file')
error('File does not exist')
end
fid = fopen(fname,'r');
evt = textscan(fid,'%f\t%s');
fclose(fid);
description = unique(evt{2});
events = cell(length(description),1);
for ii=1:length(description)
ix = ismembe... |
c09de97b5f487447eca7b6d38733ea161f6555341fbb05b28920633d440c3972 | MATLAB | 389 | 16 | function skel = Graph2Skel3D(node,link,w,l,h)
% create binary image
skel = false(w,l,h);
% for all nodes
for i=1:length(node)
if(~isempty(node(i).links)) % if node has links
skel(node(i).idx)=true; % node voxels
a = [link(node(i).links(node(i).links>0)).point];
if(~isempty(a))
... |
7766ced08107ceb89cba8e7ba24468b57eabb479ddc0593025556531db53e49a | MATLAB | 390 | 23 | function [hb, he] = barplot(data,gca)
% [hb, he] = barplot(data,gca)
% INPUT:
% data: cell array
N = length(data);
mu = zeros(1,N);
er = zeros(1,N);
for ii=1:N
mu(ii)=nanmean( data{ii});
er(ii)=nansem( data{ii});
end
bar(mu); %,'b','FaceColor',[0.5,0.5,1],'LineWidth',1.5)
hold on
for ii=1:N
... |
923ef7194097fed0d7705a3e775393422ae541ccc17fa38c6cd5ef742aa9f3bd | MATLAB | 390 | 18 | prompt='Enter path: '
path=input(prompt,'s');
path=strcat(path,'\')
prompt='Enter filename: '
filename=input(prompt,'s');
file=strcat(path,filename);
[header,Aout,imgInfo,rawStream] = scanimage.util.opentif(file);
frameTimestamps_sec=header.frameTimestamps_sec;
target_file=strcat(file(1:end-4),'_heade... |
a05315f603e56697122b8f7d14680309ce6cf32ae3b477c338b413221718e6aa | MATLAB | 391 | 24 | function R = LoadFuncReg(parent)
% Syntax:
%
% R = LoadFuncReg()
% R = LoadFuncReg(parent)
%
% Description:
%
%
% First get all the argument there are to get using the 8 possible syntax
% calls
if nargin==0
parent = [];
end
if ~isempty(parent) && isproperty(parent, 'R') && ~isempty(pa... |
a5bc01f3b8d4876e840590ff1c42efd7b426535306751d9260fee14411f9d081 | MATLAB | 392 | 14 | function tracks_out = ApplyMinTrackLength(tracks_in,min_track_length)
a = unique(tracks_in(:,4));
b = [];
for i = 1:length(a)
c = sum(tracks_in(:,4) == a(i));
if (c < min_track_length)
b = [b,a(i)]; %#ok<AGROW>
end
end
tracks_out = tracks_in;
for i = 1:le... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.