sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2700c07c92b95f7c2304e80c7e0024281e6abed5e68e7415804e563c14d41929 | MATLAB | 203 | 11 | function C = opttransp_geodesic(C1,C2,t)
I = eye(size(C1,1));
C112 = C1^(0.5);
Dx = C112*((C112*C2*C112)^(-0.5))*C112;
D = euclidean_geodesic(I,Dx,t);
C = D*C2*D;
|
90cc22dea5f6282b3492468a44a02066b8fa27a9871185c3fc81d03d5b611394 | MATLAB | 203 | 8 | function [current_score] = zef_ES_score_sys(y, rwnnz)
if istable(y)
y = table2array(y);
end
sorted_y = cumsum(sort(abs(y),'descend'));
y = sorted_y/norm(y,1);
current_score = find(y >= rwnnz,1);
end
|
38de91afcb1b6070d153a8dddc785a4ec692679efbda688e40a389971dadf201 | MATLAB | 204 | 13 | function zef = zef_nse_tool_start(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_nse_tool_window',2/3,1);
if nargout == 0
assignin('base','zef',zef)
end
end
|
d7bfc479850a60552b536c5ee8d8e738e7197fee104cff108af49571a7be06f8 | MATLAB | 204 | 11 | function data_table = zef_dpq_add(zef)
if nargin == 0
zef = evalin('base','zef');
end
data_table = eval('zef.h_dynamical_plot_queue_table.Data');
data_table(end+1,:) = {'',true,'static',''};
end
|
dd77f82e1ade4e888f30f85a0b53bcbac8e2ce8a7de44b98670d442dc08387cc | MATLAB | 204 | 11 | function zef = zef_butterfly_plot(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_butterfly_plot_start',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
|
b859f0e86e37e79d7cef165d77c7f0259991ac1541522ef0cadca57cbf433678 | MATLAB | 206 | 5 | function bsliang_bar(center,height,extent,lw,col)
% a self-made bar plot
plot([center-extent center-extent center+extent center+extent],...
[0 height height 0],...
'LineWidth',lw,'Color',col); |
91404061ff4dbd80400a39bfa6cfe8fadca97a0b84ba4157d7074a1d3f363fa1 | MATLAB | 207 | 9 | % time = GetTime( myobj )
%
% Returns (double) number of seconds since SpikeGLX application
% was launched.
%
function [ret] = GetTime( s )
ret = sscanf( DoQueryCmd( s, 'GETTIME' ), '%f' );
end
|
c72d04b53f1b83d4e6fd966374da5de36196a3c40bcdba47bea81fc022187103 | MATLAB | 207 | 13 | function zef = zef_ramus_inversion_tool(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_ramus_window',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
end
|
142b5f7cd962c6f3119d6d4c0e797bea92df586d4e31ae46e292486745c62576 | MATLAB | 208 | 10 | function [out, Amax] = findOutliersMAXb( A, factor )
Amax = projectMax(A);
Amax = im2single(Amax);
maxmean = mean( Amax, 'all' );
maxstd = std( Amax,0,'all');
out = Amax > (maxmean + factor * maxstd);
end
|
7cae138da2c3ac2054a7d29c5d1a8664885e3d6eb34f2ef2b8eb0d2d49f2d7f1 | MATLAB | 208 | 13 | function zef = zef_beamformer_start(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_beamformer_window',1/4,1);
if nargout == 0
assignin('base','zef',zef)
end
end
|
21306f0dba326fa2c4139caef9024ab42e12f975389a6cc167731a8a53be5d0e | MATLAB | 209 | 15 | function zef = zef_strip_tool_start(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_strip_tool_open',1/2.5,0);
if nargout == 0
assignin('base','zef',zef)
end
end |
1fd3120c6f0bacb336d93a032eba637299b3d486f73a097b20590ab71bd9e58f | MATLAB | 213 | 10 | function ETP_DeleteFcn
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
global sETP;
global sFigETP;
delete(sFigETP.output);
clear('sFigETP');
sETP.boolForceQuit = true;
end
|
3d53fdd0145787cd99112d0a19eedb699aa9d65e748be3ca6c31f298a5ede965 | MATLAB | 213 | 13 | function zef = zef_start_source_tree_tool(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_open_source_tree',1/3,1);
if nargout == 0
assignin('base','zef',zef)
end
end
|
bd67b113d3b680e7959c50fa6b46fd5159d881db1a4a71acfd18a89b51926e9b | MATLAB | 213 | 11 | function [nodes,simplexes,J] = zef_get_submesh(nodes,simplexes,I)
if nargin == 3
simplexes = simplexes(I,:);
end
[J, ~, I_aux] = unique(simplexes);
simplexes(1:numel(simplexes)) = I_aux;
nodes = nodes(J,:);
end |
c7ad84ed86041abd2f2c0391a4c8d721bd784978abf181a55c0ebcd2b1150c7f | MATLAB | 213 | 1 | if not(isempty(zef.zeffiro_current_size)); zef.zeffiro_current_size{str2num(get(gcf,'Tag'))} = zef_change_size_function(gcf,zef.zeffiro_current_size{str2num(get(gcf,'Tag'))},[],{'Colorbar','image_details'}); end;
|
199ee863600eaa24862fd1c99b45a50b5ec5fcfb023bc2a88eaf12ecd5d198b3 | MATLAB | 214 | 13 | function zef = zef_parcellation_tool(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_parcellation_tool_open',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
end
|
396b01e2a4ef82b789282df04178165654974398bdd508771f9f80bef24227d8 | MATLAB | 214 | 7 | function [q] = find_evolution_prior(L, theta0, number_of_frames, evolution_prior_db, prior_over_measurement_db, snr)
% q to evolution prior
q = (1./number_of_frames)*10^(2*(evolution_prior_db)/20) * theta0;
end
|
ed7e93a548b6b6dd3ddcc6eebb6094c623e8c3dd77ead3b30e08f692661e7ddb | MATLAB | 216 | 9 | function [colormap_vec] = zef_parcellation_colormap(varargin)
if isfield(evalin('base','zef'),'parcellation_colormap')
colormap_vec = evalin('base','zef.parcellation_colormap');
else
colormap_vec = [];
end
end
|
ce4581fc24b4dfa97ff21c6796867d044946f7ad269f69fdf759577249f96025 | MATLAB | 218 | 7 | function [node_thr]=boostrapped_node_thr(node_scores)
node_thr=zeros(1,3);
%remove NaN if necessary
node_scores(isnan(node_scores))=[];
bootstat = bootstrp(100,@customPrc,node_scores);
node_thr = mean(bootstat,1);
end
|
274ce0065727d55856a495cdb884e68b22f88926bf72ecaf6b3a3feaf257cc81 | MATLAB | 219 | 11 | function c = greenblack(m)
%greenblack Shades of green and black color map
if nargin < 1, m = size(get(gcf,'colormap'),1); end
g = linspace(0,1,m)';
r = zeros(size(g));
b = zeros(size(g));
c = [r g b];
|
4e40d6de17e5c6c26ab151d9f2193872a7ea103713fdb65d116e868c99ad63f2 | MATLAB | 219 | 15 | function zef = zef_DBS_strip_struct_start(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_DBS_strip_struct_open',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
end |
0a6fa8aba4ecb91a4b2215fc3837c8c24e6a1e42de9ac307c364a479b93f97d1 | MATLAB | 222 | 12 | function [udf_indicator_vector] = vectorize_udf(udf)
udf_indicator_vector = zeros(length(udf), 1);
num_udf = size(udf,2);
for single_udf = 1:num_udf
udf_indicator_vector(udf(:, single_udf)==1)=single_udf;
end
end
|
f2722686d95accfe24c3214c2c977238863373a635794bc459a58de00113d4e2 | MATLAB | 222 | 10 | function filteredCovset = geodesic_filter(CovSet,C,W)
% passage dans le plan tangent
S = Tangent_space(CovSet,C);
%filtering
Out = (W*((W'*W)\W'))*S;
% passage dans la variété
filteredCovset = UnTangent_space(Out,C);
|
f038177e0b494a720432eff87c50c4df1bcc3a51a4b8f2b653c3f8f4da3b2333 | MATLAB | 223 | 12 | function run_simulation(regime_type, durtn, outdirpath)
%
params = create_params_struct(regime_type, durtn, outdirpath);
run_simulation_helper0(params);
save_firing_rates(params);
disp('Job Completed... !!Yay!!');
end
|
a2f93ea2e1a84f6d78a8a792da2b36024addab2ba4d0a2a0ec72b2c206522eda | MATLAB | 225 | 9 | function d = riemannian_dist(C1,C2)
% computes the riemannian distance between two positive definite matrices,
% C1 and C2
%
% Author: Diego Vidaurre, OHBA, University of Oxford (2019)
d = sqrt(sum(log(eig(C1,C2)).^2));
end |
21015e4e4ee07f135d510bf75746da341aeb17a4ff5931bf0581d6476c848265 | MATLAB | 226 | 8 | function alpha = ang2rad(alpha)
% copyright (c) 2006 philipp berens
% berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens
% distributed under GPL with no liability
% http://www.gnu.org/copyleft/gpl.html
alpha = alpha * pi /180; |
31a3b66859c2038f3a06f0f8cf971e4ebd81ef5ce4b8d3361209031b315456cb | MATLAB | 226 | 5 | function [filling_vec] = zef_wireframe_filling_vec(eps_vec_1, eps_vec_2)
filling_vec = - (real(eps_vec_2) - real(eps_vec_1).*(real(eps_vec_2) + 2) + 2)./(2.*real(eps_vec_2) + real(eps_vec_1).*(real(eps_vec_2) - 1) - 2);
end
|
8b1e1b3d4e4edc0fbc49f9965523cc5f202fc5e85409e0acc68dbecd6af766f2 | MATLAB | 226 | 8 | function DISS = DISS(x,y,modality,keep_polarity)
if nargin < 4
keep_polarity = false ;
end
simfun = microstate.functions.map_similarity_funhandle(modality,keep_polarity) ;
DISS = real(sqrt(2*(1-simfun(x,y)))) ; |
8bef87eb06ea0de45fc17b02bc71ebb7c8c580b34f9abcfca803e09335b33a6a | MATLAB | 226 | 8 | function alpha = rad2ang(alpha)
% copyright (c) 2006 philipp berens
% berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens
% distributed under GPL with no liability
% http://www.gnu.org/copyleft/gpl.html
alpha = alpha / pi *180; |
928022b64fdd0e816ae9b187e726f54e8efd0ad6ceea743ba7084f4ffc083d55 | MATLAB | 226 | 9 | function d = readTetFimBinary(binFile)
fid = fopen(binFile);
numPoints = fread(fid, 1, 'int32');
data = single(fread(fid, inf, 'single'));
n = floor(numel(data)/numPoints);
d = reshape(data(1:n*numPoints), numPoints, n);
end |
f46859bcad1ccadd96729f2bb9b0639135ff4004fbb64852117bcfa22e1a0172 | MATLAB | 226 | 9 | function C = getAutoCovMat(hmm,k,verbose)
% Get the autocovariance from a TDE-HMM model, for state k,
%
% Diego Vidaurre, OHBA, University of Oxford (2019)
if nargin < 3, verbose = 1; end
C = getFuncConn(hmm,k,verbose);
end |
e963397c55d202ad4a29db3a7f5ca1b1813bf450b58e77665820bb62abd81833 | MATLAB | 227 | 12 | function [full_udf] = quick_expand_udf(udf)
unique_features = unique(udf);
full_udf = zeros(length(udf), length(unique_features));
for uf = 1:length(unique_features)
full_udf(udf==unique_features(uf), uf) = 1;
end
end
|
30dee4f82f933cba13b050ff2c342552676e2157dec988a3be73af2437976145 | MATLAB | 230 | 5 | if not(isequal(zef.file,0));
zef.aux_field = zef_get_mesh(zef,[zef.file_path zef.file],zef.current_sensors,'points');
eval(['zef.' zef.current_sensors '_points = zef.aux_field;']);
zef = rmfield(zef,'aux_field');
end;
|
95063d696459933b5fb6b9a2f1191f5defa7e22e842054ba1909c4d213ea4b8b | MATLAB | 230 | 12 | function data = detrenddata(data,T)
for n=1:length(T)
ind = sum(T(1:n-1))+ (1:T(n));
if isstruct(data)
data.X(ind,:) = detrend(data.X(ind,:));
else
data(ind,:) = detrend(data(ind,:));
end
end
end
|
bb7d7a3ff1203c3562fcf9b0f568695211b8e1823c46cec9ef6dde7df3e1b988 | MATLAB | 230 | 14 | function zef = zef_dataBank_refreshTree(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef.dataBank.app.Tree.Children.delete;
zef = zef_dataBank_hash2tree(zef);
if nargout == 0
assignin('base','zef',zef);
end
end
|
4f3696f003e47886d58c0704aa121b8a8f31fbf4de0a4828d281a9b909c073c4 | MATLAB | 232 | 13 | function zef = zef_find_synthetic_source_ROI(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_find_synthetic_source_ROI_window',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
end
|
82b1a0e2cd6fff42dbee38904f4693bf55d1483dc3f4bc196441bedf11ffdc52 | MATLAB | 232 | 7 | function cross_entropy = mean_cross_entropy( YTrue, YPred )
YTrue_onehot = ind2vec(double(YTrue)')';
cross_entropy = full(sum( YTrue_onehot .* ( -log( double(YPred) ) ), 2 ));
cross_entropy = mean(cross_entropy(:));
end
|
95a20b1b429412a96e07eb8bafbc5b98a64740539a8bce38c98ac7edc0ec4837 | MATLAB | 232 | 11 | function load_rois(app)
% function to load roi matrix
try
app.rois = load(app.file_rois,'rois');
app.rois = app.rois.rois;
update_log(app, 'Retreived ROIs');
catch
update_log(app, 'Unable to Retrieve ROIs');
end
end |
b194d035c1c2ebfc8465f36c63eb263e79fb9da3ccabb6f176eb715bf05be347 | MATLAB | 232 | 11 | function ET_enableForceQuit(varargin)
%UNTITLED Summary of this function goes here
%% get globals
global sEyeFig
%% enable force quit
sEyeFig.boolIsBusy = false;
ET_updateTextInformation('Force quit is now enabled');
end
|
3d6016fff6dc1fa5ab8d120d892284fedfc946e65b9a33e936600782afc5ce80 | MATLAB | 233 | 6 | function x = dbl_exp_func(t, model)
if length(model.tau)==2
x = model.a*(1-exp(-t/model.tau(1))).*exp(-t/model.tau(2));
else
x = model.a(1)*(1-exp(-t/model.tau(1))).*(exp(-t/model.tau(2))+model.a(2)*exp(-t/model.tau(3)));
end |
b22bb4cc993e04e6d7b4993d81c92051e4a339798db11f02192accf8978ff67a | MATLAB | 233 | 9 | % boolval = IsInitialized( myobj )
%
% Return 1 if SpikeGLX has completed its startup
% initialization and is ready to run.
%
function ret = IsInitialized( s )
ret = sscanf( DoQueryCmd( s, 'ISINITIALIZED' ), '%d' );
end
|
3b4dec9b6a78f3a31962beb57ba7fe9132e6c3dd4a612358268838b85712e298 | MATLAB | 234 | 11 | function load_data(app)
% function to load spike matrix
try
app.data = load(app.file_data,'data');
app.data = app.data.data;
update_log(app, 'Retrieved Data');
catch
update_log(app, 'Unable to Retrieve Data');
end
end |
981efec3d9a92c7b5f74ad16d10aa89c21dc5ff08f6c43a31a02d66c0afb5da7 | MATLAB | 235 | 8 | function [P, L, Q] = zef_kf_sLORETA_OLD(L, Q, std_lhood, theta0)
% Sparse
D2 = inv(sparse(diag(diag(L' / (L * L' + std_lhood^2 / theta0 * eye(size(L,1))) * L))));
P = theta0 * D2;
L = L / chol(D2);
Q = D2*Q;
end
|
e2de4b0d3b49e2c30d2da87a42c8711ba781d242d686ae0cdbdd3cdd890fa010 | MATLAB | 235 | 7 | %Copyright © 2018- Sampsa Pursiainen & ZI Development Team
%See: https://github.com/sampsapursiainen/zeffiro_interface
function [p_val] = zef_inverse_gamma_gpu(x, shape,scale)
p_val = zef_gamma_gpu(1./x,shape,1./scale)./(x.^2);
end
|
97cd7f92e919bd1282ddee10d70b685e58548a9cadec6c9880a29f0c8391c99b | MATLAB | 236 | 7 | function dblDprime = getdprime(dblHitFrac,dblFalseAlarmFrac)
%getdprime Returns d' for hit/FA rates
% dblDprime = getdprime(dblHitFrac,dblFalseAlarmFrac)
dblDprime = norminv(dblHitFrac,0,1) - norminv(dblFalseAlarmFrac,0,1);
end
|
9aa5d9f70aefc4e2ce6631f35a6ef01b462b3a843e2045d72c902004d9d8c073 | MATLAB | 237 | 5 | if not(isequal(zef.file,0));
zef.aux_field = zef_get_mesh(zef,[zef.file_path zef.file],zef.current_sensors,'triangles');
eval(['zef.' zef.current_sensors '_directions = zef.aux_field;']);
zef = rmfield(zef,'aux_field');
end;
|
aa2470f4bdba36b26e4c7afd21c76b9ab4da8b09b63d6a704290a07ca1dbf6da | MATLAB | 238 | 13 | function zef = zef_find_synthetic_source_legacy(zef)
if nargin == 0
zef = evalin('base','zef');
end
zef = zef_tool_start(zef,'zef_find_synthetic_source_legacy_window',1/4,0);
if nargout == 0
assignin('base','zef',zef)
end
end
|
4b9d8499d28949b9fa3c401450f554524d381a46c81919aa286a2f075bd2c255 | MATLAB | 239 | 10 | function [] = plotRaster(spikes)
%spikes in NEL format (2 columns, 1st column is trial # and second is spike
%times)
figure()
plot(spikes(:,2),spikes(:,1),'.', 'MarkerEdgeColor',[0 0.5 0])
ylabel('Trial #'), xlabel('Time (seconds)')
end |
76b83ca2abfef3b7b3f0bf33699839e9a331eb381035523f3878f4da51ab5aae | MATLAB | 240 | 9 | function Gamma = id_Gamma_inference(L,Pi,order)
% inference for independent samples (ignoring time structure)
L(L<realmin) = realmin;
Gamma = repmat(Pi,size(L,1),1) .* L;
Gamma = Gamma(1+order:end,:);
Gamma = rdiv(Gamma,sum(Gamma,2));
end |
601ae1cd70acc78a91d09b606f21739248cd3065346dea2c7432f7cbcfeccd66 | MATLAB | 241 | 14 | function prec = jacobi ( A )
%
% prec = jacobi ( A )
%
% Computes the Jacobi preconditioner for the matrix A of a system Ax = b.
%
arguments
A (:,:)
end
prec = diag ( diag ( A ) ) \ eye ( size ( A ) ) ;
end % function
|
ce37de7f88c81797ffcc7afe06ab4fe42c9087ee107f914ad05ca81db6a8dbfd | MATLAB | 241 | 10 | function strOut = cell2str(cellArray)
%cell2str Cell to string conversion
% strOut = cell2str(cellArray)
strOut = '';
for intEl=1:numel(cellArray)
strOut = strcat(strOut,cellArray{intEl},';');
end
strOut = strOut(1:(end-1));
end
|
b1a01244e9654f138d58e361fc0e62410cea10f4a0d6b6163ebe8b5201e63b3f | MATLAB | 243 | 7 | function dataset_segment_ensemble_evaluation_button_changed(app)
plot_all_udf_one_ens_auc(app);
plot_all_udf_one_ens_pr(app);
plot_one_udf_all_ens_auc(app);
plot_one_udf_all_ens_pr(app);
update_ensemble_eval_text(app);
end
|
0648f00a4bb9bba7ff1750749c1729b84dda0f45e20861bcdfb2e366c2dc381c | MATLAB | 244 | 9 | function X = applyOBM(x, OBM, N_frame, NFFT, NUMBAND)
x_hat = stdft(x, N_frame, N_frame/2, NFFT);
x_hat = x_hat(:, 1:(NFFT/2+1)).';
X = zeros(NUMBAND, size(x_hat, 2));
for i = 1:size(x_hat, 2)
X(:, i) = sqrt(OBM*abs(x_hat(:, i)).^2);
end
|
d6db908ef25e18f4e30875a0cc49550299c9582c6ef81d8f4f69600f5a321820 | MATLAB | 244 | 11 | function [models] = sort_models(models)
model_stats = collect_models(models);
model_params = [model_stats.s_lambda; model_stats.p_lambda]';
[~, sorted_models_idx] = sortrows(model_params,'descend');
models = models(sorted_models_idx);
end
|
1a1fcf770056eb277238472147d90083c4638ad5b8468344e97048ec1c8ab36d | MATLAB | 245 | 6 | function project_struct = zef_import_example
% Create project
project_struct = zeffiro_interface('start_mode','nodisplay','import_to_existing_project','scripts/scripts_for_importing/multicompartment_head_project/import_segmentation.zef');
end
|
884700c05f15737530397afc39da66c005ace5b5db9b8ad23a41fc5483589f19 | MATLAB | 246 | 9 | addpath('../../vtkToolbox/MATLAB')
box = vtkRead('box.vtu');
d = readTetFimBinary('result.bin');
box.pointData.seed1 = d(:,1);
box.pointData.seed2 = d(:,2);
box.pointData.seed3 = d(:,3);
box.pointData.seed4 = d(:,4);
vtkWrite(box, 'result.vtu'); |
bab01c860813f63ee9aafad9961cd3bdc5828568e6fd112c1335a788b33349bb | MATLAB | 246 | 6 |
%adds the data at the last position
zef.LeadFieldProcessingTool.bankPosition=zef.LeadFieldProcessingTool.bankSize+1;
zef.LeadFieldProcessingTool.bankSize=zef.LeadFieldProcessingTool.bankSize+1;
zef_LeadFieldProcessingTool_aux2bank_bankPosition
|
e20c00085ecabc17713a2bb0fe5ab91e428e445da4db802bbd997d61c8438b40 | MATLAB | 246 | 5 | [zef.file zef.file_path zef.file_index] = uiputfile({'*.jpg';'*.tif';'*.png';'*.avi'},'Save visualization as...',zef.save_file_path);
if not(isequal(zef.file,0));
zef_process_meshes(zef,zef.explode_everything);
zef_print_meshes([]);
end;
|
f94600ed4f57d7fbd5ca25a75e9d20bcc25a05087d95af13f9c43b8cc679e1ea | MATLAB | 247 | 9 | %Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team
%See: https://github.com/sampsapursiainen/GPU-Torre-3D
function save_jacobian_data(aux_mat, j, torre_dir)
save([torre_dir '/system_data/aux_mat_' int2str(j)],'aux_mat')
end
|
e78023257a36fd3f4a4b8c790e06b25d3d201d7810d1966c1e64b65f6aab9a8e | MATLAB | 248 | 7 | %Copyright © 2018- Sampsa Pursiainen & ZI Development Team
%See: https://github.com/sampsapursiainen/zeffiro_interface
function [p_val] = zef_gamma_gpu(x, shape,scale)
p_val = (1./(scale.^shape.*gamma(shape))).*x.^(shape-1).*exp(-x./scale);
end
|
f588445f23a22e66930bf0e33a792f1720e2b2ab1ed91694369f47abe0dae0a1 | MATLAB | 248 | 4 |
[zef.LeadFieldProcessingTool.traName, zef.LeadFieldProcessingTool.traPath]=uigetfile('./', 'select tra file', '*.dat');
zef.LeadFieldProcessingTool.tra=readmatrix(strcat(zef.LeadFieldProcessingTool.traPath, zef.LeadFieldProcessingTool.traName));
|
38055beae60118be81b443af1d79686df56768b95446a2a6cd8e0600b6738f33 | MATLAB | 249 | 10 | function obj = preprocess_demean(obj) ;
% Re-reference data to average
if isempty(obj.modality)
return
end
obj.data = obj.data-mean(obj.data,1) ;
obj = microstate.functions.process_append(obj,'Applied re-reference') ;
end |
8b3e3d54be2ce88f27fd70263ce794eaed8a5ab6706d8038f1650bdacf31d59b | MATLAB | 249 | 7 | function dataout=bsliang_load_DTItxt(filename)
fileID = fopen(filename,'r');
formatSpec = '%s ';
A = textscan(fileID,formatSpec);
dataout_raw=str2double(A{1,1});
dataout=dataout_raw(~isnan(dataout_raw));
fclose(fileID); |
fb63afabd0202794250c41a2980cca2aa0b43589f6dfc5fa1be3b2a0728478da | MATLAB | 249 | 12 | function c = redbluered(m)
%REDBLUEPURPLE
if nargin < 1, m = size(get(gcf,'colormap'),1); end
% From [0 0 1] to [1 1 1], then [1 1 1] to [1 0 0];
r = [linspace(1,0,floor(m/2)) linspace(0,1,ceil(m/2))]';
g = 0*r;
b = 1-r;
c = [r g b];
|
913e7fb01abacf412b50900165118e454d7e583305880162545b764d92447656 | MATLAB | 250 | 14 | function [art, d] = potato_detection(COV,C,th,method_dist)
if nargin <4
method_dist = 'riemann';
end
I = size(COV,3);
d = zeros(I,1);
for i=1:I
d(i) = distance(C,COV(:,:,i),method_dist);
end
art = d>th; |
a0136512947cf5baa879a39c4f23c422d7c2e9997030f8533f7b7f78ce1d479d | MATLAB | 250 | 12 | function c = blueredblue(m)
%REDBLUEPURPLE
if nargin < 1, m = size(get(gcf,'colormap'),1); end
% From [0 0 1] to [1 1 1], then [1 1 1] to [1 0 0];
b = [linspace(1,0,floor(m/2)) linspace(0,1,ceil(m/2))]';
g = 0*b;
r = 1-b;
c = [r g b];
|
acc3dcf0b79f4ccae5de88cf980175d422ff4080f66d2f34d6213d72e167c65c | MATLAB | 250 | 12 | function [hash]=zef_dataBank_number2hash(number)
%x is an array of numbers, we will add
% nodes and _
hash='node';
for i=1:length(number)
if ~isnan(number(i)) && ~number(i)==0
hash=strcat(hash, '_', num2str(number(i)));
end
end
end
|
9dbf3408be7ab255594e8d53933bc8d1231d6376b56176b1e4207d21b7634513 | MATLAB | 251 | 8 | function zef_reset_color_sliders
evalin('base','zef.colorscale_min_slider = 0;');
evalin('base','zef.colorscale_max_slider = 0;');
evalin('base','zef.h_colorscale_min_slider.Value = 0;');
evalin('base','zef.h_colorscale_max_slider.Value = 0;');
end
|
b2b9489cd7fe0bd39f58a6e70f2f53fafbbbbc52ad905b6b6ed7e63c265771ec | MATLAB | 253 | 16 | function [point] = myAffine3d(point, matrix)
%point(s) Nx3, matrix 4x4 affine matrix,
%output is the transformed point(s)
[N, ~]=size(point);
point=point';
point=vertcat(point, ones(1,N));
point=matrix*point;
point=point(1:3,:);
point=point';
end
|
413191fd6a983e8736e895f641fcee033f9338d25a9ddd72cb9d4e20ded321dc | MATLAB | 257 | 12 | %test resize
function downsizeStack = tdResize( stack, box )
tic
pmRaw = projectMax( stack );
pmRaw = histeq(pmRaw);
downsizeStack = arrayResize(stack, box );
pmds = projectMax( downsizeStack );
pmds = histeq(pmds);
% figure
% montage({pmRaw pmds});
toc
end |
ce4a130a1087de8f7cad655559eac45fb277aa50215d7c170d477263ddb03dcd | MATLAB | 257 | 12 | function [newRec] = zef_reconstructionTool_mean(reconstruction)
newRec=reconstruction{:,1};
for frame=2:size(reconstruction,2)
nextRec=reconstruction{:,frame};
newRec=newRec+nextRec;
end
newRec=newRec/size(reconstruction,2);
newRec={newRec};
end
|
523fb61f9fc832f7a2874356874877f0767331c6b9fe35624398fd93341a9bb5 | MATLAB | 259 | 15 | function [rmse] = func_rmse(a, b, time_start, time_end)
[c,d] = size(a);
len = max(c, d);
if size(a, 2) ~= len
a = a';
end
if size(b, 2) ~= len
b = b';
end
rmse = sqrt(mean( sum( (a(:, time_start:time_end)-b(:, time_start:time_end)).^2, 1 )));
end |
acc60b09897d32c10863f0d2259503e65fceb26d6844ce86696ec1099f7f4981 | MATLAB | 259 | 7 | function zef = zef_DBS_strip_struct_update(zef)
if zef.strip_struct.strip_type == 1
zef = zef_electrode_strip_multiple_probe(zef);
elseif zef.strip_struct.strip_type == 2
zef = zef_Abbott_infinity_strip_multiple_probe(zef);
end
end |
e534fe4861b75c7302a1c5cecf93b11b4373a1502f202185d3ef2d097debaa5f | MATLAB | 259 | 10 | function DDATA=bsliang_rejINDdata(DATA,rej_ind)
% ¸öÌå²ãÃæÉ¾Êý¾Ý
for ind=rej_ind
DATA(ind).par_info=[];
DATA(ind).def_range=[];
DATA(ind).practice=[];
DATA(ind).Id_Di=[];
end
DDATA=DATA;
end
|
b51bdd11d38cbf32b33e40eb8e14d65817e4fd4f321a13b126381fbc53e1a1a5 | MATLAB | 260 | 8 | function boolEnter = CheckEnter()
%CheckEnter Checks if escape button is pressed
% boolEnter=any(strcmpi(KbName(keyCode),'escape'));
KbName('UnifyKeyNames');
[keyIsDown, secs, keyCode] = KbCheck();
boolEnter=any(strcmpi(KbName(keyCode),'return'));
end
|
7c2146c26296bb989f4bf7f9f0d6e78ef5125c807018b71984039c69fb94e7d6 | MATLAB | 263 | 6 | warning('off');
zef.gravity_field_type = 4;
zef_delete_original_field;
zef_process_meshes;
[zef.L, zef.bg_data, zef.source_positions, zef.source_directions] = lead_field_gravity(zef.nodes,zef.tetra,zef.rho,zef.sensors,zef.active_compartment_ind);
warning('on');
|
807a018fd74429dbd3f53b73a9d10cf982391739691c05e37cabb6375f0157c8 | MATLAB | 263 | 6 | warning('off');
zef.gravity_field_type = 3;
zef_delete_original_field;
zef_process_meshes;
[zef.L, zef.bg_data, zef.source_positions, zef.source_directions] = lead_field_gravity(zef.nodes,zef.tetra,zef.rho,zef.sensors,zef.active_compartment_ind);
warning('on');
|
e27ca53f3dcafea963b91640fa5308c28eebacef656e2945359286b33d299e27 | MATLAB | 263 | 7 | function skew_correct(TiffFolder, SaveFolder, InfoFile)
listing = dir(strcat(TiffFolder,'/*.tif'));
parfor j = 1:length(listing)
%disp(listing(j).name);
skew_correct_one(TiffFolder, SaveFolder, listing(j).name, InfoFile);
end
end |
d7f6b30c9f826426e2dd845c7164e6de4ea0d31af2c26af2c2c7b865763a1aac | MATLAB | 264 | 9 | % channelSubset = GetSaveChans( myobj, streamID )
%
% Returns a vector containing the indices of
% IMEC channels being saved.
%
function [ret] = GetSaveChans( s, streamID )
ret = str2num( DoQueryCmd( s, sprintf( 'GETSAVECHANS %d', streamID ) ) );
end
|
4d402dac881c069fae9fb12bd21d88ac9e71b6fe1ce1f7eedfab09afee0fba76 | MATLAB | 267 | 9 | % sampleRate = GetSampleRate( myobj, streamID )
%
% Returns sample rate of selected stream in Hz,
% or zero if not enabled.
%
function [ret] = GetSampleRate( s, streamID )
ret = str2double( DoQueryCmd( s, sprintf( 'GETSAMPLERATE %d', streamID ) ) );
end
|
759807ab313beab050a52a19dc8bedc70b0ee32cd11d0b4b32a96e724e98505c | MATLAB | 267 | 9 | % scanCount = GetScanCount( myobj, streamID )
%
% Returns number of scans since current run started
% or zero if not running.
%
function [ret] = GetScanCount( s, streamID )
ret = str2double( DoQueryCmd( s, sprintf( 'GETSCANCOUNT %d', streamID ) ) );
end
|
25e3381d4d44ae7670d7f3edc1680c2432d9d99cf1ef50fdf120221a22eb2ffd | MATLAB | 268 | 6 | warning('off');
zef.gravity_field_type = 2;
zef_delete_original_field;
zef_process_meshes;
[zef.L, zef.bg_data, zef.source_positions, zef.source_directions] = lead_field_gravity_grad(zef.nodes,zef.tetra,zef.rho,zef.sensors,zef.active_compartment_ind);
warning('on');
|
451e5405d875bf31f0f991218b5a498d5955dd8df3721b2af3e80f669b2a57a7 | MATLAB | 268 | 6 | warning('off');
zef.gravity_field_type = 1;
zef_delete_original_field;
zef_process_meshes;
[zef.L, zef.bg_data, zef.source_positions, zef.source_directions] = lead_field_gravity_grad(zef.nodes,zef.tetra,zef.rho,zef.sensors,zef.active_compartment_ind);
warning('on');
|
73e6df2f03c912a4893889b8bdd1a8817542372e28cf32d6e2f057d74f6eb0c9 | MATLAB | 268 | 10 | function zef = zef_strip_tool_add(zef)
zef.strip_tool.strip_current_id = zef.strip_tool.strip_current_id + 1;
zef.strip_tool.current_strip = length(zef.([zef.current_sensors '_strip_cell']))+1;
zef = zef_strip_tool_init(zef);
zef = zef_strip_tool_update(zef);
end |
126b10335023987772f556d2b0c2930f46232c6b747729509b85f7330d7c7b33 | MATLAB | 269 | 8 | function bsliang_piledbar(values)
bsliang_bar(0.3125-1,values(1),0.1875,0.5,'k');
hold on
bsliang_bar(0.6875-1,values(2),0.1875,0.5,'k');
bsliang_bar(1.3125-1,values(3),0.1875,0.5,'k');
bsliang_bar(1.6875-1,values(4),0.1875,0.5,'k');
plot([-1 1],[0 0],'k--');
|
2004f5497299ea953dced4af49fb5f366c838463c3fad93ad9c9b050d8785081 | MATLAB | 269 | 9 | function struct = remel(struct,vecElements)
%RemEl Summary of this function goes here
% Detailed explanation goes here
struct = structfun(@doRemEl,struct,'UniformOutput',false);
function varField = doRemEl(varField)
varField = varField(vecElements);
end
end
|
75ad0a2de4109779baa6e8ade95ca0dd5f0fd8424a41640d1b15dce9fa675703 | MATLAB | 269 | 6 | function new_colormap = zef_update_colormap(colormap_ind, colortune_param, colormap_size)
colormap_cell = evalin('base','zef.colormap_cell');
new_colormap = evalin('base',[colormap_cell{colormap_ind} '(' num2str(colortune_param) ',' num2str(colormap_size) ')']);
end
|
c7a28fe56d68bb5fb11fa6082cd60dc6a2c3a9f0025374a6ab63127e4672854f | MATLAB | 269 | 8 | % Append to process
function obj = process_append(obj,process,info)
if nargin < 3
info = struct ;
end
process = convertCharsToStrings(process) ;
obj.process = [obj.process;table(process,{info},'VariableNames',{'Process','Info'})] ;
end |
defacc6f88fb2bfd4e6116a540954e3fc0af1c6a052f605495376ac16d1b9065 | MATLAB | 271 | 9 | % startCt = GetFileStartCount( myobj, streamID )
%
% Returns index of first scan in latest file,
% or zero if not available.
%
function [ret] = GetFileStartCount( s, streamID )
ret = str2double( DoQueryCmd( s, sprintf( 'GETFILESTART %d', streamID ) ) );
end
|
0f5128d63b1abccd3415c68926e6478c57e1d397fc6d4f5ac2bc7449a1db4909 | MATLAB | 272 | 5 | function [contacts, sensor_info, triangle_index] = zef_sensor_get_function_eval(function_string, project_struct, domain_type)
[contacts, sensor_info, triangle_index] = feval(@(project_struct, domain_type)evalin('caller',function_string),project_struct, domain_type);
end |
71c25e12f06cb6c768e004b256ca0a9230624ab987a817b840f8c674ac22385b | MATLAB | 272 | 12 | % myobj = SetDataDir( myobj, dir )
%
% Set global run data directory.
%
function [s] = SetDataDir( s, dir )
if( ~ischar( dir ) )
error( 'SetDataDir ''dir'' argument must be a string.' );
end
DoSimpleCmd( s, sprintf( 'SETDATADIR %s', dir ) );
end
|
220e022c3310cb92217ec7763fcd528321a4d32996699f74bc564fd832540ff2 | MATLAB | 273 | 17 | % function Z=rdiv(X,Y)
%
% row division: Z = X / Y row-wise
% Y must have one column
function Z=rdiv(X,Y)
if(length(X(:,1)) ~= length(Y(:,1)) | length(Y(1,:)) ~=1)
disp('Error in RDIV');
return;
end
Z=zeros(size(X));
for i=1:length(X(1,:))
Z(:,i)=X(:,i)./Y;
end
|
2d3fe8d096e09b9b054454451f85ff1e5a23eb36aecc07c20fbb495102043606 | MATLAB | 273 | 13 | function [binary] = quick_infer_binary(data)
num_samples = size(data, 1);
num_neurons = size(data, 2);
binary = zeros(num_samples, num_neurons);
for neuron = 1:num_neurons
decon = data(:, neuron);
thr = 2*std(decon);
binary(decon > thr, neuron) = 1;
end
end
|
aed642fe3434aa0846a328b977ca1e6cb847edfdca0aa2c08b744c7902d28b03 | MATLAB | 273 | 17 | function wrapped_validator(app)
params = app.params;
app.params = parameterize(params);
app.rois = app.params.rois; % just in case we made simulated rois
set_gui_range_limits(app);
app.params.stage = 1;
app.is_validated = true;
app.ValidateData.Enable = 'off';
end
|
1c082dacf7314cbff4449ee8850d0e32a60b3e6d6a6bf1e7fd5b07ebacd907c0 | MATLAB | 277 | 10 | function zef_plot_dof_space(void)
%Plot spatial degrees of freedom
h_axes = evalin('base','zef.h_axes1');
axes(h_axes);
hold on
source_positions = evalin('base','zef.source_positions');
scatter3(source_positions(:,1),source_positions(:,2),source_positions(:,3),'filled')
end
|
a95dc02694b651d25558da5d0c6933c451215e9c3a7037f6039d01ece0f4e3ca | MATLAB | 278 | 15 | function fig_num = zef_fig_num
h_fig_aux = findobj(groot, '-property','ZefFig');
max_tag = 0;
for i = 1 : length(h_fig_aux)
tag_val = get(h_fig_aux(i),'ZefFig');
if not(isempty(tag_val))
max_tag = max(max_tag,tag_val);
end
end
fig_num = max_tag + 1;
end
|
c3414ff3717445e6552d0ddf0e05756c7a529bcdfef0fa19fa9bf5d555140761 | MATLAB | 279 | 13 | function [newRec] = zef_reconstructionTool_power(reconstruction)
newRec=reconstruction{:,1};
newRec=newRec.^2;
for frame=2:size(reconstruction,2)
nextRec=reconstruction{:,frame};
newRec=newRec+nextRec.^2;
end
newRec=newRec/size(reconstruction,2);
newRec={newRec};
end
|
6c51e4928e63cd4f53f686cc53b772069cd4ec5972c8b1df6b22e4d282564b4a | MATLAB | 280 | 14 | function d = distance_set(COV,C,method_dist,arg_dist)
if (nargin<3)||(isempty(method_dist))
method_dist = 'euclid';
end
if (nargin<4)
arg_dist = {};
end
Ntrial = size(COV,3);
d = zeros(Ntrial,1);
for i=1:Ntrial
d(i) = distance(COV(:,:,i),C,method_dist,arg_dist);
end |
2d5042051a90dbbea5050efe39878c3d6a344cfb892e74a31574e9e71066b0af | MATLAB | 281 | 9 | function RTs=bsliang_getIDRT(rawdata)
steps=unique(rawdata(:,1));
RTs=nan(1,length(steps));
for step=steps'
rttmp=rawdata(rawdata(:,1)==step,3);
rttmp(rttmp>1.5)=nan;
rttmp(rttmp<0.2)=nan;
RTs(step)=mean(rttmp,'omitnan');
end |
3933210df665ec12fdf2a28c60221205f8666cafd02a0480ab2db73b2370f078 | MATLAB | 282 | 11 | function selected_node = zef_source_tree_get_selected(treeObj)
sel = treeObj.SelectedNodes;
if isempty(sel)
error('zef_cbtreenode_add_child:NoSelection', ...
'SelectedNodes is empty. Select a parent node first.');
end
selected_node = sel(1);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.