Reproducibility and preparation for publication
Scientific Python in GX-TXT · Module 10 · Lesson 60
We conclude the synthetic study by verifying that the published Datasets correspond to the protocol and collecting the materials necessary to explain and repeat the analysis.
Objectives
- Regenerate in memory the values expected from the protocol.
- Compare them with the published canonical datasets.
- Distinguish data verification, repetition of fit and publication of the course.
- Organize sources, figures and editorial metadata.
Verification of data
Import final_verification.py to the corso_python Session, after performing lesson 56. Save it and run it in the Runner.

import numpy as np
from gxtxt import gxtxt_api_call, gxtxt_api_require, gxtxt_bridge_info
gxtxt_api_require("CANONICAL_DATASET_API_v2@2")
rng = np.random.default_rng(2026)
t = np.linspace(0., 5., 21)
print("Verification of synthetic study; seed 2026")
for display_name, k in (("a", 0.5), ("b", 0.8)):
ideal = 3.0 * np.exp(-k * t)
expected = ideal + rng.normal(0., 0.05, t.size)
dataset = "corso_finale_" + display_name
data_values = gxtxt_api_call("CANONICAL_DATASET_API_v2", "read_range", [dataset, ["tempo", "segnale", "sigma", "ideale"], 0, 21])
read_result_value = {v: np.asarray(data_values[v]["values"]).reshape(-1) for v in ("tempo", "segnale", "sigma", "ideale")}
verify = (np.allclose(read_result_value["tempo"], t) and np.allclose(read_result_value["segnale"], expected) and
np.allclose(read_result_value["sigma"], 0.05) and np.allclose(read_result_value["ideale"], ideal))
print(dataset, "righe:", len(read_result_value["tempo"]), "riprodotto:", verify)
if not verify:
raise AssertionError("Data other than protocol: " + dataset)
print("Bridge available:", bool(gxtxt_bridge_info()))
print("Complete verification: synthetic data, non-measures")
The program recreates the times, ideal signals and two sets of noise in the same order and with the same seed of lesson 56. Then reread Dataset and compare time, signal, sigma and ideal with np.allclose.

Both Datasets show 21 rows and riprodotto: True in the environment used. It is a numerical verification with the tolerance of published data; it is not a byte-for-byte comparison or a substitute for the repetition of the fit and chart. To retrace the whole analysis, execute in the order protocol, generation, preparation, fit and chart of lessons 55–59, respecting property rules and output IDs.
Prepare materials for the blog
For each lesson, it preserves the Italian text, the Python files, the cut-out real images, the captions and the relative links. For the final study, you include the statement that the data is synthetic, seed, unit, model, parameters, results, limits and software versions. Title, description and structure of the sections can be adapted to the editorial format of the blog without altering the scientific results.
A searchable HTML page and an importable content package are artifacts distinct from the online publication. Before publishing, check images, links and readability in the context of the site. Any future translations must preserve units and the meaning of the conclusions.
Exercise
- What four variables are compared for each Dataset?
- What guarantees
allclosein this example? - Why should we keep the word “synthetic data” even in the published version?
Worked solution
- Time, signal, sigma and ideal.
- That the compared values coincide within the used tolerances, not that the files are byte-for-byte identical.
- Not to present a simulation as an experiment or a real measure.