sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f86100e824d4bc7a196633ceb5d063ba2f3b2d04b7831e1ecff797a1453ea9eb | MATLAB | 129 | 3 | %This script runs runHistPreprocess_base with automatic alignment
runAutomatic = true;
runHistPreprocess_base(runAutomatic);
|
72ec5ee4d3051301bb9c190d8d1d6ba57cf690f180eb977c853762c5358f4cf3 | MATLAB | 130 | 5 | function passTresh = stepConverged(y, tresh)
residual = sum((y-y(:,end)).^2);
passTresh = min(find(residual<tresh));
end
|
837ae05b55f98dcc029bd9a202a238fe44b4882970d658d9e8697f0d2e0772c8 | MATLAB | 131 | 10 | function ix = FindAlignNext(D, t)
nIX = length(t);
ix = zeros(size(t));
for iIX = 1:nIX
ix(iIX) = AlignNext(D, t(iIX));
end
|
1083b04524172facff0381e1983c3fc33c4c4d5a4d1ae2b9679e700eb0f58b6d | MATLAB | 132 | 9 | function [r] = urandom(type)
if nargin==0
type = 'int32';
end
f = fopen('/dev/urandom', 'r');
r = fread(f, 1, type);
fclose(f);
|
3cb0674d96276e640e274660d173a7e128bfad971bb2d10c6a158c679b6e7dd6 | MATLAB | 135 | 6 | function y = deltaActivation(x)
y = ones(size(x));
y(x<0) = 0.01;
filter = x>0.5;
y(filter) = 0.25./(x(filter).^2);
end |
55f6a3fcaec5fcf412a884c6259c4990120df3f0b044a9f2b1eea6429ccbcc68 | MATLAB | 135 | 6 | function UsedSets=GetUsedSets()
UsedSets=[1, 4, 9, 10, 11, 12, 13, 15, 23, 24, 29, 32, 33, 34, 48, 49, 62, 75, 77, 110, 114, 118];
|
8025dc1344168adcc40ae1c3de802418eff5070500f2e651e7d5df92d8042572 | MATLAB | 137 | 7 | function [output] = cellall(x, val)
if nargin==1, val = 1; end
for k = 1:numel(x)
tmp(k) = all(x{k}==val);
end
output = all(tmp==1);
|
5b447a263dd672e22de5ba83d52b8044d887457a56b4f2374ec9f70afbfe8286 | MATLAB | 139 | 3 | function save_step1(params, step1_data)
save([params.figure.folder filesep params.figure.prefix '_step1.mat'],'step1_data', 'params');
end |
0f07acae5b92f6639c86d87c6c393ae78702de19717090ab1a2657b2430e9cd9 | MATLAB | 141 | 9 | function [ lt_Colors ] = lighten_color( Colors,st )
[m,n]=size(Colors);
dk=Colors==0;
lt_add=dk*st;
lt_Colors=Colors+lt_add;
end
|
1ab7445f20860eb95e50c0b03ceb138ef99e8d5cedfa0610e03aa9cbd06f907f | MATLAB | 142 | 7 | function parsave(fname,ms)
%PARSAVE Summary of this function goes here
% Detailed explanation goes here
save(fname,'ms','-v7.3');
end
|
89248be525c6823fa7537a1d2aa4e2b21ce96f33001ca760bc8fd83335c7f5c3 | MATLAB | 143 | 4 | rTimes=0;
X=[X; repmat(X((y>0),:,:),[rTimes,1,1]).*(1+randn([rTimes,1,1].*size(X((y>0),:,:)))/10)];
y2=[y; repmat(y(y>0),[rTimes,1])];
Y=y2; |
ec0b6d75cb6a75c2286975d654d0fae8fd2b562d13db35a96a08e51a9c8ab9b7 | MATLAB | 143 | 8 | % resize ext_dir data to a smaller size
new_size=40;
ext_dir2=zeros(1,new_size^2);
for i = 1:(new_size^2)
ext_dir2(1,i)=ext_dir(1,i);
end |
90d34d9713bf1e0e2193b18b842f627e63bb70fce2f41f86961aabd99663a56d | MATLAB | 144 | 5 | function mean_state = getMean(net)
nStates = length(net.params.Lm);
for state=1:nStates
mean_state{state}= net.params.Lm{state}(:,1);
end
|
a2fcefbb0ebc102e47efa9456222336fca7ce4ee370d1b53cd14aaa91bcfa99f | MATLAB | 144 | 5 | %%% 22-7-17: Ernst function for ssSPGR
function sig = ssSPGR(theta,TR,T1)
E1=exp(-TR./T1);
sig = sin(theta).*(1-E1)./(1-E1.*cos(theta));
end |
e54f9b6e6d3d1bbfb19debc14fb0438dd9787ed8519ab94424c0e3284a9056ad | MATLAB | 145 | 7 | function DeleteTsv(rootdir)
if ~exist('rootdir','var')
rootdir = pwd;
end
rootdir = filesepStandard(rootdir);
Snirf2Tsv(rootdir, 'remove');
|
99a7bdbe66a6f0ed1e7d12e1a49623bd16b61911297242f9f032356f0517ac2c | MATLAB | 147 | 5 | function f=exponential_ap(params,x)
% f=exponential_ap(params,x)
% f=params(1)*exp(params(2)*x)+params(3);
f=params(1)*exp(params(2)*x)+params(3); |
8ef36ba5708b125a6cafc865758bbd60d2dc02481f2abf511bc1dac49fd04018 | MATLAB | 150 | 11 | function d = Cohen_d(X1,X2)
M1=mean(X1);
M2=mean(X2);
S1=std(X1);
S2=std(X2);
SDpool=sqrt( (S1^2 + S2^2)/2 );
d=(M2-M1) ./ SDpool;
end
|
bedc4a5b78d012ee9743ad11fbeeadda2c7f67b28b428939b415b9b30f537659 | MATLAB | 152 | 9 | function iWl = GetWl(handles)
iWl=[];
if nargin==0
return
end
if isempty(handles)
return
end
iWl = get(handles.listboxPlotWavelength, 'value');
|
ebedec37f6205da8e3d4ff70f69e30c7c69ecea5b77b44cda0dfb5f8ace6e3da | MATLAB | 155 | 10 | function Cell2List(carray, list)
fid = fopen(list, 'w');
for i = 1:length(carray)
fprintf(fid, '%s\n', carray{i});
end
fclose(fid);
|
041adc25d31301ddfd46c8bb74dc421ea90b0b8099db5bf6c8738c1b384f4b75 | MATLAB | 157 | 7 | function equal=streq(a,b)
% equal=streq(a,b)
% Are strings equal? Equivalent to strcmp(a,b), but easier to read.
% 2/4/05 dgp Wrote it.
equal=strcmp(a,b);
|
79bb00c727f439b851ffceed6b24211a27ac192477d5826f28214931f1342acd | MATLAB | 157 | 7 | function [ output_args ] = msSegementsInField( input_args )
%MSSEGEMENTSINFIELD Summary of this function goes here
% Detailed explanation goes here
end
|
0541ea5ec581651ed86bf32264e377f6d199f152b22f0f44b1e86dc411847f80 | MATLAB | 159 | 9 | function [idx vals] = maxi(mat)
% [IDX VALS] = MAXI(MAT)
%
% Just calls Matlab's built-in MAX function, but returns
% the IDX first.
[vals idx] = max(mat);
|
a7c320bad892638c777495cf3c447d471606296ac2b72d183208cd73af7b6095 | MATLAB | 159 | 9 | function [idx vals] = mini(mat)
% [IDX VALS] = MINI(MAT)
%
% Just calls Matlab's built-in MIN function, but returns
% the IDX first.
[vals idx] = min(mat);
|
8de87f0b2637cb5724a285bbe22a5ddc26ac37298ea7701e1ca98a18995bcd09 | MATLAB | 161 | 6 | function [y, x_norm] = normc(x)
% NORMC column-wise norm normalisation
x_norm = sqrt(sum(x.^2));
y = full(x*spdiags(1./x_norm(:),0,size(x,2),size(x,2)));
|
e57089f2da7b6729711617ab73a683ea5c413f2451478473a76e51ac16f43908 | MATLAB | 162 | 4 | function subjectName = s3GetSubjectName(subjectPath)
s = awsModifyPathForCompetability([subjectPath '/']);
[~,subjectName] = fileparts([s(1:(end-1)) '.a']);
|
74f14eeee798aed1be0c11da427f29526c755c57b6227b89005f4b369ba81342 | MATLAB | 163 | 9 | function [idx vals] = sorti(mat)
% [IDX VALS] = SORTI(MAT)
%
% Just calls Matlab's built-in SORT function, but returns
% the IDX first.
[vals idx] = sort(mat);
|
c923758d1e6a846bd781143a5720b47654e461a2347f68506dd42d856fba25fd | MATLAB | 165 | 10 | function y = sem(x,dim)
% Hannah Payne 9/30/13
if nargin==1
y = nanstd(x)./sqrt(sum(~isnan(x)));
else
y = nanstd(x,0,dim)./sqrt(sum(~isnan(x),dim));
end
|
fe6f9e38e38745fbe25322021100461a2e8dca5966e5cbb52354aec32a12d6f8 | MATLAB | 166 | 5 | function region = awsGetRegion()
%This function gets the active region used by AWS as set by the environment
%varible, (level = 0)
region = getenv('AWS_REGION'); |
436cb5d58daae19534afcdaf35b361a28eb3f1cc20fc865de5783a5dceba2699 | MATLAB | 167 | 7 | function output = hilbert(input)
% output the hilbert transform (per row)
output = cell(size(input));
for k = 1:numel(input)
output{k} = hilbert(input{k}.').';
end
|
7fb3a61346ce0842400accfc0d052882b22a88cb4f9361c4ff557ce7ccd8e2a3 | MATLAB | 167 | 8 | function run_script(scriptname, varargin)
if numel(varargin)>0
for k = 1:numel(varargin)
eval([varargin{k }{1},'=varargin{k}{2}']);
end
end
eval(scriptname);
|
47bec10114f1c4258ae64da61ee0d5efbeb6a1a3147cda37fdc1bf9b5d56f34f | MATLAB | 168 | 15 | function [c, mx, my] = covc(x, y, dim)
if nargin==2
dim = y;
y = x;
end
if dim==1
c = x'*y;
elseif dim==2
c = x*y';
end
mx = sum(x,dim);
my = sum(y,dim);
|
7410e397db29232d506f3c22f795d6ce49dcb1e087f6cc5d64b55691a2933d8b | MATLAB | 168 | 7 | function regFrame = register_frame_phasecorr(frame, ds, ops)
fdata = fft2(frame);
regFrame = real(ifft2(fdata .* exp(1i * 2*pi*(ds(1)*ops.Ny + ds(2)*ops.Nx))));
end
|
db689c2772dc42641ac8c74df2c3da6a92e84099e131655a3e0f11c91874397f | MATLAB | 175 | 7 | function output = imag(input)
% output the imaginary part of the data in the input cells
output = cell(size(input));
for k = 1:numel(input)
output{k} = imag(input{k});
end
|
54eb7e5f3f2d2aaf8b856563a0c83a04125e13e2acde336045ea9d3a94879136 | MATLAB | 176 | 7 | % df/dp3
function dfdp3 = VMMix_df_dp3(x, mu, k, p1, p2, p3)
const = 1/2/pi;
f = VMMix_f(x, mu, k, p1, p2, p3);
z = sum(exp([p1, p2, p3]));
dfdp3 = (exp(p3)/z)*(const - f);
end |
75af038987a09098332f96254df97fb86c454eb1075223af1ccd06804109ec4d | MATLAB | 176 | 12 | function ts = findTime(D, ix)
%
% ctsd/findTime
% ix = findTime(D, ix)
%
% Returns timestamsp at which index ix occues
% ADR
% version L4.0
% status: PROMOTED
ts = D.t(ix); |
f879b4bba18c5cc548c7cd1b1d9b0c69ee19412557df7b62d3b58b7e40331100 | MATLAB | 176 | 14 | function S = nanzscore(X)
if min(size(X)) == 1;
X = X(:);
end
S = NaN(size(X));
for ii=1:size(X,2)
ix = ~isnan(X(:,ii));
S(ix,ii) = zscore(X(ix,ii));
end
|
5b6b66071e0ebd9cec7ee127bc1b193119156eced591f72f286ab9660e1175ca | MATLAB | 177 | 6 | function recomputeStackAlignment(subjectPath)
% This function recomputes stack alignment
% Written at Jan 10, 2020.
%%
subjectFolder_ = subjectPath;
analyzeAlignmentStack; |
4373cea67673be9ab5e5ff4daf8bc2cc8825601e4f287db6d808f1fac31eda39 | MATLAB | 178 | 4 | function cmap = PinkGreenColormap(numColors)
vec = linspace(0, 1, round(numColors/2))';
cmap = [vec, ones(size(vec)), vec; ...
ones(size(vec)), flipud(vec), ones(size(vec))]; |
afe99595673cbf123939c75ba29bf2ad44346c634f9d8810f0ef3ca2ef1538fe | MATLAB | 178 | 11 | function str = cell2str(c)
str = '';
for ii=1:length(c)
if isempty(str)
str = sprintf(c{ii});
else
str = [str, ' ', sprintf(c{ii})];
end
end
|
163813dcea38cedb6419fbaba1ba7a1c9f84df213e49702122540677d136360e | MATLAB | 179 | 8 | function tf = awsIsAWSPath(filePath)
%This function returns true if filePath contains an AWS stream
if (strncmpi(filePath,'s3:',3))
tf = true;
else
tf = false;
end |
20e6a1fe52faecbd18760046a70e15e660d4aa41dd32e2b36570ab21d6d94adf | MATLAB | 179 | 12 | function condition = GetCondition(handles)
condition = 0;
if nargin==0
return
end
if isempty(handles)
return
end
condition = get(handles.popupmenuConditions, 'value');
|
6d2aca3542b38f66ee2ed3620333483bafc7e96c2716cef89080c6bf569fe520 | MATLAB | 179 | 7 | % df/dp1
function dfdp1 = VMMix_df_dp1(x, mu, k, p1, p2, p3)
g = VMMix_g(x, mu, k);
f = VMMix_f(x, mu, k, p1, p2, p3);
z = sum(exp([p1, p2, p3]));
dfdp1 = (exp(p1)/z)*(g - f);
end |
a38158644088212f6cece1d0eb8341f0c1fb5d16e984dd5a25aba8e1236ed576 | MATLAB | 182 | 6 | function [projValues] = getNoiseVar_alongSignalAxis(data, signalVector)
projValues=[];
for k=1:size(data,1)
projValues(k) = dot( data(k,:), signalVector)/norm(signalVector);
end |
c1d6b841527032b20755da76e7a8849510425c2c4686e071548f942383140adc | MATLAB | 182 | 9 | function SetAxesDataCh(handles, eventdata)
if ~exist('eventdata','var')
eventdata = [];
end
% Find which channels were selected from axesSDG
SetAxesSDGCh(handles, eventdata);
|
b29c228c7a008d54abba12ab97688a695d0d3b2130fb48364843c3c6d1bd3c42 | MATLAB | 185 | 12 | function [A, z] = normalize(A, dim)
if(nargin < 2)
z = sum(A(:));
z(z==0) = 1;
A = A./z;
else
z = sum(A, dim);
z(z==0) = 1;
A = bsxfun(@rdivide, A, z);
end
end
|
b2b612e40fa2ec5892cb4fdf91d17cccd1b94c6db337c89ae879f9667d8904cc | MATLAB | 185 | 6 | function [animal_name,dopaminergic_status] = parse_animal_foldername_roman(foldername)
tmp = split(foldername,'D');
animal_name = tmp{1};
dopaminergic_status = tmp{2};
end
|
4c19dbbc9811820dcc384552e407ccb4a35cfaaf3c5fc78bc87237780379e460 | MATLAB | 186 | 11 | function y = signal_fit(x, a)
% Create fitting model for signal
y = zeros(size(x));
for i = 1:length(x)
if i >= 450 && i <= 650
y(i) = a*cos(2*pi*5*i*1e-3);
end
end
end |
37d11086266d226b19ba88af302624c1a6d199b2621ec44bd6d7a4a3c606fb6b | MATLAB | 188 | 7 | % df/dp2
function dfdp2 = VMMix_df_dp2(x, mu, k, p1, p2, p3)
gpi = VMMix_g(x, mu + pi, k);
f = VMMix_f(x, mu, k, p1, p2, p3);
z = sum(exp([p1, p2, p3]));
dfdp2 = (exp(p2)/z)*(gpi - f);
end |
71df32577c920eb600b0bf969a665e20b784f9e5ecde1d765e87b29237985ba2 | MATLAB | 188 | 9 |
function box_out = threeclass_probability_Matrix_Uninitialize(box_in)
disp('Uninitializing the box...')
fclose(box_in.user_data.s);
instrreset;
box_out = box_in;
end
|
cd7bf1b7567974c0fb012fef6026d1e3bbacc5fe9c14abcd10a14235942e81b6 | MATLAB | 188 | 11 | function Cor=AffImFcn(x,Im1,Im2)
tform = affine2d([x(1) 0 0; 0 x(2) 0; 0 0 1]);
temp = imwarp(Im1,tform);
temp2=imrotate(temp,x(3));
c = normxcorr2(Im2,temp2);
Cor=1-max(c(:));
end
|
f1377e5c1a8edbd17ccf7791cc7afcf3e3c76944355bff281e88110397f73bf6 | MATLAB | 189 | 6 | function p = f_cdf(x,df)
% Faster, but less general version of cumulative F distribution. Accurate
% to around 10e-14.
p = betainc(df(2)./(df(2)+x.*df(1)), df(2)/2, df(1)/2,'upper'); |
7ad6c817448db78387280d2eaeb8f7daabad4b8997e0ca9adf84386083c3d4c5 | MATLAB | 190 | 11 |
s = size(Lm,2);
a = pa + .5*size(Lm{1},1);
for tt = 1:s
kt = size(Lm{tt},2);
b{tt} = pb*ones(1,kt-1) + .5*( diag(sum(Lcov{tt}(2:end,2:end,:),3))' + sum(Lm{tt}(:,2:end).^2,1) );
end
|
835b65173ce2c47f7b66112f996ac9708ca6612d0d9cad02da6a79335ff6e47e | MATLAB | 190 | 8 | function features = extractFeaturesTRCSP(data, TRCSPFilters)
CSPData = data * TRCSPFilters;
features = log(var(CSPData));
features = reshape(features, 1, []);
end
|
d4580fed2aabcbc8dd8b51ab47538c3ccb073012eb691800b215395a4179b1e2 | MATLAB | 191 | 6 | resultPath='/home/dichang/code/related_work/u-mvsnet/dtu_eval/TotalStat_mvsnet.mat';
x=load(resultPath);
data=x.BaseStat;
comp=mean(data.MeanStl)
acc=mean(data.MeanData)
overall= (comp+acc)/2 |
42cd9e3bab3d768b3efae53d26af23bda982aff3599117080d54e2d5bae98523 | MATLAB | 193 | 6 | function neighbormap = graphneighbors(G)
nnodes = size(G.Nodes, 1);
neighbormap = nan(nnodes, nnodes);
for i = 1:nnodes
neighbormap(i, :) = ismember((1:nnodes), neighbors(G, i));
end
|
843df5cfcf5ea67dbb38df25243ce2761f987b9673ce92f72068a8cf56d29911 | MATLAB | 193 | 9 | function AddScaleBar(position)
hold on;
x = position(1);
y = position(2);
len = position(3);
wid = position(4);
fill([x; x; x + len; x + len], ...
[y; y + wid; y + wid; y], 'w');
hold off; |
90e258ee7d612c5cca19fb7fea7edfe12f1aa631e4e49a4cb738181a53d11877 | MATLAB | 193 | 6 | function dff_ = dff(t, iso_fit, physio)
min_ = min([min(physio), min(iso_fit)]);
physio = physio - min_ + 1;
iso_fit = iso_fit - min_ + 1;
dff_ = (physio-iso_fit)./iso_fit;
end
|
e578ec8ad21cb90f035afd303fc823fbba09ab8a33ab1069b62855bcf56ed3a0 | MATLAB | 193 | 9 | function y = solveWithLeastSquare(A, b, x0)
y = lsqnonlin(@(x) step(x, A, b), x0);
end
function delta = step(x, A, b)
xRaw = A*x + b;
y = activation(xRaw);
delta = y-x;
end |
b139971a7bc7ac2ba9f5e7453858f2157822c167250e1b398d0c62dad919349c | MATLAB | 194 | 11 | function setListboxValueToLast(h)
foo = get(h, 'string');
if iscell(foo)
idx_lastline = length(foo);
elseif ischar(foo)
idx_lastline = size(foo,1);
end
set(h, 'value', idx_lastline);
|
be27d2d97545824b986433fd5112230060aa7394acc8da524838f9b809af246d | MATLAB | 194 | 11 |
function PCs = projectPC(KSD,W)
nStm = size(KSD,1);
T = size(KSD,2);
nClu = size(KSD,3);
X = reshape(KSD,nStm*T,nClu);
PCs = reshape(W' * X',nStm,T);
end |
25900db101a21862060c9d2224faa732b8503014dbfe99394cd0a6ed9ff9f021 | MATLAB | 195 | 7 | function varargout = read_header(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
varargout{1} = spm_vol(varargin{:}); |
2ded186911ae60f562796721f799955f6456ec50ccede01bd6ffc3abd709e77d | MATLAB | 195 | 15 | #import <Foundation/Foundation.h>
#ifdef __cplusplus
extern "C" {
#endif
void UnityAdsBridgeTransfer(void *x) {
if (!x) return;
(__bridge_transfer id)x;
}
#ifdef __cplusplus
}
#endif
|
d504f6d90025c1f11b6f7154a9e8601d1451e2a2b603187ccd1ee3fd786a0dda | MATLAB | 199 | 8 | function [rowI, colI, rowII, colII, v, Ival] = getSparsityInfo(A)
N = size(A, 1);
[rowI, colI, v] = find(A);
rowII = [rowI;[1:N]'];
colII = [colI;[1:N]'];
Ival = -ones(N,1);
end
|
5d890136d7949a1fc9f1538a5c91a2a3c95b80355126067da107faa525e60729 | MATLAB | 200 | 9 | function beta=cosfit_ap(t,y,beta0)
% beta=cosfit_ap(t,y,beta0)
% fit to cosine function by calling nlinfit with cos_ap
%try
beta=nlinfit(t,y,'cos_ap',beta0);
%catch
% beta = [NaN NaN];
%end
|
90efb39db1a5a0496eead137cfbb74a6e49485342c3883dad280d673fd80cd05 | MATLAB | 200 | 13 | function [T] = trimT(x, percent, dim)
if nargin<3,
dim = find(size(x)>1, 1, 'first');
end
if nargin<2,
percent = 0.2;
end
m = trimmean(x, percent, dim);
s = trimsem(x, percent, dim);
T = m./s;
|
9a46e69fecd80c4cf4945b1a08544f22c22bf2d39f024b2e42fe243d3ca15fe7 | MATLAB | 200 | 7 | function stop_eyetracker(Experiment)
if strcmp(Experiment.Mode.eyetracking,'Yes')
WaitSecs(0.1);
% stop the recording of eye-movements for the current trial
Eyelink('StopRecording');
end
|
b5c2b4bfec4dd847b1ff46ef1feddd595b71c3a9884835d648e6138cdf45a921 | MATLAB | 200 | 8 | function eventCode = fireEvent(structLPT, eventCode)
structLPT.put(0);
% disp(0);
tic, while toc < 0.1;end
structLPT.put(eventCode);
% disp(eventCode);
while toc < 0.1;end
end |
44cc743bf19aecb1aede88b98e7aeb58e23716550c9ab04514d55637105e0088 | MATLAB | 201 | 3 | % add path to Offline Analysis Toolbox
%addpath('/comp_neuro/Software/CARLsim6/tools/offline_analysis_toolbox')
addpath('/comp_neuro/Software/CARLsim4_dgx_hc_09_18_21/tools/offline_analysis_toolbox') |
8276aa62c54a396393833dc12a7be92042e6a5c14fa119e4b72908a343f888cf | MATLAB | 201 | 6 | function fit_ = fit_iso(iso, physio)
%% fit iso to fluo gcamp (fit sig1 to sig2)
N=1; % polynomial coef for linear
P = polyfit(iso, physio, N);
fit_ = iso*P(1)+P(2);
end |
b425ea1a1a5d1bcfa331d5278811f546977928320d1a2f925a1cfb5a6aa912a8 | MATLAB | 201 | 6 | function dff = calculate_dff(t, iso_fit, physio)
min_ = min([min(physio), min(iso_fit)]);
physio = physio - min_ + 1;
iso_fit = iso_fit - min_ + 1;
dff = (physio-iso_fit)./iso_fit;
end
|
1eb464cbf34fc655eeea47232860d0eaf07d6a31a654553558ef7dd78f5afc65 | MATLAB | 203 | 9 | function parsave( fn, saveStruct )
%PARSAVE Save `saveStruct` to path `fn` as an HDF5-compatible file
% (Implemented so as to be parallelizeable.)
save( fn, '-struct', 'saveStruct', '-v7.3' );
end
% |
bf2ffb6abd4a30f7a788d10581e293f22b9da220f1fa064b9e57db85d552988c | MATLAB | 203 | 7 | % df/dk
function dfdk = VMMix_df_dk(x, mu, k, p1, p2, p3)
z = sum(exp([p1, p2, p3]));
dgdk = VMMix_dg_dk(x, mu, k);
dgpidk = VMMix_dg_dk(x, mu + pi, k);
dfdk = (1/z)*(exp(p1)*dgdk + exp(p2)*dgpidk);
end |
3a0e709ec9b3c281483b79e24e6a5380ce30907d08e568acc17dd04f61778386 | MATLAB | 204 | 9 | function A = generateSparseMatrix(N, sparsity, SRtarget)
A = randn(N);
A(rand(N)>sparsity) = 0;
A(eye(N) == 1) = 0;
sr = max(abs(eig(A)));
A = SRtarget * A/sr;
A = sparse(A);
end
|
67ec513356f0122a47de757c137b358e4eff960abb2931733d8a379a29eef55c | MATLAB | 205 | 11 | function mu = softmax(eta)
% Softmax function
% mu(i,c) = exp(eta(i,c))/sum_c' exp(eta(i,c'))
c = 3;
tmp = exp(c*eta);
denom = sum(tmp, 2);
mu = bsxfun(@rdivide, tmp, denom);
end |
5bb3bc1ce1e24ccba2889655a0584d22ca40e3f86bc8a41198bf1b2955c1132e | MATLAB | 207 | 12 |
load(fullfile('Analysis','AutoCorrs'));
midBin = floor(length(bins)./2);
mxAc = max(acorrs,[],1);
midAc = acorrs(midBin,:);
cqs = [midAc./mxAc]';
SaveAnalysis(pwd,'ClusterQualityScore',{cqs},{'cqs'});
|
70f3c13c51c8bbe2d5f697c90a358d88de96b46fe08ca9b23962079f28500f06 | MATLAB | 207 | 8 | function depthprob = IPL2depthprob(IPLd)
nType = size(IPLd, 1);
for i = 1:nType
for j = 1:nType
depthprob(i, j) = corr(IPLd(i, :)', IPLd(j, :)').^2;
end
end
end |
bb3ddb406210dfdf773870ba7162091dfbd4f5d88bea9440e4a41b84ee3286cc | MATLAB | 208 | 11 | clear
clc
close all
addpath('data')
addpath('src')
dataset = {'4_Usoskin'}
load(['Test_' dataset{1}]);
rng(95584,'twister'); %%% for reproducibility
[K1, K2] = Estimate_Number_of_Clusters_SIMLR(in_X,2:10);
|
cc8b57779fb03612c2d8d112bf8a56b012fd3198819fd02df9d4d6e05addd685 | MATLAB | 208 | 8 | function [Hv] = LogisticHv(v,w,X,y)
% v(feature,1) - vector that we will multiply Hessian by
% w(feature,1)
% X(instance,feature)
% y(instance,1)
sig = 1./(1+exp(-y.*(X*w)));
Hv = X.'*(sig.*(1-sig).*(X*v));
|
17fc5c5e61254dfa67dc9e49cb935a462497fd3c864a18b88e4b0e273e83c2c5 | MATLAB | 209 | 8 | % loading stack
load('.\..\wholestack.mat');
% specifying output folder
outputpath='.\..\output\';
% running parameter selection step
SE_parameter_selection(wholestack, outputpath, [0.267 0.267 2]);
|
4cdb082f0347d529f52bd2db81b4681d9e7695a185345d4cca49f2d56ace1639 | MATLAB | 210 | 7 | function [outputArg1,outputArg2] = has_ComplexTTL(inputArg1,inputArg2)
%HAS_COMPLEXTTL Summary of this function goes here
% Detailed explanation goes here
outputArg1 = inputArg1;
outputArg2 = inputArg2;
end
|
f78ccd996d730dd49d9210f477beeee7aa632421edc57f95958916036332c148 | MATLAB | 210 | 6 | function Experiment = set_up_trial(Experiment)
events = {'grating1', 'mask1', 'grating2', 'mask2', 'cue', 'delay',...
'probe', 'response', 'feedback', 'iti', 'trialCue'};
Experiment.Trial.events = events; |
f25a953ef3617e40f2bdc518b05901297c912efc0063c4186df68ce1d988f4a2 | MATLAB | 211 | 5 | function cov_state = getCovariance(net)
nStates = length(net.params.Lm);
for state=1:nStates
cov_state{state}= net.params.Lm{state}(:,2:end)*net.params.Lm{state}(:,2:end)' + diag(net.hparams.psii)^-1;
end
|
0c48b248cd31984b5b14f0b411e9ef351a0f387cf077909ac9445574b69450e3 | MATLAB | 212 | 5 | %% Make Flow Figure Movies
% The goal of this part of the code is to generate the movies that nicely
% show the output of the Optical Flow part of the code
FlowFigureMovies(fileParams, flowFigureImageParams); |
2a091d0e4ee45cdfa3d8113ee96886ecc022cabf2ed0c8899b0c74bacab6d21e | MATLAB | 213 | 9 | function [ets dt] = ETSpectrum(t1,tspec,spec,bin,nbbins)
nbbins = 2*floor(nbbins/2)+1;
ets = zeros(nbbins,size(spec,2));
for ii=1:size(spec,2)
[ets(:,ii) dt] = ETAverage(t1,tspec,spec(:,ii),bin,nbbins);
end |
2fffdbe8a30ffd2cde989eec8d1ffbcd17adc3c2cb4b53125f40ca4428800cb9 | MATLAB | 213 | 7 | % df/dmu
function dfdmu = VMMix_df_dmu(x, mu, k, p1, p2, p3)
z = sum(exp([p1, p2, p3]));
dgdmu = VMMix_dg_dmu(x, mu, k);
dgpidmu = VMMix_dg_dmu(x, mu + pi, k);
dfdmu = (1/z)*(exp(p1)*dgdmu + exp(p2)*dgpidmu);
end |
4b911854b961137304810f77602160108c8d36cfd2733a7210fc3149f8a02342 | MATLAB | 213 | 9 | function Y = spharm_vec(theta,phi,l,m)
Y = [];
thetas = theta(:);
phis = phi(:);
for n = 1:numel(thetas)
y = spharm(thetas(n),phis(n),l,m);
Y = [Y;y];
end
Y = reshape(Y,size(theta)); |
e9b3bab57ff67176b2bd65c64910bbeea3e031996980943d6bc32b95d18f438c | MATLAB | 213 | 13 |
function asterisk=pval_to_asterisk(pval)
if pval<0.001
asterisk='***';
elseif pval<0.01
asterisk='**';
elseif pval<0.05
asterisk='*';
else
asterisk='';
end
end |
2596ef547dbd67c56da8e6aa5eb195f93cd056c62a9eaa40a1e828f9764d04ea | MATLAB | 214 | 9 | function setPDFRes(fig)
% set output size for vectorized PDF output
% fig: figure handle
fig.Renderer = 'painter';
fig.PaperUnits = 'inches';
fig.PaperSize = fig.Position(3:4)./96; %96 dpi
fig.Color = 'none';
end
|
71936d82c9278b86578888fb01ee80f2ed2a5c0bc90b37d23feac8e58e6c9bfc | MATLAB | 215 | 6 | function angList = AccumulateFlowAngleList(vx, vy, mask, angRange)
angList = atan2(vy(mask(:) > 0), vx(mask(:) > 0));
if strcmp(angRange, '90')
angList = asin(sin(acos(cos(angList))));
end
angList = angList(:); |
d638476aee5115af4e2ab1d6536a91b4952bdd4029a85c4b4bd964c2a6596dcc | MATLAB | 215 | 5 | function [vx, vy] = DeclutterQuiver(vx, vy, s)
vx(mod(1:size(vx, 1), s) ~= 0, :, :) = 0;
vx(:, mod(1:size(vx, 2), s) ~= 0, :) = 0;
vy(mod(1:size(vy, 1), s) ~= 0, :, :) = 0;
vy(:, mod(1:size(vy, 2), s) ~= 0, :) = 0;
|
bc39fa84487517be0426c81c840dab1f191b3b7613dbc3006760b069eba96b1e | MATLAB | 216 | 8 | function [tau_ee, alpha_ee, gamma_ee] = mergeRunScalingAnalysis(x_reps1, x_reps2)
% idea is to write a function that would pull from multiple analyses
% structs to generate the eta-epsilon phase space.
keyboard
|
b9605e390cb76eb4a4db8f51186ff80b18818551ea410f00104b61177806f89c | MATLAB | 219 | 6 | function [t,x,y]=getBonsaiData(bonsai_path, video_freq_Hz)
vt = readtable(bonsai_path, 'ReadVariableNames', true);
x = vt.X;y = vt.Y;
vt_samples_num = length(x);
t = (1:vt_samples_num)/video_freq_Hz;
end |
815dba88dec85bb9893e625c8677347736855e9d6c8eb54c7af19e5f51e283ae | MATLAB | 221 | 8 | function lse = mylogsumexp(b)
% does logsumexp across columns
B = max(b,[],2);
lse = log(sum(exp(b-repmat(B,[1 size(b,2)])),2))+B;
% Old version that used repmatC
%lse = log(sum(exp(b-repmatC(B,[1 size(b,2)])),2))+B;
end |
b109b659e60f007be2c75db5b1dd111d0d17f2015b30158d6097b2e543198b5f | MATLAB | 221 | 6 | %Assigns labels provided by labels_array to each dot in the scatter plot.
function assign_scatter_labels(s,labels_array)
row = dataTipTextRow('Label',labels_array);
s.DataTipTemplate.DataTipRows(end+1) = row;
end |
a477a59c154623bc4e21c59e895291f0cc748e566bcae1e341b1ccbaf12f46e9 | MATLAB | 223 | 5 | function projection_length = projectOnPCA(coeff,point_1,point_2)
% Project the vector between points 1 and 2 onto the principal axis
vector_diff = point_1 - point_2;
projection_length = dot(vector_diff, coeff(:,1));
end |
a5dced62e8a2dc9d1f7fc0a34bad0ad1663c8c7c42e64be0be3fa1151afb466d | MATLAB | 223 | 11 | function out = clip_boxplotrule(in)
[m,n] = size(in);
[t1, t2] = percthreshold(in, 0.25, 2);
iq = t2-t1;
upper = t2+1.5*iq;
%lower = t1-1.5*iq; % don't clip the lower
out = min(in, upper*ones(1,n));
|
6f7315507f2fa4d492d11dfb9b3bbe0166799e3125720bb4774faf3470cc53e8 | MATLAB | 224 | 9 | function probability = pathprob(path, pathprobmap)
nedge = length(path);
probability = nan(nedge-1, 1);
for i = 1:nedge-1
probability(i) = pathprobmap(path(i), path(i+1));
end
probability = prod(probability);
|
ef6c8d9a5a1939952ae6118b010afee330713de02405566f758e361341b78a68 | MATLAB | 224 | 16 | function ac = TCautocorr(h)
if length(h) > 360 % assuming 360 bins
h = h(1:360);
end
nBins = length(h);
ac = nan(nBins,1);
for nR = 0:nBins-1
hs = circshift(h,nR);
ac(nR+1) = corr(h,hs);
end |
093340d13a80eaf0a91905bc5313210f9525bda4afb096970d613e75ec0d31be | MATLAB | 225 | 13 | function [mu] = mean_ignore_zeros(vec)
% Calculate the mean of vector VEC, excluding zeros
%
% [MU] = MEAN_IGNORE_ZEROS(VEC)
if ~isvector(vec)
error('VEC must be a vector');
end
vec = vec(find(vec~=0));
mu = mean(vec);
|
4b6d105300246e72c945958b0ace1af9f79a6977efe0fb580f5cc80c0a24882b | MATLAB | 226 | 8 | function mag = pixelSizeToMagnification(pixelSizeMicrons)
% Opposite of magnificationToPixelSizeMicrons
mags = {'10x','4x','2x'};
pixelSizesUm = [1 2 4];
[~,i] = min(abs(pixelSizeMicrons-pixelSizesUm));
mag = mags{i}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.