sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e396ab62e2eac95905eb8c2e97b2f977c6a3863055b3d02bdce0ae0f642ce7b6
MATLAB
162
5
function checkSpatialFT(MRSIStruct) if(~getFlags(MRSIStruct, 'spatialFT')) error('Please fourier transform along the spatial dimension') end end
1a20e1a7e0f7cd34370f8fb7a296c9f693e52922d94f6e208548aec33cad67be
MATLAB
164
10
data = []; line = plot(data); for t = 1:1000 newdata = rand(2,1); data = [data; newdata']; plot(data); xlim([max(0, t-10) t]); pause(0.01); end
bdb1430f9140abb3453250db9af21b62ea3ebc3be63a6f0184aea5f0d0ef0cfb
MATLAB
165
5
function checkSpectralFT(MRSIStruct) if(~getFlags(MRSIStruct, 'spectralFT')) error('Please Fourier transform along the spectral dimension') end end
2d4e8d376ac6049c0e949de908bd1d2a4f14d5fc858383c202f22913a855cdbe
MATLAB
168
7
clear clc close all subs=1:1:30; parfor sub=1:length(subs) [amplitude1,snr1,am_spectrum1,am_spectrum2,snr_spectrum1,snr_spectrum2]=savefor_Figure8(sub); end
7e86ce8472a7726b478e6348aab59508788e4b95b9a2a7022659df88742b1b31
MATLAB
168
5
function [covarianceMatrix] = extractCovariance(eegData) %% Trace normalised EEG data covarianceMatrix=cov1para(eegData./(sqrt(trace(eegData'*eegData)))); end
a871219028dd327f191b180f6598c7510f530fbb6fdfb870e990a51bd28221e8
MATLAB
169
10
function C = basisExpansion(slice,dmat,mask) %BASISEXPANSION fit solid harmonic basis functions to field % % best-fit quadratic curve C = dmat \ slice(mask); end
e2d0cae362c395004b4704af939e910eb17b0ab55a864353c91bc206af9065dd
MATLAB
169
9
n = 3; imshow('cameraman.tif'); r = 25; for i = 1:n [x,y] = ginput(1); h = imellipse(gca(), [x - r/2, y - r/2, r, r]); wait(h); disp(getPosition(h)); end
b32da075fef0d851080ba597e0434189ece41f134cc0768b68418848b5c360c2
MATLAB
171
7
%% check_load_stack %% test 1 stack = load_stack ('sample.stk', '-s'); tprint ('./panels/load_stack1', ... '-jpg -HR', [10 10]);
1468d8ee9258d27e4a9b64239d167d0b03abf22556ceb16fa3eca11f3334ae8c
MATLAB
174
8
function tgt_ind = find_time(t, currInd, t_delta) tgt_time = t(currInd)+t_delta; if tgt_time > max(t) tgt_ind = NaN; else [~, tgt_ind] = min(abs(tgt_time-t)); end end
41cb0660634825ae3c0a222af99270c940802c4d70936c88085ab3cf3c0f9ab9
MATLAB
176
8
%% Image Metadata % % * <./id_md_Metadata.html |Metadata| quick start guide> % * <./id_md_Calibration.html |CalibrationPixelSize| quick start guide> %% % % <./index.html Home>
a1d54825daee4c30709741650ead2250915cab06c389d7ddd756112a3cde8295
MATLAB
176
8
%% Preprocessing % % * <./id_pp_motion_corr.html Motion correction quick start guide> % * <./id_pp_utilities.html Other utilities quick start guide> %% % % <./index.html Home>
1714e997bea149d744805273a91520aa780963e3f2c27a8f0c14a15c529b168e
MATLAB
177
13
%% check_scheme check_bezahlt check_deg2rad check_eucdist check_gauss check_gifmaker check_rad2deg check_rotation_matrix check_roundshow check_scalebar check_shine check_tprint
230757590b56ba49f2fd0eafd84d02117a04f58f80938f98bc6985e1ce2151a8
MATLAB
179
9
function col=mat2col(matrix) c=0; %convert half matrix (no diagno) for i=1:size(matrix,1)-1 for j=i+1:size(matrix,2) c=c+1; col(c,1)=matrix(i,j); end end
e2b56dcce05babb1f3d027a353e7fdce4dbc3c6160700550032d9268fe83c157
MATLAB
182
8
function runInfo = GetRunInfo(expt, dataDir) for r = flip(1:expt.Nruns) runInfo(r) = MakeInfoStruct( dataDir, expt.mouse, expt.date, expt.runs(r), expt.fov ); end end
b59e6df87319b8036f5f82531c60f13bad994f2dde3cfd6d6df9e459ded64fde
MATLAB
184
1
function n=angle2pix(display,ang) %ANGLE2PIX %n=angle2pix(display,ang) %returns width of square in pixels for visual angle ang n=2*display.distance*tan(ang*pi/360)/display.pixelSize;
c49f017e2fa0f0f27f33873c59954c7d9ef01d750472cef08f1d6557d4294234
MATLAB
184
15
%% check_electrotonics check_elen_tree check_gi_tree check_gm_tree check_lambda_tree check_loop_tree check_M_tree check_sse_tree check_ssecat_tree check_syn_tree check_syncat_tree
4f0a0b393c74c95ca76de62cb57c04d1df2e5d7fb9b3be872d5dd5d01389eae4
MATLAB
185
8
%% Groups of Images (ImgGroup Classes) % % * <./ig_ImgGroup.html |ImgGroup| quick start guide> % * <./ig_CompositeImg.html |CompositeImg| quick start guide> % %% % % <./index.html Home>
b5c932ceb400f9c8db0cfe7ebb9a98d8c2ea3b4355c85c1e53e6994e99214f37
MATLAB
185
3
function thresholdedCell = getCellArrayFromIndexThreshold(dataCell, indexCell, threshold) thresholdedCell = cellfun(@(x, y) x(y > threshold), dataCell, indexCell, 'uni', 0);
ca9cf95049604581a1be6c60852446a4ce950f3f173e5376697b6249c0b4838b
MATLAB
185
6
trees = load_tree('wteene_aligned.mtr'); for i = 1:length(trees{1}) disp(trees{1}{i}.name) swc_tree(trees{1}{i},['WT_EE_6mo_',trees{1}{i}.name(1:2),'_',num2str(i),'.swc']) end
4108d7b06d1dc7075a1b067e1bc021ce31e1e0b85d2daada2ade875283f857bb
MATLAB
192
12
classdef (Abstract, HandleCompatible) IMock %UNTITLED Summary of this class goes here % Detailed explanation goes here properties end methods end end
8a5eb88cfee1e27dc64b9facaa92e0470e16fd1f36744541513cf350166348ba
MATLAB
192
12
%% check_IO check_load_tree check_neurolucida_tree check_neuroml_tree check_neuron_template_tree check_neuron_tree check_pov_tree check_save_tree check_swc_tree check_ver_tree check_x3d_tree
45cf74a65828993f8e0423687ed49fa770e8994f3ed34a5067edfb7e5d50ccd5
MATLAB
194
9
%% Image Data % % * <./id_md.html Image metadata quick start guide> % * <./id_ri.html Raw images quick start guide> % * <./id_pp.html Preprocessing quick start guide> %% % % <./index.html Home>
9d5dc264ea2477502b0943e2f26cd58bfc8dfab6d6f1747ce4c9e672314df252
MATLAB
196
7
function hlData = ReadHalflifeData(fn) %fn = 'C:/Work/MatlabCode/projects/HMASandbox/HMA_Sandbox/Single-cell Modeling/NeuronModeling/data/pr101183k_si_002_HELA.txt' hlData = readtable(fn); end
f11c52aed011fc77ad30b37d08d10d6e5e88c50a015b243cd284b1be80cc7bc3
MATLAB
198
14
% FileExists(FileName) % % returns 1 if the file exists, 0 otherwise function exists = FileExists(FileName) fp = fopen(FileName, 'r'); if (fp==-1) exists = 0; else fclose(fp); exists = 1; end;
365d8f467207bfe95e3485cf92a02d5dc59b1010b55423fd661f361414fe0482
MATLAB
199
17
%% clear; close all; clc load('distsFOVFx_bad_global.mat') %% dDif = distsCom{2}./distsCom{1}; difMean = mean(dDif,1); [difMx,difIdx] = max(dDif(1:end,:)); difIdx = difIdx;
1c2eb00133d4fbaab15f8720002fa09672469a6ccf240b12eeb7b58a8f41f720
MATLAB
200
14
%% check edit folder check_cat_tree check_delete_tree% check_elim0_tree check_elimt_tree check_insert_tree check_insertp_tree check_recon_tree check_repair_tree check_resample_tree check_root_tree
1fa182e6e79968dd112cd55fe94a5b7118cdde7f8e45e4d96a65a92abc0cfae9
MATLAB
200
7
function [transformed_data] = Affine_transformation(data,reference) for i=1:size(data,3) transformed_data(:,:,i)=inv(sqrtm(reference))*data(:,:,i)*inv(sqrtm(reference))'; end end
d8e7ae5ca6349660f6fece8cf55b5d6d4594f7457d2b5f1716869529d95a06ea
MATLAB
203
7
function hlData = ReadHalflifeData(fn) %fn = 'C:/Work/MatlabCode/projects/HMASandbox/HMA_Sandbox/Single-cell Modeling/NeuronModeling/data/pr101183k_si_002_HELA.txt' hlData = readtable(fn); end
21e06d9fb0b1698b51c0bacf000e38df27544ba3362ef86506b7117c16d95005
MATLAB
206
9
% Figure01.m % Figure 1 contains no data; everything was created in PowerPoint. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % % END OF FILE.
d9922415fe591949c536c4c33f3c39d758c39b7a0c12afc9722225103583d0f3
MATLAB
206
11
function Y=predictN(X,W,N,c,x_min,x_max) % function for predicting M=size(X,2); x_N=Normalization(X,x_min,x_max); Q=Kmatrix(x_N,M,size(X,1),N,c); Y_N=Q*W; Y=zeros(size(Y_N)); Y(Y_N>=-0.375)=1;
e10c4411b5dd6b9065d97431a604b00a417e9549fd24c9ad6b5639558a6b2241
MATLAB
206
6
function MRSIStruct = setDimsAllZero(MRSIStruct) dimNames = fieldnames(MRSIStruct.dims); for iName = 1:length(dimNames) MRSIStruct = setDimension(MRSIStruct, dimNames{iName}, 0); end end
4cf9c0ed09ff6edea6d03df9b35140cffee09d8121873e9ff5cd36342249e0ad
MATLAB
207
6
%% check_loadtifs_stack %% test 1 stack = loadtifs_stack ('./data/stack_0002_MSO_P10_2-1_2.tif', '-s'); tprint ('./panels/loadtifs_stack1', ... '-jpg -HR', [10 10]);
8dfdd8c273258d043399a2c21e30bbc745cb4f3aeb44e7e9bae9e582a266cf68
MATLAB
207
12
function [ idx ] = chIdx(s, ch) %CHIDX Get a channel's ID in a session channels = s.Channels; Nch = length(channels); for idx = 1:Nch if strcmp( channels(idx).ID, ch.ID) return end end end
ab8e438e4d2d3e53b50684260b8e1c715f4352a5c0c389e720311b96eeb66582
MATLAB
210
7
function [] = setupfig(wid,ht,ft) set(gcf ,'windowStyle','normal'); set(gcf,'color','w'); set(gcf, 'Units', 'inches'); set(gcf, 'Position', [1 1 wid ht]); set(findall(gcf,'-property','FontSize'),'FontSize',ft)
4a3a600ae4590ce2cc804df88273b42fa0b402ce03720324997f89c9a5239562
MATLAB
217
10
function rms_out = rms_val(sig) % function rms_out = rms_val(sig) % % Returns the root mean square value of the signal passed as 'sig' % % Author: Angela Onslow, May 2010 rms_out = norm(sig)/sqrt((length(sig))); end
e8fa08b84dbc2461ea086edf6c72dfef5f01064408b5fc1748c6edbc5dc2f668
MATLAB
219
7
function B = ITR(N,p,s) B = s.*(log2(N)+p.*log2(p)+(1-p).*log2((1-p)./(N-1))); ix = find(p==0); B(ix) = s.*(log2(N)+(1-p(ix)).*log2((1-p(ix))./(N-1))); ix = find(p==1); B(ix) = s.*(log2(N)+p(ix).*log2(p(ix))); end
f91594587e15a40173cabe70f71a40e7b3690ccb8d0ad89bd37d90c269e06712
MATLAB
221
6
function shuffled_matrix = shuffle_matrix(original_matrix) % Get the dimensions of the matrix [num_rows, num_columns] = size(original_matrix); shuffled_matrix = original_matrix(:,randperm(num_columns)); end
3a287febe16c74847fbfb827c4e9f808b6fdccd4d2c1ff962d973f1bf329b327
MATLAB
223
7
%compare data: clear all dataFileName1 = 'C:\David\Phd2020\ElectordesClassification\res\2023-02-15_09-36-30\imputedDataAllBouts.xlsx'; [DataMatrix1, Labels1,MouseIDs1,Days1] = GetImputedDataMatrix(dataFileName1);
97a10461decc053b0b29e99e3daf9367cfbb9b44ed33196b5e6f82e0d7ff3cc9
MATLAB
225
14
function [row, col, val] = get_triu_CC(mat) N = size(mat,1); t = 1; for n=1:N-1 M = (n+1):N; for m=M row(t,1) = n; col(t,1) = m; val(t,1) = mat(n,m); t = t+1; end end
74c9dcd370b072e4ce693269e3352ba8ce850ed4a584a01acbdb912322ba8377
MATLAB
227
8
% HSN_TREE load a sample HSN cell % % the TREES toolbox: edit, generate, visualise and analyse neuronal trees % Copyright (C) 2009 - 2016 Hermann Cuntz function hsn = hsn_tree hsn = load_tree ('hsn.mtr', 'none');
eddadb90894624505b19ba3c00bffdc5d97399dd19a076b567377fd7c74eda64
MATLAB
227
8
% HSS_TREE load a sample HSS cell % % the TREES toolbox: edit, generate, visualise and analyse neuronal trees % Copyright (C) 2009 - 2016 Hermann Cuntz function hss = hss_tree hss = load_tree ('hss.mtr', 'none');
d70978601a145610a39adae72b337f269acecf8fb12afff475a76b7f3aaed25b
MATLAB
228
12
function [dataN,m,s] = standardizeData(Data,m,s) l = size(Data,1); if isempty(m) m = mean(Data); end if isempty(s) s = std(Data); end dataN = (Data-repmat(m,l,1))./repmat(s,l,1); end
c5cf9ad8bea627ed4eef957c60557aa7a36d82cebc7f786939529764e2ef6ffe
MATLAB
237
9
function fig = tch_fig(name, pos) if nargin < 1; name = ''; end if nargin < 2; pos = [.1 .1 .5 .5]; end % pos = rectify(pos); fig = figure('Name', name, 'Color', 'w', 'Units', 'centimeters', 'Position', pos); tch_set_axes; hold on; end
634dbb4087d67f7527e94aeae6028c822d65d4fc20c101cdeee4a11bb0f4c382
MATLAB
238
13
function [] = draw_1(Xq_R, Yq_R, vq_R,Xq_B, Yq_B, vq_B) figure(4); subplot(2,2,1) imagesc(vq_R) title('full') subplot(2,2,2) imagesc(vq_B) title('small') subplot(2,2,3) mesh(Xq_R,Yq_R,vq_R) subplot(2,2,4) mesh(Xq_B,Yq_B,vq_B)
365418694630e434c11d5a3bbd7b62b8b2d36c1090e74e949f1fc36b48a45fbc
MATLAB
239
12
function [dx_nxt, dy_nxt] = shrinkIso2DTV(dx, dy, tau) % Perform isotropic soft thresholding mag = sqrt(dx.^2+dy.^2); magt = shrinkageOp(mag,tau); mmult = magt./mag; mmult(mag==0) = 0; dx_nxt = dx.*mmult; dy_nxt = dy.*mmult;
57e046e7a5609a7a40ba97d926984296fb78ea7614f391702c222ea8ca6a37eb
MATLAB
239
7
function avgBoutKey = createUniqueAvgBoutID(mouseID,day,label6) avgBoutKey = cell(1,length(mouseID)); for k=1:length(mouseID) avgBoutKey{k} = ['M',num2str(mouseID(k)) ,'_D',num2str(day(k)), '_L',num2str(label6(k))]; end
c44b15b87b1f273243f57077416aa11c55fb8635f03950041670ff0d9b40aadb
MATLAB
241
9
%% Raw Images (RawImg Classes) % % * <./id_ri_SCIM_Tif.html |SCIM_Tif| quick start guide> % * <./id_ri_BioFormats.html |BioFormats| quick start guide> % * <./id_ri_RawImgDummy.html |RawImgDummy| quick start guide> %% % % <./index.html Home>
0dbc1b11c75f350c2e4e953b58b199ad90abbfedfd9da91843a175d5a760cdb8
MATLAB
243
14
function saveFigure(h, fname); set(gcf,'Units','points'); set(gcf,'PaperUnits','points') size = get(gcf,'Position'); size = size(3:4); set(gcf,'PaperSize',size) set(gcf,'PaperPosition',[0,0,size(1),size(2)]) print(h,fname,'-dpng');
28549615c8aead00aa0d78c22d23fa75a0497f78ef79df830cd7a9f1adb9150a
MATLAB
244
10
function gamma = getGamma(argumentVariables) arguments argumentVariables.overTwoPi (1, 1) logical = 1; end if(argumentVariables.overTwoPi) gamma = 42.577478518e6; else gamma = 267.52218744e6; end end
e484e4ab3ea6ddf0279f3a1d610a8d23cbd5f4fe55e9569052f9b5b414a9219b
MATLAB
244
14
function str = getPvalStr(pval,baseStr) str=''; if pval<0.00001 str = '#'; elseif pval<0.0001 str = '***'; elseif pval<0.001 str = '**'; elseif pval< 0.05 str = '*'; end str = [str,baseStr,num2str(pval,'%.4f')];
8b519b09eebea19636ef027bdafcafe458738533eb2da4c01f3c6d0b46acca91
MATLAB
250
8
% SAMPLE2_TREE load a simple sample tree % % the TREES toolbox: edit, generate, visualise and analyse neuronal trees % Copyright (C) 2009 - 2016 Hermann Cuntz function sample2 = sample2_tree sample2 = load_tree ('sample2.mtr', 'none');
5bb95c63e52033537b6679c5138706b34cef20175c654f1f16a14072e59471af
MATLAB
252
10
function h = shadedLineMeanSte(dat,linewid,linez,colz) % function h = shadedLineMeanSte(dat,linewid,linez,colz) m=nanmean(dat); hold on; plot(m,'color',colz,'LineWidth',linewid,'linestyle',linez); fillAroundLine(m,ste(dat),colz); return
0a06b91ed4338e4fcdb895f07fc78076284b058892b1a2c365f44beecf601d90
MATLAB
255
17
clear close all force f1 = open('fig_Obj_a22_4_5.fig'); f2 = open('fig_6_a16_1.fig'); f3 = figure(3); clf ax3 = subplot(3,6,[1,2,7,8,13,14]); ax1 = get(f1,'Children'); copyobj(ax1,f3); ax3 = get(f3,'Children'); set(ax3(2),'position',[.1,.2,.3,.75]);
9a48cba496ea5bf0bed8ee24fba4a85bb368d5f51d82f57bea7b519dc5087cd4
MATLAB
255
11
function df = removeBetaOutlier(DT) targetTmodel = {'1ch_glm','1ch_dcts', '3ch_stLN'}; for tm = 1:3 params.tmodel = targetTmodel{tm}; df{tm} = tableFilter(DT,params); df{tm} = tableOutlier(df{tm},'beta'); end df = [df{1}; df{2}; df{3}]; end
6df66baae7c1ca5225aa0c022702be9913a345c284da3e1b6e40ab8bf94beaa4
MATLAB
256
10
%% Getting Started % % * <./documentation_and_examples.html Documentation and examples> % * <./system_requirements.html System requirements> % * <./release_notes.html Release notes> % * <./acknowledgements.html Acknowledgements> %% % % <./index.html Home>
a405749ceb6c41766c982e066122089e89fd185d3b842543c650c18bf023b262
MATLAB
256
17
function me = ent(prob) up = sort(prob,'descend'); me = 0; dim = 0; if size(up,1)==1 dim = 2; else if size(up,2)==1 dim = 1; end end for i = 1:size(up,dim) if up(i)>0 me = me - up(i) * log(up(i)); end end me = exp(me);
fac20a9d50edf02fb22fdd46d1a7403ca20f2bec179e095900f2583bbebce6cf
MATLAB
256
9
function log(cfg, message) %LOG Print a timestamped pipeline message when cfg.verbose is true. if isfield(cfg, 'verbose') && cfg.verbose timestamp = string(datetime("now", "Format", "HH:mm:ss")); fprintf('[%s] %s\n', timestamp, message); end end
96b32ba554e603e5cea1bf3430e4f2507a14c55e2574d6c18a19289f7923a9b6
MATLAB
257
8
function tch_set_axes set(gca, 'TickDir', 'out', 'FontSize', 20, 'FontName', 'Helvetica', ... 'XColor', 'k', 'YColor', 'k','LineWidth',2); hold on; % ax=gca;ax.LineWidth=2; %axis square; % set(gca,'TickDir','out','TickLength',[0.02 0.5]); box off; end
d88000395226f50af42f443c201c35df505ee77cb902381a9c03210bb6239dfe
MATLAB
257
8
% SAMPLE_TREE load a subtree of a sample HSN cell % % the TREES toolbox: edit, generate, visualise and analyse neuronal trees % Copyright (C) 2009 - 2016 Hermann Cuntz function sample = sample_tree sample = load_tree ('sample.mtr', 'none');
ff275401b45ebb80552e37f94241a14d83e2aa8849b47beae02154b5366ea968
MATLAB
257
8
% Set colormap to green purple. function colormapG2P = setFavoriteColormap %% Set the green purple divergent map from cpt-city maps. cptFile = 'greenPurple'; %'PRGn_11'; % colormapG2P = cptcmap(cptFile, 'ncol', 256); colormap(gca, colormapG2P); end
32ffe5b34a7bdffeafccd3a0158d674e0fb09d16ab2ffc5060f7c90f8858c4df
MATLAB
258
13
function [Ev,Em] = eigMax_A(A,At,maxit,lmbd2,szX,useGPU) X = 10*randn(szX); if useGPU ==1 X = gpuArray(X); end for ii = 1:maxit Xnew = At*(A*X) + lmbd2*X; Em = (Xnew(:)'*X(:))/(X(:)'*X(:)); X = Xnew/norm(Xnew(:)); end Ev = X; end
b1ba7040ba91732f69d256c4c8b69b1d03ea4df293d6f697128a05671ea34389
MATLAB
258
10
function d = EuclideanDistance(X,Y,Z) % X,Y,Z are matrices nPoints*2. calcola la distanza lungo la seconda % dimensione d = zeros(size(X, 1), 1); for i=1:size(X,1) d(i) = sqrt((X(i,1)-X(i,2)).^2 + (Y(i,1)-Y(i,2)).^2 + (Z(i,1)-Z(i,2)).^2); end
b5df26e8c24020e858995f67d86a6bea70703e7ba249e81de1dde4bd65eac620
MATLAB
259
8
function startup_fmri_phase() %STARTUP_FMRI_PHASE Add the v2 MATLAB toolbox to the MATLAB path. rootDir = fileparts(fileparts(mfilename('fullpath'))); addpath(fullfile(rootDir, 'matlab')); addpath(fullfile(rootDir, 'matlab', 'vendor', 'tapas_physio')); end
6b00702028b6994df1fda0fdfaf67bfccbde40fa24c760ef81d34e3fb91781c6
MATLAB
260
15
%% load('dataVis.mat') useDays = 1:10; cats = {[1 3:5 8 10:14],[2 6 7 9]}; catNames = {'Good Learners','Bad Learners'}; data1 = dataVis(useDays,cats{1})'; data2 = dataVis(useDays,cats{2})'; [pA,pMC] = anovaRM2W(data1,data2); % pMC = pMC';
bb4b40f3b086d89f4bbaa7cb042fd9677ea27cdce8b8130509176fbc554ea999
MATLAB
262
6
function featureArray = getRoisFeaturePerChannel(featureCellArray) for iChannel = 1: size(featureCellArray{1}, 1) featureArrayTemp = cellfun(@(x) x(iChannel, :), featureCellArray, 'uni', 0); featureArray(iChannel, :) = [featureArrayTemp{:}]; end end
eee9c1faff69f9e1aba419a2acf2164c91f5d45939805eaf2a2636bfb0e97f1d
MATLAB
263
8
%% check_fitD_stack %% test 1 tree = load_tree ('./data/auto_MSO.mtr'); stack = loadtifs_stack ('./data/stack_0002_MSO_P10_2-1_2.tif'); D = fitD_stack (tree, stack, [], '-m'); tprint ('./panels/fitD_stack1', ... '-jpg -HR', [10 10]);
38ac5d8060eeefb50acc8015f256c9848e92913f261dff40a959a6ab71977586
MATLAB
264
9
fid = fopen(fname,'w'); for i = 1:100 network = network_simulation_beluga(folder); % Initialize post network network = network.initialize_postsynaptic_network(2); M = {network.neurons(:).mType}; fprintf(fid,'%s,%s\n',M{1},M{2}); end fclose(fid)
4d89bc3f59b86006a4543c3bfe6cfbdd9a3a6bbf831fe4076b17adf5e2a01583
MATLAB
265
10
function rotationDirection = getRotationDirection(signal, startIndex, endIndex) signalPhase = phase(signal(startIndex:endIndex)); if(signalPhase(end) - signalPhase(1) > 0) rotationDirection = 1; else rotationDirection = -1; end end
8eb4167ff2b5f9decbed562339b2348a940163f2ae5b88359f4bc525bdb991ea
MATLAB
265
9
%% check_cap_tree %% test 1 tree = resample_tree (sample_tree, 1, 'none'); stree = soma_tree (tree, 20, 30, 'none'); ctree = cap_tree (stree, '-i1 -s'); tprint ('./panels/cap_tree1', ... '-jpg -HR', [10 10]);
17beded2cdca0bd120c24cb3d335551f9af0fe3a9a22dab3929abb894070ece3
MATLAB
266
18
%% check_graphical check_chull_tree check_dA_tree check_dendrogram_tree check_gdens_tree check_hull_tree check_lego_tree check_plot_tree check_plotsect_tree check_pointer_tree check_spread_tree check_vhull_tree check_vtext_tree check_xdend_tree check_xplore_tree
b29d498523a719c25e94d0d62f2dd17a05d21291b0a1b678912663104b091e4a
MATLAB
266
10
% Yigang Peng, Arvind Ganesh, November 2009. % Questions? abalasu2@illinois.edu % % Copyright: Perception and Decision Laboratory, University of Illinois, Urbana-Champaign % Microsoft Research Asia, Beijing function vecA = vec(A) vecA = A(:);
dfd89311fa9573c94d5eb6e9847ff339c098755f617234ae62690dcf898e48f1
MATLAB
266
9
%% Recompose the image from the Nth component of the SVD function [recomp, raw] = recomposeSVD(U,S,V,coeffVec,msize) mask1 = zeros(size(S)); mask1(coeffVec,coeffVec) = 1; S = S .* mask1; raw = S*V'; recomp = reshape(U*raw,[msize,size(U,2)]); end
e17f02f539e52c386b17f05bf4d88e1b37e82471f92e73009f3f29ce02ed57cd
MATLAB
267
10
function MRSIStruct = setFov(MRSIStruct, dimension, value) switch(lower(dimension)) case('x') MRSIStruct.fov.x = value; case('y') MRSIStruct.fov.y = value; case('z') MRSIStruct.fov.z = value; end end
e631235cf4e44758eaf3dc2d9d65ed0a480e36d76d7b755e77b5beea09d783f4
MATLAB
268
10
% FigureS05.m % For creating the masks displayed in FigS05, % please execute rootDir/Analyses/CBM_Scripts/EEGfMRIPav_cbm_parameter_recovery.m. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % END OF FILE.
0fa5addcfb481eb3ec449a6429d0ffd194dadcb4d1ef2f6f466e5ca1671d538c
MATLAB
270
11
function r = randi(imax,n) %fprintf(2,'legacy imax!\n'); assert(nargin > 0,'too few arguments'); if nargin == 1 r = 1+floor(imax*rand); elseif nargin == 2 r = 1+floor(imax*rand(n)); else error('please use array form for matrix dimension argument'); end
02bc03d7f2eb46cec20c29d659d0f486f1e03d21df2f50cffeea59ca0dc7cc5f
MATLAB
274
8
function [mle_output] = lyapExpLorenz(rho) [t,a] = computelorenz(10, 2.667, rho ,[0,30], 0.01, 1,1,1); fs = 100; xvals = a(:,1); [~,lag,dim] = phaseSpaceReconstruction(xvals); mle_output = lyapunovExponent(xvals,fs,lag,dim,'ExpansionRange',200); end
2a0298028895b5affacb8a936e7334f54418f1712b141b0b5ab478aa63ebfd19
MATLAB
274
20
function [output]=EOGchecker(EOGSignal,threshold) hEOG=mean(EOGSignal(:,1:2)'); vEOG=EOGSignal(:,3)'-hEOG; aEOG= mean(EOGSignal'); C=abs([hEOG;vEOG;aEOG]); if(max(max(C))>threshold) output=0; else output=1; end end
3e3661f03d0e917343ef1c3ff0f1762e19e332df03f8e9f218dbebd046426d14
MATLAB
274
10
%% check_plotsect_tree %% test 1 clf; hold on; axis off; tree = sample_tree; plot_tree (tree); plotsect_tree (tree, [1 (size (tree.dA, 1))], [1 0 0], [0 0 10]); tprint ('./panels/plotsect_tree1', ... '-jpg -HR', [10 10]);
55aadc4358c4d9415ce38d9a972f336febabaf8c3ad595e1425a3e25d6dd14ac
MATLAB
275
14
function Z = pick_idx(cluster_size, N) % given a vector of cluster sizes, return the corresponding indices the % vectorized edge list. temp = zeros(N); temp(1:cluster_size,1:cluster_size) = 1; for j = 1:N temp(j,j) = 0; end Z= find(squareform(temp)); end
8f7f945f9b86b26e7146d3277de69597def6c4f51d0d509cfab3f2308649e16d
MATLAB
278
16
function bsave(fname, matrix, arg2) % saves a binary file % bsave(fname, matrix, arg2) % uses command fwrite(fp, matrix, arg2); % % arg2 specifies a precision - default 'short' if nargin<3 arg2 = 'short'; end fp = fopen(fname, 'w'); fwrite(fp, matrix, arg2); fclose(fp);
986563caebf155ba3dcd0e733896141467f870bae3efaca515dac63c7207b669
MATLAB
278
18
function streamTiffData(frame) out.data = frame; out.EVENTTYPE = 'FRAME'; out.plane = 0; pause(3) jsonencode(out); % p = parpool(1); % % r = rand(512,512,100); % r = int32(r*100); % % for n=1:100 % tic % f(n) = parfeval(@streamTiffData, 0, r(:,:,n)); % toc % end
528e4a50c276752f41f185a0f4b69c9188d6d246a4c39c9f09adb66000e69cb3
MATLAB
281
12
function CVindex = GenerateCV(nsub, nlevel, seed) rng(seed) nfold = 10; CVO = cvpartition(nsub, 'KFold', nfold); CVindex = zeros(nsub, 1); for i = 1:nfold test = CVO.test(i); CVindex(test) = i; end CVindex = repmat(CVindex, 1, nlevel)'; CVindex = CVindex(:); end
81f4b7c2b6773d6df79892ed4ea31103816f1a2b5d470212bf3d3dfd853fcc08
MATLAB
282
16
function [RMP] = Analysis_RMP_pub(data, duration) if nargin < 5 filter = 10000; %change the filter here end if nargin < 6 filename = 'Data file'; end if nargin < 7 output_folder = 'Default'; end RMP = mean(data); end
3fa3a5591696dbbeef3710b24801dc30023726133c92708f9531d8ab3c3626ed
MATLAB
284
13
function [x_N,x_min,x_max]=Normalization(x,x_min,x_max) % function for normalization if nargin==1 x_min=min(x);x_max=max(x); else [row,col]=find(isnan(x)); x(row,col)=0; end x_N=(x-x_min)./(4*x_max-4*x_min)-0.5; [row,col]=find(isnan(x_N)); x_N(row,col)=-0.5;
8e74379162fac2692beaa559238ec8c125fbc622b0e84357afe21b253ea2ad19
MATLAB
284
16
%% check_cyl_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; cyl_tree (tree); end end %% test 2 [X1, X2, Y1, Y2, Z1, Z2] = cyl_tree (sample_tree)
130fbf710f0f50799dcf983312ee65652fbcce15ece51a34cf75812953cf5102
MATLAB
285
6
function predictedVals = GenerateRandPrediction(possibleLabels,nPredictions) nLabels = length(possibleLabels); randVals = rand(1,nPredictions)*nLabels;%now we have random distribution between 0..nVals predictedVals = ceil(randVals); predictedVals = possibleLabels(predictedVals);
f56c0184c885818aecdc440cc00540972d65ec222c208c543eac96191727639c
MATLAB
289
12
function [fids, positions] = op_CSIExtractFids(MRSIStruct, kSpaceFile) table = readTable(kSpaceFile); TR = table.TR; Kx = table.Kx; Ky = table.Ky; t = table.t; [MRSIStruct, prevPermute, prevShape] = reshapeDimensions(MRSIStruct, {'t', 'ky', 'kx'}); end
f80d23ef43419f03b1f57f2692e434a29dfbeade1bd071ad12a029e26386b6ba
MATLAB
291
10
function MRSIStruct = setVoxelSize(MRSIStruct, dimension, value) switch(lower(dimension)) case('x') MRSIStruct.voxelSize.x = value; case('y') MRSIStruct.voxelSize.y = value; case('z') MRSIStruct.voxelSize.z = value; end end
52f8ed6e44f69edf53ef808fa47c8cec303ba681595df818f40163270828534d
MATLAB
292
8
function [Ev,Ef]=fitness(X,Y,G,M,N,c,G1,G2) % fitness function r=find(N<0); N(r)=[]; c(r)=[]; K=Kmatrix(X,M,G,N,c); W=pinv(K(1:G1,:))*Y(1:G1); % WDD method Ef=100/G1*sum(abs(K(1:G1,:)*W-Y(1:G1))); % MAE: fitting set Ev=100/G2*sum(abs(K(G1+1:G,:)*W-Y(G1+1:G))); % MAE: validation set
61998486bb8a63961c85b48eb6ca8d9f53cacff33526bfd8764fa32ac09b9018
MATLAB
294
8
function [outModel] = tagModel(inModel, tag) outModel = inModel; outModel.rxns = strcat(tag,inModel.rxns); outModel.mets = strcat(tag,inModel.mets); outModel.comps = strcat(tag,inModel.comps); outModel.compNames = strcat(tag,inModel.compNames); outModel.subSystems = strcat(tag,inModel.mets);
5d0c1aeb1d710398a7548b495e6e8e869bbd3cddb1cb5bad3ef505ad2d262d41
MATLAB
297
20
function df= defaultThresh(DT,doBeta) thresh=[]; if notDefined('doBeta') doBeta = 1; end thresh.varexp = 0.1; df = tableThreshold(DT,thresh,'lower'); thresh = []; thresh.ecc = 12; % max ecc df = tableThreshold(df,thresh,'upper'); if doBeta == 1 df = removeBetaOutlier(df); end end
19d7dc1c5c3bf41339934468995b1ec4f347a24a81f6e9fb89b2df57cf1456b8
MATLAB
299
15
function A = labelpanel(x,y,str,lowerCase) if(nargin<4) str = upper(str); % CellPress else if(lowerCase) str = lower(str); % NPG else str = upper(str); end end A = annotation('textbox', [x,y,0.05,0.05],'String',str, 'LineStyle', ... 'none', 'FontWeight','bold', 'FontSize',8,'Margin',0);
fef81bc19411ecd29fa11aa46d491e42d888419bd0015d2240f023fbe0835a3b
MATLAB
299
20
%% check_metrics check_angleB_tree check_cvol_tree check_cyl_tree check_dstats_tree check_eucl_tree check_flatten_tree check_flip_tree check_len_tree check_morph_tree check_rot_tree check_scale_tree check_surf_tree check_tran_tree check_vol_tree check_zcorr_tree check_sholl_tree check_stats_tree
ffc9c34c55b81d21b0f7d440f5f72c7e3a8065ec74ec4ef8edf5191369113f01
MATLAB
299
17
classdef Mock_RawImgHelper < RawImgHelper & IMock %MOCK_RAWIMGHELPER Summary of this class goes here % Detailed explanation goes here properties (Dependent) name rawdata t0 end methods function to_long(~) end end end
52c94db1a3c432fc1d2b7b32343ca52f01652aa5d26475bb4855424adb2ba52d
MATLAB
300
11
function colors = linearlyMapArrayToColors(xArray, colorMap) % Normalize to range 0-1. if ~range(xArray(:)) == 0 xArray = (xArray - min(xArray(:))) / range(xArray(:)); end nColors = size(colorMap, 1); colorInds = floor(xArray * (nColors - 1)) + 1; colors = colorMap(colorInds, :); end
93913f916a5c883ed660e600ba769e4e3fa40dae307893ab560a8ea2bdc2efae
MATLAB
301
21
%% clear all; close all; clc d = dir('data_*'); nFile = length(d); minGlob = NaN; %% for f = 1:nFile load(d(f).name) minCur = min(size(allCen.common,1),size(allCen.unique,1)); minGlob = min(minGlob,minCur,'omitnan'); end save('minGlob.mat','minGlob')
015860eb21c10d235298e1a61bb1a94f96b232b3cbe6011aa9a15df44e392610
MATLAB
302
8
function [outModel] = tagModel(inModel, tag) outModel = inModel; outModel.rxns = strcat(tag,inModel.rxns); outModel.mets = strcat(tag,inModel.mets); outModel.comps = strcat(tag,inModel.comps); outModel.compNames = strcat(tag,inModel.compNames); outModel.subSystems = strcat(tag,inModel.mets);
927760818293053573536c63e8916068f7ec9e917142a00ddb4ae89228d0b862
MATLAB
303
9
function [volume, raw] = recomposeSvd(U, S, V, componentIdx, spatialSize) %RECOMPOSESVD Recompose a volume from one SVD component. componentMask = zeros(size(S)); componentMask(componentIdx, componentIdx) = 1; raw = (S .* componentMask) * V'; volume = reshape(U * raw, [spatialSize, size(U, 2)]); end
5ecacfb3c2ee72d396d540107d2f176be66dd1b7d8575ed1ea6669a3fec7f206
MATLAB
304
10
function logElapsed(cfg, label, timerValue) %LOGELAPSED Print elapsed time for a pipeline step. if isfield(cfg, 'verbose') && cfg.verbose timestamp = string(datetime("now", "Format", "HH:mm:ss")); fprintf('[%s] %s finished in %.1f s.\n', ... timestamp, label, toc(timerValue)); end end
4b29147127aa049213c6a92bbfd44a857c841b8af5143e3b0249cead1854d0a3
MATLAB
309
10
function RFparam = randomRFparam(StimSize,nVoxels) rng('default') % For reproducibility RFxy = normrnd(0,StimSize/4,[nVoxels,2]); % if we use linlog (default) we can specify where the cutoff lies. This RFsigma = boundUniformRand([0.2 StimSize/4],nVoxels); RFparam = [ round(RFxy,2) round(RFsigma,2)]; end