sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1430627558c25de8234adadaf6f3518acb7be7ed18c71ec99136f4a2c781a9c4 | MATLAB | 1,219 | 32 | function[interval,start]=SONGetSampleTicks(fid,chan)
% Finds the sampling interval on a data channel in a SON file
% in clock ticks and returns the time of the first sample
%
% Malcolm Lidierth 02/02
% Updated 09/05 ML
% Copyright © The Author & King's College London 2002-2006
FileH=SONFileHeader(fid); ... |
66b50f6aa9901f074b88eac1729a6e52bace9023915d7602fd65d92a61e0335f | MATLAB | 1,219 | 34 | %{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the t... |
801f6953c0c073c4a070fedd296c7022fc435f72b46d9eea741dafacd1e77ced | MATLAB | 1,220 | 47 | %ANGDIFF Difference of two angles
%
% D = ANGDIFF(TH1, TH2) returns the difference between angles TH1 and TH2 on
% the circle. The result is in the interval [-pi pi). If TH1 is a column
% vector, and TH2 a scalar then return a column vector where TH2 is modulo
% subtracted from the corresponding elements of TH1.
%
... |
553dde004fb2c22127dd4450c14ddbde3fc4a55f3b69e4fa8477d7315b7f347c | MATLAB | 1,221 | 34 | % Get user inputs
% INPUT folder
BDResFolder = uigetdir(pwd,'Select the folder that contains the BurstDetectionFiles results:');
if strcmp(num2str(BDResFolder),'0') % halting case
warndlg('Select a folder!','!!Warning!!')
return
end
[path, filename] = fileparts(BDResFolder);
% IBEI thresholds file
IBEI... |
9b267ee7bd65f395d59c55f3f7444f212ac79750fa5ba5205e4b337e5664ec01 | MATLAB | 1,221 | 49 | function prop=vl_linespec2prop(spec)
% VL_LINESPEC2PROP Convert PLOT style line specs to line properties
% PROPR = VL_LINESPEC2PROP(SPEC) converts the string SPEC to a cell
% array of properties PROPR. SPEC is in the format of PLOT().
%
% If SPEC is not a line spec, the string SPEC is returned unaltered
% as the o... |
27235d1216153abab77af6b4e0bc47af13f49b95943ebed322559f838a10ad94 | MATLAB | 1,222 | 27 | % burstDetection_getParam.m
% Get algorithm parameters from user input
function [IBEIParam, flag] = IBEI_getParam()
% initialize variables (in case they are not assigned)
IBEIParam = struct('nBinsPerDec',[],'minPeakDistance',[],'voidParamTh',[],...
'timeTh',[],'sf',[],'smoothMethod',[],'smoothSpan',[]);
flag = 0;
% use... |
35cb2219923805c1fc5e6af33609aafacb65e21151ac6e4ac6b24f4e2d08e22c | MATLAB | 1,222 | 43 | function success = calculate_spectra(folder_name)
% Take the PCA projections and get the spectrogram and directionality
addpath(genpath(pwd))
%set up parameters
parameters = load_parameters(folder_name);
if parameters.TrackOnly
success = true;
return
end
relevant_track... |
8fc84125d2977348eeb3b5945026bcdc7a0d45408e80e3e9a5eb944dc430f4d2 | MATLAB | 1,222 | 40 | function wKerns=getKernels(fnFit,includeHP,plotFlag)
if includeHP==1
cut=strfind(fnFit,'/');
fnFit= [fnFit(1:cut(end)) 'HistAndPop' fnFit(cut(end):end)];
end
cut=strfind(fnFit,'_');
numNeuron=str2num(fnFit(cut(end)-2:cut(end)-1));
load(fnFit);
disp(['The selected model is ' [modelLabels{selected_model}]])
... |
d47ad4cc0ad5068f273e81d38239f5315723b9db58c009a0c13a6409641951d5 | MATLAB | 1,223 | 43 | function [bestMap, bestCombination, metricValue] = best_flip_combinations_difference(maps)
numTrials = size(maps,3);
flipCombinations = flip_combinations(numTrials);
numCombinations = size(flipCombinations,1);
flipMetric = zeros(numCombinations,1);
flippedMap = zeros(size(maps,1), size(maps,2... |
d588516e2693eebe0874224bfda9bcab12e6bb9b74ff17cc0e02154e8eb62a03 | MATLAB | 1,223 | 38 | function [fitresult, gof] = createFit(YdegHisU, YdegHisW, Yerror)
%CREATEFIT(YDEGHISU,YDEGHISW,YERROR)
% 近似を作成します。
%
% 'Yestimate' に対するデータを近似:
% X 入力: YdegHisU
% Y 入力: YdegHisW
% Z 出力: Yerror
% 出力:
% fitresult: 近似を表す fit オブジェクト。
% gof: 適合性情報をもつ構造体。
%
% 参考 FIT, CFIT, SFIT.
... |
38f0ca3887523a15475d0560dbe35e004c395ab07610c95f3d78c2658d817e85 | MATLAB | 1,224 | 43 | function value = get(tree,uid,parameter)
% XMLTREE/GET Get Method (get object properties)
% FORMAT value = get(tree,uid,parameter)
%
% tree - XMLTree object
% uid - array of uid's
% parameter - property name
% value - property value
%______________________________________________________________________... |
6b019422b374c0ffeb6136b9e2a5bb545c6b9796006d044b5a04717d12bd320f | MATLAB | 1,224 | 29 | function mglStrokeText( string, x, y, scalex, scaley, linewidth, ...
color, rotation );
% [x,y]=mglStrokeText( string, x, y, scalex, scaley, linewidth, color, rotation );
%
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% Draws a stroked fixed-width character or string on mgl display. Def... |
956664de0c01ccc969d12b40f8e5594ad97a0ba51b15764319033ca7e7420d6d | MATLAB | 1,224 | 36 | %{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the t... |
c9e5519025070264f5586dcf3a917071b534d435323b23ad2698b16bed2fd9da | MATLAB | 1,224 | 26 | % VL_TWISTER Random number generator
% VL_TWISTER() is essentially equivalent to MATLAB native RAND()
% when using the Twister random number generator. VL_TWISTER(),
% VL_TWISTER(M,N,P,...) and VL_TWISTER([M N P ...]) are equivalent
% to RAND(), RAND(M,N,P,...) and RAND([M N P ...]) respectively.
%
% T... |
59dba78ee8841577f5dc02abe4ebb12a0a562485b6eabb9a185a3ce1537c4465 | MATLAB | 1,225 | 38 | % rmvIndAtSelX.m
%
% Function that takes in specific x-coordinate value and removes
% the corresponding index from the given indices vector
% Called by interactGetLegReversals(), meant to remove selected point
% from max/min indices list
% Converts x-coordinate value to index by using input x-coords to index
% mappi... |
b5ba060c49af1ca188790c82fa3467839c19845c70e9430161df7f345825d3d5 | MATLAB | 1,225 | 36 | % vInjDir.m
%
% Quick function that specifies folder where voltage injection protocol
% functions live.
% Ideally, would have been part of ephysSettings.m, but too awkward to
% change now
%
% INPUTS: none
%
% OUTPUTS:
% vPath - full path to folder containing current injection protocols
%
% CREATED: 2/11/21 - HHY
%
... |
dc760b430c53bd40f95b177173200ff1286edb074096b388ec341ce60832c5f9 | MATLAB | 1,225 | 45 | % getInterpPad.m
%
% Function that returns padding at the beginning or end of a vector.
% Padding is generated by cubic spline interpolation
%
% INPUTS:
% vec - vector to pad
% padLen - length of padding, in samples
% padSide - which side to pad, 'start' or 'end'
%
% OUTPUTS:
% pad - vector for calculated paddi... |
b41f475b7b331441b80f14fb7f75a63dd06a79b241a07d4b213f9dc4b883b165 | MATLAB | 1,227 | 48 | %% corr between her and behav corr
%% para
roi_num = 48;
Mask_net = logical(tril(ones(roi_num),-1));
path = pwd;
rand_time = 10000;
% her data
load('heritability_matrix_p_VBM.mat','her')
data_her = her(Mask_net);
% dis data
load('dis_whole.mat','dis_matrix_bi')
dis_moran = dis_matrix_bi;
W = 1./dis_moran;
W(1:le... |
094c32d9a6f4862aa42e84b74f87c578b95d2b0d70c32fbb1ea4b13961ad6c7a | MATLAB | 1,228 | 39 | function V = spm_vol_nifti(fname,n)
% Get header information for a NIFTI-1 image.
% FORMAT V = spm_vol_nifti(P)
% P - filename.
% n - volume id (a 1x2 array, e.g. [3,1])
% V - a structure containing the image volume information.
%____________________________________________________________________________
% Copyri... |
43536caebaba76f0c95d2c8867c6563709491efba1e5c838f681955f99185dfb | MATLAB | 1,228 | 25 | %% Figure 3C
% load data
data_path = '/Users/celia/Documents/two_context_data'; % change this
cal = load(fullfile(data_path, 'calcium_20220516_170618/analysis_results.mat'));
tet = load(fullfile(data_path, 'tetrodes_20220316_100902/analysis_results.mat'));
best_aligned = [cal.analysisResults.BestAligned; tet.analysisR... |
408a29e8c643d226d4df2cf8a056a91529453acec3c5cbda065a477bf6ef5e1f | MATLAB | 1,230 | 65 | %
% Spectral network evolution.
%
% Both decompositions need not be of the same size.
%
% V and source_V are [] for symmetric decompositions.
%
% RESULT
% dd_new Predicted new eigenvalues
%
% PARAMETERS
% source_U Decomposition of source set
% source_dd
% source_V
% U,dd,V Decomposition of training set
% func ... |
3b45a04e1b4c774ad19b576ebae1b40f0473da0523f377ceb5f677eb1b2b8ca3 | MATLAB | 1,232 | 41 | function y=consolidate(x)
%CONSOLIDATE field names in nested cell arrays produced by xml2mat of mbmling results
%
%Syntax: y=consolidate(x)
%
%Description:
% the nested cell arrays produced by XML2CELL emcapsulate the individual
% data structures. CONSOLIDATE will remove the cell encapsulation,
% returning the nested ... |
d1fb70eb01856380f03c46fa3855b3f5b6f4122ae96f792f673aa537595bc5d4 | MATLAB | 1,232 | 36 | function [linear_kernel] = BTA_to_kernel(BTA, BTA_stats,meanLEDPower,skip_threshold)
%This function gets the kernel section of the BTA
% The kernel is defined as bounded by zeros that contain all the significant
% regions
if nargin<3
meanLEDPower = 0;
end
if nargin<4
skip_threshold = tr... |
0d9f90af46b41d1a181092e360324af91e17053ae53e0d727c9a7709200cc7e1 | MATLAB | 1,235 | 54 | % VL_DEMO_SVM Demo: SVM: 2D linear learning
function vl_demo_svm
y=[];X=[];
% Load training data X and their labels y
load('vl_demo_svm_data.mat')
Xp = X(:,y==1);
Xn = X(:,y==-1);
figure
plot(Xn(1,:),Xn(2,:),'*r')
hold on
plot(Xp(1,:),Xp(2,:),'*b')
axis equal ;
vl_demo_print('svm_training') ;
% Parameters
lambda =... |
a6c380c8d371698678fa3d9e1a6502965186b2d7d3ccfed65689a72918b95de2 | MATLAB | 1,235 | 36 | % vsPatternsDir.m
%
% Quick function that specifies folder where visual stimuli patterns live,
% for G3 visual arena.
% Ideally, would have been part of ephysSettings.m, but too awkward to
% change now
%
% INPUTS: none
%
% OUTPUTS:
% vspPath - full path to folder containing visual stimuli patterns
%
% CREATED: 2/8/... |
f59bc170465ea7869fd9f8de4a5db3fb0f35d1901b68b9cf13c3659e3b121420 | MATLAB | 1,235 | 41 | figure(1000); clf;
dt=0.1;
t=0:dt:20;
mf=.1;
A=sin(2*pi*mf*t);
F=sin(2*pi*mf*t);
A=1;
%F=0;
f=.7;
x=A*sin(2*pi*(f+F).*t);
% x is the signal; t is time vector.
% performing the HILBERT TRANSFORM
hx = hilbert(x);
% calculating the INSTANTANEOUS AMPLITUDE (ENVELOPE)
inst_amp = abs(hx);
% calculating... |
acb4eb2b97a7c72d0b6c7cd7914d075f68e7bfd2cb7758d8d9f5608f1860322c | MATLAB | 1,236 | 44 | function [ r ] = ml_core_pixel_pixel_similarity_compute(T1, T2, varargin)
p = inputParser;
p.CaseSensitive = false;
checkmatrix = @(x) isnumeric(x);
addRequired(p, 'T1', checkmatrix);
addRequired(p, 'T2', checkmatrix);
% By default use all of the matrix entries
checkweight1 = @(x) isnu... |
ce6e697666b3c78f386f8dd3c810eb77cb5a1598a09395a1b761a196c3c953af | MATLAB | 1,237 | 26 | % Script to take FD_survival_plot input directory and path and input them
% to the function as well as modify a few figure fields post-function run
%
%% Example argument formatting:
% group_folder_path = '/group_shares/FAIR_LAB2/CYA/analyses_v2/Music-HumanAdult-Auckland_OHSU/GEN3-SEEDCORREL_1';
% subject_list_file =... |
679be0d3328d3c5f62c7688a9b9e940c4fe63469bd6a0a22e2ab346eec65af70 | MATLAB | 1,238 | 35 | function params = getExampleParams()
% Function to create example parameters to run spatiotemporal model
%
% INPUT:
% None
%
% OUTPUT:
% params : (struct) struct with default, example pRF model parameters
%
% Written by ERK & ISK 2021 @ VPNL Stanford U
%
%%
params = struct();
params.saveDataFlag ... |
2b8848f137d7c05832d188d5e420667a518eeff1f4ae1d8ff52146b352e36e3f | MATLAB | 1,239 | 39 | % Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024
function [hFig] = make_figure(resultsFn)
data = readtable(resultsFn); % the Excel file with the accuracies
groupLabels = {'Day 1', 'Day 2', 'Day 3'};
nGroups = length(groupLabels);
M = zeros(nGroups,1);
E =... |
dbae58078fa29ad70b6a5b3c1e9a103002d00de1034fcd30ee9d7cc6a3ffdf21 | MATLAB | 1,239 | 48 | function startpt = findstartpt_step(dat, chanNum, expmtType, freq)
%% Calculate Fits
samplerate = dat(5).samplerate;
headVel = dat(5).data;
drumVel = dat(7).data;
% Fit vars
segLength = length(headVel);
segTime = (1:segLength)/samplerate;
cycleLength = round(samplerate/freq);
... |
fd6639214ffd99e58fd94595f52962aed2549bd586914b9bebdcea242c3810e5 | MATLAB | 1,239 | 51 | %% script to run SOC optimisation and save results
% Mark Humphries
clearvars; close all
%% initialise
% parameterise network
Net.N = 200;
Net.p = 0.1;
Net.fractionExcite = 0.5;
Net.ratioI = 3;
Net.R = 10;
% parameterise algorithm
Optim.C = 1.5;
Optim.B = 0.2;
Optim.learningRate = 10;
Optim.convergenceThreshold = 0.... |
22ef2462298de31e28fa4aa149e0ae7f431de9085e555ad25e3334c8b0315420 | MATLAB | 1,241 | 46 | function [ifr,tt] = instantfr(t_spk,tt)
% INSTANTFR - Instantaneous firing rate of a spike train
% ifr = INSTANTFR(t_spk, tt) calculates the instantaneous firing rate
% at times TT of a spike train with spikes at times T_SPK.
% In the interval between two spikes I and I+1, the instanteous firing
% rate IFR is d... |
0c75a4306abfc78301ba4079957f23cd3180557b970bef3e02e76a5ac1131fd5 | MATLAB | 1,242 | 60 | function resting_state_fc(DATA,ROI,AddInfo)
%
% An Aedes plugin that calculates resting state funtional connectivity from
% seed ROIs.
% Only accept 3D or 4D data
if AddInfo.isDataMixed || ndims(DATA{1}.FTDATA)==2
errordlg('Only 3D or 4D can be used with this plugin.','Error',...
'modal');
return
end
data=DA... |
4c18bc72b45d6170d69f7c87bca7a651f5265f086f80cca87a427e978e363b0b | MATLAB | 1,242 | 36 | % vsFunctionsDir.m
%
% Quick function that specifies folder where visual stimuli functions live,
% for G3 visual arena.
% Ideally, would have been part of ephysSettings.m, but too awkward to
% change now
%
% INPUTS: none
%
% OUTPUTS:
% vspPath - full path to folder containing visual stimuli functions
%
% CREATED: 2... |
cf4d603dd74e59df970e50372c1a11f7c0e798bbf5af481927c295710397e3e6 | MATLAB | 1,242 | 37 | function [params, s_new] = denoise_mask(params, s, state)
% Mask DSS denoising function
% [params, s_new] = denoise_mask(params, s, state)
% params Function specific modifiable parameters
% params.mask ...
% state DSS algorithm state
% s Source signal estimate, matrix of row vector signals
%... |
45a6b4b71e8306b79353cce6dbefb41fbf03f8bacf7592f2202ce42f82315ec5 | MATLAB | 1,243 | 31 | function check_inputs(stg,prf)
% gets Settings and profile variables and checks for the required fields
%
% CHECK_INPUTS(STG,PRF) gets STG and PRF structured variables and checks
% for the required fields of each.
%
% Ehsan Kakaei, Jochen Braun 2021
% (https://github.com/cognitive-biology/DLDA)
disp('Checki... |
953e7c2fbde47e62cecba15a17ca820cc76e28edf9883f7bd54bd6fef2726772 | MATLAB | 1,243 | 36 | function [ allTracks, folder_indecies, track_indecies ] = loadtracks(folders, field_names)
%get the tracks given folders
if nargin < 2
field_names = {};
end
allTracks = struct([]);
folder_indecies = [];
track_indecies = [];
if iscell(folders)
for folder_index = 1:length(fol... |
a9cf1519b523ad756e0be001ae0ef63c394eeadd36ee5e67ac4cffe3d1d39c95 | MATLAB | 1,243 | 42 | function state = dss_core_pca(state)
% PCA DSS algorithm
% state = dss_core_pca(state)
% Calculates linear denoising source separation with PCA.
% Performs calculation defined by state structure and
% returns the result as state structure.
% Used CPU time is recorded in the state.
% Copyright (C) 200... |
7c1fcb4c1ece634eb54ab658716fb40c0fee148c52cbd547eda6df0c6061c01e | MATLAB | 1,245 | 46 | % Basic uninstall script for local installation
%
% Get inst directory
inst_dir = fullfile (fileparts (mfilename ('fullpath')), 'inst');
% Check if running in Octave (else assume Matlab)
info = ver;
isoctave = any (ismember ({info.Name}, 'Octave'));
if isoctave
% Uninstall for Octave
rmpath (inst_dir)
octave... |
97592bed1d10900b875ff3606aa97596a39b1e67c00249e355e0d7cb84fc6fb4 | MATLAB | 1,245 | 38 | function XML=mat2xml(MAT,VARNAME)
% MAT2XML converts structured variable MAT into XML string
%
%Syntax XML=mat2xml(MAT,VARNAME)
%
%Description
% MAT : structured varable
% VARNAME : variable name (string)
% XML : xml version of structured variable (string)
%
% See Also: XML2MAT
%
% Jonas Almeida, almeidaj@musc.edu... |
373f4f57947d551adfbfd65a3343b6f7d3107ba8c0dd9efef930db975a918505 | MATLAB | 1,246 | 42 | function output = TDMS_initData(dataType,nSamples)
%TDMS_initData Initializes raw data arrays
%
% output = TDMS_initData(dataType,nSamples)
%
% dataType - Labview datatype
% nSamples - # of samples to initialize to
%
% See Also: TDMS_getDataTypeName
switch dataType
case 1
output = ze... |
6360ed322e8ae207146f4bdd3dfc0327e7a4a65a95658b29f6c9295a84d54208 | MATLAB | 1,247 | 48 | function startpt = findstartpt(dat, chanNum, expmtType, freq)
%% Calculate Fits
samplerate = dat(5).samplerate;
headVel = dat(5).data;
drumVel = dat(7).data;
% Fit vars
segLength = length(headVel);
segTime = (1:segLength)/samplerate;
cycleLength = round(samplerate/freq);
%cycl... |
f47e563e8261b59b07fb046538480307e52d7aaa6b66308baa18a60a9fba7f98 | MATLAB | 1,247 | 52 | % loadKernelYScaleYLabels.m
%
% Quick script to load y scales and y labels for kernel plotting, for when
% behavioral velocity units are all deg/s or for both mm/s and deg/s
%
% UPDATED: 9/4/19 - HHY
yScale = {[-4e-4 16e-4]...
[-1e-5 2e-5]...
[-1e-3 2e-3]...
[-1e-5 4e-5]...
[-0.5e-5 2.5e-5]...
[-0.... |
2fc97f676630334050e1de09d2a4e194f49cce73339b124b0626e4e563b3bbd6 | MATLAB | 1,248 | 45 | % mglTestGluPartialDisk: an automated and/or interactive test for rendering.
%
% usage: mglTestGluPartialDisk(isInteractive)
% by: Benjamin Heasly
% date: 03/10/2022
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: Test rendering various sizes and shapes of vec... |
5ba0fc4b216b72340cab1aade5dff34421591772a7ae26327b2d4a47f4b83a29 | MATLAB | 1,248 | 44 | function FR=make_friston_regressors(MR, head_ratio_cm)
%% function R=make_friston_regressors(R, head_ratio_mm)
% This function takes as input a matrix having 6 columns, corresponding to
% the 6DOF movement correction parameters of EPI data and then it
% calculates the 24 corresponding Friston regressors, as reported i... |
700376e41124bf11b3ba17d36d3b6bd6a14949ac3cc8278f898bcd4bb5ad3ed7 | MATLAB | 1,249 | 53 | function [rc] = gretna_rich_club_bin(A)
%==========================================================================
% This function is used to calculate rich club metric for a binary graph or
% network G.
%
%
% Syntax: function [rc] = gretna_rich_club(A)
%
% Input:
% A:
% The adjencent matrix of... |
cf3b53e4dde2c9e9fe1f75fed1efffa618e85acd560d0af57a5881fd4760e919 | MATLAB | 1,249 | 48 | % nodeNameToInd.m
%
% Helper function that takes in name of node (or cell array of nodes) and
% returns the index value(s) in full node array. NaN if it can't find node
% name.
%
% INPUTS:
% selectNames - names of selected nodes, for which indices are desired,
% as cell array or single string
% names - ful... |
38a8525edb00376dbfd099a4d8c7f5fb6f66e2980d558c0837e4e76d2d9a98df | MATLAB | 1,250 | 60 | <<<<<<< HEAD
function plotMatchDistribution(indexes, curAxes, optPlotgms, optPlotims)
%error(nargchk(2,4,nargin));
% set the graphics handler
if nargin == 1
curAxes = figure;
end
% color and type of line
if nargin <= 2
optPlotgms = 'g-';
end
if nargin <= 3
optPlotims = 'r-';
end
axes(curAxes);
hold on, g... |
4617b48d539326674f0456037485c26261e480a46811f1b702ec399253e2818b | MATLAB | 1,250 | 31 | function w=xml2whos(w_xml)
%XML2WHOS identifies WHOS-type structured variable from xml descriptor
%
%Syntax: w=xml2whos(w_xml)
%
%Description
% w is a structured variable with the information that would have benn
% returned by a WHOS command of the structured variable
% w_xml is the corresponding xml descriptor, e.g... |
ee91370013479d177a3be039c6e2c3839e17c39a52f2889f9f742ee3cd2a941d | MATLAB | 1,250 | 55 | %
% Create nearest-neighbor graph
%
% Input:
% X: Input data
% k: The number of nearest-neighbor
% sigma: Heauristics for setting Gaussian width 'median' or 'local-scaling'
%
function [W sigma] = generate_nngraph(X, k, sigma)
D = squareform(pdist(X').^2);
[sort_D sort_idx] = sort(D);
n = size(X,2);
%% Diagonal e... |
183794f9dc0b9ac60e89cc7a7a85b235620bd3ed33d360dce69d933ffdbd6547 | MATLAB | 1,251 | 36 | % optoStimDir.m
%
% Quick function that specifies folder where opto stim functions live.
% Optogenetic stimulation through control of shutter in front of Hg lamp.
% Ideally, would have been part of ephysSettings.m, but too awkward to
% change now
%
% INPUTS: none
%
% OUTPUTS:
% iPath - full path to folder containing... |
8bf696d8d02483382281ea6be3aaa7aff1e460cab0a3f005d8943937f1559b33 | MATLAB | 1,251 | 41 | function results = vl_test_twister(varargin)
% VL_TEST_TWISTER
vl_test_init ;
function test_illegal_args()
vl_assert_exception(@() vl_twister(-1), 'vl:invalidArgument') ;
vl_assert_exception(@() vl_twister(1, -1), 'vl:invalidArgument') ;
vl_assert_exception(@() vl_twister([1, -1]), 'vl:invalidArgument') ;
function te... |
93485c4e105e5d9f77e143be168b4988490c20f09c2077391cd17c2e30cca66b | MATLAB | 1,251 | 32 | function[interval,start]=SONGetSampleTicks(fid,chan)
% Finds the sampling interval on a data channel in a SON file
% in clock ticks and returns the time of the first sample
%
% Malcolm Lidierth 02/02
% Updated 09/05 ML
% Copyright © The Author & King's College London 2002-2006
FileH=SONFileHeader(fid); ... |
2044c324e529e922c4897d0c0e9e0b56bd75425077b7736f8522688aa84b059d | MATLAB | 1,252 | 45 | % mglTestScreenCoordinates: an automated and/or interactive test for rendering.
%
% usage: mglTestScreenCoordinates(isInteractive)
% by: Benjamin Heasly
% date: 03/10/2022
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: Test setting the rendering units to be p... |
f81860c1853cd924bab344b4dfb1841f73d12d3f6f7030cab0c7090f1a97aa96 | MATLAB | 1,252 | 50 | % generate_no_oscil_ex.m
% to generate no oscillation examples
% with same simulation parameters
% as were used for figure 1
%%
clear all;
close all;
clc;
%% add fn paths if not added yet
% assumes script run within local directory
scriptdirs = {
'../../analyze';
'../../figures';
'../../helper_functions';
'../../simula... |
0b40d3397e3d3a8336ff5ba38066c1dfb20f8c2a5ed19d68f701728d5da9030c | MATLAB | 1,253 | 45 | % plotPairwiseCorr_heatmap.m
%
% Given one output file from saveStepParamPariwiseCorr_bouts(), plots the
% actual correlation as well as the bootstrapped, randomized one as
% heatmaps
%
% INPUTS:
% datDir - path to folder containing correlation files
% cScale - scale for color axis
%
% OUTPUTS:
% none, but gene... |
337d31bf4b68d01f6c0e05f8e8777261762ae325af2cd134a74c45f7a925e4c2 | MATLAB | 1,253 | 27 | function [behavioral_transition_rates,behavioral_transition_rates_std,behavior_occupation_ratio] = find_behavioral_rates(Tracks)
%This function takes in tracks and finds the various rates of behaviors,
%both transitions in transition/min and fraction of time spent in that
%behavior
fps = 14;
load('reference_em... |
460e1593ab08d51a6add8822a48a6be2d195218e4a5d24e2c0369f973f04235c | MATLAB | 1,253 | 51 | function rgb=hsl2rgb(hsl_in)
%Converts Hue-Saturation-Luminance Color value to Red-Green-Blue Color value
%
%Usage
% RGB = hsl2rgb(HSL)
%
% converts HSL, a M [x N] x 3 color matrix with values between 0 and 1
% into RGB, a M [x N] X 3 color matrix with values between 0 and 1
%
%See also rgb2hsl, rgb2hsv, hsv2... |
ad9a8762ebe0e205eb905726126607ce05b46c96e51a6b7ba3923f65fb67bc92 | MATLAB | 1,253 | 36 | function hrf = canonical_hrf(TR, P)
% Derives the canonical difference of gammas HRF implemented in SPM
%
% INPUTS
% TR: fMRI repetition time (s)
% P: parameters of the response function in units of seconds (optional)
% P(1) = delay of response relative to onset (default = 6)
% P(2) = delay of undershoot relat... |
bae70fb64b9a2241a81c748ec8e3140389ce6d03b72540f7bfb37f5f2a8471fc | MATLAB | 1,253 | 31 | function convert_dlc_to_mlbehaviourtrack_per_trial( obj, session, trial )
% Track the behaviour
mlvidrec = MLVideoRecord( fullfile(trial.getAnalysisDirectory(), 'behav.hdf5') );
% For now the DLC data is put into the recording folder (but
% shouldn't be)
%trialDLCFolder = trial.rawFolder;
trial... |
41419ceac029539691f632849a5b5dad0545af10a1a8dccfed601a09fd0338a9 | MATLAB | 1,254 | 46 | function [ r ] = ml_core_pixel_pixel_cross_correlation_compute(T1, T2, varargin)
p = inputParser;
p.CaseSensitive = false;
checkmatrix = @(x) isnumeric(x);
addRequired(p, 'T1', checkmatrix);
addRequired(p, 'T2', checkmatrix);
% By default use all of the matrix entries
checkweight1 = @(... |
cda3e8abb3d4fa556fb1004e5246c42bf274c1c45165ed3fbf35ebef36f94ae6 | MATLAB | 1,254 | 55 | function T = vox2ras_tkregmtx(voldim, voxres)
% T = vox2ras_tkregmtx(voldim, voxres)
% voldim = [ncols nrows nslices ...]
% volres = [colres rowres sliceres ...]
%
% Computes the 0-based vox2ras transform of a volume
% compatible with the registration matrix produced
% by tkregister. May work with MINC xfm.
%
%... |
591de455a85fa0ab19fc688714dc9293ca1bf5d0b36719f308132921da5d9235 | MATLAB | 1,255 | 40 | function [PN, imgo, scr] = lk_ref_track(Y, imref, maskc)
% track image cluster Y with LK tracker relative to the reference frame
% Jinghao Lu, 01/30/2018
if nargin < 3 || isempty(maskc)
maskc = true(size(imref));
end
%%% track frames %%%
n = size(Y, 3);
PN = zeros(2, n);
isf = zeros(... |
a180f3b42976b3df46b13ae1ae7c43309883799d336265564fd46cbfe9d30039 | MATLAB | 1,255 | 35 | % mglContextList: List the names of stashed and active mgl contexts.
%
% $Id$
% usage: [stashedNames, activeName] = mglContextList()
% by: ben heasly
% date: 09/07/2022
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: List the names of stashed and active... |
30fc73c6e7ed0156cb4ea2b9d1a8b6f488a02c46d9e5aa56645edba8dd7d12c6 | MATLAB | 1,258 | 45 | % getNormSynWeight.m
%
% Function to get normalized weights: number of synapses of given
% connection / number of synapses that neuron receives
%
% INPUTS:
% synNumCSVFile - full path to CSV file containing node IDs and number of
% synapses they receive
% t - array of targets for connections
% weights - ar... |
40ea2f81d0a5fb267a9bd96007d43150fbe8cf4e3d835c39c655134d71ea5780 | MATLAB | 1,258 | 28 | % Script to take FD_survival_plot input directory and path and input them
% to the function as well as modify a few figure fields post-function run
%
%% Example argument formatting:
% group_folder_path = '/group_shares/FAIR_LAB2/CYA/analyses_v2/Music-HumanAdult-Auckland_OHSU/GEN3-SEEDCORREL_1';
% subject_list_file =... |
5f8d5921bbc10e3449bbb874d52857ef3d42776292df3af16d8af40b1b18ecfd | MATLAB | 1,258 | 25 | % Script to take FD_survival_plot input directory and path and input them
% to the function as well as modify a few figure fields post-function run
%% Example argument formatting:
% group_folder_path = '/group_shares/FAIR_LAB2/CYA/analyses_v2/Music-HumanAdult-Auckland_OHSU/GEN3-SEEDCORREL_1';
% subject_list_file = '/... |
64c999bc353c6ef4ffd33f57c0f360c8f5f58db71cd4ea5494d5ef74b9a04220 | MATLAB | 1,258 | 34 | %scan ramps using tilt shifts
SC = set_PG_ND(SC);
%% settings
f_fin = OPT_S.f_fin.*SC.mask_f_laser;
num_tilts = length(FOV.TS_scan);
FOV.conf_images=zeros(SC.N_PG,SC.N_PG,num_tilts,4);
fx_laser_0 = SC.ramps.fx_laser;
fy_laser_0 = SC.ramps.fy_laser;
%% scan ramps
SC = laser_on(SC);
thetas = [0 45 90 135]; ... |
821471de77a3d10ecbb9375c353ebc163e48bb26d955681d6193d8f7f2f08351 | MATLAB | 1,258 | 44 | function create_directories_results(path_of_script, voxel_positions, snrs)
for inx_voxel = 1 : size(voxel_positions,2)
voxel_name = voxel_positions{inx_voxel};
folder_voxel_name = [path_of_script filesep 'Results_And_Figures' filesep 'Fit_Results' filesep 'voxels' filesep voxel_name];
if ~exist(folder_vo... |
1ddc17245ca45ec7c9030184cf340bf59352259c031bc7a90fae3a1a70471b37 | MATLAB | 1,260 | 58 | %% this script is used to takes a segments, or chunks of data, and organize
% them in a useful way.
%
% max.gagnon11@gmail.com 5/18
%% Import data
clear
data = 1:1000;
%% setup
% Define start time
startT = 10;
% CHOOSE ONE: total amount of segments, or end time of the segments
endT = 80;
%segNum = 4;
% Define len... |
a2844a774583807f8c28df2b1991567cc190f792e73dba2556e223301273c984 | MATLAB | 1,260 | 62 | close all
clear all
clc
project = ml_util_json_read('project_config.json');
fl = dir(fullfile(project.analysisFolder, '**', 'rate_difference_matrices.mat'));
%iFile = 1;
sc = [];
dc = [];
for iFile = 1:length(fl)
f = fl(iFile);
fn = fullfile(f.folder, f.name);
[scn, dcn] = process_matrix(fn);
sc = [s... |
ce18875f225795a325ca7b59d32645ffe0825b1fb0f6e29c736bcb8db42728fa | MATLAB | 1,260 | 44 | function [manual_intensities, manual_intensities2,cellocs] = findintensities_s2pcentroids(red_wavelength_stack,centroids)
npocks=size(red_wavelength_stack,1);
nwaves=size(red_wavelength_stack,2);
manual_intensities=zeros(size(centroids,1),npocks*nwaves);% intensities is a w, p, idx matrix for avg brightness of each r... |
069dc3b29857a4f83749a62aadf9571be44bff8855b10c8e5d42134f63c81c73 | MATLAB | 1,261 | 31 | %%
clear
file=dir('ACC*restable*.mat');
k=1;
for jj=1:length(file)
load(file(jj).name)
n=length(outcome);
n1=fix(n*0.15);n2=fix(n*0.5);
go{1}=[find(outcome(1:n1,1)==1);find(outcome(1:n1,1)==2);find(outcome(1:n1,1)==5)];
go{2}=[find(outcome(n1+1:n2,1)==1);find(outcome(n1+1:n2,1)==2);find(out... |
1e3d5d00aa9393f1a885dc8cf1cbaf1c2ee89c1be981413793ac07bdfb5782b7 | MATLAB | 1,261 | 49 | function C=coclassificationMatrix(S)
% coclassificationMatrix Compute coclassification frequency between nodes
%
% Syntax
%__________________________________________________________________________
%
% C=coclassificationMatrix(S)
%
%
% Description
%_____________________________________________________________________... |
61958dc4766cde0b33d70b7761abdb8fff6b5b2f060aaf93a3784a1a4f1db6d4 | MATLAB | 1,261 | 36 | %{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the t... |
58a95f4b9e1414f12be546f4bf8f09dc698d3293d4eeeef71a112783f06bb346 | MATLAB | 1,262 | 45 | function maskErode = imerode3(mask, radius, flag3d)
% Faster with build-in!
% Updated 2014-12-15
% added 2D compatibility, 2017-04-11
% updated, X.L., 2017-08-04
% updated, added 3dflag
if nargin < 3
flag3d = 0;
end
if (radius < 6) && (~flag3d)
[xx,yy,zz] = ndgrid(-radius:radius);
if size(mas... |
83327346c5c8d9a3d6cef704cf5fe27031606df727ecb868312a0f1924fac4ea | MATLAB | 1,262 | 33 | function [analytic_t_mus, analytic_y] = ml_alg_bandpassed_analytic_signal(t_mus, y, bandpass_freqs)
% Resample to have equal sampling intervals
dt_mus = median(diff(t_mus));
interp_slice_t_mus = t_mus(1):dt_mus:t_mus(end);
interp_slice_csc = interp1(t_mus, y, interp_slice_t_mus);
% New sampling... |
f9f710a730612961613657da8961fa80b7156def34409b4cc67da375872734c7 | MATLAB | 1,262 | 49 |
function cnn_forward_evaluate_obj(work_info_batch, group_idx)
prediction_info=work_info_batch.ref.prediction_info_groups{group_idx};
one_output_info=prediction_info.output_infos{end};
assert(check_valid_net_output(one_output_info));
work_info_epoch=work_info_batch.ref.work_info_epoch;
eva_r... |
4bea9cff2b0bed1389d796c44f3dbe59ae03c5b1afe883e83b57dc1dd4bb0db6 | MATLAB | 1,263 | 38 | function overlap = overlap_neurons_consume(neuronmasks,avgA,thresh_mask,thresh_consume,times)
% Combine masks with large IOU or consume.
% thresh_IOU=0.5;
% thresh_consume=0.8;
% thresh_consume should be larger than 2*thresh_IOU/(1+thresh_IOU) to avoid
% two masks consuming each other.
% [Lx,Ly,n] = size(neuronma... |
03f5fe2a08c41383ec9f7ade8b821943638cb0d6b9b658878b01cd172b9e3c97 | MATLAB | 1,264 | 63 | <<<<<<< HEAD
function plotFMRFNMR(FMR, FNMR, base, curAxes, numBins, optPlotFMR, optPlotFNMR)
narginchk(3,7);
% set the graphics handler
if nargin == 3
curAxes = figure;
end
% number of bins for distributions plot
if nargin <= 4
numBins = 100;
end
% color and type of line
if nargin <= 5
optPlotFMR = 'r-';... |
a6ad396fd7cb7a119406dfc134814b5f44c5c6893fa0e1267647b5dcbaad1bcd | MATLAB | 1,265 | 42 | % collectData.m
%
% Function to collect data from DAQ background acquisition into global
% variable daqData.
% Persistent variable whichInScan helps keep track of index
% into daqData across calls to collectData
% Based off collectData() from Clandinin lab 2P-stim-code
%
% INPUTS:
% src - as required by listener, ... |
be3bc1edb91d581258598e8f3ad9fc85b1c50ec05fd863045a38b7f2ca3bd7f6 | MATLAB | 1,265 | 55 | path_of_script = fileparts(mfilename('fullpath'));
load('invivo_datasets.mat')
dataset_names = {'cb', 'ct','or', 'slf'};
for inx_dataset = 1: numel (dataset_names)
for inx = 1:3
if inx_dataset == 1
Dataset = Dataset_cb;
elseif inx_dataset == 2
Dataset = Dataset_ct;
... |
1bdb3fbb491f2727a1030b301e43288eaf62dd298340438fffb9a641c123b17c | MATLAB | 1,266 | 36 | function [motionData] = ml_motion_load_nvt( nvtFilename )
%% This function read in the motion tracking coordinates from the Neuralynx
%% file format (custom).
if ~isfile(nvtFilename)
error('The file (%s) does not exist. Can not export motion tracking coordinates.\n', nvtFilename);
end
reco... |
2f2da8330b381934ae774f73738a20408076f44177683f2830ee7dcfeccba243 | MATLAB | 1,266 | 33 | function [slice] = ml_nlx_nvt_split_into_slices( nvtFilename, nvt_file_slice_separation_threshold_s )
% Check that the inputs are fine
if ~isfile( nvtFilename )
error('The required file (%s) does not exist.\n', nvtFilename);
end
if nvt_file_slice_separation_threshold_s <= 0
error('The sl... |
4adf3436a5d14fbe92aae07b8a87960ba78dd36c6ce325e05846f0d4f617281d | MATLAB | 1,267 | 54 | function [smat] = shuffle_isi_delta_windows(delta_mat)
%shuffle_isi_delta_windows.m
%6/12/22
% assumes nWin x nTime orientation
ISI = getISI(delta_mat);
nI = numel(ISI);
sISI = sort(ISI,'descend');
pool = sISI;
[nW,winLen] = size(delta_mat);
timeLeft = ones(nW,1)*(winLen-1); % -1 to reserve room for init spk
wmat = ze... |
1a52909910669edc15daeaac1292072b82624177b235209326b6f12c549d77e3 | MATLAB | 1,268 | 42 | function cIm = Rgb2C(rgbIm)
% cIm = Rgb2C(rgb)
%
% Transforms RGB image into C-space. This is basically opponent color space
% where the intensity is divided out of the opponent color channels.
%
% rgbIm: N x M x 3 Rgb image. Doubles in range 0:1.
%
% cIm: N x M x 3 Opponent Image. Double... |
6932a22aae82eceb585616bda445d8e5706aead0a048c80c5205c05857e677c2 | MATLAB | 1,268 | 52 | function trackParams = setupEyeTracking_APP(app, trackParams)
%% Load image to test
frame = 1;
[imgLarge] = readImg_APP(trackParams.imAdjust, trackParams.cam, frame);
%% User finds pupil center and analysis ROI
[pupilStartLarge] = testradiipupilmanual_APP(app, imgLarge);
trackParams.pupilStart = [round(pupilStartLarg... |
1627520568b8c30453d1a7c0e49386212c21f9c54d5c84a82486dc1838b7c0c3 | MATLAB | 1,269 | 37 | %{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the t... |
b0b1146f1c6be53a6dfb137ffd3620b4cb8d7e98979f9281176bb9c06ab1d004 | MATLAB | 1,269 | 33 | function V = spm_write_plane(V,dat,n)
% Write transverse plane(s) of image data.
% FORMAT VO = spm_write_plane(V,dat,n)
% V - data structure containing image information.
% - see spm_vol for a description.
% dat - the two/three dimensional image to write.
% n - the plane number(s) (beginning from 1). If an en... |
b99de440deed96e5d2bed78d88856d0628c1778b97097a9c0a375b26672ea110 | MATLAB | 1,271 | 42 | function [x,y] = printPath( data, holding )
%PRINTPATH Print the the path of gaze points and return the coordinates
% When given a gaze data table this function will filter out the gaze
% positions and print them. If holding is set to true it will only return
% the coordinates.
% Give a default value to hold... |
d221d40424101a250f3d7ac7b48770f8073e764f822eabbe66197e967be0e780 | MATLAB | 1,271 | 38 | % Performs agglomerative hierarchical clustering on vectorized aggregated data
% 1. Loads correlation matrices from files corresponding to different shifts (musicians and non-musicians).
% 2. Computes the average groupwise correlation for each shift.
% 3. Calculates pairwise distance between the averaged correlation ve... |
b1e3b518ac362b11798952a5bacd19946ff4caa4db5493873e429fe5d02b771b | MATLAB | 1,272 | 40 | function o = cat(dr,varargin)
% Concatenate file_array objects. The result is a non-simple object
% that can no longer be reshaped.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: cat.m 8776 2013-11-14 09:04:48Z roboos $
... |
f0ff944bb27a70e1a306cde93a06d587d5ab9fe4f0b67b9462ca0bf30ee836ac | MATLAB | 1,272 | 40 | function [posX, posY, posX_filter, posY_filter] = findFilterPosition(x,y,step,imageSize,filterSize)
numFilter = ceil(((imageSize(1) - filterSize(1))/2 + 1)/step) * 2 + 1;
tmpImageSize = step * (numFilter - 1) + filterSize(1);
offset = - (tmpImageSize - imageSize) / 2;
filterLength = 1: filterS... |
2bc26af844149c8533b8914acca1699a8341cf0fb28c869fb4a1f57b0fd94a20 | MATLAB | 1,273 | 36 | function fbcspfiltedeeg = FBCSPFilter(eeg,fbcspw,bands,fs,filterorder)
Filter = fbcspw;
m = size(fbcspw,1)/2;
fbcspfiltedeeg = [];
for i=1:size(fbcspw,3)
udfilter=designfilt('bandpassiir','FilterOrder',filterorder, ...
'HalfPowerFrequency1',bands(i,1),'HalfPowerFrequency2',bands(i,2), ...
'Sample... |
85278a983e7d60b1aceb6e6cbce572eb0926e3c72387924a59ef6f06f6ebef43 | MATLAB | 1,274 | 42 | function [vol] = ama2vol(ama)
% AMA2VOL
%
% Use as
% vol = ama2vol(ama)
% Copyright (C) 2008, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under ... |
ce3b400bac96938fd4e4cbda695ede913b868247c08ac7ac54369beebbbcb6c5 | MATLAB | 1,274 | 39 | function [subject_list,subject_survival] = power_2014_motion_survival_plot(group_folder_path,subject_list_file,FD_threshold)
%Displays a colour map of the number of seconds remaining at various FD thresholds
% Inputs:
% group_folder_path Full filepath to where your subject visit folders
% are... |
ffe31226a739876b4f634d70c649ef918952ceb3dc043c0c8c386c3b86befbf2 | MATLAB | 1,274 | 48 | function times = LoadSpikeTimes(filename,rate)
%LoadSpikeTimes - Load spike times and cluster IDs from disk.
%
% USAGE
%
% times = LoadSpikeTimes(filename,rate)
%
% filename spike file name (either .clu or .res)
% rate sampling rate
%
% OUTPUT
%
% The output is a list of (timest... |
63f139ed3a7ad0a78673046659b42028b7539ea0e9c1683cd802c76c8b4616e2 | MATLAB | 1,275 | 39 | function [r] = ml_alg_image_align_B_to_A(A,B)
% This will use maximum cross correlation to find the best
% alignment of B relative to A.
% The k1 vector can be used for coordinate transformations.
padSize = max([size(A,1), size(A,2)]); % compute padding size
IA = prepare_image(A, padSize);
... |
fa5e56f3dfd68d819b0247cbdd6838d8ba13aa56be650a70b1590fa195f284fe | MATLAB | 1,275 | 36 | function smoothed_data = smooth_ma(data, Fs, win_sz)
%% Function: 'smooth_ma'
% DESCRIPTION
% Smoothes input data with a forward moving average (boxcar) window
% USAGE
% Full Input : smooth_ma(data, Fs)
% Example : smooth_ma(input_vector, 1024)
% INPUT
% Variable Data Type ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.