sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8385451962e89ec96cab85d090204b0f06ff0084c54ff3cf637d8bb837a838df
MATLAB
686
28
% % Compute a spectral network statistic for a full dataset. % % PARAMETERS % $statistic % $decomposition % $network % % INPUT % dat/info.$network % dat/decomposition.$decomposition.$network.mat % % OUTPUT % dat/statistic.$statistic.$network % Same format as generated by statistic_comp.m % network = getenv('networ...
8c869485953e5e81778254e7ffd40100f9fe07960b161b3f7c8ee440f00e63d5
MATLAB
686
31
% % Convert a spectrum to real values that can be visualized. % % In all cases we take simply the real part, except for skew % decompositions, where we take the imaginary part. (A more complex % example would be the complex logarithm for orthogonal matrices, whose % eigenvalues are unitary.) % % RESULT % ret Real va...
9a552365199274d8cba48130ed1c4249d6bfd00aa3b17a5e627ad2a808e1fdc9
MATLAB
686
36
% f_Secs2hms.m [As a part of HFO Detection Project] % Written by: % Miguel G. Navarrete Mejia % Electrical Engineering MS candidate % UNIVERSIDAD DE LOS ANDES % Colombia, 2012 % mnavarretem@gmail.com function v_HMS = f_Secs2hms(ps_secs) if ~isscalar(ps_secs) && ~isreal(ps_secs) v_HMS = [0 0 0]; ...
edaa9dea4f60dff900995970440c3e2c436b2e9bf727dbf80da880e9b3567021
MATLAB
686
30
function [H,lags] = spikeHazard(delta_mat,time_dim) %spikeHazard.m 5/20/22 % inputs: % delta_mat: binary matrix, spike occurrence = 1 % time_dim: 1 if time down rows, 2 if time across cols % outputs: % H: vector (row, col for time_dim 2,1) % hazard function up through max lag in delta_mat % lags: using discrete survi...
0902e6791e1799d9080f9c8e58ec6be24265ef2d1ed8af93bc6aaf1f307eb30b
MATLAB
687
25
function Q = vl_imseg(I,labels) % VL_IMSEG Color an image based on the segmentation % ISEG = VL_IMSEG(I,LABELS) labels ISEG with the average color from I of % each cluster indicated by LABELS. % % See also: VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This fil...
2cbb149f0cac81afec06866cacb26c270fdc1c2eee93ca0b28951a70bd292aab
MATLAB
688
30
% % Compute neighborhood predictions, based on paths of length 3. % % RESULT % predictions Struct by submethod name of (e*1)-vectors % containing the predictions % % PARAMETERS % A Adjacency/biadjacency matrix % T (e*2) Vertex pairs for which to compute predictions % format Format of network % weights Weights ...
f9d45dd3da2f1063ef84aff0248daf6a148149e13893457205f085ba703046db
MATLAB
689
29
% filtEphysNoSpikes.m % % Median filters ephys trace to remove spikes. % % INPUTS: % voltage - voltage trace % t - time at each sample, in seconds % filtOrder - order of filter, in seconds; i.e. number of seconds to take % median over % % OUTPUTS: % filtVolt - filtered voltage trace % % CREATED: 9/14/20 ...
a41711914d2950e25cc8c7fd5599089e1ca70e0297ff675fbf8bd6b56196ff63
MATLAB
690
35
function [Y,D] = get_D_matrix_condition(D,condition,type,bin_size,beginning,ending) start_frame = 1 Y = []; elimvect=[]; for tr = 1:length(D) if strcmp(type,'onsets') D(tr).spikes = D(tr).data_o(:,start_frame+beginning:start_frame+beginning+ending); elseif strcmp(type,'events') D(tr).spikes = D...
c5a5d5fcffb2e782b3b32b576dddce4a372f8150b499601f53edc8db9147b3c8
MATLAB
690
24
function [bins, n_norm, max_y] = f_single_IBIh(ibis, fc, max_x, binsec) % Computes the Inter-Burst Interval Histograms of the input ibis % max_x = maximum value of IBI considered [s] % fc = sampling frequency [Hz] % binsec = bin size (sec) warning off all bins = binsec/2:binsec:max_x; % IBI bins Nbins = leng...
2c97df5e5b07ff7734997628236e8f4f2080272ff217207f64078d6c24796a49
MATLAB
691
35
function varargout = fname(varargin) % Format % For getting the value % dat = fname(obj) % % For setting the value % obj = fname(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: fname.m 8776 2013-11-14 09:04:48Z robo...
6b920b3d671d02bb160f082176a8f908e283d302b21500fb28d0a37bc819844e
MATLAB
691
32
clear all; clc; % Define paths datapath = '/'; savedir = '/'; % Load data cd(datapath) % load group PCA data here data = CatScore'; clear CatCoeff CatEigVal groupname CatScores % Loop over different numbers of ICs tic for NumIC = 10:10:100 disp(['NumIC = ' num2str(NumIC)]) tic % Run icasso [iq, A, W,...
42a6621a8011dffe8364df7f9cc9834bce28c36ed42dcf76e7141b46c9eca5d1
MATLAB
692
29
function [Y] = FFT2(X, Fs) % fft2 Fourier transform algorithm % Input£º X £ºInput data matrix, the data format is [Ntime*Nchans], where Nchans % is number of channels (EEG electrodes) and the Ntime is the number of EEG samples % Fs£º the sampling frequency (in Hz) % Output£º y: Data after Fast Four...
50327ef5b051741956023d7b0287d65ae11ad5967bbc288e99def6e16b13636d
MATLAB
692
29
% moveAvgFilt.m % % Function to perform moving average using specified time window to average % over. % % INPUTS: % in - input time trace to perform moving average on % sampRate - sampling rate of input % avgWindow - time window to average over, in seconds % % OUTPUTS: % out - the filtered input % % CREATED: 3...
64ae015b3aa55181741aa29aee46a4452183c2ce7e12f47910cb760e9e2bacdd
MATLAB
692
24
function nii = nii_img_update(nii, Params) % function nii = nii_img_update(nii, Params) % % Author: Xu Li % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % % flip nii.img if needed to fit the nifti_hdr % check Params.nifti_flp_sli and Params.nifti_flp % if Params has nifti_flp_sli, flip ...
d1e6744c666fb9ee43910551c322a8ff17f8c531015ac9165522605cb8cbfdac
MATLAB
693
25
% get ROI center distances from fsaverage Desikan atlas % % 2023-10-13 Jonathan Wirsich function distED = getEuclidianDistanceDesikan() regions = 68; %load Euclidian distance reflect_folder = fileparts(mfilename('fullpath')); temp = importdata(fullfile(reflect_folder, '../../data/desi_coord_68.txt'), '...
e0026a73086ce53cdcaf01ac60a9b60c7ffbc5511b3fe1f0d8b71f69daaa7cb4
MATLAB
694
22
function intersection = BoxIntersection(a, b) % intersection = BoxIntersection(a, b) % % Creates the intersection of two bounding box sets. Returns minus ones if % there is no intersection % % a: Input bonding boxes "a" % b: Input bounding boxes "b" % Note: size(a,1) == size(b,1) OR eith...
6eb455ef02e0504dcdb59a59bc5512da4ece40779fff1ae42fce67aee454cb78
MATLAB
695
24
frame_id = round(rand(1,100)*vid.NumFrames); frame_id = frame_id(frame_id>0); % im_rep = []; vid.CurrentTime = 0; for i = 1:length(frame_id) % frame_id = round(rand(1,1)*vid.Duration); get_im = rgb2gray(read(vid,frame_id(i))); % get_im = im2gray(readFrame(vid)); im_rep(:,:,i) = (get_im); i end dis...
cb6a5e00c78a255f1b5b4086a9330f024ff874b730fb8645b73a5cbf0221c81a
MATLAB
695
22
function handles = SetFlyColors(handles) % set the order we will assign colors to flies % splintered from fixerrorsgui 6/23/12 JAB D = squareform(pdist((1:handles.nflies)')); isassigned = false(1,handles.nflies); D(:,handles.nflies) = nan; handles.colororder = zeros(1,handles.nflies); handles.colororder(1) = handles.n...
2ceeb705f7918916ff583c58a2d6d62643066f7b449a066bff5aad73e56a5821
MATLAB
697
31
function [A xy] = star_graph(n) % STAR_GRAPH Generate the star graph of order n % % The star graph is a simple star with n vertices. Vertex n is the center % vertex. % % [A xy] = star_graph(n) generates a star graph with n vertices and % returns the adjacency matrix in A. The matrix xy stores two-dimensional % coord...
603eb6207b2bac1001cfb7a1ace466679aa8a6b8ea62c0a506c5faae5f3ce33a
MATLAB
697
34
%% Create tracks object :) function [tracks] = creatFirstTrack2(data) %create first frame % create an empty array of tracks tracks = struct(... 'id', {}, ... 'data', {}, ... 'totalVisibleCount', {}, ... 'consecutiveInvisibleCount', {},... 'predictedCentroid',{},... 'age',{}); ids = 1:size(data{...
3f625c086660c77b89dae61922ec471d1e2b870bc7bd4c517d7c85b0d693dc57
MATLAB
698
35
function varargout = fname(varargin) % Format % For getting the value % dat = fname(obj) % % For setting the value % obj = fname(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privatefname.m 8776 2013-11-14 09:04:4...
bce798f7929520a33b9a3086ae7c67997ce4cb2cf3a695a89beafcf4de8cf514
MATLAB
698
29
function imageOut = rescaleImage(image,scale) %rescales an image s = size(image); s2 = round(s*scale); if min(s == s2) == 1 imageOut = image; else if scale > 1 startIdx = floor((s2 - s)/2); imageOut = imresize(image,s2); ...
f6ba5a9c66d219e3acf6766293bf2214aeee3bdd6715ce2cdc51e47b4a97d18e
MATLAB
698
17
function ver=SONVersion(varargin) %SONVERSION returns/displays the version number of the matlab SON library % % VER=SONVERSION % returns and displays the version while % VER=SONVERSION('nodisplay') % suppresses the display % % Author: Malcolm Lidierth 10/06 % Copyright © The Author & King's College London ...
425d7c20479b226dfe53221a04c9f5ad7a9200d2fd1de12b4c204146c77d2364
MATLAB
699
38
function h=vl_plotgrid(x,y,varargin) % VL_PLOTGRID Plot a 2-D grid % VL_PLOTGRID(X,Y) plots a grid with vertices (X,Y). X and Y are MxN % matrices, with one entry per vertex. % % H=VL_PLOTGRID(...) returns the handle to the grid object. % % See also: VL_HELP(). washold = ishold ; [M,N] = size(x) ; hold on ; xh...
b988de3b660ce993f998083d11ec07a232f6dbaae8b0e4cc5cb26089f4128d8b
MATLAB
699
34
%try_circ_fit % % IB % % revival of a 13 years old code % Create data for a circle + noise th = linspace(0,2*pi,20)'; R=1.1111111; sigma = R/10; x = R*cos(th)+randn(size(th))*sigma; y = R*sin(th)+randn(size(th))*sigma; plot(x,y,'o'), title(' measured points') pause(1) % reconstruct cir...
1b88cf2056c44ed8f63e562d6e210c064771e1eeafeba438e1c9e27e94ef90d4
MATLAB
700
26
function colorMoments = colorMoments(image) % input: image to be analyzed and extract 2 first moments from each R,G,B % output: 1x6 vector containing the 2 first color momenst from each R,G,B % channel % extract color channels R = double(image(:, :, 1)); G = double(image(:, :, 2)); B = double(image(:, :, 3)); % compu...
4f7a22f52037ff7922cbfa5113d8ca1e1fad9606dbf401c33a02bddd8f3ebf51
MATLAB
700
18
function out = veclinspace(v1,v2,n) % out = veclinspace(v1,v2,n) % % A vectorized version of linspace that creates a sequence of n vectors % between v1 and v2. % % 2017 - Adam Charles and Alex Song %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% out = zeros(length(v1),n); ...
8683024bdd50a05958a0dbbc270bb470fb2647b1b6f391273701b266ccff30ec
MATLAB
700
24
function waveletMoments = waveletTransform(image, spaceColor) % input: image to process and extract wavelet coefficients from % output: 1x20 feature vector containing the first 2 moments of wavelet % coefficients if (strcmp(spaceColor, 'truecolor') == 1) imgGray = double(rgb2gray(image))/255; imgGray = imresiz...
90d7eb2ed52c3a0a714ba17970dcd1139c07947c569f37d88dbdce2ce655992f
MATLAB
700
25
% IBEI_main.m clear all % close all warning('off','signal:findpeaks:noPeaks') % %%%% % Select the source folder BEFolder = uigetdir(pwd,'Select the BurstEvent files folder'); if strcmp(num2str(BEFolder),'0') errordlg('Selection Failed - End of Session', 'Error'); return end % %%%% % Select the parameters [userP...
1180f63d393b17c0c88498e51759b93e78bc8afc855383449eac13eefeee4e04
MATLAB
701
33
% test code [dataDir, exptFnDir, settings] = ephysSettings(); % aIn = {'ampScaledOut', 'ampI', 'amp10Vm'}; aIn = {}; aOut = {'ampExtCmdIn'}; % aOut = {}; % dIn = {'ficTracCamFrames', 'legCamFrames'}; dIn = {}; dOut = {'legCamFrameStartTrig'}; [userDAQ, aiCh, aoCh, diCh, doCh] = initUserDAQ(... settings, aIn,...
27a911a1127a81584467874812af1f03618e3fad0b816f8244ab0ac78310ca6c
MATLAB
701
14
function true_valid_stim_final=find_stim_on_turn_onsets(stims_delivered_during_mochis_turns,er_turn_onset_indices) %%% this function make sure that we are only selecting stim which occurs after the worm crossed ellipse ratio threshold true_valid_stim=[]; for xx=1:length(stims_delivered_during_mochis_turns) ...
6362123dff44ccf932fee5314ef74cdacc8d157eed7c9589f4e522eddfc9d4f9
MATLAB
701
23
function score = GetPascalOverlap(bb, bbgt) % Directly copied from Pascal code % % Gets the overlap measure according to Pascal % % bb: Bounding Box % bbgt: Ground truth bounding box % % score: Score between 0 and 1. 1 is complete overlap. score = 0; % intersection bbox bi=[max(b...
b6cdce278e151ec2c5e14f96570d33157f081bbd976373915128cb1821c3df5f
MATLAB
701
13
function text_FD_th=make_text_FD_th(handles) text_FD_th{1}=['FD th: ' num2str(handles.mc.FD_th,'%4.4f')]; text_FD_th{2}=['min time minutes: ' num2str(handles.mc.min_time_minutes,'%4.4f')]; text_FD_th{3}=['min frames: ' num2str(handles.mc.min_frames,'%4.0f')]; text_FD_th{4}=['skip: ' num2str(handles.mc.skip,'%4.0f')]; ...
0561606524714a3e44406475d206cf44f548e5abb31c421dfb3f9f7bc5c318e5
MATLAB
702
36
function tmp=my_load_file(cache_file, be_quite) if nargin<2 be_quite=false; end if ~be_quite fprintf('load_file:%s\n',cache_file); end tmp=[]; if exist(cache_file, 'file') finished=false; while ~finished try ...
12554dafdd3905bcff5b07e50c6889ef6148b7dc313224f34838fc967bc91373
MATLAB
702
25
function EyeHeadData = GetEyeHeadDataXworkNew clear XWORK = uigetfile('*.00**','Enter file'); data = readcxdata(XWORK, 0, 7); MaestroConvEPos = 0.025; MaestroConvEVel = 0.0919; MaestroConvHVel = 0.1057; Epos = MaestroConvEPos*data.data(1, :); Evel = MaestroConvEVel*data.data(2, :); %hevel, just to compare with Eye...
2cad42eb24eb68fd7ca42b0e1c2f2c3ccb1748e552f0e5172193f87504263354
MATLAB
702
18
function [ index_found ] = is_approximate_member(search_for,search_in,min_difference) %finds if there exists an approximate row in "search_in" for the row "search_for" %used to see if a stimulus shape appears similar to another stimulus shape if nargin < 3 min_difference = 0.05; end index_found = 0...
7c93a5f6651c04c9a835732e16aa319d5562609974ccf67d6a044c1991d09fe9
MATLAB
702
31
function lpp_plot_set(ylim,ytick,yticklabel,xlim,xtick,xticklabel,figsize) %LPP_PLOT_SET 이 함수의 요약 설명 위치 % ylim: e.g., [0.73 0.96] % ytick: e.g., [0.73 0.8 0.85 0.9 0.95 1] % yticklabel: True or False % xlim: e.g., [0.5 5.5] % xtick: e.g., [1 2 3 4 5] % xticklabel: True or False % figsize: [303 472 30...
4efe328db62f4c52c1a5f4980ae110a6d05368e6f15f9db67ab91d04030d3757
MATLAB
705
16
% feature should be dimensions * nSegments (column major) function diff = hist_dist( hist1, hist2, method ) switch method case 'x2' % diff = 0.5 * sum((hist1 - hist2).^2) ./ sum(hist1 + hist2 + eps); diff = 0.5 * sum( (hist1 - hist2).^2 ./ (hist1 + hist2 + eps) ); case ...
5980f87d805294bdc90d771e4584a0a56fca3c1d592ff01c11d3d2414955925b
MATLAB
705
16
function [ ] = bemf2_graphics_surf_field(P, t, FQ, Indicator, tissuenumber) % Surface field graphics: plot a field quantity FQ at the surface of a % brain compartment with the number "tissuenumber" % % Copyright SNM 2017-2020 ind = tissuenumber; t0 = t(Indicator==ind, :); Num...
6f3f307e4caa13104cbbf2e767ead4e48554b0566826c782c1f5e71147978894
MATLAB
705
23
function rasterPlot(obj) scope_timestamps_ms = obj.getScopeTimestampsMs(); tm = ceil(scope_timestamps_ms(end)/1000); edges_s = linspace(0, tm, tm); raster = zeros(obj.neuronData.num_neurons, length(edges_s)-1); for iN = 1:obj.neuronData.num_neurons t_s = [obj.neuronData.neuron(iN).calciumE...
d823e336f1fb2b82f55fc2f914b03fdc6a70aac0a2a88d7a6ba5f3c6ba8eeda5
MATLAB
705
22
% VL_CUMMAX Cumulative maximum % If X is a vector, VL_CUMMAX(X) is the vector with the cumulative % maximum of X. If X is a matrix, VL_CUMMAX(X) is the matrix of the % cumulative maximum of the columns of X. If X is a multi-dimensional % array, VL_CUMMAX(X) operates along the first non-singleton % dimension....
cc482d5e542f13ac968ae372c431fc0c2ee369eb528ca315e8ef42998075e448
MATLAB
706
11
function [rand_shift_ms, rand_shift_n] = ml_util_rand_timeshift(ts_ms, shiftMin_ms, numDraws) % tshift_min = ts_ms(1) + shiftMin_ms; % min seconds from start % tshift_max = ts_ms(end) - shiftMin_ms; % min seconds before end % tshift_draw_ms = (tshift_max - tshift_min).*rand(1,numDraw...
e74c58ef5d55264a5e6032ff03646ef0e19f33498c76e7e3b0934d763ee090fb
MATLAB
706
22
function ExtractFields(StructNames) % Extracts the parameters from struct(s) StructNames (cell with the % struct names (struct, not characters!)) for sid = 1:length(StructNames) tmp = StructNames{sid}; FN = fieldnames(tmp); for fid=1:length(FN) eval([FN{fid} '= tmp.' FN{fid} ';']) assignin(...
f80216a52082d7723d31d99c56e3a16406bcc763f19ba2fd0b22c0c507ec393a
MATLAB
706
30
function firingRate = calc_recipInterval(spikeTimes, ephysLength, sampleRate) firingRate = nan(ephysLength,1); AAA = spikeTimes(2:end) - spikeTimes(1:end-1); eIndex = 0; tic for i = 1:length(firingRate) if eIndex >= length(spikeTimes) break end ...
6a43299ad195bea85b72022b4c1e5140796ea597c0a5a29839d8d33fead19027
MATLAB
707
16
function [first_stim_frame, stim_value, stim_duration] = read_next_rails_stim(stim_time_series, start_frame, end_frame) %given a rails timeseries and a starting point, extract the beginning and %duration of the next pulse end_frame = min(end_frame, numel(stim_time_series)); [~, stim_peaks, widths, ~] = findpeak...
db0e61f14fdae44bf8917f7973ecd48fb20ac04418a1c70a4d601c20027881c6
MATLAB
707
32
function [stats] = ml_cai_spatialfootprint_stats(sfp) sfp = ml_core_remove_zero_padding(sfp); X = sfp; p = prctile(X(X ~= 0), 50); % M1 BW = bwperim(X>0, 8); P = sum(BW == 1, 'all'); A = sum(X>0, 'all'); M1 = 4 * pi * A / P.^2; CC = bwconncomp(X >= p); numComponents = ...
6c0d24ca61db05b54d69e32ec9b5e8bbb28409d7661702b8a556c7e74618f743
MATLAB
708
37
function[weighted_intensities]= weight_intensities(all_intensities,combos) wave_tally= zeros(size(all_intensities,2),1); for i =1:length(combos) cur_waves=combos{i}; for j=1:length(cur_waves) wave_tally(j)=wave_tally(j)+1; end end delete_vect=nan(size(all_intensities,2)); for i =1:length(dele...
9546971297576d7f6d25e5dceba005a7c8ec96184ddaa31502a55c9e5a3ae005
MATLAB
708
32
% mglVFlip.m % % $Id$ % usage: mglVFlip % by: justin gardner % date: 09/06/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: flips coordinate frame vertically, % see also: mglHFlip % e.g.: % %mglOpen %mglVisualAngleCoordinates(57,[16 12]); %mgl...
a6bc3c6fd79a5b9a6c6190c85a0d3d107ac94413cbeb20239d0c1b91f3c9f6aa
MATLAB
708
19
% BIOSIG/DOC Documentation files % % DecimalFactors.txt Table of Decimal Factors [1] % leadidtable_scpecg.txt EN1064 Lead Identification Table of the SCP-ECG format [1] % units.cvs Vital Signs Units of Measurement [1] % header.txt describes HDR struct [2] % eventcodes.txt Table of Event Codes [2] % elecpos.txt ...
cc8ee89492fa967acfccd1e4f83544d7a94a6915769ac3cadcc1d75b5190820f
MATLAB
708
38
function w_fid=linebroad(fid,at,lb) %line braodening for csi data set dims=size(fid); [np,loc]=max(dims); if length(dims)==2 dims(3)=1; end sw = np/at; t1 = ((1:np) .* 1/sw); if (loc == 1) for idx = 1:dims(2) for idx2 = 1:dims(3) fid(:,idx,idx2) = squeeze(fid(:,idx,idx2)) .* exp(-t1 .* ...
e194e8dbc113e4276c04fe75db44390d903a72d7922973f7d6d354f57033df23
MATLAB
711
23
function [] = ExtDataFig05_QtoP_TN1dsx() % Code for plotting changes in ΔF/F from quiet to pulse transitions in Extended Data Fig. 5k. %% Song-type preference index (dPR1, TN1SG) load(['../Data/Summary_TN1dsx/QtoPIndex']) buf_Idx = Idx_QtoP; xx = [1*ones(length(Idx_QtoP),1)]; figure('Position',[100,100,50,50]) hold ...
42deba87b3758e515e48cb7e5d5ac3e61ad7496af85d1e3b60779bff5a794283
MATLAB
713
29
function [averk, ki] = gretna_node_degree(A) %========================================================================== % This function is used to calculate nodal degree for a binary graph or % network G. % % % Syntax: function [averk ki] = gretna_node_degree(A) % % Input: % A: % The adjencent ...
03d10a4b5ea2b5f69af3af599024749ad342a2a5751de0c0339ba413ffceb726
MATLAB
715
27
%% degree distribution load('Sub_topo_str_DBM.mat') roi_num = 48; Glo_topo = {'acp','alp','acpratio','alpratio','aQ','aQratio'}; itopo = 1; net_type = {'bin_no_smo','bin_smo'}; Nbins = 10; results = struct; save_path = [pwd '\pic']; mkdir(save_path) % degree topo_data = [mean(sub_topo_bin_no_smo)',mean(sub_topo_bin...
7e2b3b79588f69b9264782163557252d3c30c2cf17168fba230752fd2d6292c5
MATLAB
715
25
% Get header of the subject information % [ Yokogawa MEG Reader toolbox for MATLAB ] % % brief: % This function retrieves information of the subject in the specified file. % % usage: % subject = getYkgwHdrSubject(filepath) % % arguments: % filepath : file path % % return values: % subject : structure o...
9b4b5bf7c0ed1be45e31d38a11c126d0bebf2d5b95baeb2c660c95949ee9ce4c
MATLAB
715
15
function [arena] = ml_arena_initialize(arenaJson, refP, refQ) % Example for tetrode roi %refP = reshape(arenaroi.inside.j, 1, 4); %refQ = reshape(arenaroi.inside.i, 1, 4); if strcmpi(arenaJson.shape, 'rectangle') arena = MLArenaRectangle([refP; refQ], arenaJson.x_len...
9dee126dc66df5faf47edc0fc9db23a5089b990d9a7972eaf871fc40813ec3c3
MATLAB
715
29
function [angle,l,x,y,ismissing] = FixWingNaNs(angle,l,i,medianlength,outtrx) ismissing_angle = isnan(angle); ismissing_l = isnan(l); % fill with zeros angle(ismissing_angle) = 0; % interpolate ispresent_l = ~ismissing_l ; n_present_l = nnz(ispresent_l) ; n = length(ispresent_l) ; if n_present_l == 0 l(:) = median...
a4115bf102d556f11eb0cd4f1d4ffd6a2ac2be42040384d65ab41164c2546609
MATLAB
715
17
function ver=SONVersion(varargin) %SONVERSION returns/displays the version number of the matlab SON library % % VER=SONVERSION % returns and displays the version while % VER=SONVERSION('nodisplay') % suppresses the display % % Author: Malcolm Lidierth 10/06 % Copyright © The Author & King's Colleg...
cff92a818056971d6898e08cf574282800ceda1c6d126810c5211b8c97af5463
MATLAB
715
27
%% degree distribution load('Sub_topo_str_VBM.mat') roi_num = 48; Glo_topo = {'acp','alp','acpratio','alpratio','aQ','aQratio'}; itopo = 1; net_type = {'bin_no_smo','bin_smo'}; Nbins = 10; results = struct; save_path = [pwd '\pic']; mkdir(save_path) % degree topo_data = [mean(sub_topo_bin_no_smo)',mean(sub_topo_bin...
66a918f4df57634084dac55db5ff2192c8a6cafe7cf9c228b9592424cd8e2d53
MATLAB
716
29
function [nu,x,h,xp,yp]=univar(data) % Computes the univariate pdf of data and the histogram values. % Returns the frequency of data per bin (nu), the position of the bins (x) % and their size (h). The pdf is returned in yp for the xp values % Cyril Pernet v1 % --------------------------------- % Copyright (C) Corr...
712b0e499e4ac78a56f26de9b70137899278cf990f3328a6c669ed184c0ae870
MATLAB
716
22
% VL_IMINTEGRAL Compute integral image % J = VL_IMINTEGRAL(I) calculates the integral image J of the image % I. I must a matrix with DOUBLE, SINGLE, UINT32, or INT32 storage % class. J is given by % % J(i,j) = sum(I(1:i,1:j)). % % J has the same size as I and the same storage class. % % Example:: % T...
f5881d7ff380dc0a82f4d3363ac3902bbe4f20d4005c70fe982a77dbeaf80d88
MATLAB
716
31
function [shift]=shift_wseries(img) yr= nan(512,1023);% each row is the xcorr of the y from each image ylag=nan(1023,1); % just a list of the lags that can be overriden every time in the for loop xr= nan(512,1023);% xcorr of the x xlag=nan(1023,1); for x_or_y=1:512 [xr(x_or_y,:),xlag(:)]=xcorr(img.wsRef(x_or...
0f4bc735a20732e72519630e0ac993cb5028859f81ca29445b2d04fd60bbb191
MATLAB
718
17
function [task myscreen] = mglEyelinkCallbackGetPosition(task, myscreen) % mglEyelinkCallbackGetPosition - Assigns eye position to myscreen % % Usage: mglEyelinkCallbackGetPosition(IP, conntype) % IP - the ip address of the eyelink eye tracker, defaults to 100.1.1.1 % conntype - the connection type: 0 opens a direc...
c988f096b437048f430db80e74e2879a2037e666f06ba7f1edb5def838ef4a66
MATLAB
718
25
function [scores index] = BlobBestOverlap(gtBlobs, testBlobs) % [scores index] = BlobBestOverlap(gtBlobs, testBlobs) % % Get overlap scores (Pascal-wise) for test blobs % % groundTruthBlob: ground truth blobs % test: Test blobs % % scores: Highest overlap scores for...
dfa179de0f2ea00cb8faf9c0a3f73307e7a116729e7b2fdce4f07c394c196714
MATLAB
718
24
function lf=openmeeg_helper(pos,vol,splitdim) % % Splits the calculation of leadfields in smaller chunks % pos: positions of dipoles % vol: volume conductor % splitdim: splitting factor lf = []; ndip = size(pos,1); numsol = fix(ndip./splitdim); nleft = rem(ndip,splitdim); lf = zeros(size(vol.mat,1),ndip*3); if...
5d80baa3dbef63b31c06d6cd730b4b20b3142d3466b7a29166ab843ee01dac62
MATLAB
719
29
%% distance data analysis for aedes addpath(pwd) addpath('Path to code here') %% build parameters structure Params = struct(); Params.FirstPath = pwd; %% get directory of interest (add directory to video file(s) here) selpath = uigetdir; cd(selpath) dirContents = dir('**/*.*') ; strIdx = (strfind({dirContent...
a1ff15fdd372e0b78bd9cdc7197d5124f283591f8e60b747fa9b9b7c06d33096
MATLAB
719
23
function [estFps, percentFps] = ml_cai_daq_estimatefps( timestamp_ms ) % timestamp_ms should be an array of timestamps in milliseconds % The fps to check (these are the default DAQ options) FPS_TO_CHECK = [5 10 15 20 30 60]; % +/- DFPS DFPS = 5; % Compute the instantaneous fps across time fps = 1 ./ double(diff(times...
0db6b9fabb784a3683d9acfddca7ea607f1679c33383c1900b5184dcf5495e25
MATLAB
720
34
% % Computer the "diam" statistic from the hop distribution. % % PARAMETERS % $NETWORK % $TYPE "full" or "split" % % INPUT % dat/hopdistr_time.$TYPE.$NETWORK % % OUTPUT % dat/statistic_time.$TYPE.diam.$NETWORK % network = getenv('NETWORK'); type = getenv('TYPE'); data = load(sprintf('dat/hopdistr_time.%s.%s', typ...
2550decb67ea033406b4855a9ab1a14ec5a9aa76c8eaa93b0bfd7f30bfa15eb6
MATLAB
720
23
% nestedEvalin.m % % Helper function that enables evalin function call using variables in the % function that calls nestedEvalin instead of the function that called the % function that contains evalin. I.e. uses the workspace of the present % function. % % Notes: so far, only tested when str is variable name, not wh...
ba03058d727e777cab18a5e9bfe1f07437a25981cfc8d5c139e942fce3dd0429
MATLAB
720
37
% quickPlotSpikerateVTurnBouts.m % % 7/18/23 - Quick and dirty plotting function relating spike rate to % turning bouts. Plots output of saveSpikerate_bouts.m for i = 1:5 figure; scatter(allYaw(i,:), allFwd(i,:), [], allSpikerate(i,:), 'filled'); colormap(gca, 'parula'); caxis([0 100]) colorb...
a02e5bf5c205a99bbda240acf20ba0612d167098f09b0e71078a33b9a1eb53a7
MATLAB
721
18
close all clear all clc fclose('all') recordingsParentFolder = '/work/muzziolab/PROJECTS/two_contexts_CA1/miniscope/recordings/feature_rich/CMG129_CA1'; analysisParentFolder = strrep(recordingsParentFolder, 'recordings', 'analysis'); config = mulana_json_read('/work/muzziolab/PROJECTS/two_contexts_CA1/miniscope/source...
3dc25dc99d682a1859048bffd67ab6a9a2aa3a3c70ccdea33102b81e6c492b70
MATLAB
722
19
function [SNR_threshold] = find_snr_threshold(bias_average,crit_val,simulated_SNRs,max_n) for index_alogrithm = 1:4 for AxTM_index = 1:5 if and (~isempty( max(find([bias_average(AxTM_index,:,index_alogrithm)] >= crit_val)) ), max(find([bias_average(AxTM_index,:,index_alogrithm)] >= crit_val)) ~=...
c70db66e3c711ded5793e414ce471c32ef11905592d8a8a966b805704470b322
MATLAB
722
26
% copy from VOC toolkit % VOCLABELCOLORMAP Creates a label color map such that adjacent indices have different % colors. Useful for reading and writing index images which contain large indices, % by encoding them as RGB images. % % CMAP = VOCLABELCOLORMAP(N) creates a label color map with N entries. functi...
ff7bf7eab1ddb8649f4626782a1785187d474b033e9fbf8bcd0a5bb6eb3d0cce
MATLAB
722
40
%% TE = readTE_dcm2niix_JSON(filenames) % % Input % -------------- % filenames : json file fullname(s) % % Output % -------------- % TE : echo times % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 13 June 2018 % Date last modified: % % modifed by X.L., ...
808c61a2fa92042b8378d5e50af3bd29f3559c75335cb64db90c09677509114e
MATLAB
723
15
function handles=update_paths(handles) % handles.exp_path=[handles.root_path filesep 'exploratory' filesep]; handles.root_path=handles.exp_path(1:end-11); handles.no_auto_path=[handles.root_path 'no_autocorrelation' filesep]; handles.model_based_path=[handles.root_path 'model_based' filesep]; handles.model_based_tsvd...
a6a5bd183afe5377126536e62cf2e2fab93b5c4e6c1a9ece2c8a211091dd1dfd
MATLAB
723
32
% mglVFlip.m % % $Id$ % usage: mglVFlip % by: justin gardner % date: 09/06/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: flips coordinate frame vertically, % see also: mglHFlip % e.g.: % %mglOpen %mglVisualAngleCoordinates(57,[16 12]); %mgl...
9ea805226526de8b1410a32921660385db2c7841661d1d5b1f8cb41cdbc711f9
MATLAB
724
31
<<<<<<< HEAD function [fmr1000, index, fmr1000_threshold] = computeFMR1000(FMR, FNMR, scores) %FMR1000 (the lowest FNMR for FMR<=0.1%) [fmr1000, index] = min(FNMR(find(FMR <= 0.001))); % correction on indexes if isempty(fmr1000) fmr1000 = 1; index = 0; end if nargin > 2 fmr1000_threshold = scores(index);...
3650d28c474ef9c16ab73f81c7fef77365bbbfad13df355ef32e8a324189920f
MATLAB
725
29
function [kspace,data,msg_out]=cine_recon(kspace,Dat,procpar) % This is a custom VNMR k-space reconstruction code for CINE data used by % aedes_readvnmr. % If called without input arguments, return the sequence names that % this code reconstructs if nargin==0 kspace = {'cineSSFP'}; return end data=[]; msg_out = ...
887305d2491a4b8b70794081668a5428b5fba6312330554559d5696bd0a8b5e5
MATLAB
726
20
% Noise standard deviation calculation % noise_level = calfieldnoise(iField, Mask) % % output % noise_level - the noise standard devivation of complex MR signal % % input % iField - the complex MR image % Mask - the a region of interest that is not pure noise % % Created by Tian Liu in 20013.07...
d70039f585590f22d91d17519abad1b410f3b3649b303d48a81821df474b5a00
MATLAB
726
25
function trk1 = fix_CatTracks(trk1,trk2,trajfns) % concatenates trk2 onto trk1 % does not copy all fields -- convert_units must be re-run on the output track % splintered from fixerrorsgui 6/21/12 JAB if nargin < 3, trajfns = {'x','y','a','b','theta'}; end n = trk2.nframes; for j = 1:numel(trajfns), fn = trajfns...
e5767fa6c6e421ddd74d3c3c57f5751247f82368480fcf0d8e667cd95a9e5c02
MATLAB
726
40
function ip = inplace(a) % INPLACE Convert to a type that supports inplace modification % ipa = inplace(v) creates an inplace double object from any matrix v. % % Example: % ipa = inplace(ones(5)); if nargin == 0 error('inplace:invalidParameter', ['ipdouble must be created with an initial .']); elseif isa(a,'ip...
83f06c2918af8b30104ae06312a2e7bbca39a758ba16363513e82875cde7156f
MATLAB
727
17
function y = t_mik1(n,num_VTA,dt,T,t_total,p_r,npp,unit_stim,t_stim,t_reward,T_R,alpha,beta) t_mik11 = zeros(n,t_total/dt); ndd = npp; for k = unit_stim j = (((k+1)/2)-1)*ndd; t_mik11(j+1:j+ndd,(t_stim((k+1)/2)+dt)/dt:(t_stim((k+1)/2)+T)/dt) = (rand(ndd,T/dt) < p_r); % t_mik1(j+npp+1:j+2*npp,1:t_stim/...
a82efdebe3a460ef1e1ccd65a87b49a9daa28b4768d32dc737a7c7b22b608485
MATLAB
727
26
% VL_DEMO_GMM_2D_RAND Demonstrate clustering points with a GMM %% Create a random set of points numPoints = 5000 ; dimension = 2 ; numClusters = 20 ; data = rand(dimension, numPoints) ; %% Learn a GMM: fit the points at maximum likelihood vl_twister('state',0) ; [means, covariances, priors] = ... vl_gmm(data, nu...
add8c86192b36e40283dbc37b63c27c5f1ee18a2e009620363eb2891487a1eac
MATLAB
727
23
function [ns_RESULT, nsLibraryInfo] = ns_GetLibraryInfo(); %ns_GetLibraryInfo Get library version information % % Usage: % [ns_RESULT, nsLibraryInfo] = ns_GetLibraryInfo() % % Description: % Obtains information about the API library. % % Return Values: % nsLibraryInfo Structure to receive l...
d4faddb4fe9eeb06fd6a506b3a166cce469cf44afd85f341503fd53faf1c8c56
MATLAB
727
35
function varargout = scl_slope(varargin) % Format % For getting the value % dat = scl_slope(obj) % % For setting the value % obj = scl_slope(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: scl_slope.m 8776 2013-11-1...
099fb59e9a1fd874ab42e93e5684c573d390da96aea2ad95d76bd494628ed04c
MATLAB
728
27
function[beta_similarity,angle,mean_vect]=get_beta_similarity(type,svm,trials,response,som,pv) %% b=svm.Beta; if strcmp(type,'mean') comparison_vect=mean(trials,1);% elseif strcmp(type,'unit') unit_vector=ones(1,length(b)); end beta_similarity=cosineSimilarity(b',comparison_vect); CosTheta = max(min(dot(b'...
1c05410f57af81762e51f6887dd00fab96a6af4f121dae23030651f46e78506f
MATLAB
728
24
function [dWx,dWy] = vl_dwaffine(x,y) % VL_DWAFFINE Derivative of an affine warp % [DWX,DWY]=VL_DWAFFINE(X,Y) returns the derivative of the 2-D affine % warp [WX; WY] = [A T] [X; Y] with respect to the parameters A,T % computed at points X,Y. % % See also: VL_WAFFINE(), VL_HELP(). % Copyright (C) 2007-12 Andr...
47d1a73f06e1af3cdd86ba3bc46be0c5f2704679ac1d1507fcf6b181ad3293ac
MATLAB
728
33
function [peakW,peak_latency]=peak_width(spikes,touch_idx) peakW=zeros(1,4); peak_latency=zeros(1,4); boxcar=[zeros(1,5) ones(1,5)]; for itouch=1:4 if itouch==4 filteredFR=conv(mean(spikes(touch_idx>=itouch,100:end)),boxcar,'same'); else filteredFR=conv(mean(spikes(touch_idx==itouch,100:end)...
6a8ce7b1557a3cb42091dd1aabe68e0fab441730ea016f4fa8f33cbff069cb6e
MATLAB
728
36
function varargout = scl_inter(varargin) % Format % For getting the value % dat = scl_inter(obj) % % For setting the value % obj = scl_inter(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: scl_inter.m 8776 2013-11-1...
07ba8dbedf4a61fbe24aeb4da876345742ae76a384d0fc08e8d8035dc6b7e725
MATLAB
729
25
function ns_RESULT = ns_CloseFile(hFile); %ns_CloseFile Closes a neural data file % % Usage: % ns_RESULT = ns_CloseFile(hFile) % % Description: % Closes a previously opened file specified by the file handle hFile. % % Parameters: % hFile Handle/Indentification number to an open file. % % ...
6025472522bdff7bc09993b5f46c2c3fadaf36bf9865c83814ee50def8854c1b
MATLAB
729
23
function outMatrix = normBetween01(inMatrix, dim) % normalize values between 0 and 1 % Check if there is a negative value in the matrix if any(inMatrix(:) < 0) error('Input matrix contains negative values.') end % Check if the dimension is valid if dim > ndims(inMatrix) error('I...
67369289e2b23103d78f846062546c220420f1a7a43eae5d85847d2a6dace02c
MATLAB
729
25
% Get toolbox version % [ Yokogawa MEG Reader toolbox for MATLAB ] % % brief: % This function retrieves version of this toolbox. % % usage: % ykgw_ver = getYkgwVersion; % % arguments: % none % % return values: % ykgw_ver : structure of toolbox version % .version : string, toolbox version : major.min...
105fd647d3557017b0475fbb23ad8c96ab4c41b774228d98c6bbe29d8d004065
MATLAB
730
31
angles = allAngles; rho = data{iTrial}.allDistances(activeIndices,:); % matrix of spikes x distances where #distances is #angles searched theta = data{iTrial}.lookDegCan(activeIndices); % #spikes x 1 vector x = data{iTrial}.posCan(activeIndices,:); % position #spikes x 2 distanceThreshold = 30; rhot = rho; rhot(rhot <...
5cb09ec2959401f648bc1d7f6ff007ec5f4eaacba9950ee7309385b0764acec8
MATLAB
730
16
function [result] = ml_egomaps_compute(... animal_pos_x_cm, animal_pos_y_cm, animal_facing_angle_deg, ... cell_activation, ... ARENA_WIDTH_CM, ARENA_HEIGHT_CM, RADIUS_CM, EGOMAPS_CM_PER_BIN, showAnimation) DISCRETIZATION_SCALE_FACTOR = 100; EgoTable = ml_egomaps_compute_segment_table(... an...
9e73e4924eff672ce364fff8aff1bfe83fa7bc416d55094488ae40fec9715817
MATLAB
730
19
function I = capture_PG_area_ramps(SC,max_ramp,d_ramp,titl) ramps = -max_ramp:d_ramp:max_ramp; num_ramps = length(ramps); mat_flag = 1; py_flag = 0; flag_nearest = 0; images = zeros(SC.N_PG,SC.N_PG,num_ramps,num_ramps); %uncomment this line for ix = 1:num_ramps for iy = 1:num_ramps fx = ramps(i...
e2a9ae205fbbe13aef1e361a0acb85b14414c8903f7110756f6a4a2bc850a2f1
MATLAB
730
26
function d = getdict % Dictionary of GIfTI/NIfTI stuff %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: getdict.m 8776 2013-11-14 09:04:48Z roboos $ persistent dict; if ~isempty(dict) d = dict; re...
fee8b6920a11179a5e32f4a4261d612c6a93979075928eb68659dda367412445
MATLAB
731
19
% VL_LBP Local Binary Patterns % F = VL_LBP(IM, CELLSIZE) computes the Local Binary Pattern (LBP) % features for image I. % % IM is divided in cells of size CELLSIZE. F is a three-dimensional % array containing one histograms of quantized LBP features per % cell. The witdh of F is FLOOR(WIDTH/CELLSIZE), wher...
07d1834a863672acc4146b4f1824a0ab4193a5ebcc2c9adab2149206e8fab655
MATLAB
732
32
% mglHFlip.m % % $Id$ % usage: mglHFlip() % by: justin gardner % date: 09/06/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: flips coordinate frame horizontally, useful for when % the display is viewed through a mirror % e.g.: % %mg...
60a48963574ea753c99e4e4c3f362ccb7a216d34f9c63cf4333205d840eb4ff2
MATLAB
732
13
function Tracks = BehavioralTransitionToBehavioralAnnotation(Tracks) %Add Tracks with BehavioralTransition field with BehavioralAnnotation Field for track_index = 1:length(Tracks) behavioral_annotaiton = zeros(1, length(Tracks(track_index).Frames)); for transtion_index = 1:size(Tracks(track_index).Beh...
02b65ddcc55d819720d5be7fb80d2e003a242e651ec77d3d1e126ad96dff25b4
MATLAB
733
21
function [comment]=SONGetChanComment(fh, chan) % SONGETCHANCOMMENT returns the comment string for the specified channel % % COMMENT=SONGETCHANCOMMENT(FH, CHAN) % FH SON file handle % CHAN Channel number (0 to SONMAXCHANS-1) % Returns the channel comment as a string. % ...
755f37bbf7c35da889333cd11c2e1fdc124fd1f6ff79edbb78a0d70551509c5c
MATLAB
733
18
function display_volume_fields(temp, th1, th2, levels, a, b, flag) % Volume field graphics: plot a field quantity temp in the observation % plane using a planar contour plot. Revision 071318 % % temp - quantity to plot % th1, th2 - two threshold levels introduced manually % levels - number of levels in...