sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
837e3b79a9ae278dd297adf76dd82a0ece2e003024fbea0d67c6c02dd436da27
MATLAB
256
15
%% Function that makes Matrix: Cells x Frames % Assumption: % Frames>Cells % Input % R: matrix size: DxG % Output % R: maatrix size: % if D>G function Rout=makecellsxframes(Rin) [D,G]=size(Rin); if D>G Rout=Rin'; % TRANPOSE else Rout=Rin; end
9296b4c6a7665b2e9b61cbf1c8af1d5532a7ef5b0b70804bf8c259899d139dcb
MATLAB
257
11
%% Function of histidine decarboxylase in glia. % Histamine synthesis in glia. % UNITS in uM/h. % b = gha. function a = VHTDCg(b) % b = cht % c = G* km = 270; %homosapiens BRENDA (other wild type =100, Komori2012) v = 61.4250; a = v.*(b./(km + b));
a949f94d1fd1e6af3d5f5cd3e300176df2afd4a2cffab49ade403f346756f5d3
MATLAB
257
9
clc clear cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f4\g') T2 = importdata("eopn3_vs_scarlet.mat"); %% stats = mes(T2.abs_IR(find(contains(T2.tag,'CONTROL')),:),T2.abs_IR(find(contains(T2.tag,'EOPN3')),:),'hedgesg')
e4056ece41e65e0e21a959be089fb41aafe1d045955e740220076dbe8e96fbab
MATLAB
257
4
function y = BPFilter6(x, fc, bw, factor) % BPFilter6 has been deprecated. Use bp_filter_complex_equiripple instead. warning('BPFilter6 has been deprecated. Use bp_filter_complex_equiripple instead.'); y = bp_filter_complex_equiripple(x, fc, bw, factor);
4aa7f541980a435b50d0ae4d40dfc14c93c055b5eeb3204c462dc910f27b1fb3
MATLAB
258
15
function A = Find_Angle360_2_Points(P1,P2) dX = P2(1) - P1(1); dY = P2(2) - P1(2); A = abs(atand(dY/dX)); % [0,90]. if(dX >= 0 && dY < 0) A = mod(-A,360); elseif(dX < 0 && dY >= 0) A = 180 - A; elseif(dX < 0 && dY < 0) A = A + 180; end end
5d4e8f1462e75a025cca1bdeeab8286c69d8d57644655e370f1b9dd5591285de
MATLAB
258
7
%% Function of replenishment of histidine decarboxylase (HDC) during FMH inhibition. % b represents ratio levels of HDC, while a represents rate of % replenishment (h-1). function a = HTDCin(b) s = 0.55; %Strength of replenishment. a = s*(1 - b); end
b4c8a8e92f32b816283629c2340bfd0137bd99e13f1e4b90503fbae29f9635bf
MATLAB
258
4
function [T0, T1] = CalculateTimeLags(peaks, phase) % CalculateTimeLags has been deprecated. Use calculate_time_lags instead. warning('CalculateTimeLags has been deprecated. Use calculate_time_lags instead.'); [T0, T1] = calculate_time_lags(peaks, phase);
1406d99a6acdce023fbdb89d8b6d778fe2963cc970e05695bfb2a683671963eb
MATLAB
259
4
function [y, B, conv] = EASI(x, nsou, lambda, nlintype) % EASI has been deprecated. Use easi_source_separation instead. warning('EASI has been deprecated. Use easi_source_separation instead.'); [y, B, conv] = easi_source_separation(x, nsou, lambda, nlintype);
4f91bb2fdb65fd6cf39dba33e4c82665940402a69e7979c02f6db274921aef1c
MATLAB
259
4
function [T0, T1] = SynchPhaseTimes2(peaks) % SynchPhaseTimes2 has been deprecated. Use synchronous_phase_samples instead. warning('SynchPhaseTimes2 has been deprecated. Use synchronous_phase_samples instead.'); [T0, T1] = synchronous_phase_samples(peaks);
9dbda0d53106064a2994ae5d70662b7279f9a0e33cf207049c044a73c7cab79b
MATLAB
259
17
function fo=eddycorrection_fid(f,fw) fo=f; for nf=1:length(f) fid = f(nf).fid; fidw = mean(fw(nf).fid,2); for k=1:size(fid,2) fid(:,k) = fid(:,k) ./ exp(1*i*angle(fidw)); % fid(:,k) = fid(:,k) - angl end fo(nf).fid = fid; end
265e067c7e8fba8d30614261cb6cae73e872381ca7a8f7079f8af4d28a976998
MATLAB
260
14
function [res] = Ragu_ReadSPINV(infile) fid = fopen(infile,'rb'); if fid == -1 res = []; return; end f = fread(fid,'single'); fclose(fid); res.nvox = f(1); res.nchan = f(2); res.spinv = reshape(f(3:(res.nvox*res.nchan*3+2)),[res.nchan,3,res.nvox]);
183f224bb60fdf7ade45b989edc778b6a50acb1dbb7c7efd5eac19770c36e228
MATLAB
262
4
function [y, W, A] = SCA2(x, f0, bw, order) % SCA2 has been deprecated. Use spectral_component_analysis_ma instead. warning('SCA2 has been deprecated. Use spectral_component_analysis_ma instead.'); [y, W, A] = spectral_component_analysis_ma(x, f0, bw, order);
5887a117b9d764b0779fa677bdd9c2a8a4bab9a0ee729926e6ab6271e0230423
MATLAB
262
4
% HMM single file processing example by Yunxiang Zhang (yxzhang@gmail.com) filename=['/Users/brunger/Dropbox/archive/programs/single_molecule/HMMbatchscript/examples/individual_traces/two_steps_photobleaching_event.txt']; HMMint=Hmmtrace_atb(filename);
5a5612e986407ae4b6270c6e2e219a9a320a6f454a633c5a6181d0710c046328
MATLAB
262
16
for i = 1:5 index(i) = sum(all_clusters_idx == i) end %% all_idx = []; for i = 1:3 all_idx = [all_idx; idx{i}] end %% for i = 1:5 subplot(1, 5, i) plot(mean(cell2mat(data(all_idx(all_clusters_idx == i), 5:end)), 1)) ylim([-2 6]) end
6fe37a1d620b925aa050d0f2c348bfa432d416eca67e6d7828f1356a27dc2d8a
MATLAB
262
9
function uInfo = exportUnitInfo(obj, iCluster) %EXPORTUNITINFO Get all data pertinent to a cluster uInfo = exportUnitInfo@jrclust.interfaces.Clustering(obj, iCluster); if ~isempty(obj.unitSNR) uInfo.SNR = obj.unitSNR(iCluster); end end
b02eea97636b6157be7e896834c04030f3a63040d65d09210e5240c1557ccc24
MATLAB
262
4
function [y, W, A, B, C] = NSCA(x, I, J) % NSCA has been deprecated. Use nonstationary_component_analysis instead. warning('NSCA has been deprecated. Use nonstationary_component_analysis instead.'); [y, W, A, B, C] = nonstationary_component_analysis(x, I, J);
ee71cb391c2d9ee7bc45c72950ba60685ecc7993d30a4ed0c722b954852ab633
MATLAB
262
8
function [Matrix]=mnl_NormaliseVectors(Matrix) % Input % Matrix - row of points,columns represent dimensions % Output % Matrix - same as above but now normalised matrix_Norm=sqrt(sum((Matrix.*Matrix),2)); Matrix=Matrix./repmat(matrix_Norm,1,size(Matrix,2)); end
4cc74c3167131e258a755fe0ca3b4259b57acb5932293b701d434180aa019adb
MATLAB
263
4
function y = BPFilterComplex(x, w0, N) % BPFilterComplex has been deprecated. Use bp_filter_complex_ma_fixed_tap instead. warning('BPFilterComplex has been deprecated. Use bp_filter_complex_ma_fixed_tap instead.'); y = bp_filter_complex_ma_fixed_tap(x, w0, N);
e74844f6d90197a102ffd6b697b44632362d9293a417fc26befa8b426e22689f
MATLAB
263
7
% Remove unrelated directories from path restoredefaultpath; clear RESTOREDEFAULTPATH_EXECUTED; % Add relevant directories to path (if they exist) addpath(genpath(fullfile(pwd,'Toolbox'))); addpath(fullfile(pwd,'Structures')); addpath(fullfile(pwd,'Data'));
2bdc844594fd62108f4fec2486dcc17a5f71e8a1428f8fedb9e4dfeac4c30b56
MATLAB
264
4
function [y, W, A] = PiCA(x, peaks1, varargin) % PiCA has been deprecated. Use periodic_component_analysis instead. warning('PiCA has been deprecated. Use periodic_component_analysis instead.'); [y, W, A] = periodic_component_analysis(x, peaks1, varargin{:});
5a61f5931143e22017e574af6af1b971a97374f2e1c216c440431482a338e716
MATLAB
264
4
function [CosTheta, U, V] = SubspaceAngles(A, B) % SubspaceAngles has been deprecated. Use subspace_principal_angles instead. warning('SubspaceAngles has been deprecated. Use subspace_principal_angles instead.'); [CosTheta, U, V] = subspace_principal_angles(A, B);
b04a1a5f853daaaee31b0db98098741472936baeefcafc9c742546f189550890
MATLAB
264
20
N=100;W=0.05; % for i=repmat(1:N,N,1); for i=1:N % A=2*W*sinc(2*W*(i-i')); for j=1:N A=2*W*sinc(2*W*(i-j)); end end [V,D]=eig(A); figure(1) for k=1:5 subplot(5,1,k) plot(V(:,N-k+1)) end figure(2) plot(diag(D))
438e2c9ecdb6a6bc4fe38fbd1d077fa9d262c62e6076fa181b98d628bcb0be0f
MATLAB
266
15
function out = get_spm_affmats(P, refVol) nV = length(P); if nargin < 2 refVol = 1; end out.pars = zeros(12,nV); out.mats = zeros(4,4,nV); for iV = 1:nV out.mats(:,:,iV) = P(iV).mat / P(refVol).mat; out.pars(:,iV) = spm_imatrix(out.mats(:,:,iV)); end
4857fbe89736fd06e99b0e56377cb444e1c1ddb5dffc623a5274f8187a7e537c
MATLAB
266
17
function out = flipAxes(dataToFlip,flip_xyz) if isempty(flip_xyz) flip_xyz = [0 0 1]; % current best guess :) end out = dataToFlip; if flip_xyz(1) out = flip(out,1); end if flip_xyz(2) out = flip(out,2); end if flip_xyz(3) out = flip(out,3); end
b5b7427acb36c8ac2fa1e6de9c2c466579cc09a7b2da40740171dbe516b43a8f
MATLAB
266
8
function [d1] = bandpassfilter(highp,lowp,fs,rawdata) %BANDPASSFILTER Summary of this function goes here % Detailed explanation goes here filter = [highp lowp]; % band-pass condition [b,a] = butter(4,filter/(fs/2)); d1 = filtfilt(b, a, rawdata(:,:)); end
d5a50b2dc6ec86959a55f06a71c3a691782f51324b06148301a064fbc29b9eac
MATLAB
266
10
plot(F0000CH1.T,F0000CH1.V) hold on plot(F0005CH1.T,F0005CH1.V) plot(F0009CH1.T,F0009CH1.V) plot(F0013CH1.T,F0013CH1.V) plot(F0017CH1.T,F0017CH1.V) plot(F0022CH1.T,F0022CH1.V) legend('10mW','20mW','30mW','40mW','50mw','60mW') xlabel('Time (s)') ylabel('Voltage (V)')
064ddd9aae75a38565e74140ce41068f51f3e36e739975e4e0d1c48716dd0861
MATLAB
268
4
function [T0,T1] = SynchPhaseTimes(peaks,phase) % SynchPhaseTimes has been deprecated. Use synchronous_phase_samples instead. warning('SynchPhaseTimes has been deprecated. Use synchronous_phase_samples instead.'); [T0, T1] = synchronous_phase_samples(peaks, phase);
59b8c6fb2829b05b54baceb2e685427ec1a9db12df68a0d9ed7efdad51969b2c
MATLAB
268
9
%% 5HT catabolism in the cytosol %Conventional Michaelis Menten rate. % b = cytosolic 5ht in the terminal, sc is the scaling factor for time. % UNITS IN uM and uM/h. function a = TCcatab(b) km = 95; %Gottowik93 and Fowler94 vmax = 4000; a = (vmax.*b./(km + b)); end
b733b4bd48c8dac212c572254bc3b3b33ecfc432a0551705d36293c9a0f81f02
MATLAB
268
7
function SmoothData = smooth_spectrum(Power, Frequencies, SmoothSpan) % function for smoothing data % Data is a 1 x Freqs matrix. FreqRes = Frequencies(2)-Frequencies(1); SmoothPoints = round(SmoothSpan/FreqRes); SmoothData = smooth(Power, SmoothPoints, 'lowess'); end
57cad63db495be0e8361774c1f15ae52cfae5333ff5009a217fd78046ad5da2e
MATLAB
269
4
function [ECGmean, ECGsd] = ECGBeatVariance(x, peaks, wlen) % ECGBeatVariance has been deprecated. Use avg_beat_calculator instead. warning('ECGBeatVariance has been deprecated. Use avg_beat_calculator instead.'); [ECGmean, ECGsd] = avg_beat_calculator(x, peaks, wlen);
d10d3caf326650443e8b9a7a9abbdf678d4ba657158b2d347016a272345086db
MATLAB
269
11
%% Function of histidine decarboxylase in mast cells. % Histamine synthesis in mast cells. % UNITS in uM/h. % b = gha. function a = VHTDCmc(b) % b = cht % c = G* km = 270; %homosapiens BRENDA (other wild type =100, Komori2012) v = 877.50; a = v.*(b./(km + b));
39524a6f9fc533873bf3a704a78e951ac23955c9ef96549da76fd0e20b309370
MATLAB
271
12
function h = SmoothStackPlot(x,y) Colors = lines(size(y,2)); baseline = zeros(size(y,1),1); px = repmat([x(:);flip(x(:))],1,size(y,2)); py = [cumsum([baseline y(:,1:end-1)],2); flip(cumsum(y,2))]; for i = 1:size(y,2) h(i) = patch(px(:,i),py(:,i),Colors(i,:)); end
4d0220cefb2d5181e5691589257dda54b40642f618edc28e582b57d7f670a3c8
MATLAB
271
8
function changecolormap(obj,~,node,data) % autocorrelatemap() and crosscorrelatemaps() depend on this function. n = length(obj.Colormap(:,1))-1; for i = 1:length(node) node(i).FaceColor = repmat(obj.Colormap(floor(data.color(node(i).UserData)*n)+1,:),3); end
b69d9ea2e8d007ff05d79a9d1e140da583a83a81d472cc1e14e60815a83387b1
MATLAB
271
13
function mnl_ExportEPSdense(h,fn) % Code to switch back the renderer to a vector format from a bmp (image % format) % Input % h = figure number (h=gcf) % fn = filename % % Output % .eps file set(h,'renderer','Painters') print(fn,'-depsc','-tiff','-r300','-painters') end
cd1267a208b66ec42fb35bafef91d19385500c2cd791d81a964ee2650893b013
MATLAB
271
4
function [y, W, A] = SCA_NSCA(x, f1, f2, I, order) % SCA_NSCA has been deprecated. Use sca_nsca_component_analysis instead. warning('SCA_NSCA has been deprecated. Use sca_nsca_component_analysis instead.'); [y, W, A] = sca_nsca_component_analysis(x, f1, f2, I, order);
30b478bd1459f93e38d226d3c91d5db1302ef0a71a636c104bc229b69f0c6b9c
MATLAB
272
8
function Folder = list_filenames(Folder) % little function for getting whatever is inside a folder, ignoring the % stupid dots and turning everything into a string Folder = deblank(string(ls(Folder))); Folder(strcmp(Folder, ".")) = []; Folder(strcmp(Folder, "..")) = [];
6a486c751494a92ac9f1c5ab5ea4a951515028ec6330d78b161ef5df758826f2
MATLAB
272
16
function P=select_data() rootdir = '/home/romain/data/spectro/hipo/dicom_files'; sujet_dir_wc = {'Sujet1[01]','Sujet09'}; fonc_dir_wc = 'TE64$'; s_dir = get_subdir_regex(rootdir,sujet_dir_wc); s_sub_dir = get_subdir_regex(s_dir,fonc_dir_wc); P = char(s_sub_dir);
9afa20e4bf554819faabf3d5cfd4b915411ee22681029c233b9a688cab7b5ee3
MATLAB
272
11
function [ output_args ] = writeAvi( movie,frameRate,fpath ) %WRITEMOVIE Summary of this function goes here % Detailed explanation goes here v = VideoWriter(fpath,'Grayscale AVI'); v.FrameRate = frameRate; open(v) writeVideo(v,movie); close(v) end
2a19cab7480da0a2f45b042f734e06a8abec211100df3180198fdb8ab5682c91
MATLAB
273
9
function tc = trueClass(vals) %TRUECLASS Return class of vals, or, in the case of gpuArrays, the % underlying class if isempty(vals) tc = class(jrclust.utils.tryGather(vals)); else tc = class(jrclust.utils.tryGather(vals(1))); end end
c407befd8231afc5d00f75624fa5188846713fa26cd54de27e81446623cdd70e
MATLAB
273
11
%% Rate of reuptake from serotonin transporters in serotonin terminals. % b = e5ht %UNITS IN uM and uM/h. function a = VSERT(b, sert_density, ssri, ki) k = 0.060; vmax = 250; vmax_app = vmax * sert_density; k_app = k * (1 + ssri/ki); a = vmax_app.*b./(k_app + b); end
0514d7811eacf1d827c18687dba2f0ddef0940e792f7e286fc0e2eab6cccbb0b
MATLAB
274
10
function Labels = indexes2labels(Indexes, Chanlocs) % outputs channel indices based on chanlocs labels AllLabels = string({Chanlocs.labels}); AllLabels(strcmpi(AllLabels, 'CZ')) = "129"; Labels = AllLabels(Indexes); Labels = char(Labels(:)); Labels = str2double(Labels);
d616f2008fc2da8bff6b9044edbba3fb29f20a0cac9bcc704af8a6857024c268
MATLAB
274
4
function [index, rank] = ChannelIndex0(x, th1, th2, varargin) % ChannelIndex0 has been deprecated. Use sqi_level_crossing instead. warning('ChannelIndex0 has been deprecated. Use sqi_level_crossing instead.'); [index, rank] = sqi_level_crossing(x, th1, th2, varargin{:});
197d31d4165fea2f752ba0ff7ddf2a9a836a80c718b73dc5c0fcff51c10ab568
MATLAB
275
4
function [index, rank, y] = ChannelIndex2(x, w, varargin) % ChannelIndex2 has been deprecated. Use sqi_power_fluctuation instead. warning('ChannelIndex2 has been deprecated. Use sqi_power_fluctuation instead.'); [index, rank, y] = sqi_power_fluctuation(x, w, varargin{:});
9ee9b0627ce4f2b576fce42378d033687628c7d17c2a4bbf22ff452a56a899be
MATLAB
276
4
function [A, AA, B] = PiCAMatrixes(x, peaks, peaks2) % PiCAMatrixes has been deprecated. Use pica_matrices_double_peaks instead. warning('PiCAMatrixes has been deprecated. Use pica_matrices_double_peaks instead.'); [A, AA, B] = pica_matrices_double_peaks(x, peaks, peaks2);
68b8af3eb3b7cbdb6333f85b163d5d52df3348ef3bbc1738fdbc201322034fc9
MATLAB
278
4
function [s, W, A, B, C] = MultichannelNotchFilter(x, fc, Q, fs) % MultichannelNotchFilter has been deprecated. Use sca_notch_filter instead. warning('MultichannelNotchFilter has been deprecated. Use sca_notch_filter instead.'); [s, W, A, B, C] = sca_notch_filter(x, fc, Q, fs);
87a11f2356c9898f418ba58f4061d2026fb2da690cc545609a5a7e33cdc7f318
MATLAB
278
18
function [y] = phi(x, param) % scaled/biased logarithmic sigmoid: a * s(x - b) % % Parameters % ---------- % - x: array % Input % - param: [scalar, scalar] % Scale and bias parameters % % Returns % ------- % - y: array % Output y = param(1) .* logsig(x - param(2)); end
5466067e89ad7f2984133700807a8f56ec45dc007a8997f58dfc443486e018ae
MATLAB
279
8
function out=madr(x) % Computes the median absolute deviation to the median, % adjusting by a factor for asymptotically normal consistency. % This is the formula used in the R version of mad, % which is different from the Matlab version. out=1.4826.*median(abs(x-median(x)));
2969593a8c3117f25bf69ffd0dfdcc41b665d34bf6e3e182c3d7c7a5fc6b176c
MATLAB
280
4
function [b2, b1] = BaseLine2(x, L1, L2, approach) % BaseLine2 has been deprecated. Use baseline_sliding_window_twice instead. warning('BaseLine2 has been deprecated. Use baseline_sliding_window_twice instead.'); [b2, b1] = baseline_sliding_window_twice(x, L1, L2, approach);
5a3afaa399d10bf9865f5aeb1a5764f7b8c0f68f0126790766ab9f290bf1c6b9
MATLAB
280
12
function w=HanningWindow_(window_size) w=zeros(1,window_size); if mod(window_size,2)==0 for n=1:window_size, w(n)=0.5-0.5*cos(2*pi*(n-1)/window_size); end else for n=1:window_size, w(n)=0.5-0.5*cos(2*pi*(n-0.5)/window_size); end end
6abcf401d4a4d850477ac56251b48941ef3806259ed94ec5d06b524a33372492
MATLAB
280
17
function output = sumEveryN(input, N, dim) if N<2 error('N must be > 1') end s = size(input); % only works for 2d id = find(~ismember([1 2], dim)); for ii = 1:s(id) in_temp = input(:,ii); output(:,ii) = reshape(sum(reshape(in_temp,N,[]),'omitnan'),[],1); end end
a02df4d231e1781abf64871cab1ce7c93c4b2a9504d867b2487843c0cb0b6dba
MATLAB
280
10
function samplesIn = userFilter(samplesIn, filtKernel) %USERFILTER Convolve samplesIn with user's custom kernel if ~isempty(filtKernel) for i = 1:size(samplesIn, 2) samplesIn(:, i) = conv(samplesIn(:, i), filtKernel, 'same'); end end end
5772d63ef695f4316980bb9a42dd4b632e0ccf860aeca48ef6b3216ea6f22da4
MATLAB
281
10
function [meanSize,stdSize,numOfCommunity] = community_size_mean_std(S) uniqueS = unique(S); for i = 1:numel(uniqueS) sizeCommunity(i) = sum(S==uniqueS(i)); end meanSize = mean(sizeCommunity); stdSize = std(sizeCommunity); numOfCommunity = numel(sizeCommunity); end
6dcb1340feb6a78803fc03700b177c2e009a3b2d8448ed5b98c818fb644bbb22
MATLAB
281
17
function bic = nhmm_bic(Y, Omega_est,map_states) n = size(Y,1); [p,~,k] = size(Omega_est); mu = zeros(1,p); nparams = k*p*(p+1)/2+k*(k+1); for i = 1:n llike = mvnloglike(Y(i,:),mu,Omega_est(:,:,map_states(i))); end llike = sum(sum(llike)); bic = log(n)*nparams-2*llike;
a3a31175740d9b4c80152c3193a335f96ff1d483db22d5a4a07e9dfb5c0c9d7a
MATLAB
282
10
function outstr = c_str(instr) % eja function to read C-style null-terminated strings % (strips everything past the first null) %rrr added because fread use with type UINT8 instead of char if isnumeric(instr) instr = char(instr); end outstr = strtok(instr, char(0));
b91985909aad7e8a9f611cce4d621ae9af9c884f04abde21416b46cc0fd1a0af
MATLAB
282
8
function samplesIn = fir1Filter(samplesIn, order, passband) %FIR1FILTER Convolve samples with a FIR bandpass filter of given order ff = single(fir1(order, passband)); for i = 1:size(samplesIn, 2) samplesIn(:, i) = conv(samplesIn(:, i), ff, 'same'); end end
d4753133936797dd3677041e12186d7df2ce30ee6050fc70254a60b1a132ce9e
MATLAB
282
9
%% Function of histamine inhibition of histamine firing. % Dependent on Serotonin-activated g-protein (b) and the equilibrium value % of the activated G-protein (c). % Units in uM. function a = inhibRHAtoHA(b, c) min_a = 0; a = 1 - (2).*(b - c); a(a<min_a) = min_a; end
01c6234b73973bb4c8a3eb764ba7500fcc499ab1f88ed979aba027c8ba98b5f6
MATLAB
283
4
function [y, W, A] = SCAmodified(x, fl, fu) % SCAmodified has been deprecated. Use spectral_component_analysis_bp instead. warning('SCAmodified has been deprecated. Use spectral_component_analysis_bp instead.'); [y, W, A] = spectral_component_analysis_bp(x, fl, fu, 'DFT_FILTER');
3a054af9f642a8e31b864cd963c7917c4cf6766516df9d3c872b3a9688c2bfbe
MATLAB
283
15
function centreOfMass = calcCOM(cellArray,xvals, method) if nargin == 3 if strcmp(method, 'mean') xSums = cellfun(@mean, cellArray); end else xSums = cellfun(@sum, cellArray); % default end M = sum(xSums(:)); centreOfMass = sum((xvals.*xSums))/M;
3ca1811ec675895c98accf2798e5b6e0ddb7a2411903e8642cb142896c244d11
MATLAB
284
15
%% Global Variables: global SIGNALS; global DETSIGNALS; global preDRIVE; global preLAMBDAS; global RASTER; global Responses; global Names_Conditions; global fs; global SIGNALSclean; global SNRlambda; global Experiment; global RasterAlgorithm; % global isSIGNALS; % global notSIGNALS;
592a4fada41f74f3fd20e1ccef11f4d3314563e032d16b873ccb78e13472bfd5
MATLAB
284
8
function cells = blockify_data(ob, data, varargin) %function cells = blockify_data(ob, data, varargin) if isempty(ob.handle_blockify_data) fail('The %s of type %s has no handle_blockify_data', ... class(ob), ob.caller) end cells = ob.handle_blockify_data(ob, data, varargin{:});
7895996362624607f6dadbd789304635cc534451f45fb0e94f7173577faff4f4
MATLAB
285
4
function [peaks, mn, r] = PeakDetection3(x, fs, h, th, fmax) % PeakDetection3 has been deprecated. Use peak_det_matched_filter instead. warning('PeakDetection3 has been deprecated. Use peak_det_matched_filter instead.'); [peaks, mn, r] = peak_det_matched_filter(x, fs, h, th, fmax);
4f56c29b843f9570d764dfa08b71d98c6f639940ae33a986af0c44793465b5a7
MATLAB
286
15
function [map_states, sure] = mapstates(st_post) N = size(st_post,2); map_states = zeros(1,N); sure = map_states; for i = 1:N tbl = tabulate(st_post(:,i)); sure(i) = max(tbl(:,3))/100; counts = tbl(:,2); [m,ind] = max(counts); map_states(i) = tbl(ind,1); end end
ce1d5c8a85849a6a33222c41c5bcad0110ccd6e92dd6311a41646ab4e6e5ac7b
MATLAB
286
14
function [ tform] = getAffReflect( plane_normal ) %GETAFFREFLECT Summary of this function goes here % Detailed explanation goes here plane_normal = plane_normal(:); reflmat = eye(4); reflmat(1:3,1:3) = eye(3) - (2 * plane_normal * plane_normal'); tform = affine3d(reflmat); end
1dd1300af534a2f64a9a9ddb92a97d961db25b1180b60821f223b932264d2a4f
MATLAB
287
11
function mmil_mkdir(outdir) %function mmil_mkdir(outdir) % % NOTE: gives error if unable to create outdir % % Created: 04/04/11 by Don Hagler % Last Mod: 04/04/11 by Don Hagler % [succ,msg] = mkdir(outdir); if ~succ, error('failed to create output directory %s:\n%s',outdir,msg); end;
cd962bb571d8aab6a542a23a8ec28014ed8d575005fa1dadf91bef9a0f3cc15c
MATLAB
287
9
%% Function of serotonin activation of histamine release. % Dependent on Serotonin-activated g-protein (b) and the equilibrium value % of the activated G-protein (c). % Units in uM. function a = activR5HTtoHA(b, c) min_a = 0; a = 1 + (3).*(b - c); a(a<min_a) = min_a; end
d399fbdf7206b1e107a322c08c9b64c976318d2d192b4420e77412ac4e16757b
MATLAB
287
17
function Vout = apply_spm_affmats(V,Mats) nV = length(V); if (nV)~=size(Mats,3) disp('') disp('Error: there should be a 4x4 matrix for the n volumes from V') disp('') return end Vout = V; Mstart = Vout(1).mat; for iV = 1:nV Vout(iV).mat = Mats(:,:,iV)*Mstart; end
a6a45f6455c379f884f3b7ad73294b12886a6bb26d0ff409a722efddd2f56b3e
MATLAB
288
9
function [x fs] = LoadSeizureEEGFull(path, subject, mode, number) load([path subject '_' mode '_segment_' num2str(number,'%.4d') '.mat']); varname = [mode '_segment_' num2str(number,'%d')]; eval(['data = ' varname '; clear ' varname ';']); x = data.data; fs = data.sampling_frequency;
be5bbfd7191be06ff90452e8f62a70d8a1d856293df99ce48e9f9f9052f3ca48
MATLAB
288
15
function varargout = eig(ob, varargin) % compute eig of object by converting it to full matrix. % this will be very slow for big objects ob = full(ob); [v d] = eig(ob, varargin{:}); switch nargout case 1 varargout = {diag(d)}; case 2 varargout = {v, d}; otherwise fail 'eig bug' end
05a6069b8924d997e9c638247687a906d95c47ba7a809fe770ba332c17d59687
MATLAB
289
4
function [peaks, peak_indexes] = PeakDetection(x, ff, varargin) % PeakDetection has been deprecated. Use peak_det_local_search instead. warning('PeakDetection has been deprecated. Use peak_det_local_search instead.'); [peaks, peak_indexes] = peak_det_local_search(x, ff, varargin{:});
4f9ec6a451b73eeac3f188a320583336dbda5fb9d545600995ce5036350b6636
MATLAB
289
11
function output = rgetfield(S, field) % Split the fieldname on "." parts = regexp(field, '\.', 'once', 'split'); output = [S.(parts{1})]; if numel(parts) > 1 % If there are more parts, recursively get them output = rgetfield(output, parts{2}); end end
bd8e6664113b651b633bf827dfda86883347228e8069fe459822f0f9a249c4c4
MATLAB
289
7
%% Function that models slow down in escit dissociation from SERTs due to allosteric binding %Units in uM. function ki = allo_ssri_ki(ssri) min_ki = 0.001; b = 4; %Strength. ki = 0.05.*exp(-b.*ssri) + min_ki; %constant of inhibition of ESCIT in uM. doi:10.1017/S1461145706007486. end
ecf58c1c55c68989a8e6824774ab9eb98c687f2c2bdca7d644a19fd6488c3f93
MATLAB
289
11
function out = NormDimL2(in,dim) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License rep = ones(numel(size(in)),1); rep(dim) = size(in,dim); d = sqrt(mean(in.*in,dim)); %d = std(in,1,dim); d(d == 0) = 1; out = in./repmat(d,rep(:)');
43857a410473e41b0d782a55d940b6db312a7e2486b1a201230931cf9041d563
MATLAB
290
9
%% Inihibition of serotonin release from 5-HT1B due to serotonin. % Dependent on Serotonin-activated g-protein (b) and the equilibrium value % of the activated G-protein (c). % UNITS IN uM. function a = inhibR5HTto5HT(b, c) min_a = 0; a = 1 - (1.5).*(b - c); a(a<min_a) = min_a; end
2e1740e72a80c2ce6e1ba54691aa1d2bdfd000c895ac9494d045bf536fc3f543
MATLAB
291
9
function zScored = z_score(vals, mu, sigma) %% function to z-score values according to a known normal distribution. % example usage for analysing PSTHs: % Generate normal dist by z-scoring baseline period and then use this to % z-score the rest of the PSTH. zScored = (vals-mu)/sigma; end
024e764a8f4b0d28dfc154d3a6e466a49bfe213209325e7c4d01d24b2a24426d
MATLAB
292
4
function [status, count] = MatToBinaryFileConverter(x, fs, ofname) % MatToBinaryFileConverter has been deprecated. Use write_binary_signal instead. warning('MatToBinaryFileConverter has been deprecated. Use write_binary_signal instead.'); [status, count] = write_binary_signal(x, fs, ofname);
0e61ef6b4aa3ec1bbcc7a13d6449a8659d986fc0196355ef62ca15b234eb7806
MATLAB
295
7
function [WhitenedPower, FooofFrequencies] = whiten_spectrum(Power, Frequencies, FooofFittingRange) % uses FOOOF FooofModel = fooof(Frequencies, Power, FooofFittingRange, struct(), true); FooofFrequencies = FooofModel.freqs; WhitenedPower = 10.^(FooofModel.power_spectrum-FooofModel.ap_fit)-1;
4d6ab8087bb6bb17be9806fce0b51f9e8cd4af6596664a1876484a3ff6fddfcd
MATLAB
295
4
function [peaks, peak_indexes] = PeakDetection6(x,ff,th,varargin) % PeakDetection6 has been deprecated. Use peak_det_amp_threshold instead. warning('PeakDetection6 has been deprecated. Use peak_det_amp_threshold instead.'); [peaks, peak_indexes] = peak_det_amp_threshold(x, ff, th, varargin{:});
70a07ad103f6dc9cfb599643c72dfe9be8a4d49a0ffd375af587bba2bf0abf07
MATLAB
295
4
function ratios = RelativeSpectralPower(x, fs, freqs, Q_factor) % RelativeSpectralPower has been deprecated. Use relative_spectral_power instead. warning('RelativeSpectralPower has been deprecated. Use relative_spectral_power instead.'); ratios = relative_spectral_power(x, fs, freqs, Q_factor);
fcd12fb402bf4c780c256a38ee02809cbe6f8d0b6892132513db44c173eea4c3
MATLAB
295
4
function baseline = BaselineEstimator(x_raw, baseline_removal_method, params) % BaselineEstimator has been deprecated. Use baseline_filter instead. warning('BaselineEstimator has been deprecated. Use baseline_filter instead.'); baseline = baseline_filter(x_raw, baseline_removal_method, params);
14df62ba493143af96810b313821d5a4b902781b8e9862973f34fbe0980d2150
MATLAB
296
13
function outstr = c_str(instr) % eja function to read C-style null-terminated strings % (strips everything past the first null) if (isempty(instr)) outstr = ''; else if (instr(1) == char(0)) outstr = ''; else outstr = strtok(instr, char(0)); end end
30a5a81af363ff16728ff35a190c25b0120b2b8d2458cdc42545c99fd1e6a689
MATLAB
296
4
function [index, rank, yy] = ChannelIndex7(x, w, th, varargin) % ChannelIndex7 has been deprecated. Use sqi_power_level_crossing instead. warning('ChannelIndex7 has been deprecated. Use sqi_power_level_crossing instead.'); [index, rank, yy] = sqi_power_level_crossing(x, w, th, varargin{:});
98840732959e2726ddda6a1611d15fe36fc490e25ff63712c6288f86d8ce1931
MATLAB
296
11
function varargout = tryGather(varargin) %TRYGATHER Try to gather gpuArrays for i = 1:nargin if isa(varargin{i}, 'gpuArray') varargout{i} = gather(varargin{i}); varargin{i} = []; else varargout{i} = varargin{i}; end end end
4cdc2e4d382551b7df0c3dddce6ed5c8a305c8a7877b8b54aab83594201df86c
MATLAB
297
12
function [ts_ecg_out, ts_bp_out, idx_bp_out] = realign_bp_ecg(ts_ecg_in, ts_bp_in, idx_bp_in) ts_ecg = unique(ts_ecg_in); ts_bp = unique(ts_bp_in); idx_bp = unique(idx_bp_in); tmp = find (diff(ts_bp)< 0.5 ); ts_bp(tmp) = []; idx_bp(tmp) = []; tmp = find(diff(ts_ecg) < 0.5); ts_ecg(tmp) = [];
757a4b198929a6108dd3d7b80d18bc1dd5b1f847324b28ddd20cdee1d1cee4d0
MATLAB
297
4
function [V, d, delta, similarity, epsilon] = LaplacianEigenmap(C, kappa) % LaplacianEigenmap has been deprecated. Use laplacian_eigenmap instead. warning('LaplacianEigenmap has been deprecated. Use laplacian_eigenmap instead.'); [V, d, delta, similarity, epsilon] = laplacian_eigenmap(C, kappa);
b3bb37617c89c959b70da632dee94dd747dfed5c78c4013c6135c1a667e368a2
MATLAB
297
14
function [B, mu] = matrix_centering(A) % Take a matrix A and return a centered version. % % Parameters: % A: matrix % A matrix of size (M x N) assert(ismatrix(A), 'A has to be a matrix of size (M X N)') assert(isreal(A), 'Please check A') mu = mean(A, 1); B = bsxfun(@minus, A, mu); end
0449c1d783a94db520f04123a19da56f1d6b958bd9294694d0e0fc00a4677724
MATLAB
298
10
function c = correct_water_content_mean(c) for npool=1:length(c) c(npool).fgray = ones(1,length(c(npool).fgray)) .* mean(c(npool).fgray); c(npool).fwhite = ones(1,length(c(npool).fwhite)) .* mean(c(npool).fwhite); c(npool).fcsf = ones(1,length(c(npool).fcsf)) .* mean(c(npool).fcsf); end
9b17c3673cb1a001231f6c5fae6e7a45ff69f8bb657890fffdf98c23657f95d8
MATLAB
298
9
%% Serotonin synthesis inhibition from 5-HT1B autoreceptors. % depends on levels of serotonin-activated g-protein (b) % and the equilibrium value of the activated G-protein (c). % UNITS IN ratio. function a = inhibsyn5HTto5HT(b, c) min_a = 0; a = 1 - (0.1).*(b - c); a(a<min_a) = min_a; end
f37e7aebd79ac426967b954823a9120e9d6746e64867f350754fb0a4fe56d4d3
MATLAB
299
9
function deleteAnnotated(obj) %DELETEANNOTATED Delete clusters which are annotated to_delete deleteMe = find(strcmp(obj.hClust.clusterNotes, 'to_delete')); if ~isempty(deleteMe) obj.deleteClusters(deleteMe); else jrclust.utils.qMsgBox('No units deleted'); end end
7e9d6b47cad77bc8b6c191c6b5483ee04e4d447915e6bbbf7406afd2f4fab383
MATLAB
300
4
function [ECG, teta] = SingleChannelECGGenerator(teta, teta0, alphai, bi, tetai) % SingleChannelECGGenerator has been deprecated. Use ecg_gen_gmm instead. warning('SingleChannelECGGenerator has been deprecated. Use ecg_gen_gmm instead.'); [ECG, teta] = ecg_gen_gmm(teta, teta0, alphai, bi, tetai);
0946bcfcdfae36104302814c4f10bb3badd72297d6376ae8c2c281df04157c60
MATLAB
301
13
function sigma = XxGuassianFitting2D(psf) addpath(genpath('../')); [~, Nx] = size(psf); x = double(1:Nx); [~, I] = max(sum(psf,2)); psf_y = XxNorm(psf(I,:),0,100); fun_gs = fittype('A*exp(-(x-mu)^2/(2*sigma^2))'); [cf_y, ~] = fit(x(:),psf_y(:),fun_gs,'Start',[1, Nx/2, 3]); sigma = cf_y.sigma; end
3ab5f091b7884fdc623d9f0637125a28cbbd82395053ffa44f62c1bbb0a91332
MATLAB
301
6
% Visual/Manual Proesssing Controler: (-+) & (--) mf=msgbox({'For Visual Inspection of Detected Ca++ Transients';'Type: ';... '>>Detected_Visual_Inspection';' ';'And for Undetected Ca++ Transients';... '>>Undetected_Visual_Inspection'}); VisualInspector=[false,false]; waitfor(mf); delete(mf);
5da415d77bb61af22bc9f43c7a4ec39d83f5365c378d1b62c7044b448ea70cdc
MATLAB
301
10
%% Histamine H3 inhibition of serotonin release. %autoreceptors and depends on levels of g-coupled proteins activated (b) by %histamine and basal levels of g-coupled histamine (c). %UNITS IN ratio. function a = inhibRHAto5HT(b, c) min_a = 0; %b = gha* a = 1 - (3).*(b - c); a(a<min_a) = min_a; end
70ee9319048e4a4d9fffae083df84039238ed4e1330f1f340c6b6f2ce772402d
MATLAB
301
23
function fo = sum_fid_local2(fids,nz) fo=fids; for nbser = 1:length(fids) fid = fids(nbser).fid; num_fid = size(fid,2); for kf = 1:nz:num_fid fidn(:,(kf-1)/nz + 1) = sum(fid(:,kf:(kf+nz-1)),2) ./ nz; end fo(nbser).fid = fidn; clear fidn; % fo{nbser}.Nex = fidn; end
4fd67ed635b951090c4d6e4e66d8f28aced34701e9132a6117ad7401c7908b82
MATLAB
302
4
function [DIP, teta] = DipoleGenerator2(N, fs, f, alphai, bi, tetai, teta0) % DipoleGenerator2 has been deprecated. Use vcg_gen_direct_sum instead. warning('DipoleGenerator2 has been deprecated. Use vcg_gen_direct_sum instead.'); [DIP, teta] = vcg_gen_direct_sum(N, fs, f, alphai, bi, tetai, teta0);
6cf2ebdd4abf6ef78f363fbd3a7b6d6712fb1f40ec68124a99aa05f483d86ea1
MATLAB
302
4
function [DIP, teta] = DipoleGenerator(N, fs, f, alphai, bi, tetai, teta0) % DipoleGenerator has been deprecated. Use vcg_gen_state_space instead. warning('DipoleGenerator has been deprecated. Use vcg_gen_state_space instead.'); [DIP, teta] = vcg_gen_state_space(N, fs, f, alphai, bi, tetai, teta0);
743681104da35add02843765b5862adf0eb41abf302eed83babe1e6ac33ec4d8
MATLAB
302
4
function noise = NoiseGenerator(noisetype, SignalPower, SNR, N, varargin) % NoiseGenerator has been deprecated. Use biosignal_noise_gen instead. warning('NoiseGenerator has been deprecated. Use biosignal_noise_gen instead.'); noise = biosignal_noise_gen(noisetype, SignalPower, SNR, N, varargin{:});
de6c63ed3ea19b4de79dfa544be6c5ef3959be03563b07d5363d922a6872b3a2
MATLAB
302
14
function update_cluster_popup(app) %UNTITLED Summary of this function goes here % Detailed explanation goes here str_cell = {[]}; for i = 1: max(app.spike_res.cluster) str_cell{i} = num2str(i); end app.popup_cluster.Items = str_cell; app.popup_cluster.Value = app.popup_cluster.Items{1}; end
e5df61acaed425451c8cc3022bc84d44497d90daa3cfc6faa734db39c670de3d
MATLAB
302
13
function unpackStruct (structure) fn = fieldnames(structure); for i = 1:numel(fn) fni = string(fn(i)); field = structure.(fni); if (isstruct(field)) unpackStruct(field); continue; end assignin('base', fni, field); end end
8766fab1c7496b023a7a809d58987303cb0cd5c5c4ba6501cbb716d4715d7abe
MATLAB
303
17
function [y] = inv_phi(x, param) % Inverse of scaled/biased logarithmic sigmoid: b - log((a / x) - 1) % % Parameters % ---------- % - x: array % Input % - param: [scalar, scalar] % Scale and bias parameters % % Returns % ------- % - y: array % Output y = param(2) - log((param(1) ./ x) - 1); end
cf68eda669f2b36d617a2b381e027c7d352f0028c0e978b1857a4deacd2d0656
MATLAB
304
13
function IntervalSpike clear all global StartTime FinishTime cd C:\Users\B133_2\Desktop\2601_170620 load 2601_170620 StartTime FinishTime dpath='C:\Users\B133_2\Desktop\CheetahData\2017-6-20_21-17-32 2601-11' cd(dpath); SpikeArray=GetSpikeAll(dpath,'Sc7_SS_01.t'); SpikeArray RpegTouchall