sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
90b6444a414ac4bf6ccab986ea99fb5f8d74617d568fc2f29c57a39122b02bb1
MATLAB
1,584
57
classdef DescendState < LogbookState %DESCENDSTATE happens when a subject responded during a trial. % Author: Lasse Osterhagen properties (SetAccess = private) ignores = 0 end methods function this = DescendState(evaluator) this@LogbookState(evaluator) end function evaluate(this, ev...
1ada7590a941b358b2efabe84a1b9217be9f95ee63452f62ea3c50f42ce4950b
MATLAB
1,599
59
classdef ArrayAOGenerator < AudioObjectGenerator %ARRAYAOGENERATOR generates AudioObjects out of an array of AudioObjects. % This is not much more than a container class implementing the % AudioObjectGenerator iterator interface. % Author: Lasse Osterhagen properties (SetAccess = private) % Container for all ...
4bf2ee66e7941bf9d3f8b2126032d325d265cba18f2b949aac948ee9cd8b0329
MATLAB
1,613
62
classdef TimeoutState < ExperimentState %TIMEOUTSTATE - ExperimentState that interrupts the experiment for a %certain amount of time. % This ExperimentState is used to avoid that rewards are given after a % negative reaction time and to avoid that multiple rewards are given after % a correct response. % Author:...
65fbea04f295d90b8b01f366b2e15c0833368106965b7060267beb7a37ee712e
MATLAB
1,613
59
classdef ReadyDebounceState < ExperimentState % Ready to start trials, but debounce photo sensor first. % Author: Lasse Osterhagen properties (Constant) % How long does the photo sensor value has to be stable to go on to % the next state? debounceTime = 0.1; end ...
ab049176f8e59e4bf120f9eaae367a092eb8d07601c1e010bcf2f83d334f1dfa
MATLAB
1,613
25
function l = loss(x) V=x(:,1); P_a=x(:,2); P_i=x(:,3); n=x(:,4); r=x(:,5); s_1=x(:,6); s_2=x(:,7); s_3=x(:,8); m=x(:,9); h_1=x(:,10); h_2=x(:,11); d_L=x(:,12); f_L=x(:,13); d_T=x(:,14); f_T=x(:,15); Na_i=x(:,16); Ca_up=x(:,17); Ca_rel=x(:,18); Ca_i=x(:,19); O_c=x(:,20); O_TnCa=x(:,21); O_TnMgCa=x(:,22); O_TnMgMg=x(:,2...
a50274a1d6fb8681d7d4935c2f30c16823e4eeba3718fd89ef4497b49d52bc4e
MATLAB
1,615
74
function AVG_MOV = FSA_MakeAvgDffMov() % Make average Dff movie from aligned videos. filt_rad=15; % gauss filter radius filt_alpha=20; % gauss filter alpha lims=3; % contrast prctile limits (i.e. clipping limits lims 1-lims) cmap=colormap('jet'); per=0; % baseline percentile (0 for min) counter = 1; mov_listing=di...
e2fae4eddcb4fef0893c4267810234feed10395c4500e926bb4c0dc21865c8ac
MATLAB
1,615
49
function [C,U] = HALS_temporal(Y, A, C, maxIter,tol,nonneg,flag_AY) %% run HALS by fixating all spatial components % input: % Y: d*T, fluorescence data or K*T, product A'*Y if flag_AY = true % A: d*K, spatial components % C: K*T, temporal components % maxIter: maximum number of iterations...
e32039969bfcd70844df7b417622e8a0c8b7dc96faab7c2f8259982841f5dc69
MATLAB
1,619
68
function [SI, I, H_cond] = SI_Gauss(Cov_X,Cov_XY,Cov_Y,Z) %----------------------------------------------------------------------- % FUNCTION: SI_Gauss.m % PURPOSE: calculate stochastic interaction given covariance of data % (Ay, 2001; Ay, 2015, Entropy; Barrett & Seth, 2011, PLoS Comp Biol) % % INPUTS: % ...
6bfec5cb81224956c64defddadf74ec40a18fd34444d83b4cf14c2893e4ee02a
MATLAB
1,620
61
function displayeddata = immontage(data, rowscolums, noimage) % ClinicalASL toolbox 2023, JCWSiero if( nargin == 1 ) rowscolums = []; end displayeddata = MakeMontage(data, rowscolums); % see lines below if( nargin <= 2 ) % plot the data % Plot the image. imagesc(displayeddata); % Set the ...
7decac0e0bb015d42ffc78c358166468285df910610360b02ff7f97265473a9f
MATLAB
1,622
43
function var = loadSingleVarFromFile(config) %LOADVARFROMFILE loads a variable from a .mat file % This function is part of the dependency injection framework % (depInj.createObjFromTree()). For the method field, write % 'depInj.loadSingleVarFromFile'. % The struct config must have a field 'fileName' with % a ...
c8617e96def09778291481d94938c64c955505d005df918bd93e9b4e98849f54
MATLAB
1,625
52
function generateNormalizedDisplacements(in_template_byu,in_prop_byu,out_vec_txt,out_inout_txt,out_norm_byu,out_vec_vtk,out_inout_vtk) %in_template_byu='../template/dstriatum_ana_crop.byu'; %in_prop_byu='propSurface_dstriatum.byu'; %normalized displacement defined as local vertex displacement minus local %neighbourhoo...
9da56560e8844a3d9c7324fd5dec4811d7ee12318f4cfbed11ee74e6da3874e2
MATLAB
1,629
14
function SlicerPNGs(filenameA, filenameB, prefixA, prefixB, outputdir) % ClinicalASL toolbox 2023, JCWSiero % create Slicer PNGs for outlines of two overlapping dataset % input filenameA = reference image, filenameB = moved image, prefixA, prefixB= prefixnames for output % output will be an edge image shwoing overl...
235b4ea744132c6a11686fb9cc575f2be900e355bb13524cdfcd344d9a80f15e
MATLAB
1,631
36
function scale_bar_SHP(img,bar_length_in_micron,px_length_in_nm,bar_color,bar_position) %% bar_length_in_px=round((1/(px_length_in_nm*1e-3))*bar_length_in_micron); if abs(1-size(img.CData,1)/size(img.CData,2))<.3 % If the image is almost square if size(img.CData,1)<150 bar_thickness_in_px=round...
e4b89f027e2764f994a1949c53bd91201ba5c5892c3c56ba548b5602a35da6a3
MATLAB
1,631
56
function [starts ends] = consecutive_ones(x) % periods of 1 are searched for, for each period the start and end position % is given % x contains only ones or zeros assert(isempty(find(x ~= 1 & x ~= 0))) % prepare starts = []; ends = []; if isempty(find(x ~= 1)) starts = 1; ends = length(x); else idx_0 =...
2bf20acbdef49ec98ee7d5e281d0b35779bdfd92a7f469b1427978c887f8c35c
MATLAB
1,638
66
function gramm_classicIOT_line(IDX) %% Goal % use gramm and plot the simultaneous congruent, incongruent, and monoc % preferred. % line plots using "methods for visualizing repeated trajectories" %% Initial variables conditNameForCC = IDX.allV1(1).condition.Properties.RowNames; TM = IDX.allV1(1).TM; clear DataForVis...
2aab99c73ff7e317f1cf33ea2b481ed571754fb62099354d36552e7488afe9d5
MATLAB
1,639
46
%% What is missing between the old IDX and the newIDX? %oldIDX - vector var that lists identifier by unit oldIDX = load('D:\5 diIDX dir\IDX_iScienceSubmission.mat'); oldPenetration = {oldIDX.IDX.allV1.penetration}.'; oldPenetration(:,2) = {oldIDX.IDX.allV1.depth}.'; for i = 1:size(oldPenetration,1) oldPenetration{...
50d9746e52e40ef11df6719ac56fb8c22b77fe128c563381e8f024c884c5110e
MATLAB
1,639
53
function C = C_ML_Lasso( y, S_init,lambda) y = double(y); S = S_init; [height, width, wavelength] = size(y); [~,k] = size (S_init); % k is number of pure components C = zeros(height, width,k); %e = nan(height, width, wavelength); mask = nan(height, width, wavelength); mask(~isnan(y)) = 1; % Initialize e as y...
bd31b33a4c2c5568b4ce985c96ad703f7fc87ef8d00676b15e8fb896b32a5379
MATLAB
1,640
88
function [AGG_DETRENDED,AGG_DETRENDED_PKONLY]=fb_aggregate_trials(DIR,varargin) % % % % % % nparams=length(varargin); dff=1; fs=22; win=.4; per=12; medfilt_size=.4; cut=25; out_dir='extraction'; save_dir='detrended_aligned'; dat_dir='trace_data'; method='prctile'; % 'prctile','medianfilt','mean','fft','highpass' thres...
703c45c5d3c8eff350d666316fb11e89673feecda99db2f51fa741e8bbd45173
MATLAB
1,641
52
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...
bcbafaefa2ea0f668905ca73999fe2278877bd69540df0a288d0046f23e91814
MATLAB
1,642
57
%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...
70974f197093d356b030ad98f86f814cc22d6a9009959d289d0c9c52fe517f00
MATLAB
1,645
53
function info_line = get_comp_info(s_comp) % GET_COMP_INFO extract information about the given Sig_comp object. % info_line = GET_COMP_INFO(s_comp) returns a character array that hold % information on the given Sig_comp object. % The content of the information depends on the Input method of the % component (either ...
b2141609a8d51a9fb7df17495a72459e6311b1fdfd649cc4d206515a70f415c7
MATLAB
1,645
53
function [list,entries_list]=get_comp_names_list(sig) % GET_COMP_NAMES_LIST returns the list of components names. % LIST=GET_COMP_NAMES_LIST(SIG_COORD) returns the list of % components namesof the Main_signal object that the given % Signal-coodinator coordinates, including components that consists % it's Envelopes. co...
23e0132c1dce726bee86fb12094a6fa208e93a91937071dbb31ac8e8c83d8d9f
MATLAB
1,653
42
function makeGapThresholdExpFiles(subjectID) %MAKEGAPTHRESHOLDEXPFILES creates gap detection experiment files from fixed %parameters. % Arguments: % subjectID - a string identifying the subject for which the session % files are constructed. % % All parameters are fixed according to our current practice for ...
670eb1c276e32525e67bcc8e2e75f36aecfb625b000c754ba1df778acae4c085
MATLAB
1,665
70
function visIDX_FullTmBRFS_AllCond_AllContacts(IDX,dataType) %% Initial variables conditNameForCC = IDX.allV1(1).condition.Properties.RowNames; TM = IDX.allV1(1).tm; uctLength = length(IDX.allV1); % B. pull out all laminar matrices 3x(6,450,el#) %preallocate SDF = nan(size(IDX.allV1(1).SDF.raw,1),size(IDX.allV1(1)...
7963ae66665c02f27c83d6674f8a076274537e28420206116147042a2de4b9eb
MATLAB
1,669
57
function [RT, type2AUC] = one_condition(N, drift_rate, drift_rate_var, bound, conf_noise) % Initialize the variables choice = zeros(1,N); conf = zeros(1,N); RT = zeros(1,N); % Simulate N trials for trial=1:N % Initialize trial-specific variables time = 0; continue_accumulating = 1; process{1} = 0...
1c114e531bd33ab988edc2a52b53f92369cb91bbb5bee838dbd8f6ba79fe6799
MATLAB
1,675
45
function saveTIFF_multi(counts, labels, tags, path, varargin) path = strsplit(path, '.'); path = path{1}; % normalizing name tiff = Tiff([path, '.tiff'], 'a'); if numel(varargin)==1 bits = varargin{1}; else bits = 16; end for index=1:numel(labels) tags{index}.BitsPerSampl...
ad01dcd0535d2e38560b0370b3e46af227bf8b31a4d7cd739fb78c17f1ea6a47
MATLAB
1,675
46
function plot_4bars_withinError(data, t_values, reference, ylabel_string, ylimit) number_subjects = size(data,1); for i=1:4 if i~=reference SD(i)=compute_sd_from_t(mean(data(:,reference) - data(:,i)), t_values(i), 17); else SD(reference) = SD(1); end end figure ax = axes; bar(1, mean(data(...
65b67f95d5816476832da0902b9faf9383045867c1d0bdb71b48f3d753834f9b
MATLAB
1,679
56
% [out,mask] = apodImRect(in,N) % --------------------------------------- % % Apodize the edges of a 2D image % % Inputs: % in Input image % N Number of pixels of the apodization % % Outputs: % out Apodized image % mask Mask used to apodize the image % % --------------------------...
2de917c447de054c30c4a04ba7ef0422d8efc06f3175557bc61fced489c9956a
MATLAB
1,681
28
function [modelMeanResp, modelParamsVec, modelParams] = makeMeanResp(Npd, numRow, gain, direction, sigD, sponR, cparams1, cparams2, cparams3, cparams4, decoderN) [modelParams] = makeParamMat(Npd, numRow, direction, decoderN); modelMeanResp = []; modelParamsVec.PD = zeros(1, length(modelParams.PD)*length(modelParams.M...
c136b36d61d2cbfd3f70eca02b708d03fcbbded9408b5a33aaec8901e5c8e135
MATLAB
1,681
43
% function [deltaF] = deltaF(datafile) % load(datafile, 'channelData'); %channelData=state.photometry2.channelData(6101:end,:); channelData=state.photoreceiver.channelData(6101:end,:); sample_rate = 211; figure;plot(channelData(:,1),'g');hold on plot(channelData(:,2),'r'); channelData1=findpeaks(channelData(:,1...
3cdce4e89967d0b0dcddb089cd8038394e0c1649295f1eb4ea4f83474b877082
MATLAB
1,685
59
function silenced_times = load_silenced_times(folder, sampling_rate) % JN 2021-02-12 % Probably this works only for Deuteron at the moment, not for TBSI DT2_SAMPLES = 2^18; fname_times = fullfile(folder, 'ks_output', 'ts_large.mat'); tvar = load(fname_times); n_DT2_per_raw = ceil(max(vertcat(tvar.noise_loc_arr{:}))/...
8f2bf6c5a4fb7d3616fbe3d8a109c54d027d79778b88e04a042b86188df98ef2
MATLAB
1,697
65
function [B, lims] = rescale2(A, lims, out_lims) %RESCALE Linearly rescale values in an array % % Examples: % B = rescale(A) % B = rescale(A, lims) % B = rescale(A, lims, out_lims) % [B lims] = rescale(A) % % Linearly rescales values in an array, saturating values outside limits. % % IN: % A - In...
06ac5dab38c9fff74b280ce3bdfced531c31f5a685d0d778d763d9fbcc333b68
MATLAB
1,699
42
% NORMXCORR2_MEX % RESULT = normxcorr2_mex(TEMPLATE, IMAGE, SHAPE) % % TEMPLATE - type double, size <= size of image % IMAGE - type double % SHAPE - one of: 'valid', 'same', 'full'. same as conv2 shape parameter % % RESULT - type double, values in [-1,1]. size depends on SHAPE % ...
238d9dbcdc6b210b7878535fcf1a2c7f137929bd6d9c8aec47ec2d8d2915892a
MATLAB
1,701
62
clc close all clear figure('Units','normalized','OuterPosition',[.1 .1 .05 .2]) hold on [perc(1), CI(:,1)] = prep4cibra('discharge'); [perc(2), CI(:,2)] = prep4cibra('action_preference'); [perc(3), CI(:,3)] = prep4cibra('LDA'); for i = 1:3 line([i i],[CI(1,i) CI(2,i)],'color',[.7 .7 .7],... 'linewidth'...
60545bcd521f635616b427471a4e44bdcb09dcc266bb68d9c5aa2b2215234cc1
MATLAB
1,704
54
%% % Create the connection matrix used in the diffusion approximation % Note: There are no feedforward connections, since these are approximated % in the main function %% function [wind,wipost,wstr] = Diff_approx_gen_weights(Ncells,p0,J) %% set up recurrent weight matrix Ntot = sum(Ncells); Npop = length(Ncells); Max...
5e3e2e6df581db057c9eada6d0cb247080a1e62f579eb0561c9f0ba5b8ffb3b7
MATLAB
1,707
47
function data = get_one_subject_data(subject) %Navigate to the folder with the results current_folder = pwd; cd .. %% Variables of interest % p.stim_type %1: left tilt, 2: right tilt % p.speed_accuracy_trial %1: speed, 2: accuracy % p.cue_validity %0: invalid, 1: valid % p.cue_direction %1:cue left, 2: cue ...
8b630683ec63786aac1cf25258bc4334ee6298ee298eebf443ef545b99df1e3a
MATLAB
1,712
72
function visIDX_FullTmBRFS_AllCond(IDX,dataType) %% Initial variables conditNameForCC = IDX.allV1(1).condition.Properties.RowNames; TM = IDX.allV1(1).tm; uctLength = length(IDX.allV1); % B. pull out all laminar matrices 3x(6,450,el#) %preallocate SDF = nan(size(IDX.allV1(1).SDF.raw,1),size(IDX.allV1(1).SDF.raw,2),...
050aa92dcfcf6670eaae1eecef385711c798367db1438dbfba2cb7d04ab37155
MATLAB
1,714
50
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is FLANKING_BAND 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 Center frequency and the bandwidt...
fcd3515ac62348f59170e9fffe048ea7573b552d550a96b1380fe4615e176881
MATLAB
1,718
43
function phi = phi_comp(X, Z, params, options) %----------------------------------------------------------------------- % FUNCTION: phi_comp.m % PURPOSE: Compute phi from time series data % % INPUTS: % X: time series data in the form (units X time) % Z: partition % - 1 by n matrix. Each elem...
852cc9b19d4a9b201bddef4f8e7e63f27ed2a9abc413f5ec45564040493bbb41
MATLAB
1,719
47
function [f_P, f_D] = pot_dep_func(L, velocity, param_P, param_D) %{ Define the underlying bioprocesses using skewed t student function https://ieeexplore.ieee.org/document/7217164 %} if nargin < 3 % parameter are nu, mu, sigma, skew % nu: degree of t student % mu: location ...
f9b64cb0faa4acbb73000b96d651eacee50751c0b38f76101f385c65c999fc48
MATLAB
1,720
70
function FS_SortMotif2 % Sort each .mat file by its identified motif in the .mat file mat_dir=[pwd,'/', 'MOTIF2']; counter = 1; if exist(mat_dir,'dir'); rmdir(mat_dir,'s'); end mkdir(mat_dir); Dir01 = strcat(mat_dir,'/Motif_first'); Dir02 = strcat(mat_dir,'/Motif_second'); Dir03 = strcat(mat_dir,'/Motif_third'); Dir0...
4ff2b61b4e3e230d2d9cc3d80e1ff2fefd0f439db43be2208f8517be2d30664b
MATLAB
1,721
55
% [im,path] = loadData(path) % --------------------------------------- % % Generic function to load arbitrary image stacks in the workspace % % Inputs: % path Full path of the file, if not provided the function will call uigetfile % % Outputs: % im Loaded image % path Image full path % % ----------...
0c76211bdca9bdfd5a1c852ce2955e10fdc5bbca03141fabd6e92704e68a5d8b
MATLAB
1,724
65
function [xx,yy,nn] = psychfunctionmod(xvalues,pchoice,itrial,varargin) % PSYCHFUNCTIONMOD compute psychometric function for model predictions % % Inputs: % xvalues: abscissa values (1 x ntrials) % pchoice: probability of choice (1 x ntrials) % itrial: subset of trials to consider % varargin: parameters to compu...
b509d7e4a110f26f01bf217da1950c6a5d1e840bdcc1109e5633f131bc5f64e3
MATLAB
1,727
56
% [ind,A] = getDcorrMax(d) % --------------------------------------- % % Return the local maxima of the decorrelation function d % % Inputs: % d Decorrelation function % % Outputs: % ind Position of the local maxima % A Amplitude of the local maxima % % --------------------------------------- % % ...
3fdc54045648740b75e50c3e4c31bb419ae786e3569324ded33554b816975522
MATLAB
1,728
61
function behavior_table = make_behavior_table(behavior_folder, ... experiment, behavior_file_no, snr_times, out_folder) % JN 2019-07-04 behavior_filenames = find_behavior_filenames(behavior_folder, ... experiment, behavior_file_no); for i = 1:length(behavior_filenames) if any(behavior_filenames{i}) ...
023aebf284b70eb713c241c8a1978b5b7e25d4678014dd5ccdb8bec4729f497c
MATLAB
1,736
40
% calculate the mask and stats (i.e. objects) in the image based upon set % blur, threshold, and minimum values. function [mask, stats] = calc_mask(point, pipeline_data) counts = point.counts; mask_channel_index = find(strcmp(pipeline_data.mask_channel, pipeline_data.points.labels())); mask_src = ...
806ce7487cc80e9a961a26e3cab34ba8a106d61ef1e2fdad9868d4d6204902e3
MATLAB
1,740
76
function data_smooth = tdrTemporalSmoothing(data,tmppars) % Temporal smoothing of trial-by-trial or condition-averaged responses % % Inputs: % data: population response (simultaneous, see 'help tdr') % tmppars.filter: filter type ('gauss' or 'box') % tmppars.width: filter widht (s) % % Outputs: % data_smooth: smoo...
ef19b934c2e4dd1fb2d7f41509fdca46a508b6a2addb78007591066049fe4fa4
MATLAB
1,748
25
function SUBJECT = ASLSaveResultsCBFAAT_FAST(SUBJECT, prefix) % ClinicalASL toolbox 2023, JCWSiero % save BASIl results: NIFTI and PNG - loops over smoothed BASIl data % load BASIL output data : %% CBF Arrival transit time (AAT), aCBV, arterial transit artefact (ATA) for spatial COV computation, allPLD for another C...
d93630954ae9a778b96a20209e82e9eb07b038fc52ac5a77994b35963aada0be
MATLAB
1,749
43
function [Z_MIP, phi_MIP] = MIP_search( X, params, options) %----------------------------------------------------------------------- % FUNCTION: MIP_search.m % PURPOSE: Find the Minimum Information Partition (MIP) from time series % data X % % INPUTS: % X: time series data in the form (units X time) % % ...
812fb0304d1670e5d86ff96f20e446aa8b926121d8ad0af4aec6e2a3e29ff19b
MATLAB
1,750
49
date = '07.10.20'; filenum = 4; %% load(['C:\maestro_results\Analog_data',date,'\Tables_',num2str(filenum),'.mat']) mdp_table = MDPData.MDPStates; loc = find(mdp_table.type == 'A' | mdp_table.type == 'B' |mdp_table.type == 'C'); reward = [0 0 0]; mistake = reward; miss = reward; for ii = 1:length(loc)-1 tmpT = mdp_...
8e44a9a8bc03a5971ba347111ac9508e50a64a19b1fd4c7afc0df7047f5d35ab
MATLAB
1,754
77
%% calculate the mean angle of the right most cluster cmap = parula(11+1); cmap = cmap .* repmat([.9 .8 .9],size(cmap,1),1); ic = 0; for thresh = 5:15 x = obs2obs(:); y = exe2obs(:); ind_min_rel = x>=thresh; x = x(ind_min_rel); y = y(ind_min_rel); % convert to angle ang...
d599e13a1feace49d06a1b6e55592864f6e84b8dc164dba8df66126a89023852
MATLAB
1,758
52
function swp = Sweep(varargin) % SWEEP class constructor. % s=Sweep(SDATA,EDATA,NUM_DATA,REPS,MODE,STEP) creates a % sweep object that generates values in the range (SDATA,EDATA). % The number of values generated is NUM_DATA and each is being % repeated REPS time (the total number of values are num_data*re...
e52af32900b7ad54cd5c253c432217ffc30b1789ef394a5224c6eb9fb034bfdb
MATLAB
1,759
47
function phi_I = phi_I_dis(probs,q_probs) %------------------------------------------------------------------------------------------------- % PURPOSE: calculate mutual information based integrated information proposed in discretized data % % INPUTS: % probs: probability distributions computed from X % probs.p...
a4f57edddbd0732cf9fbf97540cba86631ac2c34336712677e91b84c03291e11
MATLAB
1,761
59
classdef LogBookTest < matlab.unittest.TestCase % Author: Lasse Osterhagen properties(Constant) eventGenerator = EventGenerator(); end properties logbook end methods(TestMethodSetup) function setUp(this) this.logbook = LogBook(); this.l...
c04fde5f9221f18433c5af18704d91422695f6b73f44a39f71cefd606d598cb2
MATLAB
1,766
47
figure; %% Enters the nest subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],mean_z_score_all_days_all_mice_enters_the_nest,{@mean,@stderrm},'r') 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([0 2532]);ylim([-1 1]); xlab...
e04ae73146dc77898cc5e97b306eeaed1beb10abc0b813866e802e68205fa295
MATLAB
1,769
91
clc clear close all stat_for_fig06 % keep n6c n6d n6e n6f figure('Units','normalized','OuterPosition',[.1 .1 .12 .7]) subplot(4,2,1) prep_for_fig06A subplot(4,2,2) load xx_109_7_pop_exe2obs e2e = perf.verif; e2o = perf.test; load xx_109_7_pop_obs2exe o2o = perf.verif; o2e = perf.test; prep_for_fig06BCDEF(e2e,e2o,...
3a220fcd715cda6c25e5ee54a741f2a5e11c264ffdb05f0b5d80cb3cb4a95a06
MATLAB
1,775
69
function[subject,data] = nmri_freqplot(subject,data) %% make the QC dir if (~isfield(subject,'QCdir')) subject.QCdir=fullfile(subject.analysis_dir,subject.id,'QC'); end if (~exist(subject.QCdir,'dir')) mkdir(subject.QCdir) end %% do fft-plot MEGGRAD cfg = []; cfg.output = 'pow'; cfg.channel = 'meggrad'; cfg.metho...
7b3cc1a8d6e10634749138eaf7e96db08382a506e52de4d1b3ab1ea168143c69
MATLAB
1,775
82
function FS_SortMotif % Sort each .mat file by its identified motif mat_dir='MOTIF'; counter = 1; if exist(mat_dir,'dir'); rmdir(mat_dir,'s'); end mkdir(mat_dir); Dir01 = strcat(mat_dir,'/Motif_first'); Dir02 = strcat(mat_dir,'/Motif_Middle'); Dir03 = strcat(mat_dir,'/Motif_last'); Dir04 = strcat(mat_dir,'/Motif_seco...
fef3860117f5bfb8250ee6166a404c8f6e74337e83de6d2d708f5cf6b4c0340b
MATLAB
1,777
53
% Copyright (C) Alex A. Bhogal, 2021, University Medical Center Utrecht, % a.bhogal@umcutrecht.nl % <import_Events: imports GEN4 RespirAct data > % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Fou...
de0e7712660c5b666c668e58096576147a9c42d3d22cf995a5d7ad35b800ff19
MATLAB
1,778
57
function [parts,vertices,edges] = readBYUSurface(filename,fixedwidth) % [parts,vertices,edges] = readBYUSurface(filename,fixedwidth) % Reads a BYU file if it holds a triangulated mesh % % filename - path to BYU file % fixedwidth - 0 or 1 refers to which style of byu file (whether numbers are spaced into fixed widt...
74e4ec551c4048cf46a3159056e211ab81637e5e3eabf46264ec8d993ed9bf11
MATLAB
1,780
57
function create_supp_table1(rt, accuracy, conf, fileName) %File name output_path = pwd; file = fullfile(output_path,[fileName '.xls']); %Delete previous version of the file and open new file if exist(file) delete(file) end fid = fopen(file,'a'); %% RT % Print first line fprintf(fid,'RT\nCondition\tS1\tFEF\tDLPFC...
1e857e834fa7b0a08b979a5ae3101110432b3b34a364222297ab0caada925399
MATLAB
1,783
43
function shearletSystem = MIRO_SLgetShearletSystem2D(useGPU, rows, cols, nScales, shearLevels, full, directionalFilter, quadratureMirrorFilter) %% Compute the shearlet system %%check input arguments if nargin < 4 error('Too few input arguments!'); end if nargin < 8 quadratureMirrorFilter = [0.0104933261758410...
3c119de6b18d30300937d3cd3990c3a6dcd2c0ab831febc0074fcb7a59f14dfd
MATLAB
1,784
51
function [dO_c, dO_TnCa, dO_TnMgCa, dO_TnMgMg, ... dO_Calse, phi_ca_i, dCa_up, dCa_rel, ... dF_1, dF_2, dF_3, I_up, I_rel] = ... SR_calcium_handling(ATP_i, Ca_i, Ca_up, ... Ca_rel, F_1, F_2, F_3, O_c, O_TnCa, O_TnMgCa, ... O_TnMgMg, O_Calse, V, data) F = data.F; V_up =...
ff38609b79b965a43c460095cf56c7a1c794d1844b801c0a2099e385f6f958e2
MATLAB
1,788
46
%% LaBGAS_copy_con_imgs_CANlab_folder_struct % % This simple script copies con1-3 images (pos, neu, neg) from % rootdir\firstlevel\model_x_yyy\sub-zz\ to % rootdir\secondlevel\model_x_yyy\con_images\sub-zz % to prepare second level analysis with CANlab batch scripts % %__________________________________________________...
d5f46747372cec8043ab6a847c74f30858c4a1f6910c2101eb4c962bbac2e372
MATLAB
1,792
37
function [request, old_run] = copyRun(auth_token, url, old_label, copy_label) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here run_response = httpGET(auth_token, [url, '/runs/?label=', old_label]); old_run = run_response.Body.Data; if ~isempty(old_run) xml_path = [old...
3c9a02698f92ad63444cbb3f88bea5839f284c3c3441adc0af1356090ea19e6c
MATLAB
1,795
42
function [mean_population,mean_cells,mean_behaviors] = neuronal_activity_session(calcium_data,calcium_time,calcium_fps,behav_data,behav_time,behav_fps,min_behav_duration) % This function calculates the average activity for the whold recording and % during each behavior. % INPUTS: calcium_data, neurons x time matrix...
196ffcf912a54ebf8b7ac4cbe4fc79232d4c29a79016112ad1749c8614882f43
MATLAB
1,796
48
%% label2rgbBackdropLive.m % Overview: % % Code that labels different regions of a bw image in different colors. The % inputs are the image to be colored, a 2D array the size of the image that % indexes the regions to be colored and the colormap for the indexed % regions. Code can also conv...
cad475d6a9429e02142e0ce25a0c1628721f37800125df915425b1e371d3b226
MATLAB
1,798
34
figure; %Plots of the mean Z-scored traces of ACCCAMKII neurons (cyan) and ACCVGAT neurons (magenta) %for all dams and all days aligned to the dams?s entry to the nest (H) and exit from the nest (I) (n = 5 mice). %% All days averaged dams camkii vs vgat-cre %Pup contact subplot('Position',[0.2 0.61 0.2 0.17]); shade...
970fafc95566ae7632e7d229a334d314899760c04d7253683ebec7a124660c1f
MATLAB
1,802
54
function SI = SI_dis(probs, q_probs) %------------------------------------------------------------------------------------------------- % PURPOSE: calculate stochastic interaction in discretized data % % INPUTS: % probs: probability distributions computed from X % probs.past: probability distribution of past s...
a467cd051cc093eacc4d46803176c89e8e43ba5a8a567c9a44a4e4fa1c515c44
MATLAB
1,806
72
function [C, kept_N] = generate_dct_basis(size_h, size_w, k_h, k_w) x_axis = 1 : size_h; x_axis = x_axis / size_h; y_axis = 1 : size_w; y_axis = y_axis / size_w; [Y, X] = meshgrid(y_axis, x_axis); phi_shift = 2; img = []; img_global = []; for i = 1 : k_h for j = 1 : k_w ...
9a44d2ebafad6da48380d6da5da99afa5ee7b48101f90c22dcb65fa87eda6385
MATLAB
1,808
44
%% Demo demonstrating the algorithm result formats for COCO %% select results type for demo (either bbox or segm) type = {'segm','bbox','keypoints'}; type = type{1}; % specify type here fprintf('Running demo for *%s* results.\n\n',type); %% initialize COCO ground truth api dataDir='../'; prefix='instances'; dataType=...
df8f6f457a80f82ed988803932aa97f2586fff4e0f317e078e7cb04e2868b5e4
MATLAB
1,818
44
function [Result,pData,DataCapture] = AO_GetChannelData(ChannelId) %Function is used to get the data for the specified channel ,in format of streamDataBlock %% %AO_GetChannelData :will get the data for the specified channel ,in format of streamDataBlock %ChannelId :The channel id which we want to get data ...
5cf7f8c232e162efd792a02ef55e90296ed13bbea50ad7324a14c964573ad905
MATLAB
1,820
53
function sig_comp= change_sweep_param(sig_comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. sdata_flg=0; ...
0efe7ead7765bd72e76df380fad86b3d81e594c855d42f23d201864e5fc12d0e
MATLAB
1,825
73
%% % Plots spatial correlation curves across different values of probability % and strength of ensheathment % % Creates S3 Fig %% %% load the data and get the statistics load('./CompressedData/Spatial/Spatial_SuppData_condensed.mat') %% f = figure(10); clf; f.Position(3:4) = [970 420]; set(gca,'fontsize',16) % te...
841a02fa553d0321e76c8ba6d99fdaecd5061af08454cadbc6d3093bd1b27226
MATLAB
1,825
61
function X = SLshearrec2D(coeffs, shearletSystem) %SLshearrec2D 2D reconstruction of shearlet coefficients. % %Usage: % % X = SLshearrec2D(coeffs, shearletSystem); % %Input: % coeffs: XxYxN array of shearlet coefficients. % shearletSystem: Structure containing a shearlet system. This should be % ...
e648927426ed2829f17a5ae081bcd00a8845d7598305d159909b1f3bc5d82c2f
MATLAB
1,829
47
function comp = set(comp,varargin) % SET Set STime_comp properties and return the updated object. % Property names are: % Sig_comp,Input_method, Static_value, Value_formula, Static_reps, Reps_formula, % Seq_values, Seq_values_str, Coord_index, Index_formula, Wrap, Fixed_num_data, Sweep. property_argin = varargin; whil...
b876e1fd0c10fa705d3407e16154a4b7a72ebfc4373bebed5089f6cb56bdeac7
MATLAB
1,831
35
function [Result] = AO_StartStimulation(ChannelNumber); % This function is used to stimulate using the SnR/Neuro Omega % % ChannelNumber:The ID of the channel used for stimulation % Result is an integer result of the AO_StartStimulation, 0 = no function errors %% Note: The stimulation params should be set before stim...
87a6b002283a2b4afb34cff967cea059dab32b55c3316f0fbb846a7052012de4
MATLAB
1,832
51
function preparedFiltersGPU = SLfiltersToGPU2D(preparedFilters) %SLFILTERSTOGPU2D Transfer precomputed filters for the construction of 2D shearlets to the graphics card. % %Usage: % % preparedFiltersGPU = SLFILTERSTOGPU2D(preparedFilters) % %Input: % % preparedFilters: A structure containing filters that can be used to...
81882b420e006bd8552b111bc643f9ecf9bc1325210de920e4d7ea582886f21f
MATLAB
1,834
31
figure; %% All days averaged fathers vs mothers subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],fathers_mean_z_score_all_days_all_mice_pup_contact,{@mean,@stderrm},'k') yticks([-1 -0.5 0 0.5 1 1.5 2 ]);yticklabels({'-1' '-0.5' '0' '0.5' '1' '1.5' '2'});xticks([0 211 422 633 844 1055 1266 1477 1688 1899]);x...
1ded769274eaa29a3eb00859a281e16a6c00f16adc61d63920c14628e953e368
MATLAB
1,835
57
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is NEW_ENV 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 ~(ise...
ba73a221c38b8dd2d1c26ceb19c966ab3e55860a79faf087a55e3e487952c3f6
MATLAB
1,842
48
% Changed by AlexKaz on 110520 to create the 32x1 linear channel map for the Deuteron system Nchannels = 32; connected = true(Nchannels, 1); chanMap = 1:Nchannels; chanMap0ind = chanMap - 1; xcoords = ones(Nchannels,1); ycoords = [1:Nchannels]'; kcoords = ones(Nchannels,1); % grouping of channels (i.e. tetrode...
265145c4cecd9485c48d1cbad3c31fdfb44f0b6c899de86819fad059e2784cbf
MATLAB
1,845
41
function [psf_crop_sum_normalized] = crop_psf(dataset, N, first_scale_factor, second_scale_factor, crop_box_h, crop_box_w) % CROP_PSF - crop psf to fit the support box % input: % dataset : h*w*N psf matrix to be downsampled and cropped % N : field number of psf stack % first_scale_factor : first down...
effb856d5e67ac2c6aeedb28359ad39dbe54238c5ac2e84f56216d7ca8f0a522
MATLAB
1,845
72
% This function functions like the build in MATLAB function csvwrite but % allows a row of headers to be easily inserted % % known limitations % The same limitation that apply to the data structure that exist with % csvwrite apply in this function, notably: % m must not be a cell array % % Inputs % % fil...
5df0f088fba2bc72c12c4f3a002c3042c8ed553ddffd4b71f2bcbad826c9565b
MATLAB
1,850
39
function [Item_Name_struct] = extract_events(data_table) % Function extract_events gets a single table with parsed event data from a single .csv, and converts % it to a struct. the keys of the struct are the names of the events. % % Inputs: % data_table - (N x 8 table) - Each column holds a single event type % % ...
c4a57b02dda321cb4bd28fac4fad12bc3f094f68486b90b36ebcb5f52ef093e9
MATLAB
1,851
52
clear;clc load('\demo\input\Ydata.mat') % load dependent vadiables % z-score: Y=zscore(Y); load('demo\input\Xdata.mat') % load independent variables X=parcelExpression; X(isnan(X))=0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %perform full PLS and plot vari...
104758607550a8d71b08de67b623a8d94e70130d2bd1415708754558e13e4f18
MATLAB
1,854
53
function [dataTable] = loadFileList(varargin) %loadFileList Load and combine tables from multiple output files % Will include only columns found in all datasets, and adds a column % naming the originating data set o = ecogutils.postHocOptionsParser(varargin{:}); dataPath = [getLocalPath('ECoGoutput') 'init...
bb1505ca10063e7a548dee72cd4f8da3dbdcccc0adb8969df738e8c5bd3ae86d
MATLAB
1,856
57
clear close all PostSetup('BrockWork') anaName = 'IDX_findTimingOffsets_rawResp'; %% Get IDX global IDXDIR cd(IDXDIR) if ~exist(strcat(IDXDIR,strcat(filesep,anaName,'.mat')),'file') IDX_iScienceSubmission end load(strcat(IDXDIR,strcat(filesep,anaName,'.mat'))) %% JASP conversion % JASP requires each unit to...
dee821586bea25900d6e6d6aa5cd0ff56fd5608dfcdc476c8b56b310e4649c4c
MATLAB
1,857
43
function sound_channel = identify_sound_channel(NA_mat_uint16) % Function identify_sound_channel() locates the sound shannel in NA recording (if exists). % The sound is identified based on its statistics = higher mean channel value, due non-negative % air pressure measurments. % % Inputs: % ...
9f0be2e052c890e64a2f3add580c7fefbcc87dd8021a43e7df720aada1a9bdb6
MATLAB
1,858
57
function [list,entries_list]=get_crid_list(sig) % GET_CRID_LIST returns the list of components crids. % LIST=GET_CRID_LIST(SIG_COORD) returns the list of % components CRIDs of the Main_signal object that the given % Signal-coodinator coordinates, including components that consists % it's Envelopes. counter=1; comp_nam...
768a8e277b0fc8bf86a919770cb2e6cdea7e64c9341868e7027f1586de2fbc33
MATLAB
1,862
69
function testLoad %TESTLOAD Test json.load. fixtures = {... [], 'null';... 1, '1.0';... inf, 'Infinity';... -inf, '-Infinity';... nan, 'NaN';... true, 'true';... 'foo', 'foo';... {}, '[]';... struct(), '{}';... 1:5, '[1,2,...
863fdab9fd403954bb54300f237c4b8ecb972ac854ad8852db3ee11135c3c18d
MATLAB
1,867
76
%************************************************************************** %************************************************************************** % % maxentropie is a function for thresholding using Maximum Entropy % % % input = I ==> Image in gray level % output = % I1 ==> binary image %...
999aff8996d29b25df97b266d457ff3d9dbc862105b26dd38fe19df64cc00279
MATLAB
1,867
47
figure; %% PND0 subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],mean_z_score_all_days_all_mice_pup_contact,{@mean,@stderrm},'k') yticks([-0.5 0 0.5 1 1.5]);yticklabels({'-0.5' '0' '0.5' '1' '1.5'});xticks([0 211 422 633 844 1055 1266 1477 1688 1899]);xticklabels({'-4' '-3' '-2' '-1' '0' '1' '2' '3' '4' '5'...
cf8d89596d520e3683e25d3b99a73bfee705c14de891113b39c5c21e4e483207
MATLAB
1,867
47
figure; %% PND0 subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],mean_z_score_all_days_all_mice_pup_contact,{@mean,@stderrm},'r') yticks([-0.5 0 0.5 1 1.5]);yticklabels({'-0.5' '0' '0.5' '1' '1.5'});xticks([0 211 422 633 844 1055 1266 1477 1688 1899]);xticklabels({'-4' '-3' '-2' '-1' '0' '1' '2' '3' '4' '5'...
0f752936237a64414fa271517de88451da00a5315e7bd342c5b6ea6ed4cb0c08
MATLAB
1,870
47
figure; %% Pup contact subplot('Position',[0.2 0.61 0.2 0.17]); shadedErrorBar([],mean_z_score_all_days_all_mice_pup_contact,{@mean,@stderrm},'r') yticks([-0.5 0 0.5 1 1.5]);yticklabels({'-0.5' '0' '0.5' '1' '1.5'});xticks([0 211 422 633 844 1055 1266 1477 1688 1899]);xticklabels({'-4' '-3' '-2' '-1' '0' '1' '2' '3' ...
2a542b1762ba1cb5c28039fcba6e574873ec595c480ffcfa829dc508c72dc434
MATLAB
1,870
61
function [list,entries_list]=get_crid_list(sig) % GET_CRID_LIST returns the list of components crids. % LIST=GET_CRID_LIST(SIG_COORD) returns the list of % components CRIDs of the Main_signal object that the given % Signal-coodinator coordinates, including components that consists % it's Envelopes. counter=1; comp_cri...
fd8a275b6ebb139972945470de771769cf8afa758c7c088e5782b7994b58f02c
MATLAB
1,870
44
% Copyright (C) Alex A. Bhogal, 2021, University Medical Center Utrecht, % a.bhogal@umcutrecht.nl % <resampleGEN3: resamples GEN3 breathing data to the time-step defined by TR > % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as publi...
cc9f50c41120976ad08a07b3780a43f5e44a7e3271f0c35930587e552beba5de
MATLAB
1,873
62
clc clear close all % /// Execution load("behavioral_data_exe.mat") cue_type = 'Informative'; actions = {'Twist', 'Shift', 'Lift'}; periods = unique(Period, 'stable'); ind_cue = strcmp(CueType, cue_type); for iaction = 1:numel(actions) ind_action = strcmp(ActionType, actions{iaction}); for iperiod = 1:nu...
b8f9a41e523d3e21f4c9d1d89ec070eeb078f470f5bcfca937f34b2117e69f37
MATLAB
1,874
67
function folders = create_folder_names(expdata) % JN 2019-02-11 % This function fills the struct `folders` with the locations of all input % data, and the output folder folders = expdata.folders; folders.base = folders.data_location; logging = 'neural'; maestro = 'control'; behavior = 'behavior'; camera = 'camera'; ...
bd6e17a97c37accbc637a46b519da8dccdaeb8291865b179147ef098827a276f
MATLAB
1,879
50
%---------------------------------------------------------------% % This is the main script for decoding animal's current % % position using rate maps from N' -- Wenbo Tang (Jan 05, 2023)% %---------------------------------------------------------------% clc; clear all close all; %% famnov_dir = '/Volumes/Nove...
7a87d19fa02b2e1f9c6c35a0fe7b0a00da7357f3f55f62742eb46547018087f9
MATLAB
1,881
64
classdef LogBook < handle % Class to register (listen to) a number of events and save them to a % cell array with a time stamp. Event can optionally have an % ExperimentEventData object as event.EventData. % Author: Lasse Osterhagen properties displaying = true; end pr...