sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
adcaeb9b2712fcbe2ff2ee84a5964482069f9d472e48bd8d09ad543ee4e0eb53
MATLAB
466
17
function results = vl_test_ikmeans(varargin) % VL_TEST_IKMEANS vl_test_init ; function s = setup() rand('state',0) ; s.data = uint8(rand(2,1000) * 255) ; function test_basic(s) [centers, assign] = vl_ikmeans(s.data,100) ; assign_ = vl_ikmeanspush(s.data, centers) ; vl_assert_equal(assign,assign_) ; function test_elk...
3f1bd90bd59d6f4661c0ad18c2678550b25b5d17603b95124ebc443c448e8683
MATLAB
467
16
function [c_pt] = getCPT(lag,spline_method,brkpt) % ref for splines: https://github.com/MehradSm/Modified-Spline-Regression nSeg = ceil(lag/brkpt); c_pt_ctr = prctile([0:lag+1],([0:nSeg]./nSeg)*100); switch spline_method case 'modcard' c_pt = c_pt_ctr; case 'card' c_pt = [c_pt_ctr(1)-range(c_...
0a554eac845245690f7e136988df0d8b5a93adcccfc80e4eb8b3c233ca898662
MATLAB
468
25
% mglWaitSecs.m % % $Id$ % usage: mglWaitSecs() % by: justin gardner % date: 09/22/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Wait for a certain time % e.g.: %mglWaitSecs(1); % function mglWaitSecs(waitTime,startTime) % check arguments if...
291d6397831791fc6c44c037b343e447b284bfe1c8baa7540dfc596b5d559643
MATLAB
468
16
function v = vl_matlabversion % VL_MATLABVERSION Return MATLAB version as an integer % V = VL_MATLABVERSION() returns MATLAB version encoded as an % ingeger value. MATLAB version string has the format % % MAJOR.MINOR.SERVICEPACK % % The integer V has the value % % V = MAJOR * 10000 + MINOR * 100 + SERVIC...
4479e97db2b7dd997f7604ce11c629d890578ed48346546aef16de7cd353f91a
MATLAB
468
9
function save_figures(fignum,folder,filename) if ismac saveas(fignum,['/Users/christianpotter/Dropbox/Dual Labeling Paper/V2/',folder,'/',filename],'pdf') saveas(fignum,['/Users/christianpotter/Dropbox/Dual Labeling Paper/V2/',folder,'/',filename],'fig') else saveas(fignum,['C:\Users\Runyan1\Dropbox\Dual L...
482148d0efdd64f281547ebddd65656b67cd3fc5f5e0431717e76ec3708ae99f
MATLAB
468
17
function normedResponse = normSum(response) % Function to set sum of response to 1 % % normedResponse = normSum(response). See also normMax.m % % INPUT: % response : (vector or matrix) pRF time series (time points by pRFs) % % OUTPUT: % normedResponse : (vector or matrix) normalized pRF time series (t...
807b2b2343b989f4e31d5f0ebd15fdf73b9c8ec9bee09de5cd70d60d95de2308
MATLAB
468
22
function [header] = ml_cai_core_h5_read_header( filename ) if ~isfile(filename) error('The file (%s) does not exist.', filename); end s = h5info( filename ); % output header = {}; % Get the attribute names in the root element attribNames = {s.Attributes(:).Name}; numAttributes = length(attribNames); % Read eac...
8afdef1c813001cc72e40571d05a8b8bbb2a9762117a66417860913c195915c5
MATLAB
469
8
function behavcam_referenceframe_create( obj, session, trial ) % Compute the background frame to present to the user and use for the % tracker [pRef] = ml_cai_behavcam_referenceframe_create( trial.getTrialDirectory(), trial.getAnalysisDirectory(), ... 'verbose', obj.isVerbose(), 'maxFramesToUse', ob...
80453944beef4f5ef2488d1dfb710d1ec1b36ec4a56ed5cb4bea30ae0cee7479
MATLAB
470
17
function [onsetTime] = showStimulus(texture, window, stimWidth, stimHeight, xCenter, yCenter) global isTestMode % Stimulus coordinates: stimRect = [0, 0, stimWidth, stimHeight]; destRect = CenterRectOnPointd(stimRect, xCenter, yCenter); % Draw the shape Screen('DrawTexture', window, texture, [], destRect, 0); % Draw ...
fe1dcadc01ab2c74010b2f2e8581ec0c8a5fc0a784dc76b1847191ff9db4ad71
MATLAB
470
19
function [Q, R] = mgson(X) % Modified Gram-Schmidt orthonormalization (numerical stable version of Gram-Schmidt algorithm) % which produces the same result as [Q,R]=qr(X,0) % Written by Mo Chen (sth4nth@gmail.com). [d,n] = size(X); m = min(d,n); R = zeros(m,n); Q = zeros(d,m); for i = 1:m v = X(:,i); for j = 1...
20f5bc8d1ce6719d227752dcb61ab36c247f64b56699a0d161326e6922c988ec
MATLAB
471
17
function usPerTime=SONGetusPerTime(fh) % SONGETUSPERTIME returns the tick interval in units of SONTimeBase() % USPERTIME=SONGETUSPERTIME(FH) % FH SON file handle % % See also SONGETTIMEPERADC, SONCHANDIVIDE % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & K...
925e54daaa2210f4f160bfd9cde786d95407edb153dc57916a4f87cdb17fe646
MATLAB
471
17
function sum_mid = sum_middle(I,num_pix,mask) %returns the mean of the middle pixels of the image, multiplied by mask. %assumes size(I,1)=size(I,2), and size(I,1) is odd. if(~exist('num_pix','var')) num_pix=1; end if(num_pix==-1) sum_mid=max(I(:)); return; end N=size(I,1); hn=N/2+0.5; this_sum=I(hn-num_pix:...
d067941027d23f1c7a8abaf7884447f8e4a60018f287b9f0321a461f823e74cc
MATLAB
471
20
% % Load strings from a file. The file should contain one string per % line. The function returns a cell array of strings, where each % string is the content of one line. % function [strings] = load_strings(filename) FILE = fopen(filename); if FILE < 0, error('fopen'); end; strings = textscan(FILE, '%s'); % Re...
0f5694045f133044113f0ec45f2eec903977526ec57470e930d888cb03c0683d
MATLAB
472
16
function handles = LoadImage(hObject, handles, imageData, imageLegend) %% Author: Jiri van Bergen % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % updated 2019-06-20, X.L. handles.CurrentImage = imageData; guidata(hObject, handles); % Updat...
c46accea7aee4b8b682d62d8789379cff210299afcbb15d15d462e359400a005
MATLAB
472
11
function kappa = cohensKappa(y, yhat) C = confusionmat(y, yhat); % compute confusion matrix n = sum(C(:)); % get total N C = C./n; % Convert confusion matrix counts to proportion of n r = sum(C,2); % row sum s = sum(C); % column sum expected = r*s; % expected proportion for random agree po =...
c7130b64ae95d47bc41f8d04e24952ffcb7ef1dc00134637c3c89bb9c93bb60e
MATLAB
472
14
function interleave=SONChanInterleave(fh, chan) % SONCHANINTERLEAVE Returns the channel interleave factor for ADCMark channels % in SON V6 or above % INTERLEAVE=SONCHANINTERLEAVE(FH, CHAN) % FH SON File Handle % Chan Channel number % % Author:Malcolm Lidierth % Ma...
5ec3bcec65a92630f0912ff2e34fc8413a9bdf9d2d5fad3099b7170001a6e7b0
MATLAB
473
6
function smoothingKernel = ml_util_compute_rect_kernel(smoothingKernelGaussianSize_cm, smoothingKernelGaussianSigma_cm, cm_per_bin) [hsize, ~] = ml_util_compute_gaussian_size(smoothingKernelGaussianSize_cm, cm_per_bin); smoothingKernel = fspecial('gaussian', hsize, smoothingKernelGaussianSigma_cm / cm_per_bin);...
2ad8e03ef46804968cb7ae7798ae77379039d88de4c45bc9df3471ced021dcbf
MATLAB
474
14
function trigger_times = trigger_times_pretreatment(upindex,interval,trial_from,... trial_number,h) trigger_times = upindex*interval; total_trial_number_in_file = length(trigger_times); if trial_number > total_trial_number_in_file - trial_from + 1 trial_number = total_trial_number_in_file - trial_from + 1; ...
2e9aa0bef5848ec2451fdc7a5a6e3af38d1c9fed842a89b577d0073f28e3369c
MATLAB
475
9
function scopecam_alignvideo( obj, session, trial ) pScopeAlign = ml_cai_scopecam_alignvideo( ... trial.getTrialDirectory(), 'outputFolder', trial.getAnalysisDirectory(), ... 'spatialDownsampling', obj.Config.miniscope_camera.spatial_downsampling, ... 'isNonRigid', obj.Config.miniscope_camer...
97466980b08dc750def6fb8c8439ac667988204069064b10e88c9f696b6eda99
MATLAB
475
16
function SetFlyVisible(handles,fly,v) % makes fly body visible or invisible % splintered from fixerrorsgui 6/21/12 JAB if isdummytrk(handles.trx(fly)) return; end set(handles.hellipse(fly),'visible',v); set(handles.hcenter(fly),'visible',v); set(handles.hleft(fly),'visible',v); set(handles.hright(fly),'visible',v);...
2c9869136da438d3d3b862acf47e29492ed6781526d02d77e78b6d72c929d287
MATLAB
476
10
function depth = Volt2Depth(volt,linearmodel) %VOLT2DEPTH ƒŒ[ƒU[ƒZƒ“ƒT‚©‚ç‚Ì“dˆ³ƒf[ƒ^‚ð•\ަ‚³‚ê‚Ä‚¢‚鐔’l‚ɕϊ·‚·‚éB % “dˆ³‚Æ•\ަ‚̐”’l‚ɂ͌덷‚ª‘¶Ý‚µA‚»‚̌덷‚Í“dˆ³‚̑傫‚³‚É”ä—á‚·‚éB‚±‚̊֐” % ‚Å‚»‚̌덷‚ðC³‚·‚éB p1 = linearmodel.p1; p2 = linearmodel.p2; volt = (volt-2.5)*2; depth = volt + p1*vol...
50cb8e64e3debfcc62ea8cfc6b60babf74bea8a9975a088b5969454c1227a91c
MATLAB
476
15
function res_val = resultant_val( val ) %function res_val = resultant_val( val ) % This function calculates the resultant temporal values % val should be N-by-3 or N-by-4. The first column is time and others are velocity or % acceleration etc. % % Author: Wei Zhao, 01/20/2016 %% if size(val,2) == 3 res_v...
6d2d14c431c8fb1c52543243b42b952ea488d4b5355faa877d78025041cd053e
MATLAB
476
15
function myTicks(gca, A, vec, ilabels, fontsize) % plot ticks and ticklabels on axis A ('X', 'Y') % ilabels, indices if labels ([1:5:15]) % Detailed explanation goes here if nargin<5, fontsize=8; end set(gca,[A 'tick'],vec); set(gca,[A 'ticklabels'],{}); iL = nor01(ilabels); for ii=1:length(iL), text(iL(ii...
690a264abb4b92c9aff69047be412277abd7355415e28b7d7d196d66cad29812
MATLAB
477
20
<<<<<<< HEAD function msVector = rebuildMs(msN, msX) msVector = []; % trasformi i vettori di frequenza in un vettore lineare for i = 1:length(msX) for j = 1:msN(i) msVector = [msVector msX(i)]; end ======= function msVector = rebuildMs(msN, msX) msVector = []; % trasformi i vettori di frequenza in un ...
b1e86f86b8d97cfa65f849bb4dc1565d65d1bd2c06f18924feab8bd24f60e0ab
MATLAB
477
16
function MaxTime=SONChanMaxTime(fh, chan) % SONCHANMAXTIME returns the sample time for the last data item on a channel % % MAXTIME=SONCHANMAXTIME(FH, CHAN) % where FH is the SON file handle % CHAN the channel (0-SONMaxChannels()-1) % % MAXTIME is returned in clock ticks % % % Author:Malcolm ...
1c0b3b27d7c5c9e2251528039b2eb4b70e1fd1b12151654929f063e37cee78ae
MATLAB
478
19
function [err]=SONBookFileSpace(fh, lspace) % SONBOOKFILESPACE Allocates disk space for a file % ERR=SONBOOKFILESPACE(FH,LSPACE) % FHH SON32.DLL file handle % LSPACE space in bytes % Returns 0 or a negative error code % % Author:Malcolm Lidierth % Matlab SON library: % Copyright ...
8c60886355ebcfe1950d38f38d37c88bd45ff8875a9302db1d4b1f6087d2c6ba
MATLAB
478
25
function file_names=get_sub_file_names(root_dir) file_infos=dir(root_dir); file_names=[]; file_dates=[]; for f_idx=1:length(file_infos) one_f_info=file_infos(f_idx); if ~one_f_info.isdir file_name=one_f_info.name; file_names=cat(1, file_names, {file_name}); file_dates=cat(1, file...
a156602b90dd1ea0a2ed895b237027a267f36b674b33e7e99c029fe5c1e7f0ea
MATLAB
478
20
dirlist = dir('Z:\MATLAB\fieldtrip-20210328\template\layout\*'); addpath Z:\MATLAB\fieldtrip-20210328 %Windows filename = {dirlist(strncmp('neuromag306',{dirlist.name},11)).name}; ft_defaults for i=1:length(filename) cfg = []; cfg.layout = filename{i}; cfg.layout = 'vertical'; layout = ft_prepare_layout(cfg); figur...
ac4afc991d2f00fe15b7b06bdf5ae92c70b7c14f93e91620c579d64dfdeb54b1
MATLAB
478
18
function handles = fix_FixBirthEvent(handles,fly) % add or remove fly's birth event from suspicious sequences list, as appropriate % splintered from fixerrorsgui 6/21/12 JAB f = handles.trx(fly).firstframe; if f == 1, handles = fix_RemoveBirthEvent(handles,fly); else for i = 1:length(handles.seqs) if ~strcmpi(...
bc0584b3a59d2efed8f43a69b7a20d73858d9f952fe5b2e05b752195dbf5d0da
MATLAB
478
15
function make_file_censored_data(handles) surv_file=[handles.env.path_group_list filesep handles.env.group handles.env.original_filename_ext]; ix=handles.mc.surv_ix; n=sum(ix,1); fileID = fopen(surv_file,'wt'); ix1=find(ix(:,1)); T=table(handles.participants.full_path(ix1,:)); writetable(T,surv_file,'WriteVariableNam...
db74beb7deb4d7ae4f1f86032f7a176d64f313df95eb8b7302e6e4d2b7f09678
MATLAB
478
19
function ticks=SONGetTimePerADC(fh) % SONGETTIMEPERADC returns the number of clock ticks per ADC conversion % TICKS=SONGETTIMEPERADC(FH) % FH = file handle % Returns the number of ticks (no error codes) % % See also SONGETUSPERTIME, SONCHANDIVIDE % % Author:Malcolm Lidierth % Matlab SON library: % Copy...
dd21b9ed40a778396d28e8473d1f6b146e2a560385d736178dcc40ea7d3c8de6
MATLAB
478
14
function Source = TR_RecordLoad(Experiment, IDs) % In this version, TREX output x,y variables are stored in a single csv file % under an individual plate folder % or in a csv file containing many other outputs % read these data as a table % in RecordGUI user indicates a particular file. Load only that file Record = ...
ef2dd2c84c98b20cf82bc1a9e22a339656567a00f4d36b0787b3df2343987abc
MATLAB
478
14
% VL_VERSION Obtain VLFeat version information % VL_VERSION() prints VLFeat version number. VL_VERSION('VERBOSE') % prints additional information. % % STR = VL_VERSION(...) returns the ouptut in a string rather than % printing it. % % See also: VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Ful...
30a0bd301698aad3d7b9256ea96644d5ab2fb04bd2bb2bc7e0c811f59697a2dd
MATLAB
479
16
function chantitle=SONGetChanTitle(fh, chan) % SONGETCHANTITLE Returns the channel title % % TITLE=SONGETCHANTITLE(FH, CHAN) % % INPUTS FH is the file handle % CHAN is the channel number (0 to SONMaxChans()-1 % OUTPUT the channel title as a string % % Author:Malcolm Lidierth % Matlab SON library: % Copyright ©...
ef2ddda662f6d1579f8348a3794f48945ff06e96b0ef291427687b596621de8b
MATLAB
479
23
function[] =plot_lambda(Lambda,M) figure(3) colorAU= [0 0 1; 1 0 0; 1 0 1]; state={'SOM','PV','Mixed'}; hold on for pid=1:Np errorbar(1:M, mean(Lambda(:,:,pid,i),2),std(Lambda(:,:,pid,i),[],2)/sqrt(size(Lambda,2)),'-','color',colorAU(pid,:),'LineWidth',2) end legend({'SOM Events', 'PV Ev...
5194a7cb342160fd31edd5e8c572a6859a33b853a9ab8c555f3badf25aa252af
MATLAB
480
17
function X = kargerfit(t,K,init) karger = @(t,tex) 2./(t./tex).*(1-1./(t./tex).*(1-exp(-t./tex))); options = fitoptions('Method','NonlinearLeastSquares',... 'Algorithm','Trust-Region',... 'Upper',[Inf Inf],'Lower',[0 0],'StartPoint',init); ft = fittype(@(K0,tex,t) K0*karger(t,tex),... 'independent','t'); [...
6794abdfe453f75710a9ed06d6c68ffd325ecf2c9c7a38eb3868faaf7c753631
MATLAB
480
24
load('Activity_result.mat'); %select Ch ch = 38 for i = 1:351 x_time(1,i) = -2 + (i-1)*(0.01); end %time-frequencygram f1 = figure contourf(x_time,[1:200],TFA_rawdata(ch).data(1:200,1:351),500,'linecolor','none');hold on; caxis([0 4.5]) colormap(jet); axis xy set(gca,'yscale','log') xlim([-0....
a9d1bfe3a2d20031c4a44630c89a0d6fd5467a1f2c76b2d03e2a3cd5fa7ddd50
MATLAB
480
14
function trigger_times = trigger_times_pretreatment_multi(upindex,trial_from,interval,... trial_number,h) trigger_times = upindex*interval; total_trial_number_in_file = length(trigger_times); if trial_number > total_trial_number_in_file - trial_from + 1 trial_number = total_trial_number_in_file - trial_from +...
ee3d3f11122f9fc70518c7b90b1a000311e2466fb65021d0e919b654a580a716
MATLAB
480
14
% VL_SIMDCTRL Toggle VLFeat SIMD optimizations % VL_SIMDCTRL() returns TRUE if VLFeat SIMD optimizations are enabled % and FALSE otherwise. % % VL_SIMDCTRL(TRUE) enables VLFeat SIMD optimizations. VL_SIMDCTRL(FALSE) % disables them. % % See also: VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian F...
1b39da99d1263df9ffb80925a21c091c8f8556a64e37ce20f22ce1612d5f3e7c
MATLAB
481
16
function H = vl_hat(om) % VL_HAT Hat operator % H = VL_HAT(OM) returns the skew symmetric matrix by taking the "hat" % of the 3D vector OM. % % See also: VL_IHAT(), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat library and is ma...
5e19fe531a35df46d378c4135d9d9a2a6397f350e5a0fc706b7d263d20528e52
MATLAB
481
17
function handles = fix_RemoveDeathEvent(handles,fly) % removes a death event for a fly % splintered from fixerrorsgui 6/21/12 JAB for i = 1:length(handles.seqs) if strcmpi(handles.seqs(i).type,'death'), if fly ~= handles.seqs(i).flies, continue; end if isempty(handles.doneseqs), handles.dones...
fdec3900dc1debf190d7a7faf4ae7880e83d22d5b8bfe60bf6923a30f1f9f3e7
MATLAB
481
17
function color_new = changecolor(color_old) if (color_old == [0 1 0 ]) color_new = [1 0 0]; elseif (color_old == [1 0 0]) color_new = [0 1 1]; elseif (color_old == [0 1 1]) color_new = [0.8 0.8 0.8]; elseif (color_old == [0.8 0.8 0.8]) color_new = [1 0 1]; elseif...
2162265df60ba986e3d39ba243841f308de3b2fef6c9d948a06a30d2753b0030
MATLAB
482
16
function y = vl_aibcutpush(map, x) % VL_AIBCUTPUSH Quantize based on VL_AIB cut % Y = VL_AIBCUTPUSH(MAP, X) maps the data X to elements of the AIB % cut specified by MAP. % % The function is equivalent to Y = MAP(X). % % See also: VL_HELP(), VL_AIB(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % ...
396c6554d7855a4ecc98312d8e751c5fb00817601622845c3cd0b5f1eea853df
MATLAB
482
17
function [p_l, p_r] = perceptual_state(stimulus,sigma,bias) % computes the perceptual evidence (here probability) for being in a LEFT or % RIGHT state resolution = 0:0.001:4; measurement_sample = normrnd(stimulus+bias,sigma); measurement_distribution = normpdf(resolution,measurement_sample,sigma); %measurement_distri...
8410946bd664f1be0c8399d9fe037034bdd98ae2473b51306cb8ee2b62016a5b
MATLAB
482
17
function[silhouettes]=get_silhouettes(alldistances,ident) silhouettes=nan(size(alldistances,1),1); for i= 1:size( alldistances,1) % get silhouette score if ident(i)==1 silhouettes(i)=(alldistances(i,2)-alldistances(i,1))/max(alldistances(i...
aa6a4885edf5a8fd3f387b2e2f852eb1f4ce4a111802c9538ae4155dcd7a286d
MATLAB
482
26
function e = ChangeEdges(e, a, b, c) % This function replaces in the edge list 'e' the merged blobs a and b with % their fusion 'c'. for i = 1:size(e,1) if (e(i,1) == a) e(i,1) = e(i,2); e(i,2) = c; end if (e(i,2) == a) e(i,2) = c; end if (e(i,1) == b...
0302dc3de9c5b704f58e586d56a845851dbe468f7814e219459a30ee2ffff355
MATLAB
483
22
function output = convCut(stimulus, impulse, nTerms) % Function to trim time series to initial length after convolution % % convCut(stimulus, impulse, nTerms) % % INPUTS % stimulus : a stimulus time course % impulse : an impulse response function % nTerms : number of terms after cutting % % OUTPUT(S) % ...
2e4d84f17b77ba14269ffa8f823162677466fccf93f844f74c88b01a0a6e8fd3
MATLAB
483
19
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [randMaps, randIndices] = ml_util_shuffle_table_maps(maps) % This will shuffle a table of maps with no repetitions. numMaps = size(maps,1); randIndices = randperm(numMaps); randMaps = maps(randIndices); ...
3dcc3841f324a70a574ae6dded41957ba32d8fdc78ab8d58f0abe9dcfe5381fa
MATLAB
483
15
function [cells] = findUniqueCells(sessionRatemap) % just a helper function to tell me what cells are present in a given % session. Ratemap structs at the moment only tell you how many cells are % in a trial, but if a cell doesn't meet threshold for a given trial, it % won't exist for that trial. Not fair to the cell t...
a302ca36fc763c026664d0f4ad5d8cbf8729fa09b2c0d13b317c6d790a6d3e1a
MATLAB
483
15
function f = vl_ertr(f) ; % VL_ERTR Transpose exremal regions frames % F = VL_ERTR(F) transposes the frames F as returned by VL_MSER(). This % conversion is required as the VL_MSER algorithm considers the column % index I as the frist image index, while according standard image % convention the first coordinate is...
f1532c235ed2312f5b37876e8dda851fe6b9f2f41b00cb558ab9a88dd2186e2f
MATLAB
483
11
function [imagesCellTrain, filenameTrnPCA] = loadImagesTrainingColor(files, dirDB, allIndexes, indImagesTrain, numImagesTrain) %init vectorIndexTrain = allIndexes(indImagesTrain); filenameTrnPCA = cell(length(vectorIndexTrain), 1); imagesCellTrain = cell(numImagesTrain, 1); for i = 1 : length(vectorIndexTrain) fil...
68150adca83aa24fd179f992ffa24cb1f0d734816dccdea4c1860afd7a2d2baa
MATLAB
484
15
function [output_matrix] = SpaceMapping(input_matrix, xx) %SpaceMapping takes in a linspace xx and an arbitury input_matrix and looks %up the indecies in xx closest to each element of the input_matrix to %generate the output_matrix %figure out the equation that maps xx slope = (xx(end) - xx(1))/length(xx); ...
bd627f1c999d0d1b8259091bd6b3467df6d1ec6ab458fbd863a9ad9d52f5b223
MATLAB
484
16
function coord = readFilename(folder,pattern) % read filename in folder and return coordinates of all dots % Detailed explanation goes here files = struct2cell(dir(folder))'; filenames = files(:,1); col = count(pattern,'%f'); coord = zeros(length(filenames),col); for i = 1:length(filenames)...
63041befd0278640569898ec9e3cff1accaa37befe27c7d9500f337295b3d285
MATLAB
485
20
function [bytes]=SONChanBytes(fh, chan) % SONCHANBYTES returns the number of bytes written, or buffered, on the % specified channel % BYTES=SONCHANBYTES(FH, CHAN) % FH SON file handle % CHAN Channel number 0 to SONMAXCHANS-1 % % % Author:Malcolm Lidierth % Matlab SON library: %...
0066778c38f29fba4cbac2ad53e5c8abb37e7c2053319e81f20bcdbf3103b63d
MATLAB
486
17
function [mode_model] = modeModelFcn(vid,numModFrames,maxTime) %max time is in seconds (Nick) tFrames = maxTime * vid.FrameRate; frame_id = round(rand(1,30)*30); frame_id = frame_id(frame_id>0); im_rep = []; for i = 1:length(frame_id) % frame_id = round(rand(1,1)*vid.Duration); get_im = rgb2gray(read(vid,frame_...
ceb98e4ef206654bf1d5cc965f587cccd4c4dde7a835005caaa1284fabf9ed43
MATLAB
486
20
%# -*- texinfo -*- %# @deftypefn {Function File} {} X = gamlike ([@var{A} @var{B}], @var{R}) %# Calculates the negative log-likelihood function for the Gamma %# distribution over vector R, with the given parameters A and B. %# @seealso{gampdf, gaminv, gamrnd, gamfit} %# @end deftypefn %# Written by Martijn van Ooster...
a73cf98868427c30266d3b0c41069827d82b5f6bacb4a9851861fe363f96689b
MATLAB
487
16
function noise = noise_PSD(traces_input, pct) % pct = 2/3; traces_raw = traces_input - mean(traces_input,2); T = size(traces_raw,2); spectrum = fft(traces_raw,[],2); spectrum(:,1) = 0; % power = abs(traces_raw).^2; PSD = abs(spectrum).^2/T; % plot(sum(PSD,2)./sum(power,2)); above = ...
1d5e0776363f0caf9a4b9a910f342220476bf5f5c061bd293e8c75b62d9da02f
MATLAB
488
19
function dps_seq = dpss(seq_length,time_halfbandwidth) % DPSS approximate the discrete prolate spheroidal (DPSS), or Slepian sequences % using a precomputed version on disk persistent w if isempty(w) % load the precomputed tapers only once load precompute_dpss end n = 1000; s = 1:0.5:50; % find the nearest matc...
778945139fc0fec438f4696f08d0fb2d95ad7a5bbb7c5aa90accd83187fb3a6b
MATLAB
488
34
% % Compute the steps % % PARAMETERS % $network % % INPUT % dat/info.$network % % OUTPUT % dat/stepsi.$network % The list of step values as text, with one number per line % count = 100; network = getenv('network'); info = read_info(network); stepsi_data = floor((1:count) * info.lines / count); filename = s...
d0ee3947a49496086c4606657cfee2d1b82d8cee2bbf755660d453223c353dde
MATLAB
488
18
function ml_util_json_save(data, jsonFilename) % Save a struct as JSON-formatted text, and make it pretty jsonTxt = jsonencode(data); % Make it prettier jsonTxt = strrep(jsonTxt, ',', sprintf(',\n')); jsonTxt = strrep(jsonTxt, '[{', sprintf('[\n{\n')); jsonTxt = strrep(jsonTxt, '}]', sprintf('\n}\n]')); fid = fopen(...
4ea38c4e695381a80ba5a67f170adcaf89c48b1b6c27af662798e9fe27ddb8cb
MATLAB
489
23
function disp(obj) % Disp a NIFTI-1 object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: disp.m 8776 2013-11-14 09:04:48Z roboos $ sz = size(obj); fprintf('NIFTI object: '); if length(sz)>4, fprintf('%d-D\n',length(s...
6cd678105415c6e7e9d7a3e99fee491b98c4384544116ac88bac61d64be75433
MATLAB
489
17
function [] = bemf2_graphics_base(P, t, c) % Surface plot % Copyright SNM 2017-2020 p = patch('vertices', P, 'faces', t); p.FaceColor = c.FaceColor; p.EdgeColor = c.EdgeColor; p.FaceAlpha = c.FaceAlpha; daspect([1 1 1]); xlabel('x, m'); ylabel('y, m'); zlabel('z, m'); NumberOfT...
ef83c8e146699550dba8f29792acbdc5a4e4fbd2307d13eb3548bc55cadf16d9
MATLAB
489
24
function node_scores=my_logsoftmax(node_scores) if size(node_scores, 1)>1 node_scores=bsxfun(@minus, node_scores, max(node_scores, [], 2)); tmp_node_scores=node_scores; node_scores=exp(node_scores); node_scores=bsxfun(@minus, tmp_node_scores,... log(sum(node_scores, 2))); else node...
2687f5966c26a3661865bc46a674697b1320ffdbc49b812631a672e534c43a8f
MATLAB
490
18
function [] = mglEyelinkClose() % mglEyelinkClose - Closses a connection to an SR Resarch Eyelink eyetracker % % Usage: mglEyelinkClose() % program: mglEyelinkClose.m % by: eric dewitt % date: 08/03/09 % copyright: (c) 2009,2009 Eric DeWitt, Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % ...
d29dde64bc984f2e654e8fa94b446ce5a1e31e559104b04c2e8b82ada51306a5
MATLAB
491
15
function CM = gradedColormap(StartingColor,EndingColor,CMHalfSize) % % CM = gradedColormap(StartingColor,EndingColor[,CMHalfSize]) % % Copyright Maurizio Mattia - Mar. 14, 2021 % if ~exist('CMHalfSize','var') CMHalfSize = 32; end FirstCM = linspace(1,0,CMHalfSize)'*StartingColor; FirstCM = FirstCM + li...
affe35fd663e5738531785b3197ba971d0e9dd970c4b4a99a2e6287c6a2b649e
MATLAB
492
20
function J=vl_imsc(I) % VL_IMSC Scale image % J=VL_IMSC(I) scales the range of the gray-scale or color image I to % fit in the interval [0,1]. % % See also: VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat library and is made avail...
b0c7fe0fd7e716b33a06e87ea3f2d837185832ececb8a882c154bffce40579d1
MATLAB
492
18
function handles = fix_FixDeathEvent(handles,fly) % add or remove fly's death event from suspicious sequences list, as appropriate % splintered from fixerrorsgui 6/21/12 JAB f = handles.trx(fly).endframe; if f == handles.nframes, handles = fix_RemoveDeathEvent(handles,fly); else for i = 1:length(handles.seqs) ...
ea4c99ba36e9995f54f452149b8d19a3e82a91b1e8b5e04c8a292d46bf6cdd01
MATLAB
492
11
function ml_egomaps_draw_segments(segments) % Each row has x1y1x2y2 coordinates for a line segment hold on for k = 1:size(segments,1) plot(segments(k,1), segments(k,2), 'ro', 'markerfacecolor', 'r', 'markersize', 10); plot(segments(k,3), segments(k,4), 'ro', 'markerfacecolor', 'r', 'markersi...
2bcbda36ba9f95ccf1e3d5f02c0b532412e5e01b57537a5fe62fe1076c674666
MATLAB
493
8
%----FUNCTION: % extract statistical color features (mean and standard deviation) from various of color spaces (RGB, HSV, LAB, Opponent color space) function [gradArr_c, gradArr_s] = sp_gradient_grid_cs(chns, grid_x, grid_y, patch_size, surrWidth) nPatch = numel(grid_x); nDims = size(chns.dog, 3) + size(chns.gabor...
bcb8f866e5bd56cc562c815e155c04eedf8b9383a11e481191cb0d7828e495de
MATLAB
493
19
function v_SigFilt = f_SOSfilt(pst_Filter,pv_Signal) s_Scale = double(pst_Filter.G); pst_Filter = double(pst_Filter.SOS); [s_SecNum,s_CoefNum] = size(pst_Filter); if s_CoefNum ~= 6 error('[ERROR - f_sosfilt] - Filter Matrix is not SOS') end v_SigFilt = double(pv_Signal); for kk = 1:...
9bc28e186de7fe02a6b998847df7f461780a760104df0e5426642869f4997dc3
MATLAB
494
19
function [f,P1] = getPSD(sig,maxFreq) %GETPSD get power spectrum density % already remove the first freq value % return f(n), P1(n,conds), n is the linear point of f axis. Fs = 100000; % Sampling frequency L = size(sig,1); % Length of signal Y = fft(sig); P2 = abs(Y...
9f553d94db5ad0e0adf9d69d90b62fad096b179c382634be5f73c3649945c6c9
MATLAB
494
16
function chantitle=SONGetChanTitle(fh, chan) % SONGETCHANTITLE Returns the channel title % % TITLE=SONGETCHANTITLE(FH, CHAN) % % INPUTS FH is the file handle % CHAN is the channel number (0 to SONMaxChans()-1 % OUTPUT the channel title as a string % % Author:Malcolm Lidierth % Matlab SON library: % ...
a7e51b484455221bdbfd3e86dbbe686b4559d220e14efbfd3066aa76ee1038ad
MATLAB
494
18
%% get heritability and p-value of each edge load('heritability_VBM.mat') her_real = heritability(1,:); her_rand = heritability(2:end,:); roi_num = 48; edge_mask = logical(tril(ones(roi_num),-1)); her = zeros(roi_num); her(edge_mask) = her_real; her = her + her'; her_p_vector = (sum(repmat(her_real,size(her_rand,1),...
fc5b0d06dbfa0793212fd441bc50aadfb2a6292a83c26170c6c808b4c9ec039d
MATLAB
494
16
opF = mouse: 'Thalamus45' date: '20160601' nucleus: 'VPM' whiskers: 'W' CSCs: [1 2 3 4 5 6 7 11 12 13 14 15 16] sRate: 1000000 time_start: 5.2796e+09 time_end: 8.8507e+09 Timestamps: [1x89280 double] ...
6105a202b7200293263813a53ec887b00ad69222c31a502769d5987029484764
MATLAB
495
7
OPT_S.las_SLM_flag = 1; OPT_S.cam_SLM_flag = 1; activate_func_had_fin(SC,OPT_S); %activate final function on both SLMs I=take_unsaturate_photo(SC,'BSI'); figure(1795);imagesc(I);title(['ind: ' num2str(ind_it) ' of: ' num2str(OPT_S.total_reps)]) OPT_S.ints(1) = sum_middle(I,OPT_S.mid_p...
99016f9d7e73236d4e75cdfc81daaba131e2a23cb9cc00a7e5af4849a052acce
MATLAB
495
19
function [quality] = ml_cai_quality_led_separation(x1, x2, minSep, maxSep) % x1 should be (N,2) where x(1,:) = i, j N = size(x1, 1); if size(x1) ~= size(x2) error('The sizes of x1 and x2 must be the same.') end % Calculate the distance between the two leds sep = sqrt( (x1(:,1) - x2(:,1)).^2 + (x1(:,2) - x2(:,2)).^...
15110a41f5a2c61961b46843d6b4efd7e638e510a883b6ae4b0a7be332f289bc
MATLAB
496
19
function ticks=SONGetTimePerADC(fh) % SONGETTIMEPERADC returns the number of clock ticks per ADC conversion % TICKS=SONGETTIMEPERADC(FH) % FH = file handle % Returns the number of ticks (no error codes) % % See also SONGETUSPERTIME, SONCHANDIVIDE % % Author:Malcolm Lidierth % Matlab SON librar...
2d1ecb76a5781a6efefa078a7b6d14719b76070ffdb3d0a50769747402821d0e
MATLAB
496
21
% function f_Matrix2RelAmplitud.m % function m_RelPowAmp = ... f_Matrix2RelAmplitud(... pm_InMatrix) if nargin < 1 error('[f_Matrix2RelAmplitud] - ERROR: bad number of parameters!') end m_RelPowAmp = pm_InMatrix; clear v_SumArray v_SumArray = sum(pm_InMatrix, 2); fo...
720e10d82b9face9a7d9cedf85c53a0bc74763456b37b6db3406f3e3d9717d14
MATLAB
496
19
function class_info=gen_class_info_person_parts() class_info=[]; class_info.class_names={'background'; 'Head'; 'Torso'; 'Upper Arms'; 'Lower Arms'; 'Upper Legs'; 'Lower Legs'}; assert(length(class_info.class_names)==7); class_label_values=uint8([0:6]); class_info.class_label_values=class_label_values; clas...
9bcbd0522dcdb360cb27d8a7eae03e038dcdb1ee9b6df7de2fea63f68b6ffa43
MATLAB
496
8
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [hFig] = plot_per_day_animal_averaged_rate_difference_matrix(DaysToSessions, RateMatrices, perCellNormalizationMethod, perAnimalNormalizationMethod) T = compute_per_day_animal_averaged_rate_difference_matrix(DaysToSessi...
a3fc531522bb251b54a369b746a4ec6f880265e0da10991ff0be8a70a32d3969
MATLAB
496
19
function [PDF,lags] = isiPDF2D(delta_mat) %isiPDF2D.m % will not look for serial dependencies across rows ISI = getISI(delta_mat,true); ixOK = cellnumel(ISI) >= 2; ISI1row = cellfun(@(x) x(1:end-1), ISI,'UniformOutput',false); ISI1 = cell2mat(ISI1row(ixOK)); ISI2row = cellfun(@(x) x(2:end), ISI,'UniformOutput',false)...
04e89203cdeaa3e499bcb42ccfd5c3d85083a0902205bc5877ba1388d0eb64c8
MATLAB
497
20
function t = structn(obj) % Convert a NIFTI-1 object into a form of struct % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: structn.m 8776 2013-11-14 09:04:48Z roboos $ if numel(obj)~=1, error('Too many elements to conv...
fe4eed243267b254c4b7971ccd2f5e1844d5d63366106930cd5083cee4d4dee5
MATLAB
497
19
function [err]=SONBookFileSpace(fh, lspace) % SONBOOKFILESPACE Allocates disk space for a file % ERR=SONBOOKFILESPACE(FH,LSPACE) % FHH SON32.DLL file handle % LSPACE space in bytes % Returns 0 or a negative error code % % Author:Malcolm Lidierth % Matlab SON library: % C...
a30741b2709e26ec54bef85b7dfdfadff816444d4544b7e672f8ae8d044a6e8a
MATLAB
498
18
function direction=find_upcoming_direction(current_target,next_target) %% find_upcoming_direction finds the angle of the upcoming arm reach based on the targets' position % INPUTS % current_target: [x,y] position of the current target % next_target: [x,y] position of the following target % OUTPUT % direction=angle be...
be5fb71d2e16992d2628df3d4b9b297d005e9436f56dbfa12c058a73ef218734
MATLAB
498
23
function [s, mask] = vectorize_mask(S, mask) if nargin == 1 mask = ~isnan(S(:,:,:,1)); end if ismatrix(S) n = size(S, 1); [x, y, z] = size(mask); s = NaN([x, y, z, n], 'like', S); for i = 1:n tmp = NaN(x, y, z, 'like', S); tmp(mask(:)) = S(i, :); s(:,:,:,i) = tmp; end else nl = length( mask...
be66dc2b4b1bb61f921425dc7ce618fe9aea6432e1f3ec53c3278e3b747a1486
MATLAB
499
24
function sdf = plotSpikeDensityfunction(spikeTimes)%% Spike Density Function %% Get Data spikeTimes = round(spikeTimes*1000)/1000; timeVec = [0:1/1000:33.0160]'; timeVec = round(timeVec*1000)/1000; binned = timeVec == spikeTimes'; binned = sum(binned,2); %% Kernel kernel_sd = .05; edges = -3 * kernel_sd : .001 : ....
5950d7e26eab42e90eda8dbbc0b113177cc7d33800f5087dd640576bb520c007
MATLAB
500
25
%% compare edge via TFNBS load('group_data_DBM.mat') roi_num = 48; data_group{1,1} = data.HC; data_group{2,1} = data.MS; data_group{3,1} = data.NMO; M = 10000; Mask_net = ones(roi_num); Mask_net(1:length(Mask_net)+1:end) = 0; Pthr = 0.05; E = 0.5; % extension enhancement parameters H = 2.25; % height enhancement ...
6c02e5e4a42c1bc49668339d1cb6621fe41961dc1f489962804a13b6786f9733
MATLAB
500
15
function y = vl_dsigmoid(x) % VL_DSIGMOID Derivative of the sigmoid function % Y = VL_DSIGMOID(X) returns the derivative of VL_SIGMOID(X). This is % calculated as - VL_SIGMOID(X) * (1 - VL_SIGMOID(X)). % % See also: VL_SIGMOID(X), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All righ...
77e763ee874715d529bb4ebe4dc519d5aba37b468799b5232baaa4df8ceeb14f
MATLAB
501
23
% % Read a network statistic. % % RETURN VALUES % data (k*) Vector of all computed values % % PARAMETERS % statistic Internal name of statistic % network Internal name of network % k (optional) Number of values to return; by % default, return all values % function data = read_statistic(statistic, network, k) ...
984da0ea9e2b996d108224f4bb5f811306b2f7ddefebe9524be42287bb66ee64
MATLAB
502
16
function traces=generate_traces_from_masks(video,masks) % Generate traces for each neuron from ground truth masks [Lx,Ly,T]=size(video); [Lxm,Lym,ncells]=size(masks); if Lx==Lxm && Ly==Lym video=reshape(video,[Lxm*Lym,T]); else video=reshape(video(floor((Lx-Lxm)/2)+1:floor((Lx+Lxm)/2),floor((Ly-Lym)/2)+1:floor...
4ef51b908b37a34a490e8b3050d44c33dfd3e3426ac129a968f4601426d661c2
MATLAB
503
18
<<<<<<< HEAD function template = createTemplate(result_f, general) % if there isn't an enroll function stop the process try template = feval(general.ENROLL_function, char(result_f(1))); catch template = ''; % FTE value ======= function template = createTemplate(result_f, general) % if there isn't an enroll fu...
213ac51dd1ef67c7169ef56fbb23b87d7dd81d9ab1d54a0f4b7b83ea65700d2e
MATLAB
504
20
function [bytes]=SONChanBytes(fh, chan) % SONCHANBYTES returns the number of bytes written, or buffered, on the % specified channel % BYTES=SONCHANBYTES(FH, CHAN) % FH SON file handle % CHAN Channel number 0 to SONMAXCHANS-1 % % % Author:Malcolm Lidierth % Matlab SON l...
44bc89ea60051ff671c5e15792fb1846d6b8b7a1bcb3bac72bfe1fabfa42ae76
MATLAB
504
17
function path = vl_root % VL_ROOT Obtain VLFeat root path % PATH = VL_ROOT() returns the path to the VLFeat installation. % % See also: VL_SETUP(), VL_HELP(). % Authors: Andrea Vedaldi and Brian Fulkerson % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of ...
5da5a86ba2f3b679b1b062b304ba40ada88955abdc80860288e8124b7e7d8f5c
MATLAB
504
26
function y=rmvspikes(x,W); if nargin<2, W=5; end; dx=detrend(diff(x)); ii=find(abs(dx)> 2*std(dx)); jj=ones(length(dx),1); jj(ii)=0; SD = std(dx(find(jj))); ii=find(abs(dx)> 2*SD); ii = reshape(ii,1,[]); %ii=ii'; y=x; LL = length(y); for i=ii, if i<W+2, y(1:i+W) = y(i+W+1); elseif i>LL-W-...
427376ca877f69f3b1e6de0194e91602e8b8139a7c1df75bb9cc5fec2e997cb5
MATLAB
505
19
function x = calc_FD_HCP(prefix,brain_radius_in_mm) if nargin < 2 brain_radius_in_mm=50; end %% Read the first 6 columns formatSpec = '%f%f%f%f%f%f%[^\n\r]'; fileID = fopen(prefix,'r'); dataArray = textscan(fileID, formatSpec, 'Delimiter', '', 'WhiteSpace', '', 'ReturnOnError', false); fclose(fileID); X = [dataA...
7922d62b64ef7622ca65d923b0a5ba4073eda67f3e26a2cc86547aa6daef5749
MATLAB
505
11
mice = {'EC1-1R','EC1-1R','FL5-3L','FL5-3L','FU1-00','FU1-00','GE3-00','GE7-1L1R','GE7-1L1R','GS2-1L','GS8-00','GS8-00'}; dates= {'2021-11-05','2022-01-13','2022-03-09','2022-04-18','2022-03-17','2022-05-10','2022-10-27','2022-10-20','2022-12-20','2022-11-21','2022-11-23','2022-12-20'}; decon_matrices=cell(12,1); for...
c16d2fb242c7cdccb595da1f665e0de50c83fd88a4561efa79a059b868280542
MATLAB
505
14
function [boxesOut uniqueIdx] = BoxRemoveDuplicates(boxesIn) % function boxOut = BoxRemoveDuplicates(boxIn) % % Removes duplicate boxes. Leaves the boxes in the same order % Keeps the first box of each kind. % % boxesIn: N x 4 array containing boxes % % boxexOut: M x 4 array of boxes witout duplicates...
cc7e53c0f9bf78392aff6df7447060b90c72a4272c8a6f0415f04e4db08ba081
MATLAB
505
15
function [folders] = ml_dir_regexp_folders(containerFolder, str) % Get all of the matching child folders. files = dir(fullfile(containerFolder, '*')); keep = zeros(1, length(files)); for i = 1:length(files) if regexp(files(i).name, str) & files(i).isdir == 1 keep(i) = 1; else...
caaa7f6938e162735ba9722488566cd3551da19de2f7372f1d0de342f971ec06
MATLAB
506
18
classdef MLExperimentInterface < handle %MLExperimentInterface Interface to an experiment % An interface to an experiment methods (Abstract) getAnimalName(obj) getImagingRegion(obj) getExperimentName(obj) getArenaGeometry(obj) getNumSessions(obj) getSes...
75ee96fb1d30286189e9935103ce0ef240eb4c4233c231c73d79863d5e3f1d5c
MATLAB
507
18
function nblocks=SONBlocks(fh,chan) % SONBLOCKS returns the number of blocks written to disk for the channel % [NBLOCKS]=SONBLOCKS(FH,CHAN) % FH SON file handle % CHAN is the channel number from 0 to SONMAXCHANS-1 % Returns 0 or the number of blocks; % % Author:Malcolm Lidierth % ...