diff --git a/CHANGELOG.md b/CHANGELOG.md index 74afc4fe..107cb530 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,9 +75,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 {'bbox_inches': None}` (the same 600 x 450 picture as the PNG they wrote to a buffer before). - `htfa_network_animations`, `stocks` and `trajectories` load their data - with `tc.datasets`, write their videos with `tc.render_video` (frames in - a temporary folder; before: under `$TIMECORR_DATA`) into `tc.media_dir()` - and show them with `tc.show_video`. `stocks` keeps the two `Siccodes` + with `tc.datasets`, write their videos into `tc.media_dir()` and show + them with `tc.show_video`; `stocks` draws its frames with + `tc.render_video` (frames in a temporary folder; before: under + `$TIMECORR_DATA`). `stocks` keeps the two `Siccodes` text files of the library in the cache (before: their zip archives). - `htfa_network_animations` and `stocks` read the communities from the `"labels"` of `return_info` and no longer run `tc.features` a second @@ -94,6 +95,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 header. Without one the documentation server answered HTTP 403, so the notebook reported that no full-quality video was online. +- Tutorials on the toolboxes' own animation calls (the `tutorials` extra now + needs `htfa[plot,brain3d]>=0.2.0` and `hypertools>=1.2`): + `htfa_network_animations.ipynb` draws each video with one + `htfa.animate_network` call (per-node colors, per-frame radii, two views, + caption, legend rows, parallel frames; x264's preset `slow`) in place of + its own scene, frame composition and retry code, and its stills with + `plot_network(..., views=, legend=, caption=)`; the layout of the videos is + that of the earlier ones (brains and legend rows within 5 pixels). + `trajectories.ipynb` draws each video with one + `hyp.plot(..., panels=..., animate=True)` call; the videos show the line up + to the current sample faint and the last 30 samples solid, without the head + marker, the thicker tail and the one-second hold of the earlier videos, and + the notebook no longer filters hypertools' messages (fixed in hypertools + 1.2). - Tutorial `docs/tutorial/trajectories.ipynb`: the trajectories are drawn in hypertools' own cubes with `hyp.plot(..., panels=...)`, after reducing each order to three dimensions with `hyp.reduce` and rescaling each component to diff --git a/CLAUDE.md b/CLAUDE.md index a4a4d5d8..9da98637 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -100,7 +100,7 @@ The estimator (`wcorr`) is a kernel-weighted Pearson correlation; a true delta k - Sphinx with numpydoc, autosummary and nbsphinx; source in `docs/`; theme: Furo with the Contextual Dynamics Lab look shared with the htfa and hypertools documentation (Nunito Sans, lowercase light headings, green brand colors set in `html_theme_options` in `docs/conf.py`, rules in `docs/_static/custom.css`) - API pages: `docs/api.rst` (autosummary stubs in `docs/generated/`) - Gallery: the tutorials are the gallery. `docs/tutorials.rst` holds an nbsphinx `nbgallery` of the notebooks in `docs/tutorial/` (quickstart first); each card shows the image output of the notebook's one code cell tagged `nbsphinx-thumbnail` (a 4:3 picture without text, drawn from the notebook's own data by a cell near its end, after a one-line caption) and opens the notebook (card styles in `docs/_static/custom.css`, light and dark). `tests/test_docs_tutorials.py` checks that the gallery and the notebooks match, the thumbnail cell, the Colab badge, no error outputs, that relative links name tutorial notebooks (links to other doc pages are absolute `https://timecorr.readthedocs.io/en/latest/...` URLs, which also work on Colab), and that every public name is used (as `tc.`, imported or called; comments and strings do not count) in a tutorial's code cell -- Tutorial notebooks: `docs/tutorial/` (`quickstart`, `kernels`, `subjects`, `reduce`, `simulate`, `higher_order`, `events`, `decoding`, `htfa_network_animations`, `stocks`, `trajectories`; rendered without execution; execute them with nbconvert (needs jupyter) before committing, except the three real-data notebooks, which take minutes to tens of minutes and download data). Each starts with a Colab badge and a title cell; its first code cell installs, on Google Colab only, what the notebook imports: `timecorr` (`timecorr[segment]` for `events`, plus named packages such as polars where imported; the real-data notebooks install `timecorr[tutorials]` and `bottleneck>=1.5`, since pandas 3 warns about Colab's older bottleneck), with one shell line, `!pip install -q "timecorr>=0.3.1" ... || pip install -q "timecorr @ git+https://github.com/ContextLab/timecorr.git@master" ...`: release 0.3.1 or later (the first with the helpers the notebooks call) from PyPI, or git master when pip cannot install that (the cell prints nothing of its own; pip's error about PyPI shows before the fallback), and every notebook must run top to bottom in a fresh Colab runtime from that cell alone (the Colab badge is the way to run a tutorial; the docs give no other run instructions); text before a code cell is at most 3 short sentences, and numbers computed by the code are printed, not typed in the text. Code shared by notebooks lives in the package, not in the notebooks: the plot style of the eight simulated-data notebooks (`plt.style.use('timecorr.tutorial')`, with `COLORS` read from its color cycle), the data of the three real-data notebooks (`tc.datasets.story_listening`, `tc.datasets.industry_returns`, `tc.datasets.fetch`), their videos (`tc.render_video` calls the notebook's function that draws a run of frames; files go to `tc.media_dir()` and are shown with `tc.show_video`), community labels and constant columns (the `"labels"` and `"constant_columns"` entries of `return_info`). A thumbnail cell sets `%config InlineBackend.print_figure_kwargs = {'bbox_inches': None}` and shows a 4 x 3 inch figure made with `dpi=150` (600 x 450 pixels). `higher_order.ipynb` holds the PCA event-contrast measurement that `simulate_data`'s order >= 3 warning cites. `htfa_network_animations.ipynb` downloads the HTFA fit of the story-listening data of Owen, Chang & Manning (2021) (460 MB archive, cached under `$TIMECORR_DATA`, default `~/timecorr_data`) and draws the features of orders 1 to 4 on the brain with the htfa toolbox; it writes its four 1920 x 1080, 30 fps H.264 movies (frames rendered in parallel by `tc.render_video` with `retries=50`, since an off-screen view can come back black when GPU memory runs short, each worker keeping one pyvista scene per view for a run of frames and replacing only spheres and edges; encoded at CRF 23 with `+faststart`; one frame per timepoint, 300 frames, 10 s; `QUALITY = 'full'`, chosen with 4 or more usable cores; with fewer, as on Colab, `'preview'` draws 960 x 540 frames of every 8th timepoint and also shows the full-quality videos of the online docs when reachable) to `docs/_static/tutorial_media/htfa_order{1..4}.mp4` (committed; at most about 8 MB each) and links them with `