You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/FileRemodelingQuickstart.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -309,7 +309,7 @@ because *remove_parent_event* is false.
309
309
rows in the data file no longer represent trials, but individual events within the trial.)
310
310
311
311
Next we specify how the new events are generated in the *new_events* dictionary.
312
-
Each new event has a name, which is a key in the *new_events* dictionary.
312
+
Each type of new event has a name, which is a key in the *new_events* dictionary.
313
313
Each key is associated with a dictionary
314
314
specifying the values of the following parameters.
315
315
@@ -338,7 +338,8 @@ The AOMIC data report indicates that the stop signal lasted 500 ms.
338
338
The copy columns indicate which columns from the parent event should be copied to the
339
339
newly-created event.
340
340
We would like to transfer the *response_accuracy* and the *response_hand* information to the response event.
341
-
*Note:* Copy columns is an optional key in the new events dictionary. If you do not want to carry over any column values from the parent event to the new events you can omit this key.
341
+
*Note:* Copy columns is an optional key in the *new_events* dictionary.
342
+
If you do not want to carry over any column values from the parent event to the new events you can omit this key.
The following MATLAB code demos are available to show how to access HED web services.
24
+
25
+
| Target | MATLAB source | Purpose |
26
+
| ------ |-----------------|-----------|
27
+
| Overall |[**runAllDemos.m**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/runAllDemos.m)| Harness for running all demos. |
28
+
| Overall |[**demoGetServices.m**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/demoGetServices.m)| List available services. |
The [**runAllDemos.m**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/runAllDemos.m)
38
+
script runs all the demo code and reports whether
39
+
the demos run successfully.
40
+
Before using the HED web services from MATLAB,
41
+
you should run this script to make sure everything is working on your system,
26
42
that you have Internet access, and that the HED services are available.
27
43
28
-
This script also demonstrates how to call the individual test functions.
29
-
Each test function takes a host URL as a parameter and returns a list of errors.
30
-
The individual test scripts illustrate how to call each type of available web service.
31
-
32
-
33
-
| Target | MATLAB source| Purpose |
34
-
| ------ | ------------- | ------- |
35
-
| Overall |[**runAllTests.m**](https://raw.githubusercontent.com/hed-standard/hed-examples/main/hedcode/matlab_scripts/web_services/runAllTests.m)| Harness for running all tests. |
36
-
| Overall |[**testGetServices.m**](https://raw.githubusercontent.com/hed-standard/hed-examples/main/hedcode/matlab_scripts/web_services/testGetServices.m)| List available services. |
function, which returns a MATLAB `struct` containing all needed test data.
49
+
The individual demo scripts illustrate how to call each type of available web service.
44
50
51
+
(overview-of-service-requests-anchor)=
45
52
### Overview of service requests
46
53
47
54
Calling HED services from MATLAB requires the following steps:
48
55
49
-
1.**Set up a session**:
50
-
1. Establish a session by requesting a CSRF token and a cookie.
51
-
2. Construct a header array using the token and the cookie.
52
-
2.**Create a request structure**.
53
-
3.**Make a request** using the MATLAB `webwrite`.
54
-
4.**Decode the response** returned from `webwrite`.
56
+
1.[**Set up a session**](setting-up-a-session-from-matlab-anchor).
57
+
2.[**Create a request structure**](creating-a-request-structure-anchor).
58
+
3.[**Make a request**](making-a-service-request-anchor).
59
+
4.[**Decode the response**](decoding-a-service-response-anchor).
55
60
56
61
Usually, you will do the first step (the session setup) once at the beginning of your script
57
62
to construct a fixed session header that can be used in subsequent requests in your script.
58
63
64
+
(setting-up-a-session-from-matlab-anchor)=
59
65
### Setting up a session from MATLAB
60
66
61
67
The goal of the session setup is to construct a header that can be used in subsequent web requests.
62
-
The first step is to call the [**getHostOptions.m**](https://raw.githubusercontent.com/hed-standard/hed-examples/main/hedcode/matlab_scripts/web_services/getHostOptions.m).
63
-
This function constructs the services URL from the host URL.
64
-
The function also makes a service request to obtain a CSRF token and a cookie.
65
-
The function then constructs a header and calls the MATLAB `weboptions` function
66
-
to get an options object suitable for use with the MATLAB `webwrite` function
67
-
use in all of our examples.
68
+
The first step is to call the [**getHostOptions.m**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/getHostOptions.m).
68
69
69
70
(setting)=
70
71
`````{admonition} Establish a session.
@@ -80,20 +81,19 @@ The `host` should be set to the URL of the webserver that you are using.
80
81
The call to `getHostOptions`, only needs to be done once at the beginning of your session.
81
82
The `servicesURL` and the `options` can be used for all of your subsequent requests.
82
83
84
+
This function constructs the services URL from the host URL.
85
+
The function also makes a service request to obtain a CSRF token and a cookie using
This example reads the JSON sidecar to be validated as a character array into the variable `jsonText`
186
-
and makes a request for validation using HED8.0.0.xml.
193
+
and makes a request for validation using `HED8.2.0.xml`.
187
194
188
195
The request indicates that validation warnings as well as errors should be included in the response.
189
196
If you wish to exclude warnings, use `off` instead of `on` as the `check_for_warnings` field value.
190
197
191
-
The [**testSidecarServices.m**](https://raw.githubusercontent.com/hed-standard/hed-examples/main/hedcode/matlab_scripts/web_services/testSidecarServices.m)
198
+
The [**demoSidecarServices.m**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/demoSidecarServices.m)
192
199
function shows complete examples of the various HED services for JSON sidecars.
193
200
201
+
(making-a-service-request-anchor)=
194
202
### Making a service request
195
203
196
204
The HED services all use the MATLAB `webwrite` to make HED web service requests.
@@ -207,7 +215,7 @@ outputReport(response, 'Example: validate a JSON sidecar');
207
215
```
208
216
`````
209
217
210
-
The [**<code>outputReport.m</code>**](https://raw.githubusercontent.com/hed-standard/hed-examples/main/hedcode/matlab_scripts/web_services/outputReport.m)
218
+
The [**<code>outputReport.m</code>**](https://raw.githubusercontent.com/hed-standard/hed-matlab/main/hedmat/web_services/outputReport.m)
211
219
MATLAB script outputs the response in readable form with a user-provided table.
212
220
213
221
If the web server is down or times out during a request,
0 commit comments