Skip to content

Commit be04c16

Browse files
author
nengel
committed
UPDATE
1 parent 8211f4b commit be04c16

File tree

212 files changed

+9253
-14039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+9253
-14039
lines changed

BuildAndTest.m renamed to BuildMINT.m

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
% updating MATLAB paths, and ensuring all necessary configurations are applied at MATLAB startup. Execute from the
33
% MINT project root directory.
44

5-
function BuildAndTest()
5+
function BuildMINT()
66
ecosdir = fullfile(pwd, 'extern', 'ecos-matlab-master','bin');
77
configdir = fullfile(pwd, 'config');
88
% MI_BuildAndTest(configdir, 0);
@@ -130,17 +130,6 @@ function PID_BuildAndTest(configdir, ecosdir)
130130
srcdir = fullfile(pwd, moduleFolder);
131131
find_and_replace_in(startupfiletemplate, startupfile, '$PID_MATLAB_ROOT', srcdir);
132132
add_to_startup(startupfile);
133-
134-
% disp('Testing PID');
135-
% testFolder = fullfile(pwd, 'tests', 'PID');
136-
% testSuite = matlab.unittest.TestSuite.fromFolder(testFolder, 'IncludingSubfolders', true);
137-
% runner = matlab.unittest.TestRunner.withTextOutput;
138-
% result = run(runner, testSuite);
139-
% if any([result.Failed])
140-
% error('One or more tests have failed.');
141-
% else
142-
% disp('PID tests completed successfully.');
143-
% end
144133
end
145134

146135

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
PARTITION_X Creates sub-partitions of response matrix for quadratic
2+
extrapolation bias correction.
3+
4+
------
5+
SYNTAX
6+
------
7+
PARTITION_X can be used in two different ways
8+
9+
Xpart = partition_X(X, nt, Npart, partIdx, ntPart);
10+
11+
or
12+
13+
[Xpart, ntPart, totNtPart] = partition_X(X, nt, Npart, partIdx);
14+
15+
In the first case it is assumed that the number of trial per stimulus,
16+
ntPart, of the final partition matrix is known. In the second case it
17+
is assumed that ntPart is not know and needs to be computed by the
18+
function itself (see also the examples below). This dual behavior can
19+
be used to save time when different partitions corresponding to the
20+
same Npart value need to be computed.
21+
22+
---------
23+
ARGUMENTS
24+
---------
25+
X - response matrix
26+
nt - number of trials per stimulus
27+
Npart - number of partitions
28+
partIdx - index of the partition to be extracted
29+
ntPart - number of trials per stimulus of the partition matrix. In
30+
Matlab's language it would be ntPart = floor(nt./Npart)
31+
32+
------
33+
OUTPUT
34+
------
35+
Xpart - partition matrix
36+
npart - number of trials per stimulus of the partition matrix. In
37+
Matlab's language it would be ntPart = floor(nt./Npart)
38+
totNtPart - total number of trials of the partition matrix. In Matlab's
39+
language it would be totNtPart = sum(ntPart)
40+
41+
--------
42+
EXAMPLES
43+
--------
44+
The command
45+
46+
[Xpart, ntPart, totNtPart] = partition_X(X, nt, 4, 2);
47+
48+
provides the second of the four possible partitions of X together with
49+
the number of trials per stimulus and the total number of trials of the
50+
partition matrix. Alternatively
51+
52+
Xpart = partition_X(X, nt, 4, 2, ntPart);
53+
54+
also provides the second of the four possible partitions of X. In this
55+
case, however, the array ntPart is provided as an input to speed up
56+
computations.
57+
58+
Copyright (C) 2010 Cesare Magri
59+
Version: 1.0.2
60+
61+
-------
62+
LICENSE
63+
-------
64+
This software is distributed free under the condition that:
65+
66+
1. it shall not be incorporated in software that is subsequently sold;
67+
68+
2. the authorship of the software shall be acknowledged and the following
69+
article shall be properly cited in any publication that uses results
70+
generated by the software:
71+
72+
Magri C, Whittingstall K, Singh V, Logothetis NK, Panzeri S: A
73+
toolbox for the fast information analysis of multiple-site LFP, EEG
74+
and spike train recordings. BMC Neuroscience 2009 10(1):81;
75+
76+
3. this notice shall remain in place in each source file.
77+
78+
----------
79+
DISCLAIMER
80+
----------
81+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
82+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
83+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
84+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
85+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
86+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
87+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
88+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
89+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
90+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
91+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%%% *function [HX, HXY, HlX, HlXY, HiX, HiXY, ChiX, HshX, HshXY] = xtrploop(X, pars)*
2+
%%%
3+
%%% ### Description
4+
%%% Loops over iterations of the extrapolation procedure.
5+
%%%
6+
%%% ### Inputs:
7+
%%% - *X*: *nDimensions x nTrials x nStimuli* array including response data.
8+
%%% - *pars*: parameter structure to check generated by build_parameters_structure.
9+
%%%
10+
%%% ### Outputs:
11+
%%% - *HX*: estimate of H(X).
12+
%%% - *HXY*: estimate of H(X|Y).
13+
%%% - *HlX*: estimate of H_lin(X).
14+
%%% - *HlXY*: estimate of H_lin(X|Y).
15+
%%% - *HiX*: estimate of H_ind(X).
16+
%%% - *HiXY*: estimate of H_ind(X|Y).
17+
%%% - *ChiX*: estimate of Chi(X).
18+
%%% - *HshX*: estimate of H_shuffle(X).
19+
%%% - *HshXY*: estimate of H_shuffle(X|Y).
20+
%%%
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
%%% *function [HX, HXY, HlX, HlXY, HiX, HiXY, ChiX, HshX, HshXY] = quadratic_extrapolation_v2(X, pars)*
2+
%%%
3+
%%% ### Description
4+
%%% Quadratic extrapolation procedure.
5+
%%%
6+
%%% ### Inputs:
7+
%%% - *X*: *nDimensions x nTrials x nStimuli* array including response data.
8+
%%% - *pars*: parameter structure to check generated by build_parameters_structure.
9+
%%% -
10+
%%%
11+
%%% ### Outputs:
12+
%%% - *HX*: estimate of H(X).
13+
%%% - *HXY*: estimate of H(X|Y).
14+
%%% - *HlX*: estimate of H_lin(X).
15+
%%% - *HlXY*: estimate of H_lin(X|Y).
16+
%%% - *HiX*: estimate of H_ind(X).
17+
%%% - *HiXY*: estimate of H_ind(X|Y).
18+
%%% - *ChiX*: estimate of Chi(X).
19+
%%% - *HshX*: estimate of H_shuffle(X).
20+
%%% - *HshXY*: estimate of H_shuffle(X|Y).
21+
%%%
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
%%% *function ind = findtrial(Nt, maxNt, Ns)*
2+
%%%
3+
%%% ### Description
4+
%%% Index responses corresponding to trials.
5+
%%%
6+
%%% ### Inputs:
7+
%%% - *Nt*: number of trials per stimulus array.
8+
%%% - *maxNt*: max number of trials (must be equal to max(NT)).
9+
%%% - *Ns*: number of stimuli (must be equal to length(NT)).
10+
%%%
11+
%%% ### Outputs:
12+
%%% - *ind*: position of the trials in the response matrix R (see ENTROPY and INFORMATION) ignoring the first dimension (dimensionality of the response).
13+
%%%
14+
%%% ### Further notes:
15+
%%%
16+
%%% EXAMPLE
17+
%%% Let's consider the response matrix in the figure below (letters are
18+
%%% used to represent undefined values):
19+
%%%
20+
%%% -----------------
21+
%%% | q | s | - | - |
22+
%%% |---------------|
23+
%%% | r | t | - | - |
24+
%%% -----------------
25+
%%% ----------------- /
26+
%%% | i | m | o | - | /
27+
%%% |---------------| /
28+
%%% | l | n | p | - | /
29+
%%% ----------------- /
30+
%%% | ----------------- / S=3
31+
%%% | | a | c | e | g | /
32+
%%% L=2 | |---------------| /
33+
%%% | | b | d | f | h | /
34+
%%% | ----------------- /
35+
%%%
36+
%%% -----------------
37+
%%% T=4
38+
%%%
39+
%%% in this case L=2, T=4 and S=3. Four trials are availabe for the first
40+
%%% stimulus, two for the second and three for the third stimulus. We have
41+
%%% Nt = [4; 3; 2] and maxNt = 4 and thus
42+
%%%
43+
%%% ind = tridxs([4; 3; 2], 4, 3)
44+
%%%
45+
%%% ind =
46+
%%%
47+
%%% 1
48+
%%% 2
49+
%%% 3
50+
%%% 4
51+
%%% 5
52+
%%% 6
53+
%%% 7
54+
%%% 9
55+
%%% 10
56+
%%%
57+
%%% The indexes computed this way can be used to extract all the responses
58+
%%% corresponding to trials by means of the command
59+
%%%
60+
%%% R(:,ind) =
61+
%%%
62+
%%% a c e g i m o q s
63+
%%% b d f h l n p r t
64+
%%%
65+
%%% REMARKS
66+
%%% The inputs are obviously redundant since all the information required for
67+
%%% the computation is contained in NT. However, by passing the additional
68+
%%% arguments we can speed up things a bit.
69+
%%%
70+
%%%
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
%%% *function additional_checks(X, Par, opts)*
2+
%%%
3+
%%% ### Description
4+
%%% Perform additional checks over input to ENTROPY.
5+
%%%
6+
%%% ### Inputs:
7+
%%% - *X*: *nDimensionsX x nTrials x nStimuli* array including response data.
8+
%%% - *Par*: parameter structure to check generated by build_parameters_structure.
9+
%%% - *opts*: options to compute the entropy.
10+
%%%
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
%%% *function pars = build_parameters_structure(X, opts, responseMatrixName, outputsList)*
2+
%%%
3+
%%% ### Description
4+
%%% Build parameters structure for ENTROPY.m
5+
%%%
6+
%%% ### Inputs:
7+
%%% - *X*: *nDimensionsX X nTrials X nY* 3D array including response data.
8+
%%% - *opts*: options to compute the entropy.
9+
%%% - *responseMatrixName*: name associated to the X matrix.
10+
%%% - *outputsList*: cell array of char arrays of strings specifying which quantities to compute.
11+
%%%
12+
%%% ### Further notes:
13+
%%%
14+
%%% Recap of the fields in the parameter structure
15+
%%% ----------------------------------------------
16+
%%%
17+
%%% X-related parameters:
18+
%%% - pars.Nc
19+
%%% - pars.Ns
20+
%%% - pars.Nt
21+
%%% - pars.maxNt
22+
%%% - pars.totNt
23+
%%%
24+
%%% TESTMODE-related parameters:
25+
%%% - pars.testmode
26+
%%%
27+
%%% METHOD-related parameters:
28+
%%% - pars.methodFunc
29+
%%% - pars.methodNum
30+
%%%
31+
%%% EXTRAPOLATION-related parameters
32+
%%% - pars.xtrp
33+
%%%
34+
%%% BIAS-related parameters:
35+
%%% - pars.biasCorrNum
36+
%%% - pars.biasCorrFuncName
37+
%%%
38+
%%% BOOTSTRAP-related parameters:
39+
%%% - pars.btsp
40+
%%%
41+
%%% OUTPUT-related parameters:
42+
%%% - pars.whereHX
43+
%%% - pars.whereHXY
44+
%%% - pars.whereHlX
45+
%%% - pars.whereHlXY
46+
%%% - pars.whereHiX
47+
%%% - pars.whereChiX
48+
%%% - pars.whereHshX
49+
%%% - pars.whereHshXY
50+
%%% - pars.whereHiXY
51+
%%% - pars.doHX
52+
%%% - pars.doHXY
53+
%%% - pars.doHlX
54+
%%% - pars.doHlXY
55+
%%% - pars.doHiX
56+
%%% - pars.doHiXY
57+
%%% - pars.doChiX
58+
%%% - pars.doHshX
59+
%%% - pars.doHshXY
60+
%%%
61+
%%% CHECKS-related parameters:
62+
%%% - pars.addChecks
63+
%%% - pars.numberOfSpecifiedOptions
64+
%%% - pars.Noutput
65+
%%%
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
%%% DIRECT_METHOD Estimate entropy quantities with direct method.
2+
%%%
3+
%%% This function is the direct method engine of called by ENTROPY and its
4+
%%% related functions.
5+
%%%
6+
%%% USAGE
7+
%%%
8+
%%% [HX, HXY, HlX, HlXY, HiX, HiXY, ChiX, HshX, HshXY] = direct_method(X, nt, pars);
9+
%%%
10+
%%%
11+
%%% INPUTS
12+
%%%
13+
%%% X - response matrix
14+
%%% pars - parameters structure
15+
%%%
16+
%%% *function direct_method*
17+
%%%
18+
%%% ### Description
19+
%%% Estimate entropy quantities with direct method. This function is the direct method engine of called by ENTROPY and its related functions.
20+
%%%
21+
%%% ### Inputs:
22+
%%% - *X*: *nDimensions x nTrials x nStimuli* array including response data.
23+
%%% - *pars*: parameter structure to check generated by build_parameters_structure.
24+
%%%
25+
%%% ### Outputs:
26+
%%% - *HX*: direct estimate of H(X).
27+
%%% - *HXY*: direct estimate of H(X|Y).
28+
%%% - *HlX*: direct estimate of H_lin(X).
29+
%%% - *HlXY*: direct estimate of H_lin(X|Y).
30+
%%% - *HiX*: direct estimate of H_ind(X).
31+
%%% - *HiXY*: direct estimate of H_ind(X|Y).
32+
%%% - *ChiX*: direct estimate of Chi(X).
33+
%%% - *HshX*: direct estimate of H_shuffle(X).
34+
%%% - *HshXY*: direct estimate of H_shuffle(X|Y).
35+
%%%
36+
%%% ### Further notes:
37+
%%%
38+
%%% The parameters structure must include the following fields:
39+
%%%
40+
%%% =========================================================================
41+
%%% | FIELD NAME | TYPE | DESCRIPTION |
42+
%%% =========================================================================
43+
%%% | pars.nt | numeric array | number of trials per stimulus. |
44+
%%% |-----------------------------------------------------------------------|
45+
%%% | pars.biasCorrNum | scalar value | bias correction number: |
46+
%%% | | | |
47+
%%% | | | -1 : user-defined bias |
48+
%%% | | | correction routine |
49+
%%% | | | |
50+
%%% | | | 2 : Panzeri & Treves |
51+
%%% |-----------------------------------------------------------------------|
52+
%%% | pars.doHX | logical value | flag specifying whether H(X) needs |
53+
%%% | | | to be estimated |
54+
%%% |-----------------------------------------------------------------------|
55+
%%% | pars.doHXY | logical value | flag specifying whether H(X|Y) |
56+
%%% | | | needs to be estimated |
57+
%%% |-----------------------------------------------------------------------|
58+
%%% | pars.doHlX | logical value | flag specifying whether H_lin(X) |
59+
%%% | | | needs to be estimated |
60+
%%% |-----------------------------------------------------------------------|
61+
%%% | pars.doHlXY | logical value | flag specifying whether H_lin(X|Y) |
62+
%%% | | | needs to be estimated |
63+
%%% |-----------------------------------------------------------------------|
64+
%%% | pars.doHiX | logical value | flag specifying whether H_ind(X) |
65+
%%% | | | needs to be estimated |
66+
%%% |-----------------------------------------------------------------------|
67+
%%% | pars.doHiXY | logical value | flag specifying whether H_ind(X|Y) |
68+
%%% | | | needs to be estimated |
69+
%%% |-----------------------------------------------------------------------|
70+
%%% | pars.doChiX | logical value | flag specifying whether Chi(X) |
71+
%%% | | | needs to be estimated |
72+
%%% |-----------------------------------------------------------------------|
73+
%%% | pars.doHshX | logical value | flag specifying whether H_sh(X) |
74+
%%% | | | needs to be estimated |
75+
%%% |-----------------------------------------------------------------------|
76+
%%% | pars.doHshXY | logical value | flag specifying whether H_sh(X|Y) |
77+
%%% | | | needs to be estimated |
78+
%%% |-----------------------------------------------------------------------|
79+
%%% | pars.testMode | logical value | flag specifying whther test-mode |
80+
%%% | | | has been selected |
81+
%%% =========================================================================
82+
%%%
83+
%%% Zero is returned for all outputs corresponding to output options that were not selected by the user.
84+
%%%

0 commit comments

Comments
 (0)