sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b5343edef89d8d46662cb14efab675736ebd8ef50d3fe5a06b73bd53ba0358c3
MATLAB
1,336
36
%EARTH Black-green-white colormap % % Examples: % map = earth; % map = earth(len); % B = earth(A); % B = earth(A, lims); % % A black to white colormap with several distinct shades, most of which % have a green or brown tint. This colormap converts linearly to grayscale % when printed in black & white...
b652cde092804b8f0189103e0900b7a2c9f8acf162c091da8d32f677993916d0
MATLAB
1,336
39
function [x, y, center_x, center_y, radius] = calc_geometry(doShow, handles) %%% Function that calculates the radius and the center of the RIFF given % port location, stored in offline file 'six_mid_points_binned.mat' if(nargin > 1) % When calc_geometry.m is called from the RatTracker, supplied by the 'handles' ...
7f3b40909f611d25b0de04e90829432ae6c61980de0f488044285cebfc933453
MATLAB
1,337
60
function [audio_ts, audio, video_ts, video] = extractmedia(fl, time_start, time_stop) % default to empty if ~exist('time_start', 'var') time_start = []; end if ~exist('time_stop', 'var') time_stop = []; end % use mex file to extract time stamps and aligned audio info = extractaudio(fl); audio_ts = info.audio_...
c65ba1e9fec74d45ac5e0a55a75309021805875d6b8535f97260c64c59714c5a
MATLAB
1,337
60
function [audio_ts, audio, video_ts, video] = extractmedia(fl, time_start, time_stop) % default to empty if ~exist('time_start', 'var') time_start = []; end if ~exist('time_stop', 'var') time_stop = []; end % use mex file to extract time stamps and aligned audio info = extractaudio(fl); audio_ts = info.audio_...
729f2655eedb8ae0327b123259cdf3614ee69c305971ac5cc28864251b7e226c
MATLAB
1,339
30
function [image_arr, LED_arr] = remove_last_black_frames_with_no_LED(image_arr, LED_arr) % Function remove_last_black_frames_with_no_LED removes empty images and their corresponding emtpy LED % values from the image array % % Inputs: % image_arr - (PxPxN matrix) - images of rats with LEDs in t...
e0a2f8c402f3e0a096d81e35a2d3b2727dd161d883335ce004b1b4edc6de03a4
MATLAB
1,342
40
function m_sig = set(m_sig,varargin) % SET Set Main_signal properties and return the updated object % Property names are: % Level_comp, STime_comp, ETime_comp, Ramp_comp, Envelope_list. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_err...
bf2ab514199f261d59aab6fe3e321cca58e90aecf4b1fd074ac00686feda537c
MATLAB
1,343
38
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is GAP synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. switch nargin case 4 params=varargin{:}; if ~(isempty...
cad6d2ff737b4b8b7e424692c28eac532dcb478bb1255afa0e4f5d9fbb9314e8
MATLAB
1,346
39
function plot_paired_graphs(data, ylabel_string, ylimit) number_subjects = size(data,1); %data = data(:,2:end) - repmat(data(:,1),1,size(data,2)-1); figure ax = axes; bar(1, mean(data(:,1,1)), 'BarWidth', 1); hold bar(2, mean(data(:,1,2)), 'BarWidth', 1); for i=2:size(data,2) bar(3*(i-1)+1, mean(data(:,i,1)), '...
93db6b97b81932eab9d69db46656ec0510b9c76b1b0c7f5d2b5f1cf88d6d4613
MATLAB
1,347
49
%load PET/SPECT data load('PETdata_HCP.mat') %permutation 5000 times permN = 5000; %% %load brain statistic values permuted 5000 times load('t_perm_5000_area_l5.mat') %percentage of missing: allowed missing rate in each HCP region pert = 0.5; %region size n = zeros(length(dn),1); %spearman's correlation s...
7d5192a19d24d06d5a0ff98f24ec17dcab6332da88528e3654f084b9622fa3d8
MATLAB
1,352
47
function [countsNoNoise] = gui_FFTfilter(counts, gauss_blur_radius, spectral_radius, scaling_factor) % Scale the image image = counts * scaling_factor; % Mean of all values mean_value = mean(image(:)); % Center the distribution image = image - mean_value; % Add custom blur ...
cd127a7a78c2375149ffc5d065a0327023e4851aa025f2111d295310f2e0a4fe
MATLAB
1,355
40
% r = getRadAvg(im) % --------------------------------------- % % Return the radial average of input square image im % % Inputs: % im Square image % % Outputs: % r Radial average % % --------------------------------------- % % Copyright © 2018 Adrien Descloux - adrien.descloux@epfl.ch, % Ecole Po...
7588a67dea7f7d8418001756b684ad2b30b1fbddd5f2cfecad9cad17bd809bda
MATLAB
1,362
41
function [p_past,p_joint,p_present] = est_p_table(X,N_s,tau, pow_vec) %------------------------------------------------------------------------------------------------- % PURPOSE: estimate probability distributions of past (p_past), present (p_present) and % joint distribution of past and present (joint) from discret...
29112e818a754931440764c4f267e7e61d6bfa1f6533e363dc0ec43e603c3399
MATLAB
1,365
55
function tint=tInterval_Calc(vect, CI) % tInterval_Calc - confidence interval based on the t-distribution % % function tint = NBP.tInterval_Calc(vect, CI) % % % Purpose % Calculate the t-interval about the mean to a given confidence % level (CI). Note that nans do not contribute to the calculation % of the sample size ...
4327d4bfaad8bd1b54f59b114409a42f56eea49c388e31d8ace46f26f2f36f46
MATLAB
1,375
32
function val=get(l_coord,prop_name) % GET Get Line Coordinator property from the specified object % and return the value. Property names are: % Coordinator - the coordinator object % Basic_line - the Basic line this Coordinator handle % Components - list of the components of the Basic line this Coordinator handle % Nu...
a1aa9519903f688b26bba624ac31bc7666aab146a61c4fdd957d116ef741cb37
MATLAB
1,378
49
% Time-frequency analysis % 'TF' is time-frequency spectra of data. % 'TF' will be a matrix (time * frequency) % 'data' should be a vector % 'sf' is a sampling rate % 'wnd_size' is a window size of data % 'baseline' is a period for baseline correction of analysis % 'f_scale' is a freqeuncy resolution of analysi...
dc0bbf0fd0a671cf6352a9705ffe468cfb2b205f557f0d57e16ec9642e46c921
MATLAB
1,378
44
function [areaTable, centData] = setFuncArea(inputvector) loclen = inputvector(1)-3; locx = inputvector(2:loclen/2+1); locy = inputvector(loclen/2+2:loclen+1); x0 = round(mean(locx));%inputvector(loclen+2); % center x y0 = round(mean(locy));%inputvector(loclen+3); % center y R = inputvector(loclen+4); % radius another ...
f4222cc77b223617e88f29ef3267f0ba07d0509b5e1e2184e6f1111ca6c0ea8d
MATLAB
1,378
57
function result=linept(matrice, X1, Y1, X2, Y2) % Connect two pixels in a matrice with 1 % % Command line % ------------ % result=linept(matrice, X1, Y1, X2, Y2) % matrice : matrice where I'll write % (X1, Y1), (X2, Y2) : points to connect % result : matrix + the line % % Note % ---- % matrice can c...
0568b6fcea3fdba124c3f1c86c373dd4ead252f6cc53fd6afa9acf6488eaf82c
MATLAB
1,380
35
%% Fowlkes-Mallows by N Clusters stabilityFigure = figure(); hold on; for iMeas = 1:5 d1 = RSdata.d.(ephysMeasures{iMeas}); Badj = (d1.clustB-d1.clustEB)./(1-d1.clustEB); q = quantile(Badj,[.25 .5 .75],2); errorbar(d1.clustNs(1:13)+(iMeas-3)/10,q((1:13),2),q((1:13),2)-q((1:13),1),q((1:13),3)-q(...
439a1af127ed34558843d8f55dda3552fd80eb8d3aa002bb3b1e55f226094b30
MATLAB
1,382
46
function [] = SampleNplot(temp, figN) timez = temp.input; auc = temp.aucs; acc = temp.accs; spec = temp.specs; sens = temp.senss; xs = temp.xxs; ys = temp.yys; figure(figN); hold off; clf; intervals= linspace(0, 1, 1000); mean_curve =[]; for j=1:size(xs,1) figure(figN); plot(xs{j...
7ac1080e6def9fa7251b326059bf329bc9d32d394ef1da93fe357cbc2b447034
MATLAB
1,385
75
function fb_plot_3dtime(DATA,T,varargin) %fb_plot_3dtime plots a 3-d trajectory over time using a colormap. % % fb_plot_3dtime(DATA,T,varargin) % % DATA % samples x dimensions matrix with at least 3 dimensions containing % the data to plot % % T % nsamples vector that specifies the point in time associated with % each...
fbcc39d61fc7cf9a0ae8ea016fd304439d10e12afaa4db3ead797dfb13abe88b
MATLAB
1,386
41
function comp = Freq_comp(varargin) % Freq_comp_comp class constructor. % c= Freq_comp_comp(STATIC_VALUE) creates a Freq_comp object which is a % Signal component representing it's frequency. global FREQ_COMP_DEFAULT; FREQ_COMP_DEFAULT=1500; if nargin==0 comp.name='Freq_comp'; s_comp=Sig_comp(FREQ_C...
9f236afc342db88c1164d7ced06432e4b434d6491b52f0f464d80a7bdda48a4e
MATLAB
1,387
47
%% % This is the analytical derivative of the Siegert function, as found in % Helias, M., Tetzlaff T., and Diesmann, M. (2013; Appendix) % % Contains both the drates/dmu and drates/sigma terms %% function [W_stability] = Siegert_stability_analytical(firing_rates, mu_ext, var_ext,... tau_m,tau_r,V_th,V_r,J,Npop,J_si...
f3ec5543c82e2abb05e71c2cd168fc375c4cde28b195e19849f095cc0ca36f89
MATLAB
1,388
38
function [embedMn,embedSD,embedDistMn,embedDistSD,embedDistCorr,elbows,pctNan,eVals,bootEmb] = bootstrapEmbedding(adjMat,nBoot,embedArgs) nNode = size(adjMat,1); nSubj = size(adjMat,3); meanAdjMat = mean(adjMat,3,'omitNan'); meanEmb = Embedding(meanAdjMat,embedArgs{:}); meanEmbDistVec = ecogu...
72a8d9d7f208e0e9e6f24e16d4351840f698da29c681026a7472f7b1bf35271d
MATLAB
1,390
61
clc close all clear figure('Units','normalized','OuterPosition',[.1 .1 .08 .2]) plotit(68) figure('Units','normalized','OuterPosition',[.18 .1 .08 .2]) plotit(28) figure('Units','normalized','OuterPosition',[.26 .1 .08 .2]) plotit(12) % ========================================================= function plotit(n...
6e64ef3673ee834fec199af9da1abf709b170620208af7d9a4c02af45a233da3
MATLAB
1,395
39
function values = get_trial_values(s_comp,varargin) % GET_TRIAL_VALUES(S_COMP) returns an array of values that would be generated for % this Signal component (s_comp) according to it's internal state. % values = GET_TRIAL_VALUES(S_COMP,RANDOM_INDICES_ARRAY) returns an array of values % for the given Signal component w...
1c2bc01cf161ba7ddc95b2f538e7f4abc9ed46f3b00603da8e3d52cd3cb1f7bc
MATLAB
1,399
45
for ind=1:1 %/ [Result,pData,DataCapture] =AO_GetChannelData(10256); if(DataCapture~=0) DataCapture=0; spk = pData(1:DataCapture); spk=double(spk); spkBlocks = reshape(spk,spk(1),length(spk)/spk(1)); spkTimeStamps = spkBlocks(5:6,:); blockNum=1; firstTSSpk=bin2dec([dec2bin(mod(double(spkTimeStamps(2,blockNum)),2^16...
fd7d73e40031d36bf2fcb278e4f1ba1c1a5fc051db4c7c32894273817413f4bc
MATLAB
1,401
56
%% std ratio of pursuit directions % Fig. 3, e-f % load behavioral data load('behavior.mat'); % behavioral result - Monkey A direction = direction_day_prior_A; ab1c100=[];ab2c100=[];ab1c008=[];ab2c008=[]; for a = 1:size(direction,1) ab1c100 = [ab1c100; std(direction{a,1})]; ab2c100 = [ab2c100; std(direction{...
4effc01db4cc9e512797d6f3844d98af867946338f9f24d4e6d548ba08d07740
MATLAB
1,410
48
function res=check_meta_params(meta,varargin) % res=CHECK_PARAMS(PARAM1,VAL1...) checks the validity for a MetaBlock object. % Checks that PARAM1 field can hold the given VAL1 value and the same for % PARAM2,VAL2 and so on. % If all params are legal - returns 1. Otherwise returns 0. global META_RUN_MODE_NAMES; res=1;...
805a6315972525bbaac1bab56b15e2b18e0dad5bee8fc4ed6e6dc7a821eddb4c
MATLAB
1,413
48
clear close all PostSetup('BrockHome') flag_SaveFigs = false; global STIMDIR cd(STIMDIR) load('151221_E_eD_LFP') brfsTrials = strcmp(STIM.task,'brfs'); % spectrogram conventions nfft = 2^8; rsampt = 0.0010; % 1 kHz frange = [1 100]; % look at 1 to 100 Hz only fs = floor(1/rsampt); overlap = nfft-1; poststim = 1:120...
f24d093dd951ae88dbea24ab55d8352a197b8b99370317eb5927a21a9e043375
MATLAB
1,419
48
function remapSegmentationLabels( in_seg_nii, in_label_mapping, output_label_mapping, out_folder) %Remaps segmentation labels using a label mapping text file, writing out %individual images and a combined label image. The input indices, in the label %mapping text file are assumed to be the line numbers (1:end). %in_...
8bd6bac237bdc777e61fd2292c14985b8ebfb351a2e6bed35f18504d7e693a97
MATLAB
1,420
42
% cc = getCorrcoef(I1,I2,c1,c2) % --------------------------------------- % % Return the normalized correlation coefficient expressed in Fourier space % % Inputs: % I1 Complex Fourier transfom of image 1 % I2 Complex Fourier transfom of image 2 % % Outputs: % cc Normalized cross-correlation...
7f7c8b218bb493445216e7982c3cf8ab32e3b911c5899a9ae657805dafcd5582
MATLAB
1,421
79
function [mu,mask]=kmeans(ima,k) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % kmeans image segmentation % % Input: % ima: grey color image % k: Number of classes % Output: % mu: vector of class means % mask: clasification image mask % % Autho...
f7b659aa93682a3144fbae98e46937b76683bb0408bf574cf0742b6b48c9bd07
MATLAB
1,424
36
function [fedback] = estimateFeedback(feedback_bin,digital_chans_tsv, D, interpMethod) % Read field that was fedback to the OPMs, reorder the channels and % interpolate to match the analogue output % If no method specified, use linear interpolation if nargin < 4 interpMethod = 'linear'; end % Read digital chann...
7c288f714a92aeb7fc87fca847c845bd201ef5981610f7dcc13cec6355b3cd1b
MATLAB
1,427
33
function [dataset, first_scale_factor] = txt2mat_crop(input_dir, target_pixel_spacing) % TXT2MAT - Convert txt to matrix or other format % A simple function for converting .txt to .mat from zemax % input: % input_dir: a string of input directory % target_pixel_spacing: actual sensor pixel pitch value % output: % ...
d3954fca37f072739daadbf674247aa9517959cae5da4ebbcd3a7d335a63cd67
MATLAB
1,429
34
% Adds a composite channel to a csv file, ensuring repeat access of composite in ez_segment GUI function composite_to_csv(pipeline_data, composite_channel_name) %get path names to points point_paths = keys(pipeline_data.points.pathsToPoints); pt_path = point_paths{1}; %obtain csv file (csv_filepath) ...
5c5b8842fb9f5d6961751befddab398c247f190f001ddd97885bcf0d0ff2ef24
MATLAB
1,432
37
function output = ASLSmoothImage(data, spatialdim, FWHM, voxelsize) % ClinicalASL toolbox 2023, JCWSiero % can handle NaNs, 2D and 3D gaussian smoothing sigma = FWHM/2.355; inplanevoxelsize = voxelsize(1); data_smooth = zeros(size(data)); if spatialdim == 2 disp(['Smoothing 2D - can handle NaNs: FWHM(mm) =...
222f89407a15c44a7e2443b1e6d3da1260eac1f791e4038abdb4cc6926d820b3
MATLAB
1,440
47
function probs = Cov_comp(X,tau,isjoint) %----------------------------------------------------------------------- % FUNCTION: Cov_comp.m % PURPOSE: Compute covarance matrices from time series data X % % INPUTS: % X: time series data in the form (units X time) % tau: time lag between past and present...
f1a009464c4d4c5bc714c728acfe6df6004a81b5ea5a7b2421ab85e2ec746b3a
MATLAB
1,440
35
function [centroids_labeled,unique_type_match,type_merged]=type_labeling(centroids,real_type,cluster_type) %for each centroid, find most commonly assigned real type for t=1:max(cluster_type) type_label(t)=mode(real_type(cluster_type==t)); end %check whether several centrois received the same label [found_...
89d21ff10c5fa995c0ec5c7f4aee7fab1e0480e3a1b63eb84e1946c8db81824c
MATLAB
1,443
44
function ttl_times = DT_get_ttls_from_logger_table(table_events, result_folder) % JN 2018-12-20 % function extracts all TTL values and times idx1 = table_events.EventType == 'Digital in'; idx2 = contains(table_events.Details, 'Digital input port status'); mode = 'status'; % JN 2018-12-30 % test whether we are workin...
a89bf24316b43f1cfb2f5b7d52957bc468013338cb68a503fae0d8d9ba4de1c0
MATLAB
1,443
45
% Test ExtendChanSampleFactory.m % Author: Lasse Osterhagen % Create mock AudioObjectSampleFactories mockFactory1Row.makeAudioObjectSamples = @(a,b) b; % return rawSamples mockFactory1Row.calcRequiredSamples = 0; mockFactory2Rows.makeAudioObjectSamples = @(a,b) [b; b+1]; % return [rawSamples; rawSamples+1] mo...
2df7ae78c00a61039b230422272973f0e55f18654bc9f3c4483ae4ef2babadce
MATLAB
1,445
46
classdef SimpleNoiseSampleSource < SampleSource %SIMPLENOISESAMPLESOURCE generates uniform distributed white noise. % This is a very simple sample source for test purposes only. It should % not be used in psychophysic experiments, because the level and the % frequency distribution will depend on the sound equipme...
b310768d9d9c1f8b34a3b032bff9489bcd36bdfce1a4c1451aaaaeae5d039b63
MATLAB
1,447
33
function preprocess_functional_parcellation_zscore(subjectdir, atlas_filename, filename, atlas) k = strfind(subjectdir,'subject'); sub = [subjectdir(k:end),' - ']; % clear k % This is simply helping with the text that will be displayed as the % function is running. 'sub' is a string with the name of the subject...
e195f44e866c00834cdfab4f2d37f2e408beb89c5c3d3883e24a43366fffa913
MATLAB
1,449
37
% /// Neurons with only shared bins (1) % load classification performance as plotted in fig.4A load xx_108_4_single_e2o_perf exe2obs_cell = cellfun(@mean, test,'UniformOutput',false); exe2obs = cell2mat(exe2obs_cell); exe2obs = exe2obs-100/3; load xx_108_4_single_o2o_perf obs2obs_cell = cellfun(@mean, verif,'UniformO...
5db3b39e2e165e6413a918dd16a0f7929a71b21ccf15d0aeb723a5c9db62a1df
MATLAB
1,451
50
classdef ToneStimulus < Stimulus %TONESTIMULUS is a stimulus that represents a sine tone. % Input arguments: % id=0, % startDelay=0, % sec % target=Target.Yes_Reward, % 'duration', 0.500, % sec % 'frequency', 10000, % Hz % 'level', 60 ...
440c897041a9adff562e0a09c572f2a0dd7b952e01f8a6ac1b6ee4c3464a665e
MATLAB
1,455
57
function group = micca_full_connected_set(C,indx_sample,thresh) % % group = full_connected_set(C,indx_sample,thresh) % tmp = triu(C,1); [pairs, I] = sort(abs(tmp(:)), 'descend'); [x y] = ind2sub(size(C),I); i = 1; nb_group = 0; group = indx_sample*0; while(sum(group == 0) > 0 && i<=length(pairs) && pairs(i) > thresh)...
b3a141f7c3145cb18b30dddcbe9bf1fff9ab771517229efa5426b82687ac59f1
MATLAB
1,456
60
classdef PunishState < ExperimentState %PUNISHSTATE : not used at the moment. % Author: Lasse Osterhagen properties % Time out as punishment when the subject descends on no-target % trials punishTimeOut = 12; end properties (Access = protected) ...
0394d9e964ef6e1538cdc9cc4464135ea831c892133cb3e4986d9ad4bb9f484a
MATLAB
1,457
34
function output = ASLLookLockerCorrectionFactor_mDelayPCASL(SUBJECT) % ClinicalASL toolbox 2023, JCWSiero % compute Look Locker scaling per PLD flipangle = SUBJECT.FLIPANGLE; M0=1; T1blood= SUBJECT.T1b*1000; % in ms PLD = SUBJECT.PLDS*1000; %in ms t = 1:1:PLD(end)*1.1; deltaPLD=mean(diff(PLD)); T1effblood=1/...
95f83299632e21d0d61407a496cb757d5d56aed96a62bfd8b3eeaa32261685e0
MATLAB
1,457
39
function [db2ETA, db2ETSD, inNEvt, db1Time] = NS_ETA(db2LFP, inSampleRate, in1EventIdx, db1WinSec) % Synopsis: % [DB2ET_AV, DB2ET_SD] = NS_ETA(DB2LFP, INSAMPLERATE, IN1EVENTIDX, DB1WINSEC) % %Calculate the event triggered average DB2ET_AV and S.D. DB2ET_SD of the %signal DB2LFP (a channel x time-sample matrix) sampl...
75877f1aeed6021e4190380828ce2f0d62a104e24a238269168b4010a4358db1
MATLAB
1,458
40
function m_sig = Main_signal(varargin) % Main_signal class constructor. % Main_signal(name) constructs a signal with a given name. % Main_signal is the base class of all signals that are not envelopes. % Every main signal has a Level component, start time, end time and ramp % length components that define th...
31414d3732221ef4a492ce4f5338b84272090e0cca4812da59d77f1bb9ecca23
MATLAB
1,460
50
% This scripts loads the statistical results for the age effects on cortical % thickness and plots the t-values (TFCE-corrected) for significant vertices % % Written by Christina Stier, 2022 % load folders and assign file names analysis_dir = ('/home/uni10/nmri/projects/cstier/aging_pipeline'); results_dir = '/home/u...
a42932a868ffe05f9f60d304e7be980db51585d3064723844479644ef33e8205
MATLAB
1,460
49
function val = get_sweep_param(s_comp,prop_name) % GET Get s_comp's sweep property from the specified signal component % and return the value. % val = get_sweep_param(s_comp,prop_name) returns s_comp prop_name. % Property names are: % Sdata, Sdata_formula, Edata, Edata_formula, Num_data, Num_data_formula, % Reps, Reps...
ac32ac195ac9ea8313edc1f6ede4d0d200332fd965181807e8e40fe64b66f585
MATLAB
1,462
39
function [out_db] = load_body_direcs(rat_dir, first_subsample_ind, subsampling_inds) % Function predicted_rat_body_points.mat() reads the sounds_table.mat that is produced by the pipeline. % % Inputs: % rat_dir - (str) - Location of the sounds_table.mat, inside the experiment folder % % O...
14267e7a3400d02c94e9c2a88e8f100585fb9d8aa2ee68f17316e9e92e06b588
MATLAB
1,464
45
function [total_struct] = create_table_from_all_csvs(file_names) % Function create_table_from_all_csvs extracts the events from all the .csvs to a single struct. % It auto-iterates over the three .csv if a single experiment and stores all events in a single % struct. % % Inputs: % dir_name - (directory, str) - Rep...
a680a8651a701b535b10b5a6bc3b23760f298aaf13b630660ceca1889a174511
MATLAB
1,472
52
% Time-frequency analysis % 'TF' is the time-frequency spectra of data. % 'TF' will be a matrix (time * frequency) % 'data' should be a vector % 'sf' is a sampling rate % 'wnd_size' is the window size of the data % 'baseline' is a period for baseline correction of analysis % 'f_scale' is a frequency resolution ...
73685895bda6694e87afb50c5aa9fd9f554d773ea225dbe7815a05a1f66e360d
MATLAB
1,475
36
function generatePanels_Fig05(Fig05) %% Arousal State Transitions transNames=fieldnames(Fig05.arousalTransitions); for transNum=1:length(transNames) theHbT=mean(Fig05.arousalTransitions.(transNames{transNum}).IOS.forepaw.dHbT,1); theEMG=mean(Fig05.arousalTransitions.(transNames{transNum}).EMG.EMGPower,1)...
2ca2aca320aeea96f87948eb4c5d1bb8dc54b4573648af193dbff2082429f289
MATLAB
1,477
48
%% Tuning amplitude and half-width % Preferred direction was calculated using both wide and narrow prior block data. load('AmpHW.mat'); % Tuning amplitude and half-width whAmp = [data.A.whAmp; data.B.whAmp]; nhAmp = [data.A.nhAmp; data.B.nhAmp]; wlAmp = [data.A.wlAmp; data.B.wlAmp]; nlAmp = [data.A.nlAmp; data.B.nlAm...
a59fbab429e976aba746495f764b8a4e3ded364b1aa3ef75d7742f11a0881d7a
MATLAB
1,482
30
% Reads all the .txt files for one condition that is in one % folder. function tensor=read_condition_tensor(data_dir,condition_name) if exist(fullfile(strcat('conditions_data_',data_dir(end-2:end-1)),strcat(condition_name,'.mat')), 'file') == 2 load (fullfile(strcat('conditions_data_',data_dir(end-2:...
572ac785eb88227054ace3cfbdce797e423883fd2729435b4613ea81e04843f3
MATLAB
1,483
40
function file = File_comp(varargin) % File_comp class constructor. % c= File_comp(STATIC_VALUE) creates a File_comp object which is a % Signal component representing the file name containing a pre-synthesized signal. global FILE_FILE_COMP_DEFAULT BASEDIR_FILE_COMP_DEFAULT FILE_FILE_COMP_DEFAULT=''; BASEDIR_FILE...
72a5aff41cc3253a4be7e65c53d0771446f787ab309abda16fa662f96a86c0a4
MATLAB
1,484
35
function val = get(s_coord,prop_name) % GET Get Signal Coordinator property from the specified object % and return the value. Property names are: % Coordinator - the coordinator object % Main_signal - the Main Signal this Coordinator handle % Name - of the main signal % Components - list of the components of the Main S...
b6a0db481c5560ea7c8f2bf65c40f1a177997d9d37af8c3febf7d9f5c5d0b863
MATLAB
1,485
43
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is NB synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. % varargin holds the requested parameters for the NB signal. % If varargin...
c931df7066dc71d8ab72fca613c19c9c7f14b6b5454e48e6ad1720736eddc8a9
MATLAB
1,489
23
function T1Processing(SUBJECT, filename) % ClinicalASL toolbox 2023, JCWSiero if isfile([SUBJECT.ANATOMYdir '/T1_brain_seg_0.nii.gz']) % check if T1 segmentation has been performed disp('Segmentation has already been performed'); else % perform T1 anatomy brain extraction and tissue segmentation disp('Pe...
40ad62536b78867c8539263ef84efc1c2b930b387293ba5a7dd8bc2555777808
MATLAB
1,490
29
function [SUBJECT] = ASLExtractParamsPARREC(SUBJECT) % ClinicalASL toolbox 2023, JCWSiero %%%%% 3. Scan information %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SUBJECT.TR = 5.5;% TR in s SUBJECT.TE = 10.8;% TE in ms SUBJECT.NPLDS = 5; % Amount of PLD's SUBJECT.NDYNS = 24; % number of repeated volumes i...
9e25eabb5c081415a19bc6da03555438597b1135e1664deb9c47988f178b0b9a
MATLAB
1,495
46
templateSize = 11; % square template imgWidth = 320; % rectangular image imgHeight = 240; template = rand(templateSize); % template with random entries img = rand(imgHeight, imgWidth); % similarly for the image % randomly embed the template inside the img embedX = round(rand*(imgWidth-templateSize-1)+1); ...
7e5dfe0cde96ec3bc3236023747b73ce9c02a825cd13b376c0504433b811d7f7
MATLAB
1,499
40
function runExampleGapSession() %RUNEXAMPLEGAPSESSION demonstrates a gap detection experiment. % The function will open two windows: % 1. The experiment control window lets you start, stop, and save an % experimental session. % 2. The key press interface GUI, which is the input device for the % subject to all...
f08cbb742c8726040edd40409b3c7a123d15fe31ce03443e63d3acae9d82240a
MATLAB
1,501
54
function mode_data = get_data_mode(swp,rand_indices_arr) % mode_data =GET_DATA_MODE (swp,rand_indices_arr) returns % an array of randomly chosen values from the vector of values % generated for the specified Sweep object according to it's STEP, % range(SDATA,EDATA),NUM_DATA and REPS. % The order in which the values wi...
c5ba973222b87ab1f663bab1be30be4d3de6e2bfc09b5af52b92f87eb2847557
MATLAB
1,504
43
function plot_4bars_withinError_only(data, t_values, reference, ylabel_string, ylimit) figure for effect=1:3 number_subjects = size(data{effect},1); for i=1:4 if i~=reference(effect) SD(i)=compute_sd_from_t(mean(data{effect}(:,reference(effect)) - data{effect}(:,i)), t_values{effect}(i), 1...
995160aed12ced6f07b6ba2865abd7ed42385ecd96fa9294e801ccd714f3ebb1
MATLAB
1,507
68
function [T, paramBBN] = createBBNblock(Told,paramBBNold,pr, nstims) % pr = struct('speaker',[],'samp_rate',[],'trial_dur',[],'stime',[],'etime',[],'ramp',[],'att',[],'nstims',[]); Tsize = size(Told,1); paramsize = size(paramBBNold,1); if pr.nstims nstims = pr.nstims; % else % nstims = 280; end type = cell(nst...
ebc08bc0b69eeef17f70698c89a82de64ffb47ed54b15e47ab89925f01c38a31
MATLAB
1,507
38
function C = conv2fft(varargin) % C = conv2fft(A, B) % C = conv2fft(H1, H2, A) % % C = CONV2FFT(A, B) performs the 2-D convolution of matrices A and B. % If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then % mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]). % % C = CONV2FFT(H1, H2, A) fi...
a2b271f25cd540f0df529a8b7858daadd67e3c5b041bf06a9facf0ce1ffda8b8
MATLAB
1,509
65
%load data %friendship load('friend_baseline.mat') %mental health load('cbcl_baseline.mat') %cognition load('tbss_baseline.mat') %covariates load('cov_beh.mat') %the number of friends is log-transformed and mean centered cf_log = log10(res_b(:,6)+1); cf_log_r = cf_log-mean(cf_log); DV = [cbcl,tbss]; va...
855d649cf88a6fb26b139cce484a1d9d6b2346238180138f52f197181b832bf8
MATLAB
1,511
44
% get_ears_level: Currently, just return the attenuation level of each % channel % ELN 311214 function [levels_arr,relevant_pa5]=get_ears_level(line,atten_arr) levels_arr=atten_arr; relevant_pa5=1:4; % % right_ear=get(line,'Right_ear'); % left_ear=get(line,'Left_ear'); % right_synth_chans=get_synth_chans(line,right_ea...
e4db6a9c452bc2a69576819aee6c85c8f92672d16e7ca03bae40d7dc79515f32
MATLAB
1,511
42
%TEMP Blue-pale-dark red colormap % % Examples: % map = temp % map = temp(len) % B = temp(A) % B = temp(A, lims) % % A colormap designed by Light & Bartlein for visualizing data such as % temperature, with good contrast for colorblind viewers. % % The function can additionally be used to convert a r...
ca9db2518833e0d674e5e3264f786b24f644856054303589f55ca83662a7fc71
MATLAB
1,513
30
function T1fromPLD=ASLT1fromPLDCompute(DATA4D, MASK, TIMEARRAY) % ClinicalASL toolbox 2023, JCWSiero % compute T1w image from multi-delay PCASL (Look-Locker) PLD (not the PLD) data across the different PLDs % we observe that the PLD across PLDs show a exponential decay that depends on T1 % take natural log and fit for ...
f8abe7aa512c40186d90b6b4db86c69e8e9281422f158c13b10b5189c2f8ed3c
MATLAB
1,513
50
%IMSC Wrapper function to SC which replicates display behaviour of IMAGESC % % Examples: % imsc(I, varargin) % imsc(x, y, I, varargin) % h = imsc(...) % % IN: % x - 1xJ vector of x-axis bounds. If x(1) > x(2) the image is flipped % left-right. If J > 2 then only the first and last values are us...
f92cfa3a1549cfa6e184a53ea69468ab5e814e49b0cd948c3207e2880936ee2d
MATLAB
1,513
56
function sem=SEM_calc(vect, CI) % SEM_calc - standard error of the mean, confidence interval % % function sem = NBP.SEM_calc(vect, CI) % % Purpose % Calculate the standard error the mean to a given confidence % interval (CI). Note that nans do not contribute to the % calculation of the sample size and are ignored for ...
b26e0908f59c388013e84661ee62dd1e78e7fbdbd50914bfe907c7d51328348a
MATLAB
1,514
33
function [classifiedTrials, classNames] = classifyBlockedTrials(trials, audioObjects) %CLASSIFYBLOCKEDTRIALS classifies trials by enclosing AudioObjects. % Arguments: % trials - an array of trials % audioObjects - an array of non-trial AudioObjects % % Returns: % classifiedTrials - a cell column with each cel...
9b9756d3e1f708979fdf467b4a113dc15c585d0c6a9b8052b4822a87ec573c1d
MATLAB
1,520
40
function write_trial_data_vals(out,line_num,chan_num,signal_table,trial_num_in_line,handles) fid=get(out,'Fid'); if fid==-1 return; end % ## we use table instead of metablock ## Out_Manager,run_line_index,p,chan_table,cur_trial_index,handles % meta=get(out,'Metablock'); % line=get_line(meta,line_num); % line_trials...
0211f3178a9f5022cac250d5f772e5c9c633c8d62800fa86000c434c84b81aea
MATLAB
1,521
54
function swp = set(swp,varargin) % SET Set Sweep properties and return the updated object % Property names are: % Sdata, Sdata_formula, Edata, Edata_formula, Num_data, Num_data_formula, % Reps, Reps_formula, Mode, Step. orig_swp=swp; property_argin = varargin; while length(property_argin) >= 2, prop = property_ar...
2781d4046b568be181bcf5ed7dbb8b49f7a14e324dc02f6f84e6adae64cd4e2f
MATLAB
1,522
32
function [] = MIBIevaluateBackgroundParameters(points) global pipeline_data; for i=1:numel(points) point = pipeline_data.points.get('name', points{i}); countsAllSFiltCRSum = point.counts; labels = point.labels; bgChannel = pipeline_data.bgChannel; evalChanne...
08f5ab794ca8bd62cb506d584e2b332758da28f30aafb16359b032557b40ae1c
MATLAB
1,526
50
function h = BWR(m) % red-yellow-white-cyan-blue color map % BWR(M) returns an M-by-3 matrix containing the colormap. % BWR, by itself, is the same length as the current figure's % colormap. If no figure exists, it creates one as long as MATLAB defautly does. %----------------------- % Syntax %-----------...
dcd2f8d6008fdf0c33314d24349ab079306842ee02d96b0cb4cc08ee573286c1
MATLAB
1,526
30
function T1fromM0=ASLT1fromM0Compute(DATA4D, MASK, TIMEARRAY) % ClinicalASL toolbox 2023, JCWSiero % compute T1w image from multi-delay PCASL (Look-Locker) M0 data across the different PLDs % we observe that the M0 across PLDs show a exponential decay that depends on T1 % take natural log and fit for 'T1' dims =...
a2edc229145dee92629a82aff6262c2afb122906cc798488e7033b18071494e2
MATLAB
1,528
46
function h = BWR2(m) % red-white-blue color map % BWR2(M) returns an M-by-3 matrix containing the colormap. % BWR2, by itself, is the same length as the current figure's % colormap. If no figure exists, it creates one as long as MATLAB defautly does. %----------------------- % Syntax %--------------------...
a6915e8a5de25cfe49e36258a262142bd00b0c37a4263b5737f55d61cffcb670
MATLAB
1,528
94
close all figure(); cell = 1; clear G_c; clear G_uc; clear G; days = [1 2 3 4 5] colr = {'r' 'g' 'b' 'm' 'y' }; figcount = 1; for ii = days; % [1 3 4 6 8]; color = char(colr(figcount)); clear G_c; clear G_uc; clear G; pdata = ROI_dat{ii}; counter = 1; for cell = 1:size(pdata.raw_dat,1); for ...
d3d0f00cab6b4452dacdd804a9e42d885630bcd029629bd86180075a9ff9c4d7
MATLAB
1,533
51
function plot_cluster_stats(all_axes, stat_data, param) % JN 2020-12-14 % JN 2021-01-29 rel_cols = {'N_slow', 'N_pos', 'N_neg'}; for irat = 1:2 ax = all_axes{irat}; grid on rel_data = stat_data(stat_data.Rat == irat + 3, rel_cols); plotdata = flip(table2array(rel_data), 1); plotdata = plotdata./sum...
91d80d501cf4d182beca4327d903d1e4306112266dbd19e2d0e759fdd5bdeb03
MATLAB
1,534
21
function [SUBJECT] = ASLExtractParamsDICOM_vTR(SUBJECT, filename) % ClinicalASL toolbox 2023, JCWSiero tic disp(' Reading DICOM info... ') info = dicominfo(fullfile(SUBJECT.DICOMdir, filename)); elapsedTime = toc; disp(['..this took: ' num2str(round(elapsedTime)) ' s']) %%%%% 3. Scan information %%%%%%%%%%%%...
6c3845ab77dbced95e2be366f7c309e47fba773e4d5e45cb225c964c6eafc0f5
MATLAB
1,537
32
function [] = MIBIevaluateBackgroundParameters_3(points) global pipeline_data; for i=1:numel(points) point = pipeline_data.points.get('name', points{i}); countsAllSFiltCRSum = point.counts; labels = point.labels; bgChannel = pipeline_data.bgChannel; evalChan...
d67770f71f9fb1e77cda5953339bb214f9e407d8f3350081dcb79dd4a0290a6f
MATLAB
1,539
57
load("timeseries.Yeo2011.mm316.mat"); disp(size(subjects)); is_negative = 0; for m = 1:316 subject_mx645 = subjects(m).mx645; subject_mx1400 = subjects(m).mx1400; subject_std2500 = subjects(m).std2500; [rows, columns] = size(subject_mx645); count_negative = 0; for i = 1:rows for j=1:col...
527d066148901ec1c4eea78581c5864b530cc23d02560ee9cab29e4bf2d4be38
MATLAB
1,543
68
clc clear close all load xx_108_4_single_e2o_perf exe2obs_cell = cellfun(@mean, test,'UniformOutput',false); exe2obs = cell2mat(exe2obs_cell); exe2obs = exe2obs-100/3; load xx_108_4_single_o2o_perf obs2obs_cell = cellfun(@mean, verif,'UniformOutput',false); obs2obs = cell2mat(obs2obs_cell); obs2obs = ...
951869049802ce1e49f9e0ebbbfbe17b262c292eb5162a96809b487879252c7b
MATLAB
1,543
32
function [] = MIBIevaluateBackgroundParameters_graded(points) global pipeline_data; for i=1:numel(points) point = pipeline_data.points.get('name', points{i}); countsAllSFiltCRSum = point.counts; labels = point.labels; bgChannel = pipeline_data.bgChannel; eva...
223705b1fae2f97c1516980333e98019222ac7e5eac6043b15889c6155434e76
MATLAB
1,549
73
function roi_ave=fb_plot_roi_peaktime(ROI_MU,ROI_TIME,ROI_STATS,MOV_DATA,varargin) %fb_select_roi selects an arbitrary number of roi's for plotting % % % % % roi_colors='jet'; filt_alpha=5; filt_rad=15; lims=.05; nparams=length(varargin); if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pa...
60e8c6b08e079b6d0bb12ee29f87ca72ee3fc968c7d9db77f10b11246ff202c5
MATLAB
1,555
50
%All used PET/SPECT data are publicaly available and downloaded from %https://github.com/juryxy/JuSpace/tree/JuSpace_v1.3/JuSpace_v1.3/PETatlas %Data path path = ''; %PET/SPECT name ls = dir(fullfile(path,'data')); dn = cell(length(ls)-2,1); for i = 1:length(ls)-2 dn{i} = ls(i+2).name; end %HCP templ...
f5df0d29177c730a648d2c3ec7558b72632664e0c23cd736cef750c4d747e522
MATLAB
1,556
61
function [Final_img, Count] = MIRO_Collaborative_Wiener_dct(noisyImg,BasicImg,Transforms,sigma_g,parameters)%#codegen %% initialization width = size(noisyImg,2); height = size(noisyImg,1); block_Size = parameters(1); blk_step = parameters(7); beta = parameters(8); lambda_W = parameters(9); % lambda Wiener adaptive_...
cc40e1af3dfc399807aa38f5f67f2187c5c0f37859feb78ee4f4b1262346db3e
MATLAB
1,569
35
function numUnits = idxBreakdown(IDX,ERR) % Total number of multi-unit channels totalN = length(IDX.allV1) + length(ERR); % Number of sessions penetrationInIDX = {IDX.allV1.penetration}.'; penetrationInIDX_unique = unique(penetrationInIDX); % N = 14 penetrationInERR = {ERR.penetration}.'; penetrationInERR_unique = uni...
5c25867ba9947079056259b3fd88a8caad15f362d4afcb9c2787f263e4e808b1
MATLAB
1,572
48
function [Result] = AO_StartConnection(DspMac,PcMac,AdpaterIndex) %% Function to connect Matlab to the SnR/Neuro Omega %% DspMac array of 6 hex, this is the mac address of the Snr/Neuro Omega system (dsp) %% PcMac array of 6 hex, this is the mac address of the pc which run is %running matlab. This value must be d...
808d0e214d99b5fb42c5e71e536d6bf4b2e469880c46cdee0250ea14192ac4da
MATLAB
1,572
42
function [slice_id] = find_loc_of_point(p, c_p, r, slices) % FIND_LOC_OF_POINT finds the RIFF slice that the point belongs to, according % to the geometry of the RIFF and the internal wall locations. % % Usage: % >> [x, y] = getpts; RIFF_geo = load('RIFF_geometry.mat'); slices = load('RIFF_slices', 'slices'); ...
36aeec3a5a408a9c66eac507c68342ec4e84c1bc845fa75418091d42270aa104
MATLAB
1,574
31
figure; %% All days averaged fathers vs mothers subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],CAMKII_mean_z_score_all_days_all_mice_enters_the_nest,{@mean,@stderrm},'c') yticks([-2 -1 0 1 2 3 4]);yticklabels({'-2' '-1' '0' '1' '2' '3' '4'});xticks([0 844 1688 2532]);xticklabels({'-8' '-4' '0' '4'});xlim(...
09d1b802f94bac7b32260adf224c8be50723e5190c8de3ed95ae026e28554754
MATLAB
1,575
54
function expdata = run_from_database(expdata) % JN 2019-04-02 % JN 2020-04-23 % run pipeline from a CSV file of session information session_table = get_session_table(expdata.experimenter, expdata.year, ... expdata.month); idx = (session_table.Experimenter == expdata.experimenter) & ... (session_table.Year == ...
29fd95e3c8ea8d89662222c2f2379eaf6fafa5cfa4efd2beb8cd64d06174459d
MATLAB
1,575
49
function val = get(s_comp,prop_name) % GET Get s_comp property from the specified object % and return the value. Property names are: % Input_method, Static_value, Value_formula, Static_reps, Reps_formula, % Seq_values, Seq_values_str, Coord_index, Index_formula, Wrap, Fixed_num_data, % Sweep, Seq_values, Seq_values_st...
7111f04138552f0f82c31e98c3d03f8bfde39c4e01d4f017e5aeb957a0ffb5cc
MATLAB
1,575
72
% FullTimeClassicBRFS - update to use Gramm clear close all PostSetup('Neuropixel') flag_SaveFigs = false; anaName = 'IDX_iScienceSubmission_EyeAndOriTuned'; %% Get IDX global IDXDIR cd(IDXDIR) if ~exist(strcat(IDXDIR,strcat(filesep,anaName,'.mat')),'file') IDX_iScienceSubmission end load(strcat(IDXDIR,strca...
f3514b33ac7530d306586bf8c918469e9b8d77d4f2075609e417918b043dac53
MATLAB
1,580
50
% val = clamp(val,minval,maxval) % --------------------------------------- % % Clamp an nd-array between minval and maxval % % Inputs: % val Input matrix % minval Any value of val smaller than minval will be made equal to minval % maxval Any value of val larger than maxval will be made equal to maxval...
542c86f038d44926cdef189b6fc5a015fae035ed8c97d37ca74856d77f8a8241
MATLAB
1,583
67
function [kcMax, SNR] = ResolutionFinder(image) %% set path and load some data % addpath('funcs') % image = img0;%double(loadData('test_image.tif')); if mod(size(image,1),2) == 1 image(end,:) = []; end if mod(size(image,2),2) == 1 image(:,end) = []; end tile_size = 64; if size(image,3) == 1 && size(image,1...