Advanced Octave A10 — Metadata and scientific provenance
Advanced GNU Octave with GX-TXT · Module 02
A numerical series is more useful when those who receive it can understand how it was produced. A scientific note can describe model, unity and limits, keeping the explanation distinct from the values of the Dataset.
Objectives and prerequisites
We use the octave_advanced_sensor Synthetic Dataset created in A07. The introductory course has introduced Dataset and metadata; now we write and read a note through DATASET_NOTES_API_v1. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.
Use a dedicated didactic session: the write operation replaces the user note of the chosen Dataset. If a note already contains information you want to store, read it and save it before executing the example, or use another copy of the data.
Write and reread a note
Import note_provenienza.m, record it in the Session and run it in the Runner.
The script checks that the Dataset is available, builds a Markdown text and calls the public API:
note = sprintf(['# Synthetic teaching data\n\n', ...
'Model: voltage = 1.2 + 0.25 * time.\n', ...
'Time: s; voltage: V. Eleven values from 0 to 5 s.\n', ...
'These values are simulated and are not laboratory measurements.\n']);
gxtxt_api_call('DATASET_NOTES_API_v1', 'write', {id, note});
saved = gxtxt_api_call('DATASET_NOTES_API_v1', 'read', {id});
fprintf('Readback matches: %d\n', strcmp(note, saved));
The note states the model, the units, the range and the synthetic nature. write and read operations use the Dataset ID in the current session. Rereading verifies the preserved text: it does not automatically verify that every statement is scientifically correct.
In the test the reread text coincides with the written text (1 ). The user note is distinct from the structured metadata managed by the manufacturer and does not change the numerical values, the units or the schema of the Dataset. To document a true origin, it also retains the identities of the sources, the version of the code and the parameters actually used, according to the services and the contracts available.
A readable and verifiable document
An effective note distinguishes what has been observed by what has been calculated. For real data indicates source and conditions of acquisition; for specific model simulations, parameters and, if present, random seed. If a feature is not known, declare it instead to invent it. For structured metadata and units continue to use the appropriate API: the free text accompanies them, it does not replace them.
Exercise
- What does
strcmp(note, saved)prove? - Does the writing of the note convert the values of the Dataset into another unit?
- Why is it important to read a pre-existing note before using
write?
Worked solution
- That the returned text coincides with the written text, not that its content is correct.
- No: the note is separated from data, schema and units.
- Because writing replaces the note and could delete useful information.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories