Skip to content

Commit 59568d2

Browse files
Merge pull request #336 from VH-Lab/docs/tutorial_2.5
Docs/tutorial 2.5
2 parents d3c089d + 26187f9 commit 59568d2

File tree

5 files changed

+50
-7
lines changed

5 files changed

+50
-7
lines changed

+ndi/calculator.m

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@
4444
%
4545
% DOCS = RUN(NDI_CALCULATOR_OBJ, DOCEXISTSACTION, PARAMETERS)
4646
%
47-
%
4847
% DOCEXISTSACTION can be 'Error', 'NoAction', 'Replace', or 'ReplaceIfDifferent'
4948
% For calculators, 'ReplaceIfDifferent' is equivalent to 'NoAction' because
5049
% the input parameters define the calculator.
5150
%
52-
% Step 1: set up input parameters; they can either be completely specified by
53-
% the caller, or defaults can be used
51+
% This function is primarily intended to be called by external programs and users.
52+
%
53+
54+
55+
56+
% Step 1: set up input parameters; they can either be completely specified by
57+
% the caller, or defaults can be used
5458

5559
docs = {};
5660
docs_tocat = {};
@@ -116,6 +120,10 @@
116120
%
117121
% Returns a list of the default search parameters for finding appropriate inputs
118122
% to the calculator.
123+
%
124+
% This function is primarily intended as an internal function but is left exposed
125+
% (not private) so that it can be used for debugging. But in general, user code should
126+
% not call this function.
119127
%
120128
parameters.input_parameters = [];
121129
parameters.depends_on = vlt.data.emptystruct('name','value');
@@ -130,6 +138,10 @@
130138
% used as inputs to the calculator. PARAMETERS is a cell array of parameter
131139
% structures with fields 'input_parameters' and 'depends_on'.
132140
%
141+
% This function is primarily intended as an internal function but is left exposed
142+
% (not private) so that it can be used for debugging. But in general, user code should
143+
% not call this function.
144+
%
133145
% PARAMETERS_SPECIFICATION is a structure with the following fields:
134146
% |----------------------------------------------------------------------|
135147
% | input_parameters | A structure of fixed input parameters needed |
@@ -225,6 +237,10 @@
225237
% If it finds any, it creates a query indicating that the 'depends_on' field
226238
% must match the specified name and value.
227239
%
240+
% This function is primarily intended as an internal function but is left exposed
241+
% (not private) so that it can be used for debugging. But in general, user code should
242+
% not call this function.
243+
%
228244
query = vlt.data.emptystruct('name','query');
229245
if isfield(parameters_specification.input_parameters,'depends_on')
230246
for i=1:numel(parameters_specification.input_parameters.depends_on),
@@ -260,6 +276,11 @@
260276
% |------------------------|----------------------------------|
261277
%
262278
% in the abstract class, this returns empty
279+
%
280+
% This function is primarily intended as an internal function but is left exposed
281+
% (not private) so that it can be used for debugging. But in general, user code should
282+
% not call this function.
283+
%
263284
myemptydoc = ndi.document(ndi_calculator_obj.doc_document_types{1});
264285
property_list_name = myemptydoc.document_properties.document_class.property_list_name;
265286
% class_name = myemptydoc.document_properties.document_class.class_name
@@ -306,6 +327,10 @@
306327
% It is necessary to "columnize" the substructures because Matlab does not not necessarily preserve that
307328
% orientation when data is written to or read from JSON.
308329
%
330+
% This function is primarily intended as an internal function but is left exposed
331+
% (not private) so that it can be used for debugging. But in general, user code should
332+
% not call this function.
333+
%
309334
if ~isempty(input_parameters1),
310335
input_parameters1 = vlt.data.columnize_struct(input_parameters1);
311336
end;
@@ -328,6 +353,10 @@
328353
% can be overridden if additional criteria beyond an ndi.query are needed to
329354
% assess if a document is an appropriate input for the calculator.
330355
%
356+
% This function is primarily intended as an internal function but is left exposed
357+
% (not private) so that it can be used for debugging. But in general, user code should
358+
% not call this function.
359+
%
331360
b = 1; % base class behavior
332361
end; % is_valid_dependency_input()
333362

@@ -338,8 +367,13 @@
338367
%
339368
% Perform the calculator and return an ndi.document with the answer.
340369
%
370+
% This function is primarily intended as an internal function but is left exposed
371+
% (not private) so that it can be used for debugging. But in general, user code should
372+
% not call this function.
373+
%
341374
% In the base class, this always returns empty.
342375
doc = {};
376+
343377
end; % calculate()
344378

345379
function h=plot(ndi_calculator_obj, doc_or_parameters, varargin)
@@ -351,6 +385,8 @@
351385
% the calculator has been performed in a manner that makes sense with
352386
% its input data. Useful for debugging / validating a calculator.
353387
%
388+
% This function is intended to be called by external users and code.
389+
%
354390
% Handles to the figure, the axes, and any objects created are returned in H.
355391
%
356392
% By default, this plot is made in the current axes.
@@ -414,6 +450,8 @@
414450
% Returns the help information for the document type for an NDI
415451
% calculator object.
416452
%
453+
% This function is intended to be called by external users or code.
454+
%
417455
text = ndi.calculator.docfiletext(class(ndi_calculator_obj), 'output');
418456
end; %doc_about()
419457

@@ -425,6 +463,8 @@
425463
% Returns the help information for the document type for an NDI
426464
% calculator object.
427465
%
466+
% This function is intended to be called by external users or code.
467+
%
428468
text = ndi_calculator_obj.doc_about();
429469
end; % appdoc_description()
430470

@@ -456,6 +496,7 @@
456496
% | suppress_title (0) | 0/1 Should we suppress the title? |
457497
% |---------------------------|--------------------------------------|
458498
%
499+
459500
newfigure = 0;
460501
holdstate = 0;
461502
suppress_x_label = 0;

+ndi/query.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
% q = ndi.query('','isa','ndi.document.base') % match any ndi.document.base or subclass
7878

7979
% Argument block identical to did.query to ensure consistent interface
80-
arguments (Input)
80+
arguments
8181
field % Type checking depends on nargin, handled by superclass
8282
% Operation is required if nargin >= 2, must be member of valid list
8383
op (1,:) {mustBeMember(op, {'regexp', 'exact_string', 'contains_string', ...

docs/NDI-matlab/mkdocs-references.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
- ndi.database.fun.find_ingested_docs: 'NDI-matlab/reference/+ndi/+database/+fun/find_ingested_docs.m.md'
165165
- ndi.database.fun.findallantecedents: 'NDI-matlab/reference/+ndi/+database/+fun/findallantecedents.m.md'
166166
- ndi.database.fun.findalldependencies: 'NDI-matlab/reference/+ndi/+database/+fun/findalldependencies.m.md'
167+
- ndi.database.fun.finddocs_elementEpochType: 'NDI-matlab/reference/+ndi/+database/+fun/finddocs_elementEpochType.m.md'
167168
- ndi.database.fun.finddocs_missing_dependencies: 'NDI-matlab/reference/+ndi/+database/+fun/finddocs_missing_dependencies.m.md'
168169
- ndi.database.fun.lookup_uberon_term: 'NDI-matlab/reference/+ndi/+database/+fun/lookup_uberon_term.m.md'
169170
- ndi.database.fun.ndi_document2ndi_object: 'NDI-matlab/reference/+ndi/+database/+fun/ndi_document2ndi_object.m.md'
@@ -277,6 +278,7 @@
277278
- ndi.docs.schemastructure2docstructure: 'NDI-matlab/reference/+ndi/+docs/schemastructure2docstructure.m.md'
278279
- element PACKAGE:
279280
- ndi.element.downsample: 'NDI-matlab/reference/+ndi/+element/downsample.m.md'
281+
- ndi.element.missingepochs: 'NDI-matlab/reference/+ndi/+element/missingepochs.m.md'
280282
- ndi.element.oneepoch: 'NDI-matlab/reference/+ndi/+element/oneepoch.m.md'
281283
- ndi.element.oneepoch_bkup: 'NDI-matlab/reference/+ndi/+element/oneepoch_bkup.m.md'
282284
- ndi.element.timeseries: 'NDI-matlab/reference/+ndi/+element/timeseries.m.md'

docs/NDI-matlab/tutorials/analyzing_first_physiology_experiment/5_searching_ndi_databases.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Here we see that [ndi.document](https://vh-lab.github.io/NDI-matlab/reference/%2
5353

5454
## 2.5.2 All [ndi.document](https://vh-lab.github.io/NDI-matlab/reference/%2Bndi/document.m/) objects have the fields `document_class` and `base`.
5555

56-
The `document_class` fields contain critical information about the class, such as the file that contains its definition, its full class name and its short class name. In addition, document types can be composed of multiple document types. The [stimulus presentation](https://vh-lab.github.io/NDI-matlab/documents/stimulus/stimulus_presentation/) class has two superclasses: [ndi.document](https://vh-lab.github.io/NDI-matlab/documents/base/) and [ndi.document_epochid](https://vh-lab.github.io/NDI-matlab/documents/epochid/). This means that a [stimulus_presentation](https://vh-lab.github.io/NDI-matlab/documents/stimulus/stimulus_presentation/) document has its own fields, plus all of the fields from [ndi.document](https://vh-lab.github.io/NDI-matlab/documents/base/) documents and and [ndi.document_epochid](https://vh-lab.github.io/NDI-matlab/documents/epochid/) documents.
56+
The `document_class` fields contain critical information about the class, such as the file that contains its definition and its class name. In addition, document types can be composed of multiple document types. The [stimulus presentation](https://vh-lab.github.io/NDI-matlab/documents/stimulus/stimulus_presentation/) class has two superclasses: [ndi.document](https://vh-lab.github.io/NDI-matlab/documents/base/) and [ndi.document_epochid](https://vh-lab.github.io/NDI-matlab/documents/epochid/). This means that a [stimulus_presentation](https://vh-lab.github.io/NDI-matlab/documents/stimulus/stimulus_presentation/) document has its own fields, plus all of the fields from [ndi.document](https://vh-lab.github.io/NDI-matlab/documents/base/) documents and and [ndi.document_epochid](https://vh-lab.github.io/NDI-matlab/documents/epochid/) documents.
5757

5858
Let's look at the data that specifies the superclasses:
5959

@@ -108,8 +108,8 @@ results back to the database. The object [ndi.query](https://vh-lab.github.io/ND
108108
#### Code block 2.5.3.1. Type this into Matlab.
109109

110110
```matlab
111-
% search for document classes that contain the string 'stim'
112-
q_stim = ndi.query('document_class.class_name','contains_string','stim','');
111+
% search for document classes of type 'stimulus_presentation'
112+
q_stim = ndi.query('','isa','stimulus_presentation','');
113113
stim_docs = S.database_search(q_stim)
114114
% returns 35 matches for me
115115

docs/documentation_structure.mat

48 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)