sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0f597fd445fba5762cdf528f6139b066d0ec0815f5f240eae2209a6484d1072a
MATLAB
538
15
function [lp,dlp] = priorSameMulti(x) % Dummy hyperparameter prior distribution to have a group of hyperparameter % share the same value. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorEqualMulti. % % ...
77d09db4f71f672bc837e0953611db733d8a57da404823bebd47b1b2881bf235
MATLAB
538
14
function [lp,dlp] = priorDeltaMulti(x) % Dummy hyperparameter prior distribution to fix the value of a hyperparameter. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorClampedMulti. % % For more help on d...
dbe7ed50ccccbdb14acc9a28839cb15dc85f73b812da1f738a45f030a12e52af
MATLAB
538
27
function vrot = rodriguesRot(v, k, theta, angle_type) % rotate a vector v in R3 by theta around the axis of rotation defined by % unit vector k in R3, in degrees or radians if nargin < 4 angle_type = 'degrees'; end if strcmp(angle_type, 'degrees') cos_theta = cosd(theta); sin_theta = sind(theta); else ...
f5e3e3c256a5838faebc5923341f9e4acb8693de3ce321b7113e905cbc703b91
MATLAB
538
15
function [lp,dlp] = priorEqualMulti(x) % Dummy hyperparameter prior distribution to have a group of hyperparameter % share the same value. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorSameMulti. % % ...
fd2300ab9c728920a57e7b283d2018f4fdf4bf01eeb2553ce15858253da66514
MATLAB
538
14
function [lp,dlp] = priorClampedMulti(x) % Dummy hyperparameter prior distribution to fix the value of a hyperparameter. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorDeltaMulti. % % For more help on d...
09b17f081e47eb3c691f4566162f126edf4b149ec291b12bbd113589a96e1bdd
MATLAB
539
13
%{ experiment.TreadmillSpecs (lookup) # methods for extraction from raw data for either AOD or Galvo data -> experiment.Rig treadmill_start_date : date # first day in use on this rig --- diameter : float # treadmill diameter where mouse sits in cm counts_per_revo...
03a1c85b0a7563e7fe3f3eef59839a630384e6b98c786b63232712277ea1e88a
MATLAB
540
26
function [data] = tapas_sem_multiv_data(data, model, pars) %% Get the date from the hgf. % % Input % hgf -- Array of complete hgf models. % pars -- Parameters structure % Output % data -- Structure with the data % aponteeduardo@gmail.com % copyright (C) 2016 % data = data; ns ...
61632750d02a5a1d6488e44970f3b794131fbdadf9b92dd00cc51629d07856bd
MATLAB
540
16
function save_struct_by_level(S, levels, out_dir, suffix) % SAVE_STRUCT_BY_LEVEL Save tables from a struct by level to CSV files. % % S : struct with fields for each level (e.g., .global, .rsn_pairs) % levels : cellstr of level names to consider % out_dir: output directory % suffix : char/string appended to filen...
ae9ab47503172415aca01bc87e1a48309d6b0a5784192083eec344306c3c6d2c
MATLAB
540
25
load('fort.101') fort(:,1)=fort(:,1)/1000-2; a1=find(fort(:,2)<=200); x_ec=fort(a1,:); scatter(x_ec(:,1),x_ec(:,2),2) hold on a2=find(fort(:,2)>200 & fort(:,2)<=700); x_gc=fort(a2,:); scatter(x_gc(:,1),x_gc(:,2),2) a3=find(fort(:,2)>700 & fort(:,2)<=800); x_hil=fort(a3,:); scatter(x_hil(:,1),x_hil(:,2),2) a4=find(fo...
e896adde2a48d6f360e0c3004db12a5b8d1f6f1234d128766a9fa27325e01462
MATLAB
540
14
function whichRuns = nsd_et_lookup % ----------------------------------------------------------------------- % % Look-up: Which runs should be analyzed for each of the 8 NSD subjects % ----------------------------------------------------------------------- % whichRuns{1} = [21:44]; whichRuns{2} = [21:44]; whichRuns{4}...
5a0fdfda86b6e74398a670403a67389c7440a1d87644c982bafb1016f9f688bd
MATLAB
541
24
%28Mar14 Para encontrar el numero de rutas diferentes en un experimento. %times_secb tiene que ser un arreglo [ d_sec,times_sec ] = d_assemblies( Pks_Frame,sec_Pk_edos ); d_sec_time=cat(2,d_sec,times_secb); d_st_1=sortrows(d_sec_time); N=size(d_st_1,2); %Número de rutas j=1; for i=1:(N-1) SRRa=d_st_1(:,i); SR...
d702e7998722fdf673a807d75add1008bed473953e8e71f80b11fd95697b68ce
MATLAB
541
14
%{ # current setup parameters for each rig -> experiment.Rig --- monitor_distance : float # (cm) eye-to-monitor distance monitor_size=19 : float # (inches) size diagonal dimension monitor_aspect=1.25 : float # physica...
288b19df218ed9f0c5cea7ec8526660bc3031ec09dac7bc13c233b1f154925e7
MATLAB
542
20
function tapas_BLT_logEvent(eventName, params) % tapas_BLT_logEvent logs timing of the event specified in eventName % % Inputs: % store: data storage file % eventName: string with event name % % Outputs: % store: data storage file % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. A...
046783071984c8235fb8aca59ef60c864c92f220198f4f221228e432e22af09b
MATLAB
543
34
function Residualscombined = concatresiduals(Residuals) Residualscombined = cell(1, length(Residuals)); for sub = 1:length(Residuals) datatoconcat = []; tempresidualsepoch = []; tempresidualsepoche = cell(1, 2); for epoch= 1:2 tempresiduals = []; if epoch == 1 e = 1:4;...
a2eb21b8880b186e0976735780db1dd5337c9027e3a4253b8e1b322e56ed5df6
MATLAB
543
29
function RHS = constantSourceTerm(phi) % RHS vector for an explicit source term % k is a cell variable % % SYNOPSIS: % RHS = constantSourceTerm(k) % % PARAMETERS: % phi: Cell Variable % % RETURNS: % RHS: vector % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file d =...
a4a0b38765b2eef6415dba9e7dd805dfa573d6916b964801bf7c13e01569a6d5
MATLAB
543
21
%Creado por LC %Encuentra el porcentaje de celulas compartidas entre los diferentes %estados. function [Shared_Cells]=SharedCells(Cells_edos_active) S=size(Cells_edos_active,2); for ss=1:S for zz=(ss+1):S Sa=Cells_edos_active(:,ss); Sb=Cells_edos_active(:,zz); Sc=size(find(Sa==ss),1); %...
e550a0d3667906b305f718974303c31b8de8cf6aeec4799551fd7635968ced0f
MATLAB
543
15
folder_name = uigetdir('C:\Projects\Valencia\results\ctr\ctr_subset_results','Select folder to save reference contours in'); if (~folder_name); return; end; cd (folder_name); % workspace MUST contain the NET variable for this to work contours=NET.weight; [~,numContours]=size(contours); for i=1:numContours outputFi...
1e5c1bdea92c7bec7e44665b61ef2973766c83c5170d5c6103e6d55717329f3c
MATLAB
544
17
function r = is_stateful(f,varargin) % check whether a filter function is stateful (for some arguments) % stateful filter functions are characterized by a second output nout = nargout(f); if nout >= 0 % usually, nargout tells us this r = nout > 1; else % but in some cases (e.g., when the function is wrappe...
46c865ccbd3056d0b4a74a5e0b4addaf04bbbb82a55ee1524f5dd597e443ad60
MATLAB
544
14
function fear_separate_reactInfo(basename) % basename='~/data/Fear/triple/achel180320/achel180320'; load([basename '.basicMetaData.mat']) fprintf(' %s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.AnalysesName '-icaReac.mat']) icaReacInfo=rmfield(icaReac,'strength')...
9db787140261a4493be01d9d14d3c2eb1875b60019ca13714a6867a8e55e8688
MATLAB
544
29
function f = fillmatrix(v,msize,dim) % function f = fillmatrix(v,msize,dim) % % <v> is a vector % <msize> is a matrix size % <dim> is the dimension along which <v> is oriented % % return a matrix of size <msize> filled with <v>. % % example: % isequal(fillmatrix([1 2 3],[3 2],1),[1 1; 2 2; 3 3]) % calc len = length(m...
153359e54999b71d95c88721ed48b3e8a0d5d8c87d35dabe242e23fc9f3d4c09
MATLAB
545
13
function synchronized = fastPETH(spiketimes,events,interval) try if length(spiketimes)*length(events)<10000, synchronized =mainFastPETH(spiketimes,events,interval,1,length(spiketimes),length(events)); elseif log10(length(spiketimes)*length(events))<10 , synchronized = mainFastPETH(spiketimes,ev...
176bd34ecfa08a0467f7e29d9a1e4a81e976782d247361124962aa8cb01fe195
MATLAB
545
18
function metrics = evaluate_metrics(pred, true_labels) TP = sum(pred==1 & true_labels==1); FP = sum(pred==1 & true_labels==0); TN = sum(pred==0 & true_labels==0); FN = sum(pred==0 & true_labels==1); precision = TP/(TP+FP+eps); recall = TP/(TP+FN+eps); f1 = 2*precision*recall/(precision+recall+eps); ba = 0.5*(recall ...
2792eeb0f46619ce28f631be7e0a03b25c98b374ab429f4954f704a431dbc996
MATLAB
545
26
function scut = calc_scut(data) % calculate threshold of similarity values from shuffled data num_shuff = 20; p = 0.98; dims = size(data); % calculate similarity matrix warning('off') S = zeros(dims(2),dims(2),num_shuff,'single'); for n = 1:num_shuff data_shuff = shuffle(data,'time'); S(:,:,n) = 1-pdist2(data...
5c7d9b458a37d9f6995486bf66419add436be9759b9f013162b8c733259593e3
MATLAB
545
24
function bb = get_bb(imgname) % world-bb -- get bounding box in world (mm) coordinates V = spm_vol(imgname); d = V.dim(1:3); % corners in voxel-space c = [ 1 1 1 1 1 1 d(3) 1 1 d(2) 1 1 1 d(2) d(3) 1 d(1) 1 1 1 d(1) 1 d(3) 1 d(1) d(2) 1 1 d(1) d(2) d(3)...
523430f1cf657037ad413b23d18df48eb6297f490df8e55b23e02a4a2ef3875c
MATLAB
546
16
function S=dataframe2struct(D); % function D=struct2dataframe(S); % Converts a structure-array into a dataframe structure. % The pre-requisite is that all fields in the structure a 1xK matrices or % cell arrays, so that they can be vertically concatenated fields = fieldnames(D); numStruct = length(D.(fields{s})); for ...
13bbbf431d1ea10b9973740d5063936a79ff4d80bec0403556d0757a749485b3
MATLAB
547
19
function [imgdata] = meta_read_image(name,mask) % [imgdata] = meta_read_image(name,mask) % % gets image data in a v x 1 voxel list (for fast processing) % compatible with Meta_Activation_FWE subfunctions % % This is the inverse of meta_reconstruct_mask % image (name) and mask (mask) must have same dimensions and origi...
3be917340bdcc8f6a9df29a63e4763044af84b9326930bc0a73a141af59d2a3a
MATLAB
547
26
function isNew = tapas_uniqc_isNewGraphics() % returns true, if Matlab version is R2014b or new (different handling of % figure handles) % % isNew = tapas_uniqc_isNewGraphics() % % IN % % OUT % % EXAMPLE % tapas_uniqc_isNewGraphics % % See also % Author: Lars Kasper % Created: 2014-11-05 % Copyright (C) 2014 Ins...
4d8256a722ab1f0bc3453ce262daaeea63d29b0809a65670962c6d8afa7ce346
MATLAB
547
15
%{ # scan stim type, visual or auditory -> experiment.Scan -> experiment.StimTypes --- speaker_id : int # id of the speaker location : tinyint # 1 = Left, 2 = Right calib_trial : int # calibrati...
5d38f63d358dd63f8db16b725d8f2aedeb4072ec2b12b0f5171d4e18093967ec
MATLAB
547
19
function [wMLnew,opsnew] = removeParams(wMLold,index,ops) %will remove params and update the ops struct opsnew = ops; opsnew.nkern = ops.nkern-1; opsnew.ls = [ops.ls(1:index-1),ops.ls(index+1:end)]; opsnew.dimst = [ops.dimst(1:index-1),ops.dimst(index+1:end)]; opsnew.dimbcst = [o...
83dc6c7a5691f095d493533a73b120025547d340dc19d1931a992b7d3bebc09e
MATLAB
547
22
%{ # single slice of one stack -> stack.CorrectedStack -> shared.Channel islice : smallint # index of slice in volume --- slice : longblob # image (height x width) slice_z : float # slice dep...
a3eae72bf9d1c1a2a45c01e8654e37c7eee0c3bf1d9969228d09d3f5a07e5074
MATLAB
547
21
%{ preprocess.PrepareAodPoint (imported) # points in 3D space in coordinates of an AOD scan -> preprocess.PrepareAod point_id : smallint # id of a scan point --- x : float # (um) y : float # (um) z ...
ea7fd097fd99346b36c86ba118ecc7d159f9cf55f5f6273e3b0fc605b204ac91
MATLAB
547
34
function [llh] = tapas_vlinear_hier_llh(data, theta, ptheta) %% Linear model with variance and identity covariance matrix. % % 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); for j = 1:nc % Precision mu =...
4cabd9bc19b6deaa6633b65b68c6e3e6cb0af0763b7087d4b978b2104d98826d
MATLAB
548
18
%Author: Kim Kundert-Obando for questions please reach out to me at k.rogge.obando@gmail.com %This code will be a function that derives 4D nifti file of data that is in 2D format, v1 v2 v3 are %voxel dimensions of original nifti data function nifti_map = derive_4Dmaps(file,file_name,brainVox,mask_info,v1,v2,v3) for i...
04949d7444b004b40387079742bbe55c18c8acce195cc0b13dd792606f665cd5
MATLAB
549
30
% % Open the QT-NIRS GUI for data quality check % % Parameters % ---------- % participant: integral number % Participant to process. % % Outputs % ------- % The outputs are saved as .csv files. % % Author % ------- % Ségolène M. R. Guérin % June 29, 2023 % RnB-Lab (Institute of Neuroscience, UCLouvain) % function...
7acb72864ed49718c8c39b6434f30b42f75e87da3aee6e38a1f3c3ab479e4ec4
MATLAB
549
21
function varargout = covConst(varargin) % Wrapper for unit constant covariance function covOne.m. % % Covariance function for a constant function. The covariance function is % parameterized as: % % k(x,z) = sf^2 % % The scalar hyperparameter is: % % hyp = [ log(sf) ] % % For more help on design of covariance functions...
a8a9ec9ddc400d23432d065dd382e7996ab1dcc7b45086e963c24c4fd2fbfe05
MATLAB
549
15
function [lp,dlp] = priorDelta(x) % PRIORDELTA fix the value of a hyperparameter. % % This is a summy hyperparameter prior distribution. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorClamped. % % For m...
5b1b716507470260d495a24364c166b4c81eaa881dc638070ea3c34226274787
MATLAB
550
30
%close all %clear all path(path,'.\FUZZCLUST') %the data data.X = Z(:,[1 2]); [N,n]=size(data.X); %data normalization data = clust_normalize(data,'range'); plot(data.X(:,1),data.X(:,2),'.') hold on %parameters given %param.c = [0.51 0.91 % 0.14 0.79 % 0.6 0.17 % 0.05 0.25] param.c=4; para...
8184ed53bbd32022dbeac1fc0374f39f416bafb4b8a01c9892c8b2354d7959df
MATLAB
550
26
function ListSubj(SubjsDir,outname) if nargin==0 SubjsDir= uigetdir([],'select a input folder') ; outname='SubjList.txt' ; elseif nargin==1 outname='SubjList.txt' ; end [DirPath, fileN, extn] = fileparts(SubjsDir); list = dir (SubjsDir) ; % if exist ([SubjsDir,filesep,'SubjList.txt']) % delete ([SubjsDir...
9f206919fc0ad06125ae377b6c93a8005fe195dedc5c57f877b80b8893848938
MATLAB
550
28
function [J,h_theta] = jointcostaccfun(param,x,y,task) if nargin<4 task = ones(size(x)); end sigma = param(1); lapses = param(2:3); if length(param)==4 mu = param(4); else mu = 0; end m = length(y); h_theta = nan(m,1); utask = unique(task); ntask = length(utask); for itask = 1:ntask itrl = task == u...
e061958876b80d2951485af54d95f835048d21398e06a529a1232dd28c10efc3
MATLAB
550
16
function changeslice(src,evt,safter,Ftrace,traceX,traceY) evname = evt.EventName; switch(evname) case{'SliderValueChanging'} % f = sbefore.SliceNumber; % safter.SliceNumber = f; % disp(['Slider value changed event: ' mat2str(evt.CurrentValue)]); safter.Slice...
3ccdc0a73388f9f24b2d152422c726ff7061564ffd2a6aa7e59f94ca125b6cfd
MATLAB
551
31
function [llh] = tapas_vlinear_llh(data, theta, ptheta) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % y = data.y; u = data.u; theta = theta.y; [~, nc] = size(y); llh = zeros(1, nc); ln2pi = log(2 * pi); for i = 1:nc pe = y{i}.pe; lpe = log(pe); tllh = theta{i}.k * log(theta{i}.t) - gammaln(th...
85806da3ce64f9ed1f4b2a58b046445a611e4900a23f242f24f14ad6f33370ef
MATLAB
551
15
function [lp,dlp] = priorClamped(x) % PRIORCLAMPED fix the value of a hyperparameter. % % This is a dummy hyperparameter prior distribution. % The function is not intended to be evaluated but exists merely to make % the user aware of the possibility to use it. The function is equivalent % to priorDelta. % % For...
ed004fb7985f2b468b53c1d8dec264ba3a249790cd0504af16c4ff79aa6d33ad
MATLAB
551
25
function task_indicator_table(connames,taskstr,taskindic,tasknames) % header 1 fprintf(1,'Task types in analysis\n\nContrast Name\tTask type\tTask indicators with sample sizes\n') % header 2 fprintf(1,'\t\t') for i = 1:length(tasknames) fprintf(1,['%s\t'],tasknames{i}) end fprintf(1,'\n') % prin...
0a5a7b12d9d04e979896fbedc8bbd77e7a2693c9c703973964de9e66ca59a554
MATLAB
552
32
function [template] = tapas_load_template(fname) %% Loads a file that work as a template for filling. % % Input % fname -- File name. % % Output % string -- An array containing the string. % % aponteeduardo@gmail.com % copyright (C) 2017 % fid = fopen(fname); try template = {}; ...
ec1da39e1b9c9aa421c51edfc4c7388446be174df1bfa1f9975b7d291edc9e9b
MATLAB
552
20
function y = linTransform(x, fromLimits, toLimits) % linearly transforms values x lying in interval 'fromLimits' into another interval 'toLimits' % eq: y = k*x + c % (c) Jiri, Mar11, Nov16 % input x1 = fromLimits(1); x2 = fromLimits(end); y1 = toLimits(1); y2 = toLimits(end); % linear transformation k = (y2-y1)/(x2-...
1022c179946a679f57fa42e036bbe8334e7056da542fe4ccd06a065f80f0c2ef
MATLAB
553
19
function [data, spans, names] = read_analog_stream(stream) response = stream.next(); stream_data = response.getDataList(); length = stream_data.size(); data = zeros(length, 1); for i = 1:length data(i) = stream_data.get(i-1); end stream_spans = response.getSpansList(); length = stream_spans.size();...
1804a05116ce434e1c22db104e0c1f40647da8eff42b67d5c576327e41b38ce7
MATLAB
553
25
%{ monet.DriftTrialSet (computed) # all drift trials for this scan -> rf.Sync --- %} classdef DriftTrialSet < dj.Relvar & dj.AutoPopulate properties popRel = rf.Sync & (psy.MovingNoise & 'speed>0'); end methods(Access=protected) function makeTuples(self, key) ...
27e67580c4568a6c2f2430c59c48c37859ca1947b51b1c66569e98f7fdef8b22
MATLAB
553
15
%{ vis.MovieSeqCond (manual) # random sequences of still frames -> vis.Condition --- -> vis.Movie rng_seed : int # random number generator seed pre_blank_period : float # (s) duration : float # (s)...
606c41af4704b0f07fad96438f0fd299a01fb58e923a7a05c1507fe8d4514043
MATLAB
553
35
% Panel gives you figure-wide control over text properties. % % (a) Create a grid of panels. % (b) Change some text properties. %% (a) % create a grid p = panel(); p.pack(2, 2); % select all p.select('all'); %% (b) % if we set the properties on the root panel, they affect % all its children and grandchildre...
7f6accef62aae4f6e66b780d5b92c9087bf9663d0e909f51e58f0d15bb0f9d80
MATLAB
553
20
function fn = tapas_uniqc_str2fn(str) % reformats string so that it could be a filename (without space colon etc) % % output = tapas_uniqc_str2save(input) % % IN % str string % OUT % fn file-name compatible string without spaces, dots, slashes etc. % EXAMPLE % str2save % % See also % Author: Lars Ka...
0a31c5e22b0cf6c0067014e29bb43839a3223b215738163bf351e19f65cb7857
MATLAB
554
25
function result = is_symmetric_matrix(A) % % Symmetric Matrices % % is_symmetric_matrix(A) determines if the matrix A is a symmetric % matrix. An error is returned if a matrix that is not square is attempted % to be determined for symmetry. % % Function written by Anthony Russo, downloaded from MatlabCentral....
62f154c5b6767b01c59f23cb15520560aad11fba25fc3b82a1a75b02870e64c2
MATLAB
554
20
%{ preprocess.ExtractRawGalvoROI (imported) # region of interest produced by segmentation -> preprocess.ExtractRawGalvoSegmentation -> preprocess.ExtractRawTrace --- mask_pixels : longblob # indices into the image in column major (Fortran) order mask_weights=null : longblo...
63a2c722c314e1d7ffc230807fa0c01c1db2eef9b95ddea151bc14113403e66b
MATLAB
554
25
% handy function to save variable in nifti format function save_nii_quick(templateHeader,img,filename,datatype,voxelsize) if nargin < 4 datatype = 16; end nii = templateHeader; nii.img = single(img); nii.hdr.dime.datatype = datatype; nii.hdr.dime.dim(5) = size(img,4); nii.hdr.dime.dim(1) = ndims(img); nii.hdr.dim...
d8aec31325022bdebe41d7b1c3d5c4581bb79121a8ccd02e6b3f41d25d343358
MATLAB
554
19
function candoit = canGetCost(problem) % Checks whether the cost function can be computed for a problem structure. % % function candoit = canGetCost(problem) % % Returns true if the cost function can be computed given the problem % description, false otherwise. % % See also: getCost canGetDirectionalDerivative canGetGr...
e2309a01785892dcf25bea06b4d35d2a6aea3a299532ea7610253c81fd104f90
MATLAB
554
11
% This script is taken from the old 'callback1' variable, and is called % when the main ARTwarp GUI figure is closed. It saves the network % parameters used to a file named 'ARTwarp.mat' global vigilance bias learningRate maxNumCategories maxNumIterations sampleInterval resample; shh=get(0,'ShowHiddenHandles'); set...
ed05395267d9e3776aee49d2cfc640a5f9afa6593c28666457ffab05bba77a24
MATLAB
554
18
%% BatchScript % Script for batch running other scripts or functions basePath = 'D:\Data\Lobster\Lobster_Recording-200319-161008\Data'; filelist = dir(basePath); sessionPaths = regexp({filelist.name},'^#\S*','match'); sessionPaths = sessionPaths(~cellfun('isempty',sessionPaths)); fprintf('%d sessions detected.\n', nu...
7cd7cd87c11579841dca446dd3b7637eb7bafc611f059d1ed0b278b327b93497
MATLAB
555
25
%{ aod_monet.DriftTrialSet (computed) # all drift trials for this scan -> aodpre.Sync --- %} classdef DriftTrialSet < dj.Relvar & dj.AutoPopulate properties popRel = aodpre.Sync & (psy.MovingNoise & 'speed>0'); end methods(Access=protected) function makeTuples(self, key...
a68739d995a3de3aed2de7dac859c7a55f943b32c522270dddf6cda06bfcfa52
MATLAB
555
13
function res = hlp_sort_namevalues(varargin) % Sort name-value pairs by name. % Sorted-NVPs = hlp_sort_namevalues(NVPs) % % Since the toolbox occasionally caches results of function calls, % this is practical to uniformize arguments that lead to the same results, but look superficially different. % % ...
4b97be7e22126ae1f2ffaa9fc1470411d97bbc506ae718d2b2c9d9767abb73e1
MATLAB
556
11
function dataout = LargeCluster(data, dim1, dim2, dim3) [theObjMask, theObjNum]=bwlabeln(reshape(data, dim1, dim2, dim3),26); for x=1:theObjNum, theCurrentCluster = theObjMask==x; ClusterSize(x,1) = length(find(theCurrentCluster)) ; end [maxa maxb] =max(ClusterSize); % get t...
bdb06cadb2d1f35345f81bd723434520766608f3b9b0e6745c45def0ef76314f
MATLAB
556
22
function h=setfsize(wx,wy) % h=setfsize (wx,wy) % % Set figure position. % % h = setfsize(X,Y) % X - Horizontal length. % Y - Vertical height. % h is the figure handle to the figure just handled % Sets current figure lower left position to X by Y pixels (measured from % lower left corner of screen. On image, max p...
bf7c4516cf97d57ad7500b5da156cfb34818cc92e4af513944570c173bc46ae6
MATLAB
556
12
function y = tapas_sgm(x, a) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence (GPL), version 3. ...
846289f281e4208738419fb6329adfe46f61038a76cf291bc3453c689da4c0c1
MATLAB
557
36
function phi = solvePDE(MS, M, RHS, varargin) %SOLVEPDE solves the linear system M x \phi = RHS and returns the value of %\phi reshaped based on the structure of the MeshStructure variable. The %default solver is the matlab '\' linear solver % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % ...
fcbbf284ff461452e73a46f1855541753ec2ee55cf57a974bd268ed2815f1cf3
MATLAB
557
20
%{ # some intermediate results from affine registration -> stack.FieldRegistration --- score_map : longblob # 3-d map of best correlation scores for each yaw, pitch, rol combination position_map : longblob # 3-d map of best positions (x, y, z) f...
4f1185b4d7defef58b0d792c4269984d27a1929f3455b2d6c6d058d5c1c14e22
MATLAB
558
18
function balanced_accuracy = balanced_accuracy_score(y_true, y_pred) %% balanced_accuracy_score % same function used in the sklearn.metric.balanced_accuracy_score % but only works for the two classs. if numel(unique(y_true)) ~= 2 error('Number of class is not two.'); end classNames = unique(y_true); balanced_ac...
59a84c71523f2b53ddbf5bd953989ae3e46ef3f5997aede21c0abfe4e290fdf7
MATLAB
558
25
function fn = getImFiles(params) contents = dir(params.pth); good = false(numel(contents), 1); disp('Image files: '); for i = 1:numel(contents) if contains(contents(i).name, params.imtoken) && ~contains(contents(i).name, 'reg_') if ismember(str2double(contents(i).name(end-8:end-4)), params.nums) ...
6fd1be88f19dc83d8fc66e766b62e74ae23ac0d0bfbc5d76a1df83778be07dc2
MATLAB
558
29
function [Y]=sindex(A) % Calculate similarity of tf-idf normalized matrix % INPUT: % A: N-by-T tf-idf normalized matrix % OUTPUT: % Y: N-by-N similarity matrix % % Luis Carrillo-Reid, 2014; Shuting Han, 2017 N = size(A,2); %Número de picos Y = zeros(N,N); for i=1:N for j=i:N Aa = A(:,i);...
ead4b246b2e09a9ae7a48d75cb75af2cb563abd0e528135f92b8e2da7bdb857f
MATLAB
558
34
function X = myTEOcircshift(Y,k) % circshift without the boundary behaviour % Parameters % ---------- % Y : % k : % % Output % ------ % X : colshift = k(1); rowshift = k(2); temp = circshift(Y,k); if colshift < 0 temp(end+colshift+1:end,:) = flipud(Y(end+colshift+1:end,:)); elseif colshift > 0 temp(1:1...
0ac212d1ac69db0ec1edf60fb791ff45980002f8fbcdf746c4bf27ae3480fc41
MATLAB
559
23
function [rand_nums] = rand_with_int(N,delta) % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1 % Rubén Herzog October 2020 N = 10; % number of integers required delt...
d15274a2e3624ff2e370061f987830eb2651aca09a80e24391e5ec6a2650862b
MATLAB
559
22
%{ # Inferred background components with the CNMF algorithm -> preprocess.ExtractRaw -> preprocess.Channel -> preprocess.Slice --- masks : longblob # array (im_width x im_height x num_background_components) activity : longblob # array (n...
0f9059d02d0d84c0a64e3d30baa97342f595ff55cd6c8d670cbe7bf950365e75
MATLAB
560
27
function uidents = re_sort_uidents(uidents, identifiers) % %for testing_______________ % clear all % close all % clc % %this fbmm file was generated from the data in CPH_003_datalist % load repackData_testfile % % load lightcurvefbmm.mat % identifiers=fbmm.szGenotype; % uidents = unique(identifiers) % %end testing___...
62982038671a7fef06bd2aa4f2c14e3ca0ac3a148a4f329c2f9e1a8dc21c7934
MATLAB
560
23
function V0 = initialize_membrane_potentials(params) % INITIALIZE_MEMBRANE_POTENTIALS - Set initial voltages % % H1 Line: Initialize membrane potentials randomly % % Syntax: % V0 = initialize_membrane_potentials(params) % % Description: % Generates random initial membrane potentials between reset % and threshold ...
b5bf42497dad03480a9af0c1d8f8c0a588c36279d8f8b4fd1dd4a8e263419991
MATLAB
560
24
function im = loadTifFramesFast(FileTif, info, frames) xpix=info(1).Width; ypix=info(1).Height; bitdepth = info(1).BitsPerSample; Nframes = numel(frames); if bitdepth == 32 im=zeros(ypix,xpix,Nframes,'uint32'); elseif bitdepth ==16 im=zeros(ypix,xpix,Nframes,'uint16'); elseif bitdepth ==8 ...
bcb1ddb39d6b87d03122b7ed6724d23db6f8dcc3335d5a06d1b1b4e7f96c64e4
MATLAB
560
20
function spike_matrix = spikeTimeToMatrix(spikeTimesStruct, start_time, end_time, sampling_rate) %{ %} channel_names = fieldnames(spikeTimesStruct); bin_edges = start_time:1/sampling_rate:end_time; num_bins = length(bin_edges) - 1; num_channels = length(channel_names); spike_matrix = zeros(num_bins, num_channels);...
e0f6eb682f76867d2a86f18d1031f70ed33e2a587a1761b5f8269280a5996235
MATLAB
560
31
function [posterior] = tapas_linear_estimate(y, x, model, inference, pars) %% Estimate a linear model % % aponteeduardo@gmail.com % copyright (C) 2016 % n = 3; if nargin < n model = struct(); end n = n + 1; if nargin < n inference = struct(); end n = n + 1; if nargin < n pars = struct(); end [pars] = t...
fd95d556bf0a660ea203a428dc4df9ebf23cee81095aaf528825003c08444134
MATLAB
560
17
function edge_thresh = getEdgeThreshold(adjM, Params) %GETEDGETHRESHOLD Summary of this function goes here % Detailed explanation goes here if isfield(Params, 'networkPlotEdgeThresholdMethod') if strcmp(Params.networkPlotEdgeThresholdMethod, 'Absolute Value') edge_thresh = Params.networkPlotEdgeThreshold;...
ef206c739cf560e763dd3873ce178fc663aa76fb00e316bd7a0cfe2fd8b69364
MATLAB
561
20
function aux_stackwrite(stack, filename) %AUX_STACKWRITE Write a 3D matrix as a stack of images (.tif) % AUX_STACKWRITE(stack, filename) write the 3D matrix stack as filename % % Input: % - stack: 3D matrix % - filename: string containing the name of the stack. % % Example: % aux_stackwrite(stack, '3dou...
4f007775d1a48c2c2fdb8b2262054b3a6c752c72e2a1374a2fb43c374a262b38
MATLAB
562
32
n = 3; m = 3; p = 3; k = 2; X = randn(n, m, k); Y = randn(m, p, k); t = tic(); for K = 1 : 100000 XY1 = multiprod(X, Y); end toc(t) t = tic(); for K = 1 : 100000 XY2 = multiprod_ez(X, Y); end toc(t) t = tic(); for K = 1 : 100000 XY3 = mmx('mult', X, Y); end toc(t) fprintf('Relative difference: %g\n', no...
81af80bc9080fb1a5433f54936edc25c50709e51de6f5c484ff46f7c62861706
MATLAB
562
20
function aux_stackwrite(stack, filename) %AUX_STACKWRITE Write a 3D matrix as a stack of images (.tif) % AUX_STACKWRITE(stack, filename) write the 3D matrix stack as filename % % Input: % - stack: 3D matrix % - filename: string containing the name of the stack. % % Example: % aux_stackwrite(stack, '3dou...
d6a75935fb186f1f9957dd87632805b4a11f657d4f1bada6dabb38e15bf44d71
MATLAB
562
14
function[rawdata] = CleanData(orgrawdata, column1_index, column2_index, column3_index) % clean rawdata from messy start/finish firstdatapoint = max(orgrawdata{1,column2_index}); q = find(orgrawdata{:,column2_index} > firstdatapoint - 25E-9); if (~isempty(q)) w = q(end); else w = 1; end [maxrawdata,ma...
dfb332bde52e551cb21290d25949ad368ac95ccbcf35b39d84d7764d3e03d77f
MATLAB
563
19
function plot_eigs(ax,eigs,seleig) % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1 % Rubén Herzog October 2020 cla(ax); hold(ax,'on'); plot(ax,1:length(eigs),eigs...
038bd0e6ed8fe4088f9ff638605755f3e055b7715908065556f388121d9e7ede
MATLAB
564
31
function [posterior] = tapas_vlinear_estimate(y, x, model, inference, pars) %% Estimate a linear model % % aponteeduardo@gmail.com % copyright (C) 2016 % n = 3; if nargin < n model = struct(); end n = n + 1; if nargin < n inference = struct(); end n = n + 1; if nargin < n pars = struct(); end [pars] = ...
8dbfacd18771d54dc0021f886b3e7e049d50c950cc872cb204e751932597cbc7
MATLAB
564
15
function [dc, rho] = paraSetv2(dist, percNeigh) % using the modified version of Yger et al 2016, related to spike sorting. % % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.3...
9259f01605abdf25df342019a0f5f9def211b36e5f34c3d02f6f2761cef27bf6
MATLAB
564
20
function stackedbar2(v,colors,labels) % stackedbar(v,colors,labels) % plots a stacked bar plot, so you can see proportions of each variable out % of whole % useful for plotting p(task|act) % columns of v are tasks, rows are regions % labels are labels for regions figure('Color','w'); set(gca,'FontSize',18); hold on; ...
40994c8c99ecfd6d0f6808340897170739a89b49f53c2091880bc8fd3254f9af
MATLAB
565
29
function [theta] = tapas_mh_mc3_propose_gaussian_sample(data, model, ... inference, state, node) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % otheta = state.graph{node}; nc = numel(otheta.y); theta = otheta; % Default if not no update values if isfield(state.kernel{node}{1}, 'nuk') nup = state.kern...
58632296670cc018096f9b95ba0126fd07faeb24bf17adb4caa7f8286e9b52f4
MATLAB
565
26
function [A,W,SW,S,Q,ix_act] = ... compo_delete_act(XX,A,W,SW,S,Q,SY,i_del,jx,ix_act) % Delete component % XX = X(ix_act,:)*X' [M_act x M_all] A(i_del) = 0; M = length(ix_act); jj = [1:(jx-1), (jx+1):M]; % New active index ix_act = ix_act(jj); % Weight & variance update ss = 1./SW(jx,jx); SX =...
80f2ab518fcb657de1cbc41fd26737aec51f2706fcdabd4f5cc2b83540a8edcd
MATLAB
565
28
function b = regressVolume(data, trials, varargin) if strcmpi('low', varargin) use = find(data.block == 3 & data.optout == 1 & ... data.catch == 1); elseif strcmpi('high', varargin) use = find(data.block == 2 & data.optout == 1 & ... data.catch ==1); else use = find(data.block==1 & data.op...
a9a24087782485555204552519b9b2274490f06c51a68a9daf8f7dd9d37e29ab
MATLAB
566
16
function d = log_det(sxx) % Log( det(sxx) ) for Positive definite matrix % ¶¦Ê¬»¶¹ÔÎó¤Ï¾ï¤ËÀµÄêÃÍÂоιÔÎó % Gauss ¤Î¾ÃµîË¡¤Ë¤è¤ë»°³Ñ¹ÔÎó°ø»Ò [L,U] = lu(sxx); eig_val = abs( diag(U) ); eig_val = eig_val(eig_val > 0); d = sum( log( eig_val ) ); % ¥³¥ì¥¹¥­Ê¬²ò : X ¤¬ÀµÄê¹ÔÎó¤Î¤È¤­¡¤»°³Ñʬ²ò¤è¤êÁᤤ %R = chol...
b09ee1f649801eebcc821d5788869b8057eac00f0714575c83387d7b8e1c6247
MATLAB
566
27
function PlayBeep(w,t) %USAGE: % beep % beep(w) specify frequency (200-1,000 Hz) % beep(w,t) " " and duration in seconds % fs=65000; %sample freq in Hz (1000-65535 Hz) % it was 8192 when using SOUND command at the end of this code if (nargin == 0) w=1000; %defa...
f68c176a2dd64bcc6e8a30772ec41df7f364ef63d1a6281b8f5681c8e8b2cbbb
MATLAB
566
31
function [y] = rngits(dim,x,p) % RNGITS Random number generator using inverse transform sampling % [y] = rngits(dim,x,p) if nargin < 3 error('Missing input argument(s).'); end if size(x) ~= size(p) error('x and p should have the same size.'); end p = p/trapz(x,p); c = cumtrapz(x,p); imin = f...
1b0063430989b68a5918417b826ef233c25e21188652aad75aab07643d9df350
MATLAB
567
24
function cl2area=surfing_clusterarea(clu,node2area) % quick wrapper function to find areas of clusters. % % CL2AREA=SURFING_CLUSTERAREA(CL,NODE2AREA) % % INPUTS: % CL Nx1 cell for N clusters, where CL{K} are the indices of % the nodes in the K-th cluster % NODE2AREA Mx1 areas of each node % ...
51ee7e458e412c58714cd3aca8bcecc8237a504c85af637f5f175459e20d3a3f
MATLAB
567
24
function data = getData( obj,channel ) if nargin<2 channel = 1; end import vis2p.* assert( length(obj)==1 ); [path,name] = fetch1( Experiments*obj, 'directory','file_name' ); scan_prog = fetch1(obj,'scan_prog'); if strcmp(scan_prog,'MPScan') filename = getLocalPath([path '/' name 'p%u.h5']); tpr = tpRea...
57aa63f5d0744e495819d269914ea352143e9c00af585cfb06107ebb6f65875d
MATLAB
567
25
function niml=afni_niml_read(fn) % simple function to read niml files % % P=AFNI_NIML_READ(FN) reads a file FN and returns a NIML structure P. % % NNO Dec 2009 <n.oosterhof@bangor.ac.uk> bytes=read_bytes(fn); niml=afni_niml_parse(bytes); function s=read_bytes(fn) fid=fopen(fn); if fid==-1 if...
75d5c9a6ad0cdbbcb9b91d0cff1262254cf4929d17721807801ea6f1013f46b0
MATLAB
567
32
function tableExamples % % Table call format % % clf % % albert=[1,1,1,3,2,1,3,3,3,2,2,3,3]'; % victoria=[7,8,6,1,5,7,2,1,3,4,5,2,4]'; % M = table(victoria,albert); %place data in first column and groups in the second % % subplot(1,2,1) % notBoxPlot(M) % % subplot(1,2,2) % notBoxPlot(M,'jitter',0.5) help(['NBP.',mfi...
e6ab13b2e88763e1a7843467a20819d47a41e6cd6b78dbbcabe208f537d6e362
MATLAB
568
19
function class_calc = knnclass(neighbors_class,neighbors_distance,num_class,K) % find class on the basis of K neighbors for g = 1:num_class freq(g) = length(find(neighbors_class == g)); end unique_class = find(freq == max(freq)); if length(unique_class) == 1 [M,class_calc] = max(freq); else mean_dist = o...
a2de1dc9a085dac4d7cacca0fdf5b9de532bbb53ccff3eee184b4b298d18ff6a
MATLAB
570
21
function f = nsd_datalocation(dir0) % function f = nsd_datalocation(dir0) % % <dir> (optional) is [] | 'betas' | 'timeseries' | 'stimuli' % % Return full path to the nsddata directories. % Edit this to suit your needs! if ~exist('dir0','var') || isempty(dir0) f = '/media/charesti-start/data/NSD/nsddata/'; else sw...
e8b419e7db44b37548c252b7b84498608417cbd7b2c6fd30becd630fc2186eaa
MATLAB
570
12
function pstruct = tapas_softmax_mu3_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence (GP...
23a6e3a93c15ed4c310e8608dfb6b772cbe7663ee443012465bdb4197f1466d6
MATLAB
572
22
function [q,r] = divmod(x,y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % divmod divides X and Y and return the quotient and the remainder. % % Arguments: % x = Numerator % y = Denominator % % Output: % q = quotient % r = remainder % % Emin Serin - 14.08.2019 % %%%%%%%%%%%%%%%%%...
e781407af14086f4ebb371de2b0745463a9d9233867ee49d7743946d23aa4116
MATLAB
572
12
%{ # projector configuration projector_config_id : tinyint # projector config --- -> ProjectorColor.proj(channel_1="color_id") # channel 1 means 1st color channel. Usually red -> ProjectorColor.proj(channel_2="color_id") # channel 2 means 2nd color channel...
e951fbaa6d0bec6614538c66a0b90b7b5284afad11533b8b359b6248141b7014
MATLAB
572
19
load(which('invMLEFitResults.mat')) load(which('MLEFit.mat')) %% x0resid = cellfun(@(x0i,x0bar)x0i-x0bar,x0inv,num2cell(cMatrixMLE),'UniformOutput',false); %% Adist = cell2mat(cellfun(@(x)x(:),Ainv(:)','UniformOutput',false)'); ndist = cell2mat(cellfun(@(x)x(:),ninv(:)','UniformOutput',false)'); x0dist = cell2mat(cellf...
ef45c74c14560cbe9d69301aed9809a76abdbbbb80d5f2c31faa219448761adb
MATLAB
572
25
function [fits] = tapas_sem_normalized_fits(data, fits) %% Normalize the fits according to the data. % % Input % data -- Data structure with field y and u % fits -- Fits structure with fields pro and anti % % Output % fits -- Normalized fit structure % aponteeduardo@gmail.com % c...