sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b121375eafd303432afde93e871a9f09435c454f1320275f14e526eaf9f8fc43
MATLAB
1,977
63
function results = vl_test_vlad(varargin) % VL_TEST_VLAD vl_test_init ; function s = setup() randn('state',0) ; s.x = randn(128,256) ; s.mu = randn(128,16) ; assignments = rand(16, 256) ; s.assignments = bsxfun(@times, assignments, 1 ./ sum(assignments,1)) ; function test_basic (s) x = [1, 2, 3] ; mu = [0, 0, 0] ; a...
c1c3238f591f3b91f595b3a6147b610d1d0a452bb165c6f2cb1499676bd9909a
MATLAB
1,977
54
%{ 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...
9ee141f23428885efeec591005e606c0f25a76ba57074f284016151e235ca17f
MATLAB
1,978
67
% selectBackground.m % % Function that allows the user to select the background region from the % time series's average image. Displays a histogram of pixel intensities % (normalized as deviation from the mean) and allows the user to select a % static threshold. Background region is then used for background % subt...
98051f8d1319e1f53395d1fb92f048473d8b12ecc574f678637d06d01d42c532
MATLAB
1,979
56
classdef ReadRecipeTest < matlab.unittest.TestCase % Tests for webupload.readRecipe against the cases in upload_contract.json, shared with % the server's tests so both sides read the same IDs from the same recipe. properties Dir end methods (TestClassSetup) function addPackageToPat...
abec4e21bb8fb4f75ee68d0b4d0736be2bb6fc3bc8f1ea86ed3b9c6ec049a92f
MATLAB
1,979
52
function hp = plotresults_APP(app, frameData, hp, i) timeLen = length([frameData.time1]); if i == 15 % Pupil Horizontal Position hold(app.UIAxes3, 'on') hp(1) = plot(app.UIAxes3, [frameData.pupil_x],'r-'); xlim(app.UIAxes3, [0 timeLen]); ylim(app.UIAxes3, [nanmin([frameData.pupil_x])...
01058e0adc9677f58421169b187d955d426f43e727e0b17fc9cc683651cf6f32
MATLAB
1,981
61
function [path,pathM] = getDendritePath2(M,node,root) % [path,pathM] = getDendritePath2(M,node,root) % % Function to retrieve the path of a dendrite from the full paths matrix until % it hits the root node. Inputs are: % - M - pathfrom matrix (matrix containing obsticals to avoid) % - node - End node location i...
2d33d64fa8125504451748d7684ed57e32ab96b9ec77ea9b54be06fbdb7b2421
MATLAB
1,981
63
function results = vl_test(suite, test) % VL_TEST Run test suite % RESULTS = VL_TEST() runs all VLFeat test suites. The tests % verify that VLFeat is working correctly. % % RESULTS is a structure listing the result of each test. % It has fileds: % % TESTNAME: name of the test % SUCCEDED: a boolean flag indic...
cd2c2946f73f6156531aeb7ddda8d0145b255287d4e3cc54ab84091f172c27d9
MATLAB
1,981
80
function [dprev, dat_cpu, dat, shifts] = ... shift_batch_on_disk2_dredge(rez, ibatch, shifts, ysamp, sig, dprev) %% Adapted from Kilosort2.5 function shift_batch_on_disk2.m %% by Richard Hardstone (2022_11_30) % register one batch of a whitened binary file ops = rez.ops; Nbatch = rez.temp.Nbatch; NT ...
5ec231ec2091e3aebb8c728e14443e988c8595db0032dd42ec5ca0a4e07656bb
MATLAB
1,983
61
function ml_cai_create_neuron_hdf5(outputFilename, rawTraceMatrix, filtTraceMatrix, spikeMatrix, spatialFootprintMatrix) % Lookout for the dimensions of the spikeMatrix if it comes from CNMFe % Check the dimensions %if size(rawTraceMatrix) == size(filtTraceMatrix) == size(spikeMatrix) numNeurons = size(rawTraceMatri...
86324cebd124a10db07508d7415ab9b821b7cbdc1a5a7f6bcad9b63cf0bcc120
MATLAB
1,983
55
% findAngle2Pts.m % % Function to find the angle between two points in x,y plane. Angle of the % vector that points from (x1, y1) to (x2, y2). In degrees % Helper function for leg analysis, uses leg coordinate frame, where x axis % is direction parallel to the long axis of the body and y axis is % direction parallel...
6aa1647e31e52ea1ed1539298a62e5d4f142952f631a0f9416991afd59a2177a
MATLAB
1,988
68
function behav = msSelectPropsForTracking(behav) %MSSELECTPROPSFORTRACKING Summary of this function goes here % Detailed explanation goes here userInput = 'N'; green = cat(3, zeros(behav.height,behav.width), ... ones(behav.height,behav.width), ... zeros(behav.height,behav.width)); frame = double...
86891d4cb5bdc9f75ef8aae0647aaf80627c0e8dd76c4025d3c50f34cedd5a48
MATLAB
1,988
62
function p1 = plot_iqr(X, data, centerline, cmap, five_to_ninetyfive, Alpha) %plot_iqr creates a lineplot of the interquartile range (IQR) given data % Usage: plot_iqr(X, data, centerline, cmap, five_to_ninetyfive) % % Inputs: % X: A data domain against which to plot the measure of interest % (defa...
b0751bdf6bb4d848cc007f37c1adfd46251c4e4d06c0f60205573492592c9861
MATLAB
1,988
36
function fH = plotMeanCSTExponent_v_MeanCSSExponent(... resampled_medianCSTExp,resampled_medianCSSExp,roisToPlot,cmapROIs,saveFigs,saveFigDir) fH = figure; clf; set(gcf,'Position',[889,294,963,604],'color','w'); for idx = 1:length(roisToPlot) groupMeanOfMedianCSTExp = mean(resampled_medianCSTExp(:,idx),1,'om...
e37369e16d8e9ad2b8dbf6d519b42f0417a64f849d4bbd52cfc83c82607d6518
MATLAB
1,988
62
function dat = read_deymed_dat(filename, hdr, begsample, endsample) % READ_DEYMED_DAT reads EEG data from the Deymed Truescan file format % % Use as % dat = read_deymed_dat(filename, hdr, begsample, endsample) % % See also READ_DEYMED_INI % Copyright (C) 2013, Robert Oostenveld % % This file is part of FieldTrip, s...
1e181f648a16815f86cd9f4a93212c284127378f45b34c4a2a936cbe04b7f6f4
MATLAB
1,989
72
function cnn_softmax_evaluate(work_info_batch, group_idx) work_info_epoch=work_info_batch.ref.work_info_epoch; opts=work_info_batch.ref.train_opts; eva_result_batch_mc=do_evaluate_mc(opts, work_info_batch, group_idx); if ~isempty(eva_result_batch_mc) eva_result_epoch=work_info_epoch.ref.e...
42c4a3d7dcfe50858deb6304005b155fca5b11ca9b5a54ea17262793c3831a66
MATLAB
1,989
56
% mglLines2.m % % usage: mglLines(x0, y0, x1, y1,size,color,<anti-aliasing>) % by: justin gardner % date: 09/28/2021 adapted from previous version created on 04/03/06 % copyright: (c) 2021 Justin Gardner (GPL see mgl/COPYING) % purpose: Function to plot lines on mglMetal screen opened with mg...
6becde8437e903101fe50517de0e65d9da047395df6dc2a95412cb614e798d34
MATLAB
1,989
64
load ../graphs/bfs_example.mat [i,j,val] = find(A); % assign a randon number to each edge in the graph edge_rand = rand(num_edges(A),1); Av = sparse(i,j,edge_rand, size(A,1), size(A,2)); ee = @(ei,u,v) fprintf('examine_edge %2i, %1i, %1i, %4f, %4f\n', ... ei, u, v, edge_rand(ei), Av(u,v)); fprintf('\...
8394e59710a7f1245078447fa6b6756cbc4ca680c6619ffa819b60aa8acfcaae
MATLAB
1,989
56
function xdot=MePD_sys(~,x,par) % initialise the system xdot=zeros(6,1); % PARAMETERS d = par.d; % Time Scaling Constant cll = par.cll; % Gl self-excitation coupling constant cil = par.cil; % Gi to Gl inhibition coupling constant cli = par.cli; % Gl to Gi excitation coupling constant cii = par....
452f6a7bcc8a84c8b1e780c57e667e97b355ec339fe64a034409c98a4bc8efdd
MATLAB
1,990
54
function [FA_profile, SuperFiber, fgClipped, fgResampled] = ... Compute_FA_AlongFG(fg, dt, roi1, roi2, numberOfNodes) % Compute a weighted average of a variable (FA) in a track segment % % [fa, SuperFiber,fgClipped, fgResampled] = ... % dtiComputeDiffusionPropertiesAlongFG(fg, dt, roi1, roi2, numberOfNodes, ...
7acaf8700ff6c324cbf201ced50fe4024fcbbb1bba086803b044778066d98281
MATLAB
1,991
40
% Demo for emmeans clear all % load data load carbig t = table(Acceleration, Cylinders, Displacement, Horsepower, cellstr(Mfg), Model_Year, MPG, cellstr(Origin), Weight,... 'VariableNames',{'acc','cyl','disp','hp','mfg','year','mpg','orig','wgt'}); % predict MPG but interested in Origin differences so mak...
4c85ea1d43cdd92fe37043272ca8767f954071631350505e5aa6d1095f00f50c
MATLAB
1,992
57
% shiftIinjStartTime.m % % Function that takes in iInj struct (output of preprocessIInj() and an % amount to shift and returns a modified iInj struct with current % injection times shifted by input amount (and other struct fields % modified to match) % Helper function for computeLegStepsFictracEphysIinj_1Fly() % % I...
00385e25025eb89f3554718e24415a3c355fb04a3ae615469fde7a2fd954de3f
MATLAB
1,993
56
function TR_seconds = read_TR_MC_none(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as column vectors. % SKIP_SECONDS = IMPORTFILE(FILENAME) Reads data from text file FILENAME % for the default selection. % % SKIP_SECONDS = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads data from % ...
31d75cc5ede02f7d42ef0e1ae1636a97e29e855cbb1c34bd46ac4b2e9b83495f
MATLAB
1,993
65
function TR_RecordDisplay(app, displayH) Group = app.Experiment.Groups(app.IDs.Group).Group; Record = Group.Records(app.IDs.Record).Record; % Ttotal = Param.Ttotal; % total duration (sec) dT = app.Experiment.Specs.Display.Parameters.dT; % interval between display points (sec) Window = app.Experiment.Specs.Analysis.Pa...
a7fa38fb0ff97da47ec9dadded2313ca813b01bfe45416bbb79ba7388b85e996
MATLAB
1,993
61
% wrapper for epoching pupil data % uses PSPM toolbox % https://github.com/bachlab/PsPM % version used here: PsPM_v6.0.0 % Ulrike Horn % uhorn@cbs.mpg.de % adapted by Alice Dabbagh (dabbagh@cbs.mpg.de) close all clear addpath '/data/pt_02306/main/code/github/pain-reliability-spinalcord/1_preprocessing/' addpath '/data...
bdcb15448dc044bff3a575539b827df2a81f4852dc4f266c67ceb4f3e000a3dc
MATLAB
1,993
60
% this script create a 3-D scatter plot showing different pattern of the % dynamics, including ON-ON, OFF-ON, OFF-OFF and ON-OFF % 3 dimensions are: DeltaE (x), DeltaI (y), and Isens(z) rootFolder = "figure_200_0.02/"; % ON-ON data = readFilename(rootFolder+"agree/*_*_*_*_*_*.png",'%f_%f_%f_%f_%f_%f'); data( all(~data,...
d7775d41a19c96393eb7350680fbc23b1e1e16cf7b692da6777dea33320d802b
MATLAB
1,993
58
function [quality] = ml_cai_quality_all_two_led(t, x1, x2, varargin) p = inputParser; p.CaseSensitive = false; check_t = @(x) isnumeric(x); addRequired(p, 't', check_t); check_x1 = @(x) size(x,2) == 2 && isnumeric(x); addRequired(p,'x1', check_x1); check_x2 = @(x) size(x,2) =...
04c7e634c35586e2739330e2c41606d1e83cd1c5113e227a07c535a5db506525
MATLAB
1,994
77
load('sampledata_activity') for s = 1:2 for i = 1:56 trial_number(i,1) = size(rawdata4.ch(i).data,1) end clear data for ch = s*28-27:s*28 data.label{ch+28-s*28,1} = num2str(ch); end for t = 1:70 for ch = s*28-27:s*28 data.trial{1,t}(ch+28-s*28,:...
707750af0ed1f9cc079381733c8a3e1ced7f4bdc8ae05a0d80663528d31ce246
MATLAB
1,994
54
% bootstrap average EEG-fMRI correlation and calculate confidence intervals % (for Figure 2 and Figure 3) % % 2024-01-08 Jonathan Wirsich [confs, confs_label, groups, eeg_conn_types, bands, atlases, serialized_path] = init_serialized_conf_tle(); for atl=1:1 %load connectomes [allgroup_mean_fMRI, allgroup_mea...
a090df3a9778a95602c32f4233d40cfb869c99351a93a44927a225f7630afa1f
MATLAB
1,994
69
%{ Maxwell Gagnon - September 2019 - This function finds all BEHAVIOR Maestro files in a directory, opens them, and saves them as a .mat file. - .mat files are easier to work with than the BEHAVIOR Maestro files. %} %% Set up clear;clc; close all; fclose('all'); expmtDataFolder = 'G:\My Drive\Expmt Data\Max\Climbing ...
b0695a88ae4581302c7fe3a3364ac1f8af8aa99be2c0a02c3180ea920262fdfa
MATLAB
1,996
83
% temporary script for plotting ephys data with FicTrac and visual stimuli % % 4/8/21 % some constants fictracParams.dsf = 20; % downsample to 1000 Hz; fictracParams.filtParams.padLen = int32(200); fictracParams.filtParams.sigmaPos = int32(100); % 100 ms fictracParams.filtParams.sigmaVel = int32(50); % 50 ms BALL_DI...
2e83b4cf5cb747a21360ed6354c02dc617387b3d28c2714f3e299017a2b63269
MATLAB
1,998
46
%% Author: Jiri van Bergen and Xu Li % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % Updated by Xu Li, 2019-06-20 % Updated by Xu Li, 2021-06-23, called in cluster version %% Show Image info in GUI or print % Format Params.voxSize = single(Params.voxSize); TextDimensions = s...
6187af69ccad999cace4b92eefe025dae4302d81b9a51f3095ee2d4634b711c4
MATLAB
1,998
55
function propValue = TDMS_getPropValue(fid,propDataType,UTC_DIFF,DATE_STR_FORMAT) %TDMS_getPropValue Returns the property value given the Labview DataType % % propValue = TDMS_getPropValue(fid,propDataType,UTC_DIFF) % % See Also: TDMS_getDataTypeName SECONDS_IN_DAY = 86400; CONV_FACTOR = 695422; %dat...
c7403cc5279171cc85a23298eafd986c2a7452184f8226e7baee70b84b2f418d
MATLAB
1,998
57
function vid = setROI(vid, img1, img2,res, boxsize, boxoffset) %% Display snapshot figure(1); set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. h(1) = subplot(1,2,1); imshow(img1); title('Camera Left') text(-60,-82,'Please do it on the camera Left:','Color','red','FontSize',15) text(-53,-60,'First: Click a...
48047179a0c71c3bf2c45849799c7e990751172ce365db1f821d21b9570b8074
MATLAB
1,999
60
function write_stl(filename, pnt, tri, nrm); % WRITE_STL writes a triangulation to an ascii *.stl file, which is a file % format native to the stereolithography CAD software created by 3D Systems. % % Use as % write_stl(filename, pnt, tri, nrm) % where nrm refers to the triangle normals. % % See also READ_STL % C...
8dcd423949dcb54b381211fa2ec408e24e7c0797fb913a907c18355ebd29c6ac
MATLAB
1,999
63
function est2 = constrainEstToSomas(est,sL) % est2 = constrainEstToSomas(est,sL) % % Function to constrain the est data struct to a subset of profiles % that represent, for example, somatic components. % % 2020 - Adam Charles tmpSL = false(size(est.estactIdxs)); tmpSL(sL) = true; %% First: indexing hell est2....
8e47fdc9cb96a3382123abc0d6995369c90a1aa3c19d3b5cbe2223ed95f8b13b
MATLAB
1,999
79
function sel = vl_clickpoint(V,N,varargin) % VL_CLICKPOINT Select a point by clicking % SEL = VL_CLICKPOINT(V) let the user vl_click a point in the current % figure and returns the index v of the closest point (in Euclidean % norm) in the collection V. The 2xK matrix V has a a column for % each point. % % Th...
598102e719d9fb7a8d250315cdf34bbd503389ecbf0d3eb581e1444934692de6
MATLAB
2,000
91
%% OpenMEEG for MEG from Fieldtrip demo script % % This script provides an example of how to compute an MEG leadfield with % OpenMEEG in the Fieldtrip toolbox. % % This demo uses spherical head models and compares the OpenMEEG result % with the solution provided by the solution from Nolte. %% Set the radius and conduc...
723d84ede730801ef87978e086d8cbe3255a2f4a6e6fefe971042089f65c7d5e
MATLAB
2,000
81
%% setup clear;clc;close all;clear sound %C = IBWconnect('Z:\1_Maxwell_Gagnon\ProjectData_Sriram\Firing_spike_count'); %load('march8th.mat') sampleRateEYE = 1000; startEYE = 2022000+ 30000; additionEYE = 10*4; dispLenEYE = 1000*7 - additionEYE; sampleRateSPIKE = 50000; ORIGINALstartSPIKE = 101100000+ 1500000; startS...
f48f6d433c6cce6e7f8a1997f29cb705f5ee34f72ab594eebb5e42c09acdbb0b
MATLAB
2,000
80
function motion_estimate(DATA,ROI,AddInfo) % MOTION_ESTIMATE - Estimate motion using center of mass % (this is an Aedes plugin) % % Synopsis: % % Description: % % Examples: % % See also: % % This function is a part of Aedes - A graphical tool for analyzing % medical images % % Copyright (C) 2006 Juha-Pekka Niskane...
5a74770ce14df37c72ba3cf01264ec6bd6a8040b3fa794f014545cc8dec2c32e
MATLAB
2,003
53
%{ 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...
5df53e1031639c3cc9fd91c4613580a6f01e24377ab6799a43f02ededd57d1e0
MATLAB
2,004
75
function dataSize = TDMS_getDataSize(dataType) %TDMS_getDataSize Returns data size in bytes % % This function is used to return the size of raw data for predicting the % # of chunks of raw data % % dataSize = TDMS_getDataSize(dataType) % % INPUTS % ================= % dataType : Labview dataType ...
f61039a754129aadc9037fcae65fa72a9ca3acf71229aca4f1b715595341de53
MATLAB
2,004
45
function mlgp_compute_bfo_general_average(obj, rotDeg, group) numAngles = 360 / rotDeg; bfo_session_prob_mean = zeros(obj.Experiment.getNumSessions(), numAngles); bfo_session_prob_std = zeros(obj.Experiment.getNumSessions(), numAngles); bfo_session_corr_mean = zeros(obj.Experiment.getNumSessions()...
723337e470af6ddf6ea041386f01c62909238dc32ccedff7171d756b9d37a813
MATLAB
2,009
44
function subIm = subIndexImages(cnmf,suite2p, pcaica, est, Idxs) if isempty(Idxs) Idxs = 1; end TMP_sz = [500,500,1]; subIm.Idxs = Idxs(:); subIm.cnmfIdx = cnmf.pairs(any(bsxfun(@eq, cnmf.pairs(:,1), subIm.Idxs.'),2),2); % CNMF - strongly paired components subIm.cnmf = cnmf.compSpatial(:,:,subIm.cnmfI...
e87e1503151b7ed97aff06b6566759decf6be25f32fea44e9419d2ef6c6cce5f
MATLAB
2,009
73
function [varargout]=SONGetExtraData(varargin) % SONGETEXTRADATA reads or writes the extra data area of a SON file % % [ERR, BUFFER]=SONGETEXTRADATA(FH, N, DATATYPE, BYTEOFFSET, FLAG) % or % ERR=SONGETEXTRADATA(FH, BUFFER, BYTEOFFSET, FLAG) % % INPUTS: FH the SON file handle % N the number of ite...
1abf9838b95e2ebf2925831bfa71fb87586f223f83ec44914b7485c87ee9637f
MATLAB
2,010
54
function f = createTemporalIRFs_sustained_transient(x) % Function to create temporal IRFs for sustained and transient channel: % Sustained is a monophasic gamma function with parameters k, tau, n. % ON- and OFF_Transient impulse response functions are difference between % two-gamma functions, which are identical...
f06fcad0323d064c65f55136b0a79fe65c9c2adab7383e98b883e3b35d5aa2cc
MATLAB
2,010
80
function o = mayostruc % Create a data structure describing Analyze headers % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: mayostruc.m 8776 2013-11-14 09:04:48Z roboos $ persistent org; if ~isempty(org), o = org; ...
706c5eea1ec70859a89fc0dd7fc78ae3a611b5ade1c6d9a8f403e9a4aed5b93a
MATLAB
2,013
85
dimension = 128; numData = 10000; numClusters = 100; numIterations = 5; numIterationsKM = 3; X = rand(dimension,numData); numTrials = 2; lls = zeros(numTrials,2); for trial = 1:numTrials % kmeans initialization startKMEANS = tic; [initMeans, assignments] = vl_kmeans(X, numClusters, ... 'verbose', ... 'multit...
3fc9c762cdb29ace0fc155c8debd264aaaed30fa0ed78e64b9512dc90e96316c
MATLAB
2,014
79
function my_epoch_model_cache(opts, epoch, exp_info, net_config) if ~opts.do_cache_model return; end model_cache_epoch_idxes=opts.model_cache_epoch_idxes; model_cache_epoch_idxes_snapshot=opts.model_cache_epoch_idxes_snapshot; do_cache=false; if any(epoch==model_cach...
5ef85396ec19157b308da03a62432d8a6787cf7b308a34bd57b811fbf2e3caf7
MATLAB
2,014
70
% Function File: [Y] = sma (y, n, method, correction) % % Calculates the Simple Moving Average (SMA) of y-values for 2n+1 % number of points. The method variable must be specified as 'mean' % or 'median'. The algorithm uses a bounce end-effect correction, % which can be switched 'on' or 'off'. ...
4cce42692d163feec33d51bade8b5fda717283ff50034222c44be83c862b4896
MATLAB
2,015
52
% function out_struct = read_figS6_results_from_xlsx(fname, sheetName) % reads data necessary to create figure S6 from .xlsx. All required % variables are fields of out_struct % Inputs: % fname (str): Name including path of the .xlsx document. % sheetName (str): Name of the worksheet within fname. % ...
995816bcf19447bbcd435ede8e04780cb14d9e4046c7dfc56b41a98f136509f1
MATLAB
2,015
66
function [tap] = hanning(n, str) %HANNING Hanning window. % HANNING(N) returns the N-point symmetric Hanning window in a column % vector. Note that the first and last zero-weighted window samples % are not included. % % HANNING(N,'symmetric') returns the same result as HANNING(N). % % HANNING(N,'periodic'...
acbb8960dbb2146c17cb642eaa1526d199098147b8f79cb9f7906806ac93e195
MATLAB
2,015
41
classdef CBIG_IndCBM_unit_test < matlab.unittest.TestCase % Written by XUE Aihuiping and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % create output folder CBIG_CODE_DIR = getenv('CBIG_CODE_DIR');...
018779dce208e54ac9aa2fa74bdd868b23fbcc9a5f2d0f250f375f2c4af01aed
MATLAB
2,016
73
% getTaskVar.m % % usage: val = getTaskVar(task,varname,trialNum) % by: justin gardner % date: 11/09/16 % purpose: Gets the value of a variable from the task. % % e.g.: Get the last trial value for parameter, myVariable % val = getTaskVar(task,'myVariable',-1); % % e.g.: Ge...
779ada39e3366bb6c2d3a25edbcf4d5c32c1c4af59d5c453f7188050544de499
MATLAB
2,016
67
function write_neuralynx_nts(filename, nts); % WRITE_NEURALYNX_NTS writes spike timestamps to a NTS file % % Use as % write_neuralynx_nts(filename, nts) % % See also READ_NEURALYNX_NTS % Copyright (C) 2007, Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for the d...
caf72e0dae44d476a5ca505932491e55e3d41907248df570a8478011c57ded21
MATLAB
2,018
66
function PLOT_linearityComparison2(mag_aligned, vid_aligned, sacStarts, sacStops, keep, mag_all, mag_chunks) numSacs = length(sacStarts); numOnEach= 2; colors = {'b', 'r'}; numSubs = 6; numSubsDim = [2, 3]; figCount = ceil(numSacs / numSubs); q = 1; % each figure contians 9 subplots for i = 1:figCount figure()...
30420a2f7d76564048b487507ea47c809c4e4ff275484419ffe57e40fafa8f0e
MATLAB
2,019
72
function varargout = calceyeangle(results, theta) %% Angle between two cameras in degree 5/22 DONT CHANGE if ~exist('theta','var') theta = 39.8; end %% if input is a dat, convert to old results format if isa(results,'dat') datflag = 1; R = results; results= []; results.pupil1 = [datchandata(R,'p...
2f494ef3d4d572411689acf48fb46f9f35eb86dac634259fa40425960f2e06f8
MATLAB
2,021
79
function [clean_data,info] = find_homogeneous_FR_rows(data) % find_homogeneous_FR_rows.m % data: assumes nTr x nMS structure minSpkTr = 2; outlierFac = 3; FRs = mean(data,2)*1000; threshIX = FRs >= minSpkTr; threshRows = find(threshIX); gmmData = data(threshIX,:); gmmFRs = FRs(threshIX); nGRows = size(gmmData,1); ...
c0695ef5e998ea34a03e557dc789a1d44832cf6d02956ed9f03dc509402e8269
MATLAB
2,021
44
function trace_mat = expression_variation(trace_mat, p_off, min_mod) % function trace_mat = expression_variation(trace_mat, p_off, min_red) % % Function to take a matrix of traces (N neurons by T time-points) and to % modulate each neuron's time trace by a value that is 0 with probability % p_off (that cell has no ex...
cb3ddb5fdd84244ceba92a89b1066269bd843c72d172e8e94950120e9d7aa865
MATLAB
2,022
59
% wrapper for epoching pupil data % for predcod behav first replication dataset % uses PSPM toolbox % https://github.com/bachlab/PsPM % version used here: PsPM_v6.0.0 % Ulrike Horn % uhorn@cbs.mpg.de % adapted by Alice Dabbagh (dabbagh@cbs.mpg.de) close all clear addpath '/data/pt_02306/main/code/github/pain-reliabili...
fea7c364806c79a535dbd30ebf4ae57fba93d6ac161fa34a2b74c0e3ab67b8d7
MATLAB
2,023
53
% mglBindTexture.m % % $Id:$ % usage: mglBindTexture(tex,newdata) % by: justin gardner % date: 02/01/12 % purpose: This implements a faster way to change textures on the fly. % For example, if you want to just change the alpha of an % image it can be 4x faster than ...
3763561956483f77e1d6773f8fdee9b11ce8990a5296fee7a84719d8ced7ee62
MATLAB
2,024
61
function sig=subtract_refBDH(time,sig,sig_control,savename,subtract_method) exptname=strsplit(savename,'\'); exptname=exptname{1}; %subtract_method=2 % subraction of sig & control % subtract_method='MinResid' use bestfit model % subtract_method='Subtract' just subtract them % subtract_met...
516208fb968af54fdeca585dc27aa1ffcf612c91ce90aeb5fdcff5af81b64853
MATLAB
2,024
53
function [col1, col2, col3, col4] = read_neuromag_eve(filename) % READ_NEUROMAG_EVE imports events from the *.eve marker file that can accompany a % *.fif dataset. % % Use as % [smp, tim, val3, val4] = read_neuromag_eve(filename) % % Column one is the sample number. Column two is the time. Column three is is most % c...
b8c96189670d7a156926a5d6acf2483dd8691f4afca7512fbae844cb1c0ba8c3
MATLAB
2,024
67
% updatePDataStepParams.m % % Quick script to update legSteps struct after update to % computeStepParameters() % % CREATED: 2/13/23 - HHY % % prompt user to select pData files [pDataFNames, pDataPath] = uigetfile('*.mat', 'Select pData files', ... pDataDir(), 'MultiSelect', 'on'); % if only 1 pData file selected...
cad3168a6449efb18185cae0911575f65159888f7f1683205415bd18b3846699
MATLAB
2,025
41
function test_tracker_with_alternative_input() this_script_folder_name = fileparts(mfilename('fullpath')) ; flytracker_folder_path = fileparts(this_script_folder_name) ; flydisco_folder_path = fileparts(flytracker_folder_path) ; flytracker_test_files_folder_path = fullfile(flydisco_folder_path, 'flytra...
0376c8dfa276b8121f94b6478875e2036261ff0d1a52aed03b8276968ee74eab
MATLAB
2,026
55
function [dat] = read_bucn_nirsdata(filename, hdr, begsample, endsample, chanindx) % READ_BUCN_NIRSDATA reads ASCII-formatted NIRS data acquired with the % UCL-BIRKBECK machine and postprocessed by the Paris group. The first line % contains the channel labels and the rest of the file contains per line a % time sample....
27cc5448588de62050c0e5d5c7aabedf96b72346a67fa14edda26b1bc1d3dd84
MATLAB
2,026
40
% SONGETEXTMARKDATA returns the timings, marker values and extra data % for an AdcMark, RealMark or TextMark channel % % Implemented through SONGetExtMarkData.dll % % [npoints, times, markers, extra]= % SONGETEXTMARKDATA(fh, chan, maxpoints, stime, etime{, filtermask}) % % INPUTS: FH = file handle % ...
3c0619d8ac9f6b9eb1d1623ae738a46291fa5493177e675a7a908f75039d031a
MATLAB
2,027
81
function [] = Fig01_Example_dPR1_Frames() % Code for plotting example frames of a recording from dPR1 in Fig. 1g. Target_FileID = 2; Margin = 10; figure('Position',[100 100 1600 1200]) %% behavior TargetStim = 1; nFrames_10s = 71; % 71.0443 frames nFrames_1s = 7; %% imaging nTrials = 6; d1 = 256; % Y d2 = 256; % X ...
038a54512c37dc4acea713840248f7ef5d0ca7a9478c884870482358e91df743
MATLAB
2,028
56
function split_images(stg,prf) % reads the image files indicated in profile and splits them into various % ROIs indicated in the settings for all observers. % % % SPLIT_IMAGES(STG,PRF) get original pre-processed images indicated in the % PRF variable and extracts the data for each ROI of a desired atlas,both ...
233b33b0f8fc48cc838c3ebbf260d525141a6126be3bff258395bf7eb29c9fea
MATLAB
2,028
52
function compactify_sfp( obj, session, trial ) % Load the standard SFP used for CellReg fn = fullfile(trial.getAnalysisDirectory(), sprintf('%s.mat', obj.Config.cell_registration.spatialFootprintFilenamePrefix)); if ~isfile(fn) fn = fullfile(trial.getAnalysisDirectory(), 'sfp.mat'); if ~isfi...
8573b9472cd99461d3f5c56af0f2c802fe7cb044d78aabcba34581a1d9a98c97
MATLAB
2,028
60
% clear; addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) %% dir_video=fullfile('..','data','data_TENASPIS','added_refined_masks'); 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); eid = 1; Exp_ID = ...
c070e384dfaab317ee3f30119137ba6553f7a88bc3efd2bc4e8818e57b038a8a
MATLAB
2,028
41
clear close all 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); gotrial{1}=find(outcome(1:n1,1)==1|outcome(1:n1,1)==2|outcome(1:n1,1)==5); gotrial{2}=find(outcome(n1+1:n2,1)==1|outcome(n1+1:n2,1)==2|outcome(n1...
67445462314a0ee263ea8248e9d7f0c037a89dd3187b5da1f4e570a17aa59e91
MATLAB
2,029
53
function [shiftedLFP] = shift_LFP_data(lfpdata, lfpFS, shifts, shiftsFS, xcoords, ycoords, smoothBetweenBlocks,sigmaMask) %% Adapted from kilosort2.5 shift_batch_on_disk.m %% by Richard Hardstone numChans = size(lfpdata,1); numSamps = size(lfpdata,2); sampsPerBlock = lfpFS / shiftsFS; %% Make sure that realignment...
2306cbfb5fff942601702917fb4916d4a8acbefa27696ff31444d32b91867d0c
MATLAB
2,030
68
% convertImgSeqToVideo.m % % Function that takes in path to a folder containing a sequence of images % and converts it to video of the specified type saved one level up from % the image sequence. % % NOTE: currently doesn't work correctly on default output of Point Gray % Spinnaker b/c file numbers aren't zero padde...
a73f80268ea6fb671abaaa301072aacbb03ba38594c65a6453296df787269b4b
MATLAB
2,030
56
function dt = datatypes % Datatype % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: datatypes.m 8776 2013-11-14 09:04:48Z roboos $ persistent dtype if isempty(dtype), t = true; f = false; table = {... 0 ...
bbf6435e80607af22fb95ffa5581d88629b7053849054c1f63a18212e9d13213
MATLAB
2,030
85
% figS1_RP_no_oscil.m % generates Fig. S1 using stored values %% clear all; close all; clc; %% addpath if not added yet % assumes script run within local directory scriptdirs = {'../../plot';'../../helper_functions'}; addpath(scriptdirs{:}) datadir = pwd; datafile = 'fig1_no_oscil_ex_data.mat'; datapath = fullfile(...
4665f237bd95f2d3e75fa46391cc75b7c1ddf37052db5cbf0484de2d20f50d50
MATLAB
2,031
64
% mglMoveWindow.m % % $Id$ % usage: mglMoveWindow(leftPos, topPos, socketInfo) % by: Christopher Broussard % date: 10/23/07 % purpose: Moves the current AGL window with the left edge of the window % at 'leftPos', the top edge at 'topPos'. % % % move the primary window % ...
ca5184feef33b5f27675ca24b9d51bec37dd7c2734a0174eb9675a61719f170a
MATLAB
2,031
63
% preprocessLegVid.m % % Function for preprocessing raw voltage signals from the leg tracking % camera (strobe signal with falling edge as frame start). Extracts leg % video frame times. Checks that number of frames camera says it has % captured matches number of trigger pulses sent. Also, saves full path % to le...
f01a4307513b7a2d489254a8af15a561cf5a4266f8f753933279e3e4e67634dd
MATLAB
2,031
49
% mglContextCloseAll: Close all stashed and active mgl contexts. % % $Id$ % usage: [stashedNames, activeName] = mglContextCloseAll() % by: ben heasly % date: 09/07/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Close all stashed and active mgl con...
3b94b8db249a6bb41336bcecbfdfaf090acc476c316084154e0f7be0d303ee24
MATLAB
2,033
63
% ephysRecording.m % % Trial Type Function % Only records ephys channels, no current/voltage injection % % INPUTS: % settings - struct of ephys setup settings, from ephysSettings() % duration - duration of trial, in seconds % % OUTPUTS: % rawData - raw data measured by DAQ, matrix where each column is data % ...
4731084bde37ee31aea51f6dfffe359c8c1af01ef155b1eec8fcff1414999206
MATLAB
2,033
57
%{ 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...
e8b2b3ced57357b195f2f5c2ad58e141223b1de4a70fb0c15b8b185520b6d093
MATLAB
2,033
57
function krn = spm_smoothkern(fwhm,x,t) % Generate a Gaussian smoothing kernel % FORMAT krn = smoothing_kernel(fwhm,x,t) % fwhm - full width at half maximum % x - position % t - either 0 (nearest neighbour) or 1 (linear). % if only two arguments are passed, then a value % of one ...
0e069203efcf2d428663e2c54d47bed138637126891917ac0a86d3b1e255c2ed
MATLAB
2,034
54
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [T] = compute_per_day_cell_averaged_rate_difference_matrix(DaysToSessions, RateMatrices, perCellNormalizationMethod) uniqueDays = unique(DaysToSessions.dayNum); numDays = length(uniqueDays); T = []; k = ...
89e28c11d100246f43193195cfde0522bcd7568b87365bf6278fead0ace6284b
MATLAB
2,034
56
function[signals] = applyFindPeaks(varargin); p = inputParser; errorStr = 'Oh no! There is something wrong with your Thresholds!'; validationFcn = @(x) assert(isnumeric(x),errorStr); addParameter(p,'PHthreshold', 'Wrong',validationFcn); addParameter(p,'MPPthreshold', 'Wrong',validationFcn); addParameter(p,'Fil...
e39899b6b593ab4761882e55130887c8fb4adef61984f5bf75016ee7b2a520e3
MATLAB
2,034
51
function [path_name, file_base, file_fmt] = data_info % Select datasets to process % Jinghao Lu 01/12/2016 % [file_name_tmp, path_name] = uigetfile({'*.tif'; '*.tiff'; '*.avi'}, 'Select coordinates file', 'MultiSelect', 'on'); [file_name_tmp, path_name] = uigetfile('*', 'Select imaging file', 'MultiSelect', ...
75df18925422bd5af5ac2bd242687fe2680bc7a16de6453c763723b56e7ca7f6
MATLAB
2,035
59
function zipPath = zipFolder(dirPath) % Zip the recognised preview files in a folder into a temporary .zip % % function zipPath = webupload.zipFolder(dirPath) % % Purpose % Only files the server keeps (see webupload.selectUploadable) are included, and the % archive is flat: subfolders are ig...
765d27f4ec7791676512735894cb6c54430508193e74e23dbc97058fa52f5161
MATLAB
2,035
62
% saveAllMoveCondData.m % % Script to generate and save all movement conditioned, paired imaging and % fictrac data for flies that meet selection criteria % % Selects flies/trials using metadata spreadsheet and returnSelectMetaDat() % Runs moveCondPairData() on all selected trials and saves data % % UPDATED: % 9/13...
4c043ad8ee49db52448e95b51c64f558010fd4bb737da1f7fd641f3b9033b981
MATLAB
2,036
50
function [] = E3_Beta_Comparison_bootstrp(badSubs,slctd_strct,append,n_BS) % baSubs = code of bad subjects ([23,28] for now) % slctd_strct = which structures to do comarison on ([1,2,4]; %Th, CN and GP: selected based % on best model on all conditions combined) % appe...
af6315d31d0b1718bb10f48a0007dec57f2b677950b4011ae042fd993f0c4019
MATLAB
2,036
77
<<<<<<< HEAD function [gmsVector, gmsVectorREJ, NGRA, REJngra] = gms2Vec(gms, matching_type) % initialize vector gmsVector = []; gmsVectorREJ = []; k = 0; w = 0; for z = 1:size(gms,2) % for each ID % ciclo tutta la matrice per creare l'opportuno vettore for i = 1:size(gms{z},1) % imposto J per saltar...
4c592fb85403c848ef645862b29e347ade3a8e10ab387b117bc9e4a0115af60e
MATLAB
2,038
61
function handle = ternary_grid_lines( handle, varargin ) %ternary_grid_lines plots a set of grid lines for all three axes % % grid_pnts is structure array grid_pnts(1:3).values(1:N), where N % can vary for each axis. Ticklinelength gives any extra length on the % base axis used for ticks % %% Check...
339139b017a1236d0deff12cc04dba9da6b3168121abca7dfc863c489a4e881e
MATLAB
2,040
47
function[interval, start]=SONGetSampleInterval(fid,chan) % SONGETSAMPLEINTERVAL returns the sampling interval in microseconds % on a waveform data channel in a SON file, i.e. the reciprocal of the % sampling rate for the channel, together with the time of the first sample % % [INTERVAL{, START}]=SONGETSAMPLEINTERVAL(F...
e5a5dd51767fc4fe97ae25cbaa349f905259b2ad14b9fd06129f593321ef4e6e
MATLAB
2,040
83
function[traces_figure,smoothed_dff]=plot_traces(dff,deconv,ctype,velocity,select_time,t) %% %DFF/DECONV/CTYPE MUST BE SORTED BY CELLTYPE dff=normr(dff); deconv= normr(deconv)./5; numframes=size(dff,2); smoothed_dff=movmean(dff,10,2); velocity=normr(velocity)*15; velocity=movmean(velocity,30); %% SELECTED TIME ...
314d9048b6a019c1c1c5c9514af90d830e11a11d7dd567ad25dedf026e326304
MATLAB
2,041
59
function [eyevelH_offset, eyevelH_rel_phase, eyevelH_amp, eyeHgain] = VOR_SineFit_Single(freq, sampleRate, eyeVel, headVel, drumVel) % Segment data to current time segment %dataseg = datseg(data, [tstart tstop]); % Read in data %if ~isempty(strfind([dataseg.chanlabel],'htvel')) % drumvel = datchandata(data...
3428bf7de08af20572676615cf941de31a317e9ab0d1a566bf3f6083760b811c
MATLAB
2,041
54
% mglMetalDots.m % % $Id$ % usage: results = mglMetalDots(xyz, rgba, wh, shape, border) % by: Benjamin heasly % date: 03/16/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Draw "vectorized" dots with xyz, rgba, width and height. % usage: resul...
6a923c62a37c759160dbfbf07976ce4bfd2552ad6f14752be2f87e0474233e9e
MATLAB
2,041
61
function bnd = read_asa_bnd(fn); % READ_ASA_BND reads an ASA boundary triangulation file % converting the units of the vertices to mm % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for the documentation and details. % % FieldTrip is free so...
a9bb9bbb9ac794766278fcb4e0aa1d22c3c2fbe22baacb1a84e6eb0833aa414c
MATLAB
2,041
94
function boundary = CalculateBoundarySize(aa, bb) % boundary = CalculateBoundarySize(a,b) calculates the size of the boundary % between blob a and blob b % % Faster version % Make sure a is the smaller blob if (aa.borderSize > bb.borderSize) a = bb; b = aa; else a = aa; b = bb; end % Ge...
cee5c8ac6e538193bd6062d4186a26974e46a42034f810097cba403730f2bd29
MATLAB
2,043
78
% mglTestGlassDots: an automated and/or interactive test for rendering. % % usage: mglTestGlassDots(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering a whole bunch of dots. % usage: % ...
ebe1282de9cd146ecbf101e09c65361cd6e8194febe644ca3f170e4853332154
MATLAB
2,043
52
% writetrace.m % % $Id$ % usage: myscreen = writetrace(data,tracenum,myscreen,force) % by: justin gardner % date: 02/17/05 % copyright: (c) 2006 Justin Gardner (GPL see mgl/COPYING) % purpose: function for experiments that writes data % to a trace. because saving data in a trac...
d0b36c4c2a70ba180273c12c61e096125face3009b686f727fc6ce111bf1057e
MATLAB
2,044
59
close all clear all clc %recordingsParentFolder = 'R:\chengs_task_2c\data\minimice\feature_rich\CMG087_CA1\recordings_sep'; %recordingsParentFolder = 'T:\Minimice\feature_rich\CMG129_CA1\recordings_sep'; %analysisParentFolder = strrep(recordingsParentFolder, 'recordings', 'analysis'); config = mulana_json_read(fullfil...
b774a31232882e2d0bc518e8ec8a0b591c392a5b45ddc08c735b1364bead54c0
MATLAB
2,045
65
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 % This makes figure S12B close all clear all clc % Paths run('../load_figure_config.m') INPUT_FOLDER = CHENGS_TASK_2C_FIGURES_CONFIG.DATA_FOLDER; OUTPUT_FOLDER = CHENGS_TASK_2C_FIGURES_CONFIG.FIGURE_OUTPUT_FOLDER; if ~exist(OUTPUT_F...
cbd255a874a42e76ab4cc8578d88b9579df22809790977e0bae938c2c848b8b7
MATLAB
2,048
62
function results = vl_test_dsift(varargin) % VL_TEST_DSIFT vl_test_init ; function s = setup() I = im2double(imread(fullfile(vl_root,'data','spots.jpg'))) ; s.I = rgb2gray(single(I)) ; function test_fast_slow(s) binSize = 4 ; % bin size in pixels magnif = 3 ; % bin size / keypoint scale scale = binSize...