sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
90dc52eb0fdc3206fd2639dfe766ce6f41ac4b5e13e17f42ab072bea2e623d0b
MATLAB
2,123
61
%% addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) clear gui; global gui; global txtFntSz; global video; global masks; global area; % global r_bg_ratio; global comx; global comy; global list_weight; global list_weight_trace; global list_weight_frame; global list_neighbors; % global list_mask_update; % gl...
fd41024f899573f5787e420783b6ac7ee148fa3737306c082e1eec093ddf076a
MATLAB
2,123
61
function sal_opt = treeRankingCandicate(I_fcn, grids, slabel, sc, sr, ssprank) [imh_p, imw_p, ~] = size(I_fcn); if ndims(slabel) == 4 [sc, sr, pixNum, treeNum] = size(slabel); slabel_d = double(reshape(slabel, [sc * sr, pixNum, treeNum])); elseif ndims(slabel) == 3 [sz, pixNum, treeNum] = size(slabe...
143a3e21e25765e01d13f77213c69a48be2d61293f1e2ec02b12f77da4044f0a
MATLAB
2,124
72
function [conf, args] = vl_argparse(conf, args, varargin) % VL_ARGPARSE Parse list of parameter-value pairs % CONF = VL_ARGPARSE(CONF, ARGS) updates the structure CONF based on % the specified parameter-value pairs ARGS={PAR1, VAL1, ... PARN, % VALN}. The function produces an error if an unknown parameter name %...
429e03da4e39c4c0de3cfe391e7256dc46df650619f323966e4aef36d18b4119
MATLAB
2,124
70
function [pos,pdf] = pseudoRandSample2D(sz, nsamps, width, weight, pdf, maxit) % [pos,pdf] = pseudoRandSample2D(sz, nsamps, width, weight, pdf, maxit) % % Function to sample pseudo randomly within a 2D matrix, with partial % exclusion of previously sampled locations. The inputs are: % % - sz - Size of input ...
1bbcc9d994f664d60faf0d4cf4f88b79f13b91430037b39ec37535306654b8b4
MATLAB
2,125
59
% Function: decorrelate input images, the transform matrix is approximately predifined as suggested in Ref. % Input: comb_img - the raw RGB image % trans_matrix - decorrelation matrix % Output: decor_img - the decorrelated images % Ref: Multi-spectral SIFT for Scene Category Recognition, CVPR 11. % Auth...
5bf92351772f8d051d30f208393cedff51445fd5f9df8901051e1532b2cc2d62
MATLAB
2,125
75
function [cspfeature, cspw] = CSP(eeg,label,m) % Common Spatial Pattern % Input: % eeg: Raw EEG Data, the data format is [Ntime*Nchans*Ntrial], where Nchans % is number of channels (EEG electrodes) and the Ntime is the number of % EEG samples, and Ntrial is the number of trials. % label£ºdata label, the value...
6346850f297ef3441e2a7faf00d61b4f6cb87262f5d7d3df7f06ffecda134ef2
MATLAB
2,125
58
function create_sfp_celllike_database(obj, session) fprintf('Creating spatial footprint (sfp) cell-like database for session %s\n', session.getName()); numTrials = session.getNumTrials(); % Load the cell-like data for each trial trialSfpCellLike = cell(numTrials,1); for iTrial = 1:numTrial...
25dbefd5a1b4f70ac63539c4d0358727aad5d9201e36f2115adf491df10c535a
MATLAB
2,126
34
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [RMAverageStable, RMAverageUnstable, RMAverageStableWithinAcross, RMAverageUnstableWithinAcross] = ... compute_stability_animal_averaged_rate_matrices_within_across(SessionsToGroups, RateMatrices, BestAligned, ... BE...
03527f33501c98acbb4061a7ec89e02a2b9fcdce953c1d7b3ea5467123d012ca
MATLAB
2,128
78
function [vertex_coords, faces] = read_surf(fname) % % [vertex_coords, faces] = read_surf(fname) % reads a the vertex coordinates and face lists from a surface file % note that reading the faces from a quad file can take a very long % time due to the goofy format that they are stored in. If the faces % output variable ...
bcb5fea5ad68cc5a40257f966622fde8d103643dad47298a3b03b8594dfd728e
MATLAB
2,129
45
function [ns_RESULT, TimeStamp, Data, DataSize] = ns_GetEventData(hFile, EntityID, Index); %ns_GetEventData Retrieves event data by index % % Usage: % [ns_RESULT, TimeStamp, Data, DataSize] = % ns_GetEventData(hFile, EntityID, Index) % % Description: % Returns the da...
305d5633011a8cd49023b453da1b2d1d34f00631b4acae931df8ff72601c3f1e
MATLAB
2,130
46
function learn_data = feat_augment_data(data, names) [logfeat, normfeat] = feat_augment_log_and_norm() ; epsi = 0.001; % use floowing wavelets to take 1st and 2nd derivatives of features wavelets = [0 0.5 -0.5 0 0; % tight 1st deriv gauss 0 0.25 -0.5 0.25 0]; ...
eb249d99582d3105b43a6bad3ccd4928e9e1dcd5c2571274cf06c3a787c4dbee
MATLAB
2,130
49
clear %load F1s.mat filenames = {'sim_0','sim_1','sim_2','sim_3','sim_4',... 'sim_5','sim_6','sim_7','sim_8','sim_9'}; radii = 8; SNRs = 3; output_folder = ['./','EXTRACT_radius',num2str(radii),'_SNR',num2str(SNRs)','./']; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SN...
f9d35212db5fc1ba1e808de645b6b2913f1fcbc26be58baa3aedb8460d34e51a
MATLAB
2,130
100
% % Plot a time histogram. % % PARAMETERS % $network % % INPUT % dat/time.$network % uni/meta.$network % % OUTPUT % plot/time_histogram.[ab].$network.eps % (a) Distribution density plot % (b) Cumulative plot % bins = 90; font_size = 44; line_width = 14; color_1 = [0 0 1]; network = getenv('network'); 'loa...
a2d65ac2343c87d8de3eb003c5900bf9796289854873985a479654595a08c172
MATLAB
2,131
110
% script for quick plots of average leg steps, FicTrac, iInj data datPath = '/Users/hyang/Dropbox (HMS)/EphysAnalysis-Helen/AnalyzedData/220920_iInj_cond_200msStart_200msWin_l-50yawAngVel'; % datNames = {'220912_fly01', '220912_fly02'}; legInd = [1 2 3 4 5 6; 1 2 3 4 5 6]; durInd = 1; % 0.5 s ampVal = 100; % amp = ...
62b9463d9a8e112b2f0e8ea885a83d73ef6d28956d27d061651263bd8413095c
MATLAB
2,132
60
function cls = get_class_data(stg,prf,clean_data,seq) % returns the data for each class and each subject for the given ROI. % % CLS = GET_CLASS_DATA(SETTINGS,PROFILE,CLEAN_DATA) gets the cleaned data % CLEAN_DATA of the given ROI and returns the data CLS grouped by classes % and subjects. % % Ehsan Kakaei, Joche...
6f425f2ee6a9212730271b649562f4680d6fef98e74343d67693a48aabe6ab46
MATLAB
2,132
72
% Basic MOBI functionality %% Original, "straight line" probe % 1 - Module geometry - MOBI Module - Blue icons in flowchart inside MOCA % github probe.module = createModule("MOBI", 53); probe.module.srcposns = [16,0; -16,0; 0,11;]; probe.module.detposns = [0,19;0,-19]; probe.spacing = 4; % adding 2mm of silicone in c...
32d0e097de8cd04c4a8b83f5b8d4a0537e9da89e0aa8717abbc5edede0fcb92f
MATLAB
2,133
53
function [Pwire, Ewire] = wire_single_rung(L, a, b, N, M, type) % This function creates the structured centered wire grid for a single % straight rung with % a - cross-section radius in m when option type='circle' is chosen for % the rung cross-section % a, b - rectangle sides in m when option type='rect' is...
65edac1ab425ee9f78b0a6874413d26792d2cf971e9f55f1a1be2894e805a670
MATLAB
2,133
69
% addFictracParams.m % % Quick function to save FicTrac parameters from filtFictrac_all() into the % pData file. Corrects for bug (fixed 9/26/20) where it wasn't saved. % % INPUTS: % none, but prompts user to select pData files to add FicTrac parameters % to % % OUTPUTS: % none, but updates pData file with FicT...
7a481c03aa6dcfb3f4a81f34fa16f5184b6a7f57da8852da03fb839f1af35f0f
MATLAB
2,133
61
function [Spectra, SpectraFrames, SpectraTracks, Amps, f] = generate_spectra(Projections, Velocities, parameters) %This function gets the wavelet transform given tracks L = length(Projections); Spectra = cell(1,L); %full wavelet transform SpectraFrames = cell(1,L); %keep track of each datapoint's frame ind...
7dc53d311a0c0f1678880d8ed19f5f07a29dfde722a7b38d98298a653f7b0bc3
MATLAB
2,133
51
% mglSocketAcceptConnection: As a server, accept a pending client connection. % % $Id$ % usage: s = mglSocketAcceptConnection(s) % by: justin gardner and ben heasly % date: 12/26/2019 % copyright: (c) 2021 Justin Gardner (GPL see mgl/COPYING) % purpose: Accept a pending client connection, ...
8b7320ae432d336cea6ddd5bac6d1d4734849ca205e7474bd2dbcfefba9221ea
MATLAB
2,133
55
clear; close all; initime = clock; addpath('funcs'); % get the change of PET in parameter space Delta_e_start = 0.125; % cannot equal to 0 Delta_e_end = 0.4; % can equal to 0.5 Delta_i_start = 0.0125; % cannot equal to 0 Delta_i_end = 0.029; % can equal to 0.5 Delta_steps = 101; Iattn = 0.02; time = 10000; % contain...
a4a3c7f2293425dfe9d5f671e1fa7fd0991ee23b5a84ac8fe50c8ffe89cdad8a
MATLAB
2,133
34
% SON % % Files % progressbar - WAITBAR Display wait bar. % SONADCToDouble - scales a SON ADC channel to double precision floating point % SONADCToSingle - scales a SON ADC channel to single precision floating point % SONChanList - returns a structure with details...
ae31ddf20c0d773a401043e8b0811e447da6e157cf32dc753b883371a0c190c4
MATLAB
2,133
89
% % Integer IDs of submethods; beginning at 1. % function [ids_submethod] = get_ids_submethod() ids_submethod.rat = 1; ids_submethod.main = 2; ids_submethod.common = 3; ids_submethod.adad = 4; ids_submethod.ra = 5; ids_submethod.jaccard = 6; ids_submethod.cosine = 7; ids_submethod.sorensen = 8; ids_submethod.hpi = ...
19fed7bf370f6b679e040511bfe5a5eeed31b2ca9ead064840838f8c88792982
MATLAB
2,134
46
function[lineValues, lineSegments]= drawLine(); %% draw a line over the dendrite valueCounter = 0; segmentCounter = 0; clear lineValues lineSegments keepGoing = questdlg('Draw a line?', 'Potato', 'Yes ', 'Branch', 'Done', 'Redraw Last','Yes'); while keepGoing == 'Yes'; if valueCounter > 0; valueCo...
0b3e968e0c6b26541e22d0343089bd6685e6de5c66528fc9a7d9fd100102f125
MATLAB
2,135
49
function addRow(DynamicTable, varargin) % ADDROW Given a dynamic table and a set of keyword arguments for the row, % add a single row to the dynamic table if using keywords, or multiple rows % if using a table. % % ADDROW(DT,table) append the MATLAB table to the DynamicTable % % ADDROW(DT,col1,val1,col2,val2,...,coln...
ae00d17188ed2f3d4c8e50b597460d1632f1e06e02af4efe49de4720f1c2f4fc
MATLAB
2,135
51
function [reluResponse, params] = applyReLU(prfResponse,params) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % RECTIFIED LINEAR UNIT (ReLU) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % All spatiotemporal filters are subject to a rectified linear unit (reLU). % This should only affect models with negative predicted neural responses, ...
49f0b07d25153a208890a24e39d3568872d32dcffb3e19dcef2ef1562bb03510
MATLAB
2,136
78
% sankey demo7 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo7','Units','normalized','Position',[.05,.2,.5,.56]) clc;clear; links{7,3}=''; for i=1:7 links{i,1}=['浏览',num2str(i)]; links{i,2}=['浏览',num2str(i+1)]; links{i,3}=10000-1400*i; e...
73ad3c37086f4f07a0aa9208d7d92b835cdf49da734928c7cd377d9a3927a0ed
MATLAB
2,136
48
clear file=dir('ACC*uncertain*.mat'); k=1; for jj=1:length(file) load(file(jj).name) n=length(outcome); n1=fix(n*0.33);n2=fix(n*0.67); 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(outco...
b5b154ecc2bb6299502fdb4eb49c6d75a2f368d052e46700a098a8ae6a35a40d
MATLAB
2,136
66
function [f, BlkIdx] = Gabor_FeaExt(InImg, PalmNet, bestWavelets, param) % =======INPUT============= % InImg Input images (cell) % V given PCA filter banks (cell) % PCANet PCANet parameters (struct) % .PCANet.NumStages % the number of stages in PCANet; e.g., 2 % .PatchSize % ...
4de9a0d5281ce5db9e823893d0d5ac8283493244a76de797055e8d6a453ccef7
MATLAB
2,138
71
function PlotEvent(data_raw,lower,higher,sampleRate,butterOrder,smoothPara) %input datar1:3D event EEG data, data format:[sample points*channels* trials] % labelr1:datar1 label % lower:High pass filtering parameter settings % higher:Low pass filtering parameter settings % sampleRate:the sampling fr...
b9c7b37fc5e2d4bbb89d790ad0b4598aae11fef91578b252545ae46f124511c5
MATLAB
2,138
62
classdef DAQCamera < handle properties (SetAccess = public) cameraId = []; numFrames = []; maxFramesPerVideo = []; numVideos = []; estFps = []; estFpsPercent = []; videoWidth = []; videoHeight = []; videoFilenamePrefix = []; ...
c7377059d16961e712a831a5c29966e6ef0666c189615fd5eb68e7439dc913a6
MATLAB
2,142
79
% % Compute precision of predictions. % % PARAMETERS % $NETWORK % $METHOD % % INPUT % dat/prediction.$METHOD.$NETWORK.mat % dat/split.$NETWORK.mat % dat/meanst.$NETWORK.mat % % OUTPUT % dat/precision.$METHOD.$NETWORK.mat % precisions{submethod} Precisions by submethod; each entry is a 2-vector of the value and th...
1ede44456499dfcb0d841e24ed03b07da2f3ebe9f4d71e384f323b3c5c4b0512
MATLAB
2,143
62
function [hh,hx] = plothist(var1,Nbins,VarMargins,scale,Lowest) %plot hist % Detailed explanation goes here if nargin<2, Nbins=20; end if nargin<3, VarMargins = [0 0]; end % sets the margins to cut off from var before creating hist, in fractions of number of samples if nargin<4, scale = 'lin'; end %'lin', 'log'...
6b99d38d1386065b2cea50f4bd1230f280bf0983553f45ab8c88638890a54d24
MATLAB
2,143
62
%{ 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...
593a3861f92ac2d3fbeb73457a5620a8733205d7d528f84d399f452d39ae7122
MATLAB
2,145
71
% mglTestMetalStencil: an automated and/or interactive test for rendering. % % usage: mglTestMetalStencil(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some points. % usage: % ...
5f7ac0e6610133ebdd5ab8811d77831d3344567b6d4ac06032a30f6d4713e996
MATLAB
2,145
69
% renameFictracVid.m % % Function that renames all FicTrac video tiff files by generating and % calling Powershell script. % Assumes FicTrac video tiff files are named fictracVid_dateTime_#.tiff. % Basically same function as renameLegVid(), except meant to run on Fictrac % videos collected by camera connected to sep...
f0d10f6ea7be6d040d4a32ab737147c8a33d3c133c329ce3932a6bf7aa1884f7
MATLAB
2,145
66
%% corr the connectivity and behav data via gretna_prediction roi_num = 48; load('unrelated_sub_matrix_str_VBM.mat') Mask_net = logical(tril(ones(roi_num),-1)); Predictors = zeros(size(sub_matrix,3),sum(Mask_net(:))); for isub = 1:size(sub_matrix,3) matrix_i = sub_matrix(:,:,isub); Predictors(isub,:) = matrix_i...
f6cd22fd3ba45e8fa17c5d9fd2efe4754b6c20ff97a12dc86a8c71291f242501
MATLAB
2,145
66
%% corr the connectivity and behav data via gretna_prediction roi_num = 48; load('unrelated_sub_matrix_str_DBM.mat') Mask_net = logical(tril(ones(roi_num),-1)); Predictors = zeros(size(sub_matrix,3),sum(Mask_net(:))); for isub = 1:size(sub_matrix,3) matrix_i = sub_matrix(:,:,isub); Predictors(isub,:) = matrix_i...
3047fea1be0aa3fa37cd13e4cb1e216bf0df9eedb8eb9c99718580807c593d91
MATLAB
2,146
62
function [val] = filetype_check_extension(filename, ext) % FILETYPE_CHECK_EXTENSION helper function to determine the file type % by performing a case insensitive string comparison of the extension. % Copyright (C) 2003-2012 Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldt...
90784d669b0011ce19f1aaf8f3715ae0ab77c53ef1c97c3c0a4782c28996a118
MATLAB
2,146
37
function subject_outliers_parse_BIDS(wb_command,motion_data_file,dtseries,output_dir,output_prefix) % FD parsing Nipype wrapper pulling in list of motion files % Modified to read DVAR_pre_reg, DVAR_post_reg, and DVAR_post_all and store % values appropriately in the 51x51x3 cell array of structs % % All variables (skips...
9cf3eba6f359a634eac090b696c2c6bbb92946c88d491445f48d65e88c960777
MATLAB
2,146
47
% mglSocketCreateServer: Create a socket and bind an address. % % $Id$ % usage: socket = mglSocketCreateServer(address, [pollMilliseconds, maxConnections]) % by: justin gardner and ben heasly % date: 12/26/2019 % copyright: (c) 2021 Justin Gardner (GPL see mgl/COPYING) % purpose: Open a lo...
3473e44991a1dc4a6ef2a4e2a7814ecc45d72f9409d72a44038ac9f56e28f497
MATLAB
2,147
72
function [ACC,RT,RATE,ACCnbg,RTnbg,RATEnbg] = get_behavior() dp = '../LOGFILES'; SUB = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]; nsub = length(SUB); nrun = 6; singleplot = 1; % Columns of logfile % 1: RUN % 2: TR of Sound start for this questions % 3: TR of response % 4: time (ms) of response % 5: task (1-mal...
b5fe8e048cc9bdd6bd1d8c86fe33dd97de4a080ebf8915d98e1d04e9a53f2f5d
MATLAB
2,147
71
function [tid, sid, data] = mapData2H5(fid, data, varargin) %MAPDATA2H5 Convert MATLAB type specifier and data to HDF5 compatible data % Given base file_id, type string and data value, returns HDF5 type id, space id, % and properly converted data forceArray = any(strcmp('forceArray', varargin)); forceChunked = any...
8ddb1eda01f22c9ac643359da5fc822ddbf03008b1937e685f4e62b11d2e6c51
MATLAB
2,148
81
% NIFTI Object % % create - Create a NIFTI-1 file % disp - Disp a NIFTI-1 object % display - Display a NIFTI-1 object % fieldnames - Fieldnames of a NIFTI-1 object % nifti - Create a NIFTI-1 object % subsasgn - Subscript assignment % subsref - Subscript referencing % % other opera...
7ecc92919c600ffd9513b51ee6bd6d89535ff88fbc54aadfb8021f4c5e1f131c
MATLAB
2,150
55
% mglMetalRepeatingFlicker.m % % $Id$ % usage: [ackTime, drawTimes, frameTimes] = mglMetalRepeatingFlicker(nFrames, randomSeed) % by: Benjamin heasly % date: 06/14/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Send one command that causes multipl...
a2dfaaeadcc8fbf92f50f013d1a049f978fc1ff4241a5febc672a3b50576f03d
MATLAB
2,151
61
%% % name of the videos list_Exp_ID = { 'c25_59_228','c27_12_326','c28_83_210',... 'c25_163_267','c27_114_176','c28_161_149',... 'c25_123_348','c27_122_121','c28_163_244'}; num_Exp = length(list_Exp_ID); lam = 15; d0 = 0.8; %% Load traces and ROIs dir_parent='E:\1photon-small\added_refi...
08762175fd680e2c0c323d877ea57707c0fbafec799eb585ed070b346b1c32d7
MATLAB
2,152
98
% % Plot the outdegree vs the indegree of all nodes. Only for directed % networks. % % PARAMETERS % $network Network name % % INPUT % dat/data.$network.mat % dat/info.$network % % OUTPUT % plot/outin.[a].$network.eps Plots % font_size = 22; consts = konect_consts(); network = getenv('network'); info = read_...
ca3cd001badb39fd4a797bf9151a1e158896078a2d6e5bf70d865682b6cbd1f8
MATLAB
2,152
57
function mltp_plot_bfo_90_ac_per_cell(obj, session) dataFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); % Load the data matFilename = fullfile(dataFolder, 'bfo_90_per_cell.mat'); if ~isfile(matFilename) error('The data file (%s) does not ex...
4ca727bdb7e5187d14119b7a3794e65004af3acb153b9b2972f9d7d0f5d39042
MATLAB
2,153
61
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 % This makes Figure S14 (first run the other script). It was previously % made in Excel and this version can be made in Matlab. close all clear all clc run('../load_figure_config.m') % Load the Excel file that the previous code mad...
a6a7aa97d2bd4a9035b0dd1def126512ca2587881528836f291a681c6158eddc
MATLAB
2,155
75
% fixStairtest.m % % $Id: testExperiment.m 247 2007-06-14 15:13:51Z justin $ % usage: fixStairTest(<difficulty>) % by: justin gardner % date: 09/08/26 % copyright: (c) 2009 Justin Gardner (GPL see mgl/COPYING) % purpose: Shows the fixation staircase task alone. Difficulty of 0 is normal % ...
e8c197bdb940e5e4b8da8b0b667ff41aa81f0c78ccbab87a1eb5e127605cbd1e
MATLAB
2,155
67
function [hdr] = f_GetExtNCSHeader(filename) % This is a modification of READ_NEURALYNX_NCS and neuralynx_getheader % READ_NEURALYNX_NCS reads a single continuous channel file % % Use as % [ncs] = read_neuralynx_ncs(filename) % [ncs] = read_neuralynx_ncs(filename, begrecord, endrecord) % Copyright (C) 2005-2007, ...
0f0636ed42c09873dd4d35014d404a575064f34c1390ce4dff36ce3482ec5c49
MATLAB
2,157
94
function [intensities,red_cellocs]= partialmask_intensities(threshold,cell_stat,red_wavelength_stack,final_redidx,max_proj,shift) %% MKE VARIABLES red_stat=cell_stat(final_redidx); xshift=shift(1); yshift=shift(2); numred=length(red_stat); red_cellocs=nan(512,512,numred); %% GET FULL MASKS for i = 1 : numred ...
7653fa75121d1f4047cc1724ae84177c5c888e0137de6a3b1e3a826dc69a0ad2
MATLAB
2,157
94
function [] = ExtDataFig06_AveImgBaseline() % Code for plotting the baseline F images in Extended Data Fig. 6f,g. %% parameters GT = 'dPR1_nsyb'; % Extended Data Fig. 6f % GT = 'TN1A_nsyb'; % Extended Data Fig. 6g zVentral = [1:15]; zDorsal = [16:30]; Margin = 40; d1DS = 512/2; d2DS = 512/2; d3 = 30; Thre_Comb_DP ...
9eda67a0b25034b974a2e6a116c24453ec79e4e39566438c25768f0300498ff4
MATLAB
2,157
50
function [WPLI_1_150Hz, WPLI_5bans,comments]= Compute_WPLI(Selected_Signal,para,WPLI_Method) %% Compute WPLI for given signal % Input: Selected signal % Input: para % example: % para.Fs = 500 or 1000; % para.L = 1; % segment length (second) % ...
e839d6cd01a70ea4d45817684e7ecda2c79b1eca661a9e10bd1a5be08be5e800
MATLAB
2,157
39
%% Initialize SC = change_camera_ROI(SC,'BSI',SC.c0,SC.r0,OPT_S.n_cap); SC = change_exposure(SC,'BSI',SC.BSI_settings.init_exp); SC = laser_set(SC.laser_settings.laser_power,SC); OPT_S.this_exp = SC.BSI_settings.init_exp; OPT_S.rep_flag = 1; OPT_S.total_reps = HAD_S.total_its; %% First image SC = laser_on(SC); OPT_S.la...
1ad11580c26ef3cd310057b56a75c12615bdaf5ab93504ad6b637b32c7e7f34b
MATLAB
2,159
80
%%Calculating the frequency spectra, total power, and luminosity of visual %%stimuli close all clearvars file_directory = 'C:\Users\dmitry.kobylkov\Documents\faces\face_stimuli\face_stimuli\FaceStimuli\'; files_struct = dir(fullfile(file_directory, '*.png')); files_cell = struct2cell(files_struct); % create ...
5fbb471a2398f9e541a519a94c018a9e115fd4d25300ad59d731c077289c4a81
MATLAB
2,159
73
% This example shows how to visualize the spatial multiplexing groups % derived from characterizing a probe. The number of groups is dependent on % many parameters, including the number of sources in a module, their % layout within a module, the SDrange, and the tessellation and orientation % of each module. Here, we p...
23396e65e109efae046e13493ecd5b6a39c3b7725e525a65ebc7569a6062af61
MATLAB
2,160
54
function atonia_index = get_atonia_index(EMG,Fs,stages) %GET_ATONIA_INDEX This function calculates the atonia index for the %sleep stages identified in the vector stages. %---INPUT %- EMG: the EMG signal (whole night) %- Fs: the sampling frequency of the EMG signal (Hz) %- stages: the hypnogram. Same size as EMG....
2f1791e5ee97cf64c138131bc956c435afb0bb282e4b7585e63a1e02e766710f
MATLAB
2,161
62
% This example creates a square module, tessellates it in a 2x2 % configuration, and performs all permutations of orientation of each % module. It calculates number of channels, Brain Sensitivity, and nSMGs. clear all % Design Parameters (module, roi, SD sep range) probe.module = createModule(4, 35); % nsides, mdime...
d29b6170ce1b973d65abca61ded634b1dd1ebc8c6cf158fa39e1fa157486bc09
MATLAB
2,162
54
% Gaussian derivative calculation in given direction and sigma. % As inputs the following variables have to be transferred: % data : 2-dimensional matrix with gray-scale image, % can be obtained as % data = im2double(rgb2gray(imread(image_file_name))); % direction : direction of Gaussi...
7ca172ad9012c9c792f53a623162abf695faed144955df3a1c26d217eb2bfc25
MATLAB
2,164
80
function [trx, didsomething] = apply_convert_units(trx,pxpermm,fps, alreadyconverted) % split from convert_units_f 9/10/11 JAB pxpermminput = exist('pxpermm','var'); fpsinput = exist('fps','var'); if ~exist( 'alreadyconverted', 'var' ) alreadyconverted = false; end if ~pxpermminput pxpermm = trx(1).pxpermm; end ...
123e43f5a644b9ebb9ff8614685c530382538256ebeb97265968bdb3eb7fb9f9
MATLAB
2,165
69
% addIndAtSelX.m % % Function that takes in specific x-coordinate value and adds % the corresponding index from the given indices vector % Called by interactGetLegReversals(), meant to add selected point % from max/min indices list % Converts x-coordinate value to index by using input x-coords to index % mapping vec...
6b874f2316e277b639df2d6e211162a17c3af7dac200a7893a7645fb951a8dc0
MATLAB
2,166
47
classdef ImageSegmentation < types.core.NWBDataInterface & types.untyped.GroupClass % IMAGESEGMENTATION Stores pixels in an image that represent different regions of interest (ROIs) or masks. All segmentation for a given imaging plane is stored together, with storage for multiple imaging planes (masks) supported. Each ...
e0a6cd884186a81477a5678bdd94100fabda2f67b2150e7dbaa536f3f2185f51
MATLAB
2,166
74
function [bias_threshold, std_threshold, names] = create_plot_data(results,simulated_SNRs) max_n = 200; crit_val = 5; % threshold for difference to ground truth inx_wm =[1:12]; inx_gm =[13:24]; inx_HA = 25; inx_MA = 26; Inx_La = 27; bias_average = struct; names = {'wm','gm','HA','MA','LA'}; for inx_names = 1:num...
a9e5b54e07b53a0b9e490d5b0ed6cdf1eeaa586c9a9dc8d1ec0a4d61f54ad690
MATLAB
2,169
110
%% Atlas Adjacency Matrix for s = 1:10 scale = s*100; disp(scale); nroi = scale+14; atlas_path = 'C:\Users\flame\Box\atlases\Schaefer100_to_1000\'; % atlas_name = sprintf('Schaefer2018_%dParcels_7Networks_order_FSLMNI152_2mm.nii.gz', scale); atlas_name = sprintf('Schaefer2018_%dParcels_7Networks_order_FSLMNI152_1mm....
5e5dee9c99eef08042034e7ffde9df362f5a42a57be521d2314f99c76646ec8c
MATLAB
2,170
76
function P=normApprox(alpha,mu) % normApprox Compute normal approximate null model % % Syntax %__________________________________________________________________________ % % P=normApprox(alpha,mu) % % % Description %__________________________________________________________________________ % % P=normApprox(alpha,mu...
20a28b2039f9caa107716fbfb205f3b329f2d6c29c091d3345e3d77e2614edbd
MATLAB
2,173
58
function mlgp_plot_bfo_general_sessions(obj, rotDeg, group) numAngles = 360/rotDeg; angles = (0:numAngles-1)*rotDeg; % Load the data fn = fullfile(obj.Experiment.getAnalysisParentDirectory(), sprintf('bfo_%d_%s_avg.mat', rotDeg, group)); if ~isfile(fn) error("The file (%s) does not exis...
fba15c95ce042b804ca06c6122f5d190bf536c86686ecaef265d563ae997a7a8
MATLAB
2,174
62
function [] = GetConcentrationMaps(workingDir,T1map_precontrastFile,T1map_postcontrast1File,T1map_postcontrast2File,brainmaskFile,relaxivityconstant) % input: % - workingDir, directory in which we are currently working % - T1map_precontrastFile % - T1map_postcontrast1File, first postcontrast scan % - T1map_postcontra...
0e2407bad53f3a255ab6a2a0042fc6eeeb08861fc70a7a63a125d00024dd9b4c
MATLAB
2,175
54
function new_idx = neighbourhood_func(connection_indices, data_model) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % If you use this code, then please cite: % 1.- Ana P. Millan, et al. "Individualized epidemic spreading models % predict epilepsy surgery outcomes: a pseudo-prospective study." % ...
77e3b7923d5dcdc5d50ccb14d96d1efb6c1cdbc958b55b879adc758a507ffbdd
MATLAB
2,175
53
% --- select subsection of the scan (optional) figure;surface(flipud(abs(complx1{1})),'EdgeColor','none'); wo=round(ginput(2));wo=wo(:,1); for ii=1:length(complx1) complx2{ii}=complx1{ii}(:,min(wo):max(wo)); end complx1=complx2;clear complx2 %% removes global motion from OCT BM-scans file='xxx.mat'; %file name ...
e9131c250fa19d9b5333b32e23010d0c969f7eea6b3832e41c2c58c9b84bc755
MATLAB
2,177
67
function [EBC BC]=edge_betweenness_bin(G) %EDGE_BETWEENNESS_BIN Edge betweenness centrality % % EBC = edge_betweenness_bin(A); % [EBC BC] = edge_betweenness_bin(A); % % Edge betweenness centrality is the fraction of all shortest paths in % the network that contain a given edge. Edges with high values of % ...
1555c2972b93df3ffb634ef14374dc0a436a7b50d8e09de7b72c0348b754ddfe
MATLAB
2,178
66
function Score = TR_RecordAnalyze(app, displayH) % DistRadial = Eucledean distance from start to end % PathLength = total path length Group = app.Experiment.Groups(app.IDs.Group).Group; Record = Group.Records(app.IDs.Record).Record; Params = app.Experiment.Specs.Analysis.Parameters; % check if data type is an N-by-2 ...
5b44819474d5934e953457c36203995d0c846731e0b96348cd5a45b684ed59d0
MATLAB
2,178
52
function [angle_changes, mean_angles] = centerlines_to_angles(centerlines) %this function gets the angles with respect to the mean angle for each %segment in the worm, vectorized so that multiple centerlines can be %inputted at once. The output is in radians [nPoints, ~, num_centerlines] = size(cen...
6532db530c6d49034f34b29b1935ee9325ba96a2b8309a62e684d5d22bbdeeb5
MATLAB
2,178
55
function out = dfa_positionvariance(index, excludeperiods, pos, trials, varargin) % define defaults appendindex = 1; % process varargin if present and overwrite default values if (~isempty(varargin)) assign(varargin{:}); end d = index(1); e = index(2); if isempty(trials{d}) || isempty(trials{d}{e}) out = []...
bcb72932af68fadca87f959f9522b0f540717d3b5135e1237d71f6eaf831c573
MATLAB
2,179
65
function [p] = ml_cai_behavcam_roi_create( dataFolder, varargin ) p = inputParser; p.CaseSensitive = false; addRequired(p,'dataFolder', @isstr); addParameter(p, 'outputFolder', dataFolder, @isstr); addParameter(p, 'verbose', false, @islogical); addParameter(p, 'backgroundFrameFilenameP...
339bf458a1ee38cb91f86105214f6f5357672052f030c6cd11664076a6f5e85f
MATLAB
2,182
91
function [ax] = plotMdlDD(rpInfo,HLix,priColors,figprefs) %plotMdlDD.m dd = cellfun(@(x) x.chi2Stat(2),rpInfo.dt); optLag = rpInfo.optLag; isiLags = rpInfo.isiLags; ddLags = isiLags(1:end-1); tickdir = 'out'; dobox = 'off'; dogrid = false; doarrow = optCheck(figprefs,'doarrow',false,[true false]); doleg = optCheck(f...
42dd270a5f61bc509e3ede4792f47183602635ce1095cffd90c1df8b6d74dbb3
MATLAB
2,182
59
function [ red_wavelength_stack,summed_image] = load_reg_tif_wavelength_old(mouse,date,pock_start,pock_end,wavelengths) % LOAD_REG_TIF_WAVELENGTH loads suite2p registered tifs saved inside % '...mouse\date\W-series\suite2p\plane0\reg_tif\' %all_image size is [npock*nwave, 512, 512] %red_wavelength_stack is [npock, nwav...
ebba2329f4b4125f6eb7d7d8c0f16aa908eae5d3e0c0e5157aaff619243ec6de
MATLAB
2,183
83
% % Visualization of the spectral extrapolation method. % % PARAMETERS % $NETWORK % $DECOMPOSITION % % INPUT % dat/decomposition_time.split.$DECOMPOSITION.$NETWORK.mat % dat/steps.$NETWORK.mat % % OUTPUT % plot/spectral_extrapolation.$DECOMPOSITION.$NETWORK.eps % marker_size = 10; network = getenv('NETWORK'); ...
048f0cbe5d107a4085a5817592c20faca5c4d02a0cc594efed8ebd9746b4a051
MATLAB
2,185
46
function [distance,pathfrom] = dendrite_dijkstra2(M,dims,root) % function [distance,pathfrom2] = dendrite_dijkstra2(M,dims,root) % % Function to run Dijkstra's algorithm for growing out dendrites. Inputs to % the function are % - M - dims-size matrix that indicates blockages in the volume (i.e. % ot...
15f3411651dafe43b4d8842ca1c135a21ed4ba87f72b1400c1b0e09780d5b2c7
MATLAB
2,185
58
function mltp_plot_bfo_general_sessions(obj, rotDeg, group) numAngles = 360/rotDeg; angles = (0:numAngles-1)*rotDeg; % Load the data fn = fullfile(obj.Experiment.getAnalysisParentDirectory(), sprintf('bfo_%d_%s_avg.mat', rotDeg, group)); if ~isfile(fn) error("The file (%s) does not exis...
479350971fdc56ab93886ffba570a5c286e93ec60c797e337a80bc78d23f83a0
MATLAB
2,185
53
function [Pwire, Ewire] = wire_single_rung(L, a, b, N, M, type) % This function creates the structured centered wire grid for a single % straight rung with % a - cross-section radius in m when option type='circle' is chosen for % the rung cross-section % a, b - rectangle sides in m when option type='rec...
5301d45a72fe2600808f305d3ca59fc7e8231e0a0bb0b197ad51be8a019c7767
MATLAB
2,185
54
function [f F]=motif4struct_bin(A) %MOTIF4STRUCT_BIN Frequency of structural class-4 motifs % % [f F] = motif4struct_bin(A); % % Structural motifs are patterns of local connectivity. Motif frequency % is the frequency of occurrence of motifs around a node. % % Input: A, binary directed connectio...
87478d373b7c759b467146a8d5e94e7105767aed5e32cf71b57eace35bad4884
MATLAB
2,186
68
function [] = PlotWatershed(embeddingValues) %Plots the density map along with the watershed plot_behavior_colors = true; load('reference_embedding.mat') if nargin > 0 maxVal = max(max(abs(embeddingValues))); maxVal = round(maxVal * 1.1); sigma = 4; %change smoothing factor if neces...
ecb49ffae9c2661c8e995358a1c0b2dc9786c1d619170762955fa8326eb29bcd
MATLAB
2,186
61
%% % name of the videos list_Exp_ID={'Mouse_1K', 'Mouse_2K', 'Mouse_3K', 'Mouse_4K', ... 'Mouse_1M', 'Mouse_2M', 'Mouse_3M', 'Mouse_4M'}; num_Exp = length(list_Exp_ID); lam = 15; d0 = 0.8; %% Load traces and ROIs % dir_parent=fullfile('..','data','data_TENASPIS','original_masks'); dir_parent=fullfile('..'...
2961e56528b1aac771aca09f6dee53882859a6cb757b333a172d032bfc0368ed
MATLAB
2,187
52
% THIS IS A ONE-OFF!!! % close all % clear all % clc % cfg = jsondecode(fileread(fullfile(pwd, 'pipeline_config.json'))); % pipe = MLCalciumImagingPipeline( cfg, ... % pwd, '../../analysis/chengs_task_2c' ); mainDir = 'R:/chengs_task_2c/data/minimice/feature_rich/CMG087_CA1/recordings_sep'; %cfg = jsondecode(fil...
b0cc9756909fb36fea7e90db1dd967e3072f9ef1a5421b7a2d15a0503fa9da67
MATLAB
2,188
66
classdef RoiResponseSeries < types.core.TimeSeries & types.untyped.GroupClass % ROIRESPONSESERIES ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. % REQUIRED PROPERTIES properties rois; % REQUIRED (DynamicTableRegion) DynamicTableRegion r...
5d9011bf85c3b5dacef11c097fe6594269f12ed542d88cb4dbdb640db01ab3d3
MATLAB
2,189
67
% preprocessUserDaq.m % % Function to take raw data output from user DAQ for any experiment type % and convert it to a more useable form for later analyses % % Adapted from preprocessUserDaq.m from 2PAnalysisCode-Helen, but doesn't % incorporate information about fly or interact with a metadata % spreadsheet % % INP...
06e8c26e8c52c537be7cf2defdd52df313c314e2e15d2efc7bc9c6b6b4c14887
MATLAB
2,190
83
%% Anophles IR track launch YourPath = 'YourPathtoAnophlesTrackCodeGoesHere' addpath(YourPath) %add path to functions associated with Anophles track here %% get directory of interest (add directory to video files here) selpath = uigetdir; cd(selpath) dirContents = dir('**/*.*') ; strIdx = (strfind({dirContents.name},...
74a41bbc083f970281a935d006b082240517a510868caa97f9e8e70dcabb4546
MATLAB
2,191
59
% findBoutsDurStim2Rmv.m % % Helper function for saveBallLegStepParamCond_bouts() that takes in start % and end times of turning bouts as well as start and end times of % stimulation bouts and returns the indices of turning bouts that overlap % with the stimulation bouts. These turning bouts are to be removed from %...
b4a407c90bdde06bb74d7cb4574473ee6477af8262103a7f81ea3aeaada406f6
MATLAB
2,191
70
% gaussSmooth.m % % Function to smooth data by bidirectional convolution with 3.5 sigma % truncated gaussian kernal. % Adaptation of Stephen's python function safe_interp_conv_smooth_ball_data % in a2lib/proc_utils % % INPUTS: % vec - vector to smooth % padLen - length of padding, in samples % kernLen - length ...
b644690170bb9230c8275f80933ba02be904a8242d4c9cbf0b84e3a43a7d787d
MATLAB
2,192
31
clear stable=load('stable.mat') ;uncertain=load('uncertain.mat') ;reverse=load('reverse.mat') ;restable=load('restable.mat') ; for i=1:493 go1=[stable.population.goHit.eachDF{i} stable.population.goMiss.eachDF{i}]; go1=go1(46:90,:);Sgo{i}=(go1-mean(go1(1:15,:)))./std(go1(1:15,:)); GO(1,i)=mean(mean(Sgo...
c52063f329f0ff2e5b8991fe4721a3ef94dcb4e3af397f7537a3057bf04be0d5
MATLAB
2,192
76
function cnn_loss_group_evaluate(work_info_batch, group_idx) % prediction_info=work_info_batch.ref.prediction_info_groups{group_idx}; % obj_value=gather(prediction_info.output_infos{end}.x); % obj_value=sum(obj_value(:)); % work_info_batch.ref.obj_value=obj_value; cnn_forward_evaluate_ob...
01b2f2328c513be895eecb359f494f37ae7a874f2859483e0bc528583684eddc
MATLAB
2,193
61
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [R, success] = compute_rate_matrix_table(T, rateName, rateMatrixNumTrials) R = []; success = true; wb = []; % Get a table of unique sets of (animal name, session name, cell name) records = get_sessio...
4197a07fb7d8771e6c013e62ef74ccedc0c62c26d0f37ad27f46fa1258d986fd
MATLAB
2,193
68
function v_prime = rotate_n_dimensional_vector(v,a) % ROTATE_N_DIMENSIONAL_VECTOR rotates an n-D vector by a given angle % VPRIME = ROTATE_N_DIMENSIONAL_VECTOR(V,A) rotates the n-dimensional % vector in V by the angle A (in radians) % Returns: VPRIME, the rotated vector % % Notes: % this approach rotates the vector i...
85d3217e88c3cfd2bed0428151c6f709bab912b6b2a73dbced387898546c10c1
MATLAB
2,194
76
function [isfore,dfore,xpred,ypred,thetapred,r0,r1,c0,c1,im] = fix_FixBgSub(flies,f,handles) trx = handles.trx(flies); nflies = length(flies); boxrad = handles.maxjump; % get predicted locations for all flies, to select tracking ROI xpred = zeros(1,nflies); ypred = zeros(1,nflies); thetapred = zeros(1,nflies); for j ...
ff708ed83b3d43692bc3f8b388f5eecb3a979d4d960f341823ed4db55d864cc6
MATLAB
2,195
55
function [params, s_new] = denoise_filter(params, s, state) % Generic filter function. Can be used as DSS denoising function. % [params, s_new] = denoise_filter(params, s, state) % params Defines the used filter % params.filter_conv Inpulse response for convolution filter % params.filter_dct Mask ...
a0b6b6cf99463847cf23040855f0766ac734324e8076ab34cc0d2a0f86eddbb1
MATLAB
2,196
58
function [] = ExtDataFig05_SongTypePref_dPR1TN1A() % Code for plotting the distribution of song-type preference for dPR1 and TN1A neurons in Extended Data Fig. 5b. %% parameters Thre_Trans = 6; %% Song-type preference index (dPR1, TN1SG) load(['../Data/Summary_dPR1/SongTypePrefIndex']) Idx_SongType(nEvents_comb(1,:)<...
1e47ddee491e805273f6e45686a112cf60be5c8e58730b77b4a024dda2bab340
MATLAB
2,198
53
function [startTimes, endTimes] = extractSegmentTimesXx(folder) %% setup [~, file] = fileparts(folder); chanlist = readSpikeFile(fullfile(folder,[file '.smr']),[]); chanindsAll = [chanlist.number]; chaninds = find(arrayfun(@(x) any(strcmp(x.title,{'Keyboard'})),chanlist)); rawdata = importSpike(fullfile(folder,[file '....
b64d38bc4c988bc26c6f6eaf5aaa856d739ec1c4b687f21850a29b68f1f72adb
MATLAB
2,198
93
function [obj,residuals,Z] = gmixPlot(X,N,MaxIter,bins,plotOFF,plotSubGaussians,obj,xlimits,replicates) %finds and plots (optional) a gaussian mixture model fit to a 1d data set % %Inputs: %X = column vector of data %N = number of clusters %MaxIter = max iterations of GMM fit %bins = number of bins to display %plotsOFF...
f28449168202f418d8dc98203d61dd51ca9cf7a823eaf1a9c1d7f4d2164df63e
MATLAB
2,199
76
function dims = get_data_dimension(path_to_file) % get he dimension of a tiff file. now it only supports 2D % Author: Pengcheng Zhou, Columbia University, 2017 %get image info [~,~,ext] = fileparts(path_to_file); if strcmpi(ext,'.tiff') || strcmpi(ext,'.tif'); info = imfinfo(path_to_file); if isfield(...