sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3416e5e4244f28a6cdc315eee652b63b903180bfbb68465b7465c44279c4f31b
MATLAB
433
23
%{ aodpre.ExtractSpikes (computed) # my newest table -> aodpre.ComputeTraces -> pre.SpikeInference ----- # add additional attributes %} classdef ExtractSpikes < dj.Relvar & dj.AutoPopulate properties popRel = aodpre.ComputeTraces * pre.SpikeInference & 'language="matlab"' end methods(Access=protected) funct...
6ee5fc54f3904fa58d81092bb91d99377327f6eec9b2cff6f681eef63fc24a42
MATLAB
433
19
%{ preprocess.ComputeTracesTrace (computed) # final calcium trace but before spike extraction or filtering -> preprocess.ComputeTraces -> preprocess.ExtractRawTrace --- trace=null : longblob # leave null same as ExtractRaw.Trace %} classdef ComputeTracesTrace < dj.Relvar methods...
d5bf8b62619aae9b563d597339779ce0af94a61bbd23667753e41e993d0cc5b3
MATLAB
434
12
% This is a test script for the cvdproc MATLAB pipeline. % This script will copy a test image to the output floder and smooth it. input_image = 'placeholder/for/nipype/input_image' output_dir = 'placeholder/for/nipype/output_dir' if ~exist(output_dir, 'dir') mkdir(output_dir); end output_image = fullfile(output_d...
2c53524a3c3a47f6561a463945a57c89a9e5e7a53b2d456746bd931d77fc63bc
MATLAB
435
13
%{ # population statistics parameters opt_idx : smallint # --- rsz=10 : smallint # movie resizing factor algorithm=null : enum('opticalFlowFarneback','opticalFlowLK') # params=null : varchar(255) ...
51c742b7b7cc081a5b578d847c87a6e826da11c3ed40027644b1386c7b1d9ebb
MATLAB
436
8
%% This file specifies the Checkpoint of xQSM % Specify the directory of the xQSM code from Github deepMRI_HOME = '/home/common/matlab/sepia/external/deepMRI/'; % If you have your own trained network, specify the file that contains the trained parameters % otherwise, uses the one provided with the tool checkpoints ...
b4b47b1a3d18512a68b63ce2782e81fee078ce4e02b434f5b18c95120d5556ed
MATLAB
436
19
function neurons = eventLockRADICaL(neurons, R, tPts, tPtsRADICaL, field) % Only works for the original locking RADICaL was run on: liftTimeDLC if nargin < 4 field = 'radical_rates'; end % tPtsRADICaL = -200:10:790; % From the paper tBins2Use = ismember(tPtsRADICaL, tPts); % Format neural for tr = 1:length(neuro...
c95aad74eedc7d5cdade96373d54fd914889d9c23818043d210b9d4d278b0869
MATLAB
436
20
%{ tuning.DirectionalResponseTrial (computed) # the response for each trial and each trace -> tuning.DirectionalResponse -> preprocess.SpikesRateTrace -> tuning.DirectionalTrial --- response : float # integrated response %} classdef DirectionalResponseTrial < dj.Relvar meth...
dc76cd5ac6d131f72dfbcb09f1a5a0a7d4a9a88f11ee5f3722f2c8a43dffa350
MATLAB
436
20
%{ # table for fixing faulty calculation in preprocess.PrepareGalvo -> preprocess.PrepareGalvo --- um_width : float # width in microns um_height : float # height in microns %} classdef FixZoom < dj.Computed methods(Access=protected...
172918308e80d0069d888fed2eb7abcaacc99cc3797d0792f70a696802281faf
MATLAB
437
18
M = spherefactory(5, 10); x = M.rand(); v = M.randvec(x); t = .1; y = M.retr(x, v, t); u1 = M.randvec(x); u2 = M.randvec(x); Tu1 = M.transp(x, y, u1); Tu2 = M.transp(x, y, u2); fprintf('Probably not zero: %g\n', (M.inner(x, u1, u2) - M.inner(y, Tu1, Tu2))/M.inner(x, u1, u2)); Tu1 = M.isotransp(x, y, u1); Tu2 = M.i...
7e592763fe183fdd3b953b1041404ab2574c972fdaf8b7954a99baf95cd5e2de
MATLAB
437
32
function [njm] = tapas_zeromat(jm) %% Zeros all but the first entry in each column of jm. % % Input % jm -- Matrix. % % Output % njm -- Matrix. % % aponteeduardo@gmail.com % copyright (C) 2015 % njm = zeros(size(jm)); j = 0; i = 0; while j < size(jm, 2) j = j + 1; i = 0; while i < size(jm, ...
a0055b41f9916b3e5e521615e03eca658330ce81f8a1f5188036012e91dbc1bd
MATLAB
437
17
function a=imdilate_special(a) ind=find(abs(a)); ind_other=[1:prod(size(a))]; ind_other=setdiff(ind_other,ind)'; [x,y,z]=ind2sub(size(a),ind); [xx,yy,zz]=ind2sub(size(a),ind_other); for i=1:length(ind_other) tmp=sqrt(sum((repmat([xx(i),yy(i),zz(i)],length(x),1)-[x,y,z]).^2,2)); ind_min=find...
481ea06aa9a563407b2925030a51a58461ee2b4858601f9aa552b8b38154e0e2
MATLAB
438
10
%% really quick and dirty to get screenshots of the gradunwarp bet DATECENSORED_125001T1wMPRs022a1001.nii.gz test.nii.gz -m fslmaths test_mask.nii.gz -kernel box 9 -dilM test_mask_dil.nii.gz res is from itksnap quick and dirty fslmaths DATECENSORED_125001T1wMPRs022a1001.nii.gz -mas res.nii.gz out1_masked.nii.gz -od...
496b0c635b3687ed6a7a022afae4671d291c217e800984f128a332d6627013b7
MATLAB
438
18
function spikeMatrix = spikeTimesToSpikeMatrix(spikeTimes, duration, fs) start_time = 0; end_time = duration; bin_edges = start_time:1/fs:end_time; numUnits = length(spikeTimes); num_bins = length(bin_edges) - 1; spikeMatrix = zeros(num_bins, numUnits); for unit = 1:numUnits channel_spike_times = spikeTimes{unit...
8bcbc27450877f84f0bd17d082353f6548545466e14fcf79386e8723dcb00d0c
MATLAB
438
10
classdef FakeApp < handle % Headless stand-in for the MEA-NAP GUI app object, used only by % MEApipeline_parity.m so the pipeline's guiMode==1 status-text lines % have somewhere to write when running under `matlab -batch`. % Purely a sink for status strings — touches no analysis parameter. propertie...
bd400ca27946e0001a13b6fc991f3c53b66f4ca42bde5141bcbbf35a25d499aa
MATLAB
438
17
function [M] = cell2mat3d(C) % converts a cell with nbx1 or 1xnb same-sized matrices into a 3d matrix by % stacking the cell entries upon each other along the 3rd dimension. assert(iscell(C), "error: input must be a cell array.") assert(min(size(C))==1, "error: input must be a row or column cell array.") nb = ...
1bb25cb3fffb3230c87334a4c4ed6d15f7a59ab3d62065a4252dc5d628a1ab39
MATLAB
439
13
function tf = isfield(this,field) % Isfield method for GIfTI objects % FORMAT tf = isfield(this,field) % this - GIfTI object % field - string of cell array % tf - logical array %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimagi...
5524971f34b7113640526271711c45fca190b8267112050e3143c8a24ef3e162
MATLAB
439
20
// // MetalCompatibility.m // wxVulkanTex // // Created by takashi kawase on 5/9/19. // #import <Cocoa/Cocoa.h> #import <QuartzCore/CAMetalLayer.h> void makeViewMetalCompatible(void* handle) { NSView* view = (NSView*)handle; assert([view isKindOfClass:[NSView class]]); if (![view.layer isKindOfClas...
7252ac115b288c8493034f7f9f10e30b3324e0294c8e5b4488bda026ab25c9cd
MATLAB
439
16
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Requires: https://github.com/anders-s-olsen/psilocybin_dynamic_FC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; clc; ROI_sig = readmatrix('time_series.txt'); ROI_sig = ROI_sig(:,1:5); allpair = 0; parallel = 0; tic [ H...
9b32f96c2ae99f180c786d43d1db03f9752369daa9b0761a084c14e05ff9d2c8
MATLAB
439
21
%{ # spatiotemporal receptive field map -> tuning.RF -> preprocess.SpikesRateTrace --- scale : float # receptive field scale map : longblob # int8 data map scaled by scale %} classdef RFMap < dj.Computed methods(Access=protec...
d0f03ceca01dac56367e2853230d64503a60ad3b64e5d1188c5fd6f14b12cbc1
MATLAB
439
26
% PLAN B rho = 1055; Q0 = 15*1e-6; A1 = 1.98857e-6; A2 = 1.85632e-5; d1 = sqrt(4*A1/pi); d2 = sqrt(4*A2/pi); Q = (0:.1:20)*1e-6; dpv = 8*rho*Q.^2/pi^2*(1/d1^2 - 1/d2^2)^2; R = 16*rho/pi^2*(1./d1.^2 - 1./d2.^2)^2*Q0; R2 = 8*rho/pi^2*(1./d1.^2 - 1./d2.^2)^2; dp0 = 8*rho*Q0^2/pi^2*(1/d1^2 - 1/d2^2)^2; Q_lin = (5:.1:...
9207d5222027f6c03d0213e8b57643d8890272a32484df77afe32d78c4326e40
MATLAB
440
8
% Please cite this paper if you use any component of this software: % D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017. % Re...
6e27d857eaf5ee4237b21f4cb829c17b45b3991da019aef6cfd1a5dcf68641ef
MATLAB
441
33
function [njm] = tapas_ti_zeromat(jm) %% Zeros all but the first entry in each column of jm. % % Input % jm -- Matrix. % % Output % njm -- Matrix. % % aponteeduardo@gmail.com % copyright (C) 2015 % njm = zeros(size(jm)); j = 0; i = 0; while j < size(jm, 2) j = j + 1; i = 0; while i < size(j...
e55518fff6a3c3ba3837710ef4b5999d88edeff060b795c6b4e73e845082a3bd
MATLAB
441
10
% we used this to determine where invalid data might be in the NSD dataset (so that we can report it). % edit as necessary cd ~/Dropbox/nsddata/ppdata/subj08/func1mm/ % look at all itksnap -g T1_to_func1mm.nii.gz -o valid.nii.gz valid_nsdimagery.nii.gz valid_nsdsynthetic.nii.gz valid_prffloc.nii.gz mean.nii.gz brainm...
f8e893e047edd9ec1bcf3aabae5c6a09a60c3ed3fa74f032b5a6470ecc68e6df
MATLAB
441
24
%Creado por Luisca Mayo09. %SRactive() genera una matriz nXm donde %n:Número de células activas; %m:número de picos function [SR_active]=SRactive(A) %S_Rasterbin=Rb*Si; %Células totalesXnúmero de picos % Rasterbin y S_index tienen que tener 1 frame de resolución. N=size(A,1); %Número de células totales j=1; for...
f98551923990a7113345dfdc2bac7735213be1cb524e668777667e0158f1b513
MATLAB
441
10
function g = compute_gratio(D) % Ikeda M, Oka Y. Brain Behav, 2012. "The relationship between nerve conduction velocity and fiber morphology during peripheral nerve regeneration." % g = 0.220 .* log10(2*D) + 0.508; % g = 0.7 * ones(size(D)); % constant g-ratio g = 0.6 + 0.1 * rand(size(D)); % random g-ratio betwe...
5f944a89ef6e55a949c6746e4941b4e123c50088e5cf4fe96251a62b91a2a0bd
MATLAB
442
26
for i=1:20 i n1=num2str(900+i); file=strcat('fort.',n1); x=load(file); Fs=100000; inh=x(:,1)-mean(x(:,1)); amp=x(:,2)-mean(x(:,2)); nmd=x(:,3)-mean(x(:,3)); an=(amp+nmd)/2; w=400; ov=90; [lags,mcorre]=ccorrelation(inh,an,Fs,w,ov); lags=lags/100; cc(i,:)=mcorre; ...
7289ac84c49eb41ca8d428d754343b3c73cd9cc4b8014c822199a030cd98dde0
MATLAB
442
22
function [vec] = sqmat2vec(mat, format) %vectorizes square matrix % INPUT: % format (str) = which part of matrix shall be vectorized (e.g. triu, tril, full) if nargin ==1 format = triu; end switch format case 'triu' mask = triu(true(size(mat)),1); vec = mat(mask); case 'tril' ...
c4955f472c6855ee5a6b08ebc50122813aaa00870bd2190d416eef8a7f267dcf
MATLAB
442
25
function [u,s,v]=ss_svds(x,n); if size(x,1) < size(x,2) if n < size(x,1) [u,d] = eigs(x*x',n); else [u,d] = eig(x*x'); u=fliplr(u); d=flipud(fliplr(d)); end s = sqrt(abs(d)); v = x' * (u * diag((1./diag(s)))); else if n < size(x,2) [v,d] = eigs(x'*x,n); else [v,d] =...
c693ecd808d8024d109b17b3bad0dc6986bcbdab5b3374d6d2c7c1ee7f1b193d
MATLAB
444
21
function [tensor_idx, mdl_idx] = findZeroNF(model, IDmap) %finds cells with a neuron factor of 0 %INPUTS: % model = ktensor, this is already sorted within components % IDmap = provides a mapping of the neurons in the model %OUTPUTS: % tensor_idx = index of the cells with 0 nf in the tensor as constructed % ...
6587e46fa2ddfb8b4983a6c49e7f16858c06f736d8c928430a45d2f2e52a9a70
MATLAB
445
26
function r = mrdivide(p,q) %RDIVIDE this function divides the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if isa(p, 'FaceVariable') && (~isa(q, 'FaceV...
ce763649b5c023be1db0b3056cd39f966bf5e7ff73d27341d197cb8b815ce8a5
MATLAB
445
26
function r = mrdivide(p,q) %RDIVIDE this function divides the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if isa(p, 'CellVariable') && (~isa(q, 'CellV...
0bfd295651e35949a40a686d70128dcd62457e768715727d11b93a85c9f67b9f
MATLAB
446
17
function x = un_pca(y,vecs,mu) % %function x = un_pca(y,vecs,mu) % % Undo Principal Component Analysis transform % % inputs: % y - input data n_dim x n_samples % vecs - pca vectors n_dim x n_dim_orig (or n_dim_orig x n_dim_orig) % mu - mean of original space data n_dim_orig x 1 % % outputs: % x - y transformed back...
270d2694a34b6e3853b16f9ffbcfd0922b9f8271e778d3935501bb628e528864
MATLAB
446
15
%% BehaviorScripts %% Test whether an animal shows more avoid behavior at the end of the session % use with batch to accumulate behavior data numTrials = zeros(40,1); for session = 1 : 40 numTrials(session) = numel(output{session}); end escapeGraph = zeros(40, max(numTrials)); for session = 1 : 40 escapeGrap...
1ac0c76b8d37e3e8cab2b95eac1388fd7bc533dd21e79a863753611770ec7ba7
MATLAB
447
16
% Expects hh and cc to be defined. % Creates <somedata> in the workspace. % h5read parameters arg1 = [(cc-1)*numinchunk+1 1]; if cc==ceil(datasizes(hh,1)/numinchunk) arg2 = [datasizes(hh,1)-(cc-1)*numinchunk Inf]; else arg2 = [numinchunk Inf]; end % load the data tic; somedata = h5read(sprintf('~/ext/figurefiles/...
8fa2aae1b32caedc084355455f05759531a9b2523cb95986126c893ab7a1c7e6
MATLAB
447
16
function epochs = findContPatches(dataInds) % localizes beginnings and ends of continouus patches in vector of data indices % (c) Jiri, Oct16 % include discrete edges dataInds = dataInds(:); % column vector d = cat(1, -666, dataInds, max(dataInds)+10); % determine jumps in data index continuity i_jump = find(dif...
d9c2dae2fbf37c443f5d54a45a8113c6f736e0f2c2daa092d3d2e5c6c7b1313b
MATLAB
447
14
%{ vis.Trial (manual) # visual stimulus trial -> vis.Session trial_idx : int # trial index within sessions --- -> vis.Condition flip_times : mediumblob # (s) row array of flip times last_flip_count : int unsigned # the last flip n...
3ae8eb5919ebd08b73ed05c618293ba85212c7382842267b5c047e834b4b92cd
MATLAB
448
21
%% set_non_nan_value(h,field,val) % % Input % -------------- % h : structure contains all SEPIA handles % field : handle field to be changed % val : new value % % Description: only set the parameter when it is valid % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 6 March ...
5d838d21840e8feb79c79a67117d71d48fcba9343d6db0dc2ed4017a3f5e5cde
MATLAB
448
12
function epochWindowSizePopup_Callback(hObject, eventdata, handles) dropdown_items = cellstr(get(hObject,'String')); page_seconds = regexp(dropdown_items{get(hObject,'Value')},'([\d*.])*','match'); page_seconds = str2double(page_seconds{1}); handles.data.settings.pageSize = page_seconds; handles.data.saveSettings(); ...
397a1004cc1bb9bee734bf503e139ae575050ac713e95ebc904dc8309d9761d9
MATLAB
449
40
go to analysis_drawrois_prf_part02.m for subj03: do manual: angle (4), q (with white edges) ecc (5), o, (with white edges) and only curvature version. do two clicks for fatter edges. ============= go to analysis_drawroi_faces.m for subj03: same deal. and with only curvature. ============ "anat/" t1 0.8 ....
98620c0872a18d6f06161d6c87514abe80ca812d92898768d096f5f700c65df4
MATLAB
449
14
function plot_time_amp(rez,i) Spike_id = find(rez.st(:,end)==i); f=figure; channel = rez.Merge_cluster{i,5}; Nchan = length(channel); for k=1:Nchan subplot(Nchan,1,k) plot(rez.st(Spike_id,2),rez.best_channel_M(Spike_id,channel(k)),'.') xlabel('Time in ms') y...
24df19dd5b4bcf876bda0f4d680fdeedc7456c8c43a0c8a760de57bdd16b7796
MATLAB
450
30
clear; rho = 1055; Q0 = 15*1e-6; d1 = 0.00204; d2 = 0.00382; Q = (0:.1:20)*1e-6; A1 = d1*d1*pi/4; A2 = d2*d2*pi/4; v1 = Q/A1; v2 = Q/A2; dpv = 8*rho*Q.^2/pi^2*(1/d1^2 - 1/d2^2)^2; R = 16*rho/pi^2*(1./d1.^2 - 1./d2.^2)^2*Q0; R2 = 8*rho/pi^2*(1./d1.^2 - 1./d2.^2)^2; dp0 = 8*rho*Q0^2/pi^2*(1/d1^2 - 1/d2^2)^2; Q_lin ...
3b35e7476e3196ed21617af8dd76d4266c94daff30bc4accbbf2283532aa5d8b
MATLAB
450
15
function output = loadTargetPartialClassifier(dataPath, mouse, session) % Wrapper around targetPartialClassifier % Load preprocessed data % This data is already subsampled to the best 100 neurons and the desired % time points load(sprintf('%s%s_%s_cueLocked', dataPath, mouse, session), 'kinematics', 'neurons', 'M') % ...
46639e7a01ae9765805e0a1867b206ccc9a29be8fe2eb0b9482a2f13b5703090
MATLAB
450
10
function add_path_STIsuitev3(STISuite_dir) addpath([STISuite_dir filesep 'Core_Functions_P']); addpath([STISuite_dir filesep 'GUI_Functions_P']); addpath([STISuite_dir filesep 'Support_Functions']); addpath(genpath([STISuite_dir filesep 'Support_Functions' filesep 'qsm_kiwi_1'])); addpath(genpath([STISuite_dir filesep...
90796032370f5bc219302e3058ac857b912c3ac34cef8604fdeef5995876f64a
MATLAB
450
13
function startTime = fetchTime(obj) assert( length(obj)==1 ); [path,name] = fetch1( Experiments*obj, 'directory','file_name' ); files = dir(getLocalPath([path '/' name '_ts*'])); if isempty(files) timestamp = GetFileTime(getLocalPath([path '/' name 'p0.h5'])); save([path '/' name '_ts'],'timestamp'); st...
5c6ec469a8c002b77a8cb67d768deaceaaa690770984dfa43a809aab2f47c3d8
MATLAB
451
20
function M = perform_blurring(M, sigma, options) % perform_blurring - gaussian blurs an image % % M = perform_blurring(M, sigma, options); % % M is the original data % sigma is the width of blurs (in pixels) % % Copyright (c) 2007 Gabriel Peyre options.null = 0; n = size(M,1); eta = 4; p = round((sigma*eta)/...
5fa8701e12e2eb40c2a842889b48266739cefcc9adfbfb368cc4634a478371b4
MATLAB
451
17
xyz = randn(3,12); figure hold on %plot dot cloud plot3(xyz(1,:),xyz(2,:),xyz(3,:),'ko') %plot projections projection_constant = -5; %projection onto X plot3(xyz(1,:)*0+projection_constant,xyz(2,:),xyz(3,:),'bo') %projection onto Y plot3(xyz(1,:),xyz(2,:)*0+projection_constant,xyz(3,:),'go') %projection onto Z plot3(...
7a5dbaac6669f067c546256ae829b2e56ce411f25ca2f3a5b9ff48b9eb32c5a7
MATLAB
452
14
function [spectogram_y_lims, s, f] = cutSpectogramFrequency(s,f, handles) upper_freq = find(f>=handles.data.settings.HighFreq*1000,1); if isempty(upper_freq) upper_freq = length(f); end lower_freq = find(f>=handles.data.settings.LowFreq*1000,1); % Extract the region within the frequency ra...
c8e54e6578b49ab3c1cba67cdde290c8583a92a68cbdd8dd7148749e92a22269
MATLAB
452
21
%{ # Each pixel shows the (average) temporal correlation between that pixel and its four neighbors -> preprocess.ExtractRaw -> preprocess.Channel -> preprocess.Slice --- correlation_image : longblob # correlation image %} classdef ExtractRawGalvoCorrelationImage < dj.Imported methods(...
a9f48e56e798d2048e562be6a7119257f9e282999527748165cf8ceea9eb9817
MATLAB
453
11
function [NetMetMinMax] = findMinMaxAllNetMetStruct(NetMetAllDat) % find min and max for NetMet values and edges (adjM % values) across the batch dataset NetMetPlots = {'ND','MEW','NS','Eloc','BC','PC','Z'}; for i = 1:length(NetMetPlots) NetMetMinMax.(sprintf(NetMetPlots{i})) = [min(NetMetAllDat.(sprintf(NetMetP...
df17381864c9f27b52672c4abac62a9bb41fd1a05e92ef7ea59d960d0a61941f
MATLAB
453
12
function focusWindowSizePopup_Callback(hObject, eventdata, handles) dropdown_items = cellstr(get(hObject,'String')); focus_seconds = regexp(dropdown_items{get(hObject,'Value')},'([\d*.])*','match'); focus_seconds = str2double(focus_seconds{1}); handles.data.settings.focus_window_size = focus_seconds; handles.data.saveS...
3de1e87139bc304e31fa98674d75b98b4e75667552a3e45dabf77cb6ba76e072
MATLAB
454
17
function [loss] = computeLoss(o, utest) % Computes loss and t*. % get number of input variables D and input length T T = size(utest, 2); % compute absolute deviation at each time step scaled by std loss = abs((o-utest))./std(utest, 0, 2); % scale by time exponentially to account for inevitable error increas...
4f39c7f1976195985b517f26f0e363ead4e1b427da9ab0f1da5feac60896c8e9
MATLAB
454
11
% Compute y = log( sum(exp(x),2) ), the softmax in a numerically safe way by % subtracting the row maximum to avoid cancelation after taking the exp % the sum is done along the rows. % % Copyright (c) by Hannes Nickisch, 2013-10-16. function [y,x] = logsumexp2(logx) N = size(logx,2); max_logx = max(logx,[],2); %...
2098d219dea390983a7c7b80d5f1490f7c900d3c0c27e9e5ebfda3378ee6c071
MATLAB
455
16
=============== sessionwise √ PNG "one png from each session", 8x40. copy folders from NSD134-glmdataLOW-glmBASIC rename to subj01 rm subj*/orth* rm subj*/psc* rm subj*/varexpcumUP.png rm subj*/varexporthMID*.png rm subj*/pairwise.png meanvol00.png -> mean_session00.png grandmean.png -> mean.png grandvalid.png -> val...
f33ba4e4ac238e59ea6ac9d5fdf9fe1260e0cbda21535af715f5a6d5b1013785
MATLAB
455
23
function [v] = tapas_mc3_arc(ollh, olpp, T, mc3it) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % v = 1:numel(ollh); nc = size(ollh, 2); for l = 1:mc3it s = ceil(rand()*(nc - 1)); p = min(1, exp(ollh(s) * T(s+1) + ollh(s+1) * T(s) ... - ollh(s) * T(s) - ollh(s+1) * T(s+1))); if rand() < p ...
9c8a7e7e9589a8374a18a9f6b6aca0283565031bdbff3ecfa5e031cfcdfe6f09
MATLAB
456
18
function [SD, baseline_mean] = findsigma2(trace, eventthreshold) % recursively determine SD for the baseline period of a calcium signal % after removing elements that fall above the n sigma threshold. SD = std(trace); trace = trace-mean(trace); while true baseline = trace(trace<eventthreshold*SD); if...
094f69b353714dd9fb94fcd5c47e68b6209d13685a33868d0344670ac3af7b77
MATLAB
457
23
function [C, C_indiv] = multilevel_clustering(FC,thres_list) arguments FC double thres_list double end n = size(FC,1); FC(1:n+1:end) = nan; ML_clustering = nan(n,numel(thres_list)); C_indiv = nan(n,1); for threshold = 1:numel(thres_list) ML_clustering(:,threshold) = clustering_coef_bu_fast(F...
0b76c458ce886c3880b517511374f7f67754eb365d689ea0e166da409b295989
MATLAB
457
18
function dvh = detector_vs_human_confs(hsi,det_out,filt,halo) %function dvh = detector_vs_human_confs(hsi,det_out,filt,halo) % % Gets detector confidence for each target, put it in a matrix vs human conf and human cat % for easy comparison % % outputs: % dvh - n_targets x 3, [detector_output | human_conf | human_cat...
50fb8a839f464cd31c61193c6f73c2b1273495c4b01794b442cdec14ff56addf
MATLAB
457
18
function plot_proba(rez,i) f=figure; channel = rez.Merge_cluster{i,5}; Nchan = length(channel); h=0.01; for k=1:Nchan PDF = rez.PDF{i,k}; subplot(Nchan,1,k) N = histcounts(PDF,0:h:1); bar(0:h:1-h,N) title(['Channel:', num2str(channel(k))]);...
eb8d8a45f2eb09cb34e473111e58f7e817e65888f450d5b5e4d255f8dc029da2
MATLAB
457
21
function [sstate, si] = tapas_linear_get_stored_state(data, model, ... inference, state) %% Get the state that should be stored % % aponteeduardo@gmail.com % copyright (C) 2016 % sstate = struct('graph', {cell(4, 1)}, 'llh', {cell(4, 1)}); sstate.graph{2} = state.graph{2}.y; sstate.graph{3} = state.graph{3}.y; ...
9b62ae468188cd997bfbc3b14eda500be917ca9390549049b6b7ad000f588dd2
MATLAB
458
21
%{ # slice-specific scan information -> reso.ScanInfo -> `pipeline_shared`.`#field` --- z : float # (um) absolute depth with respect to the surface of the cortex delay_image : longblob # %} classdef ScanInfoField < dj.Imported m...
03d357d987687796daa35285e8d059293c9ff9f4ffc83da00c5ea160c7d86e92
MATLAB
459
22
function [lags,mcorre]=ccorrelation(x,y,Fs,w,ov) %w:windows (ms) %ov:overlap (%) %x:signal n %Fs=sampling frequency %Xcorr:maximum of the cross-correlation w=w/1000; nw=w*Fs; npf=1+floor((length(x)-nw)/((1-ov/100)*nw)); m=length(x(:,1)); % number of signals ji=1; jf=nw; for i=1:npf npf-i [Xcorr,lags]=xcorr(x(j...
bcf5351f048811aa28d9a2c0e21915e000b8521cde76e7894f5e43dff3f221b4
MATLAB
459
14
function X=violaPoints(X,Y,jitter) % Variable jitter according to how many points occupy each range of values. [counts,~,bins] = histcounts(Y,10); inds = find(counts~=0); counts = counts(inds); Xr = X; for jj=1:length(inds) tWidth = jitter * (1-exp(-0.1 * (counts(jj)-1))); xpoi...
efb1bf35306d3ab94af750722ad92f7348ce98e62d631c7fb0e375bec71c22d8
MATLAB
459
10
% mexGPUall. For these to complete succesfully, you need to configure the % Matlab GPU library first (see README files for platform-specific % information) mexcuda -largeArrayDims mexconv.cu % mexcuda -largeArrayDims mexTemplate.cu % If you get uninterpretable errors like "An unexpected error occurred duri...
3c7330d6af3e7afdb7340555622340c1927f07d7d3a3b40b6ea84f8fd38bb781
MATLAB
460
17
scalp_ud=get(findobj('Tag','ve_eeg'),'UserData'); if isempty(scalp_ud.data2) comp_ud=get(findobj('Tag','ve_ica'),'UserData'); comp_keep=~comp_ud.chan_marks_struct(1).flags; comp_proj=EEG.data; comp_proj(EEG.icachansind,:) = EEG.icawinv(:, find(comp_keep))*eeg_getdatact(EEG, 'component', find(comp_keep...
77e018f0cc0a9ea2cd77df93f840b1950563ebfea693510b6ece5228ab87eef7
MATLAB
460
6
function likelihood = mfunc_Likelihood(h, J, binarizedData) dataLength = size(binarizedData, 2); %likelihood = sum(sum(binarizedData.*(0.5*J*binarizedData),2)) + sum(h' * binarizedData, 2) - 2*sum(sum(log(cosh(0.5*J*binarizedData+h*ones(1,dataLength))),2)); likelihood = sum(sum(binarizedData.*(J*binarizedData),2))...
b3eac6762ac45f9de7034d45568d10da51bd886aadc2f45bd60141de5fa61e48
MATLAB
460
9
function [y1,y2,y3] = rsa_affine_transform(x1,x2,x3,M) % function [y1,y2,y3] = affine_transform(x1,x2,x3,M) % ----------------------------------------------------------------- % Affine Transform for input stuff in any format (N-dim strcutures) % ----------------------------------------------------------------- y1 = M(1...
d23465724baa03fe2b324cdb2e3ce8c86a56948b609c3cf0c766261f61a30a70
MATLAB
460
15
function boxOut = bbox_scale2(boxIn,scale,szOut) % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). if isempty(boxIn), boxOut = []; return; end boxOut = scale * (boxIn-1) + 1; boxOut =...
2e531eee2994c357181ea88a29f4b16fd4528444efa634dca57d2785bf4e0c91
MATLAB
461
18
function Y = multisym(X) % Returns the symmetric parts of the matrices in the 3D matrix X % % function Y = multisym(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % symmetric part of the slice X(:, :, i). % % See also: multiprod multitransp multiscale multiskew % This file is part of Manopt: ...
6dc62778b799fd1ad7287d3652598cee1b570fa0e1b63172b22bff22a1a2559e
MATLAB
461
34
function jitterExamples % % % Jitter examples % % default jitter is 0.3 % % clf % % R = randn(40,5); % % subplot(3,1,1) % notBoxPlot(R,'jitter',0.15) % % subplot(3,1,2) % notBoxPlot(R,'jitter',0.3); % The default % % subplot(3,1,3) % notBoxPlot(R,'jitter',0.6); help(['NBP.',mfilename]) clf R = randn(40,5); subp...
6fdc3975afab1f882490c3e24d944cbce10f6c1d743bb5698556c91416f6d641
MATLAB
461
31
function r = plus(p,q) % this function adds the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVariable')) r=...
feb213902902bf0657c21ab2b16de09b9e89b5c02161fbeedb029bd7108ea289
MATLAB
461
15
function [newVectors, meanValue] = remmean(vectors); %REMMEAN - remove the mean from vectors % % [newVectors, meanValue] = remmean(vectors); % % Removes the mean of row vectors. % Returns the new vectors and the mean. % % This function is needed by FASTICA and FASTICAG % @(#)$Id: remmean.m,v 1.2 2003/04/05 14:23:58 ja...
1d69bec6fd205d3a46b60407dfdb87bd5206691514cad2d93264164e37515fd8
MATLAB
462
25
function nfu = du2nfu(du, axis) % Converts data units of an axes to notmalized figure units (0 to 1). ax_layout = get(gca, 'Position'); switch axis case 'x' ax_lims = get(gca, 'XLim'); ndu = (du-ax_lims(1)) / diff(ax_lims); nfu = ax_layout(1) + ndu * ax_layout(3); case 'y' ...
b49bb53189f0edfc4078c3d3de43417b959abecb60629f9459b365c985b76f98
MATLAB
462
23
%{ monet.DriftResponseSet (computed) # my newest table -> monet.DriftTrialSet -> pre.ExtractSpikes --- %} classdef DriftResponseSet < dj.Relvar & dj.AutoPopulate properties popRel = monet.DriftTrialSet*pre.Segment*pre.ExtractSpikes & pre.Spikes end methods(Access=protected) ...
189196b941c3b87448b95f2e281df6f4bc1eabeb59984734399fdb40cf2b881e
MATLAB
463
31
function r = or(p,q) % this function compares the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVariable')) ...
478a9bcdc1f885e4485744ebea084858dcc091b24650ce461f8c402983c90e74
MATLAB
463
22
function stringOut = removeSpaces(stringIn); % % removeSpaces will remove all spaces from a string % % Cai Wingfield 1-2010 %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.* import rsa.rdm.* import r...
94ccbadcafb0593f0b7b73967177be44fdf4dfa084407ed976aa5ca3409ad190
MATLAB
463
17
function [f df] = fitt_optnu(nu, delta, p) % function to solve for ML nu estimate nu2 = nu/2; pnu2 = (p+nu)/2; w = (p + nu) ./ (delta + nu); f = -psi(nu2) + log(nu2) + (sum(log(w)-w)/length(delta)) + 1 ... + psi(pnu2) - log(pnu2); % jacobian if nargout > 1 dp = delta - p; dnu = delta + nu; sumterm =...
b1bacb9b5a81e482638ca17ddaf578178f26bb284990ff28bff64fb7df7432f0
MATLAB
463
29
function vox = ellipsoidMask(a,b,c) xP = []; yP = []; zP = []; for z = -c:c ymax = sqrt(b.^2 * (1 - z.^2 ./ c.^2)); for y = -ymax:ymax xmax = sqrt(a ^ 2 * (1 - z^2 / c^2 - y^2 / b^2)); for x = -xmax:xmax xP = [xP;x]; ...
ba647b0d5bef89b5546a3c36d4aa97f8c7fee8dabe99e3c2ed900f49e893bcae
MATLAB
463
16
function [uniq_bval_arr, dwi_img_new] = avgRepeatBvalVols(bval_arr,dwi_img) disp('Averaging multiple bval vols to increase signal') [uniq_bval_arr,IA,~] = unique(bval_arr); dwi_img_new = []; for i = 1:numel(uniq_bval_arr) if i < numel(uniq_bval_arr) dwi_avg_vol = mean(dwi_img(:,:,:,IA(i):IA(i+...
bbcf050ae54e91dd6097fb8bf784790393c9c027b315d59d488b257d6d7158af
MATLAB
463
28
function [llh] = tapas_ti_llh(y, x, u, theta, ptheta) %% General method to iterate across chains and subjects % % aponteeduardo@gmail.com % copyright (C) 2016 % fllh = ptheta.method_llh; ns = size(theta, 1); nc = size(theta, 2); llh = zeros(1, nc); for i = 1:nc tllh = zeros(ns, 1); for j = 1:ns tll...
6ecc2def0290a230f91b526cd83adc6f864ce3f3fb4030ad09ae06b5ea17b958
MATLAB
464
12
function [Q, R] = stiefelgeneralized_retraction_MGS_twice(B, X, U, t) % Retraction for generalized Stiefel based on Modified Gram-Schmidt. % More accurate but twice as slow as stiefelgeneralized_retraction_MGS. % NB, Dec. 16, 2018. if ~exist('t', 'var') || isempty(t) t = 1; end [Q1, R1] = stiefelgen...
ae7965c3cfedb0b9b169a5e5567fa601e569b41f25b4ca6ef8022dc22a50ef25
MATLAB
464
34
function out = MySmooth(x, N) % operates on first dimension only if N==1 out = x; return; end Ncol = size(x, 2); Nel = size(x, 1); if mod(N, 2)==0 N = N+1; end kern = ones(1, N); if N>1 kern(1:floor(N/2)) = 0; %causal end kern = kern./sum(kern); out = zeros(Nel, Ncol); ...
c6d6647dcb7f6d744432f185b5b442e39005173fe6a619fc749cbde2c706e4e6
MATLAB
464
18
function output = brain_region_features(data, original_data, mask) %generate cifti based spatial features according to different masks % Detailed explanation goes here mean_data=mean(data); std_data=std(data); std_outlier_data=std_outlier(data); if sum(original_data)==0 region_data_1=0; else region_data_1=s...
fc54afa7c7d080c54d778fe1eb0a47bd3265378bdb8ceef9f10cdddfe5682e40
MATLAB
464
31
function r = and(p,q) % this function compares the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVariable')) ...
fe7a370f4bbdda589b5fca84cf9fcd228df10949617b4fdb9978a81aa7d049dc
MATLAB
464
9
function [filt_onset_frames,filt_offset_frames] = filter_event_timestamps(onset_frames,offset_frames,min_interval) % merge events that are too close in time into one long event filt_onset_frames = onset_frames; filt_offset_frames = offset_frames; event_intervals = onset_frames(2:end) - offset_frames(1:end-1); merge...
1486e9531f5cd149b0765a73bb7fdbb9a5e8dfdd1a087dd749a85f08f617e725
MATLAB
465
13
function varargout = sparseinv_mex(varargin) % compile and run function loc = fileparts(mfilename('fullpath')); src = ['-outdir ',loc,' ',loc,'/sparseinv_mex.c ',loc,'/sparseinv.c']; if ~isempty(strfind(computer,'64')) fprintf ('Compiling sparseinv (64-bit)\n') ; eval(['mex -largeArrayDims ',src]) else ...
0ca00f4a4e917749be50b0353a16c80450f488eb2961ee638356bb900a9fb434
MATLAB
466
21
function [v] = tapas_mh_mc3_hier_arc(ollh, olpp, nllh, nlpp, ... ratio, T) %% Acceptance rejection criterion for metropolis hastings in the context of % population mcmc. % % aponteeduardo@gmail.com % copyright (C) 2016 % v = sum(nllh, 1) .* T + nlpp - (sum(ollh, 1) .* T + olpp) + ratio; nansv = isnan(v); v(nansv...
2c4019628536f614fb1022dbe9d49c29030f3b061804b4a28fbd4839417faac3
MATLAB
466
8
% --- Executes on selection change in popupmenuColorMap. function popupmenuColorMap_Callback(hObject, eventdata, handles) handles.data.cmapName = get(handles.popupmenuColorMap, 'String'); handles.data.cmapName = handles.data.cmapName(get(handles.popupmenuColorMap, 'Value')); handles.data.cmap = feval(handle...
8092d14215fc3fbace48ad37a14b192c8666f84d8e8f0e938db7fd5f6c254e72
MATLAB
466
12
function boxes = bbox_clip(boxes, im_size) % bbox_clip Clip boxes to image boundaries. % % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). boxes(:,1) = max(min(boxes(:,1),im_size(2)),1)...
c8331f95be7a82dac4383b21f094cde3d6928aab2c2f2085210e5524e656a807
MATLAB
466
19
% Compute the log intensity for the inverse link function g(f) = exp(f). % Output range: 0 <= g(f). % % The function can be used in GLM likelihoods such as likPoisson, likGamma, and % likInvGauss. % % Copyright (c) by Hannes Nickisch, 2016-10-04. function [lg,dlg,d2lg,d3lg] = glm_invlink_exp(f) lg = f; if nargout>...
4262cad2af4ee00aa0f76f022b9e13162a63c4af77e383ad3289abc5e8ea871d
MATLAB
467
20
function drawTrace(Ftrace,traceX, traceY,current) plot(Ftrace,[traceX' traceY']); hold on; Ftrace.NextPlot = 'add'; maxL = max([traceX(:); traceY(:)]); minL = min([traceX(:); traceY(:)]); plot(Ftrace,[current current],[minL maxL],'g'); xlabel('Frame #'); title('Traces (z-scored)'); % difference % plot(Ftrace,traceX-t...
89c427e36e1404c7a49020baf6d8c59dc7f79520eb84357e4a548ec5be1e8302
MATLAB
467
24
%{ trk.EyeFrame (computed) # eye tracking info for each frame of a movie -> rf.Eye -> trk.SVM frame : int # frame number in movie --- eye_frame_ts=CURRENT_TIMESTAMP: timestamp # automatic %} classdef EyeFrame < dj.Relvar & dj.AutoPopulate properties popRel = rf.Eye*t...
97146f72f989fe164db4590b0edf0ccbfe16b8169752074242d5807e05b1fb82
MATLAB
467
13
function [m,dm] = meanOne(hyp, x) % One mean function. The mean function does not have any parameters. % % m(x) = 1 % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2016-04-15. % % See also meanFunctions.m. if nargin<2, m = '0'; return; end % report number of hyperparameters m = ones(size(x...
27482f41ba1cfc931fb2285586f50040dcb31e0a65a1585e35ba986d7fea5df5
MATLAB
468
22
function [av, moes, bci] = bootmoes(vec) % Takes in a vector (that can be NaN-contaminated), calculates mean, moes, % and Cis by bootstrap %% For testing % clear all; close all; clc % vec=[0.455973541079959;0.607332882904319;0.504551752988633;0.590645277791557;0.541899635550893;0.482477113888613;NaN]; %% Calculate m...
36206c7e2117692928da68061a15322dacdf24c108317c2e0652124d003e5922
MATLAB
468
24
%{ # Calcium activity for a single field within a scan -> `pipeline_experiment`.`scan` -> `pipeline_shared`.`#pipeline_version` -> `pipeline_shared`.`#field` -> `pipeline_shared`.`#channel` -> `pipeline_shared`.`#segmentation_method` -> `pipeline_shared`.`#spike_method` --- -> fuse.Pipe %} classdef Activity < dj.Comp...
50000136ca6389c1bee4ca554a63f2016a753dc4abd7a84950f9dbf2ffc74ae5
MATLAB
468
33
function [llh] = tapas_linear_hier_llh(data, theta, ptheta) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % y = data.y; u = data.u; theta = theta.y; [np, nc] = size(y); llh = zeros(np, nc); ln2pi = log(2 * pi); % Precision pe = ptheta.pe; lpe = log(ptheta.pe); for j = 1:nc; for i = 1:np r = y...
638218b409e263c379b56abf6d4d11bf56df1f129703d3c26043e1c61ebfe7ff
MATLAB
468
24
function blockdiag = consensuscheck(D) % H Smith, Cambridge, 2020 % Check if matrix is binary and block diagonal % % INPUTS: % D: adjacency matrix % % OUTPUTS: % blockdiag: % = 0: matrix is not block diagonal % = 1: matrix is block diagonal v1 = sum(D,1); v1 = v1'; v2 = sum(D,2); check =...
ecdab53ba5c1195564cbebd2719524fc3ac1ba8b563630c1dbf8f71305daa63f
MATLAB
468
23
%{ tuning.DirectionalResponse (computed) # response to directional stimulus -> tuning.Directional -> preprocess.Spikes --- latency : float # latency used (ms) %} classdef DirectionalResponse < dj.Relvar & dj.AutoPopulate properties popRel = tuning.Directional*preprocess...
9b66b76fd4934abfdce578954ef6ff64eca4aa2b919505ae4a620c2632de6bf9
MATLAB
469
23
clear, clc %raw data to stack of 2D images fn_dat = 'location of raw data file'; fn_seq = 'SERO_example_sequence.seq'; fn_xps = 'location of xps file'; fn_nii = '2D_example.nii'; sero_pulseq_data2nii_adaptiveCombine(fn_dat, fn_seq, fn_nii, fn_xps) %% %2D stack to SRR new_nii = 'SRR_example.nii'; m...
f171731d24c7761851a580ac7b3f703aa03db7269ca9d1570822bdb69b268d6b
MATLAB
470
25
%clear all %close all path(path,'.\FUZZCLUST') %data set data.X = Z(:,[1 2]); %parameters param.c=ii; param.m=2; param.e=1e-3; param.ro=ones(1,param.c); param.val=3; %normalization data=clust_normalize(data,'range'); result = GKclust(data,param); result = validity(result,data,param); plot(data.X(:,1),data.X(:,2),'b....
6b6b4b0047457e64b1b9b71b9ed28eab7a3933d0cbde18442404a2adc2dc209d
MATLAB
471
17
function [] = error_patch(x, y, yerr, color, varargin) % draws a symmetric transparent area around a plotted line e.g. to % indicate std, confidence interval etc. % INPUT % x = x data of the plotted line; % y = y data of the plotted line; % yerr = error/deviation from y at each point in x; % VARARGIN % any nam...