Skip to content

Releases

v0.3.1

Choose a tag to compare

@ClouD-161803 ClouD-161803 released this 21 Nov 19:40
759e073

Scene format 0.5 and data container version 2 are written and read at this version, as at 0.3.0. A scene that uses the forms added below, e.g. a marker colored by a colormap, is rejected by the runtime of 0.3.0.

Added

  • The color of the marker of a points layer takes the forms of the color of a trajectories layer, i.e. a colormap over a parameter, which colors each member, and a colormap over a channel or ty.threshold_color, which color each sample, e.g. ty.marker("disc", 1.6, {"colormap": "plasma", "channel": "height", "range": (0.0, 0.8)}). A cloud of samples is thus colored by a stored value, as c= colors a matplotlib scatter plot, in one layer. The colormap magma is added, and a truncate of (1, 0) reads a colormap in reverse.
  • An axis title of a frame takes subscripts and superscripts, as a list of strings, ty.sub parts, and ty.sup parts, e.g. scene.frame("phase", axes=("C", ["initial x", ty.sub("0")], "z")) (#46). A script is set smaller and off the baseline, in the font of its title, in a plane panel, in the box of an axes layer, and at the tips of 3d axes. Unicode subscript digits are missing from many fonts, and the browser then draws them in another font.

Fixed

  • On macOS, the Chrome that is started by the scripts web/scripts/video.mjs, web/scripts/poster.mjs, and web/scripts/frame-profile.mjs and by the tests does not copy its app into a temp folder, and it is ended with Browser.close of the DevTools protocol rather than with a signal (#51). Each start left a copy of about 1,300 files behind, which macOS removes only at boot.
  • A video export is encoded and tagged in full range, with BT.709 primaries and matrix and the sRGB transfer, and its colors hence match the page in PowerPoint (#49). Chrome encoded the export in limited range, which PowerPoint draws about one level dark, so that a faint box could be seen around a video on a slide of its background color. An export takes about a quarter longer.
  • The text of a video export is drawn with the page's antialiasing and baselines in Chrome on Linux, without colored fringes, and a rotated axis title on the pixel row the page shows it on (#48).
  • A points layer whose marker does not give a color is drawn in the foreground of the theme, as the scene reference says. Such a layer was drawn in white, which hardly shows on a light page.
  • A points layer whose member is selected by a parameter input is drawn again when the input changes, e.g. when its slider is moved. Such a layer kept the member of the loaded page, unless it was revealed or given before or after.
  • A row of tabs that is wider than the page is wrapped onto further lines, and a label wider than the page is wrapped within its tab, so that every tab can be reached on a phone. Such a row stayed on one line, ran off the screen, and widened the panels past it.
  • Every viewer on a page with more viewers than the browser keeps WebGL contexts, i.e. more than 16 in Chrome, draws its scene when it is shown (#44). A viewer makes its context when it first draws, rather than when its scene loads. Once more than eight viewers of a page hold a context, the contexts of the viewers shown least recently are released, and a released viewer makes a new one when it is shown again, with its cameras and its time as they were. Chrome took the contexts of the first viewers of such a page for good, which then stayed blank.

v0.3.0

Choose a tag to compare

@ClouD-161803 ClouD-161803 released this 14 Nov 06:10
47d65e1

Scene format 0.5 and data container version 2 are written and read at this version, and a scene or a container of an older version is rejected and is written again with this version of pytycho. Format 0.5 differs from format 0.2, the format of 0.2.0, by the arrow and inset box layers, layers that read their trajectories with the attributes and channels of the reference trajectory (layers.read_from), origins given by channels, and the timeline, with the features clock.keyframes, layers.clock, camera.keyframes, layers.label, and layers.points. It also renames keys and values of format 0.2 without aliases, as listed under Changed.

Added

  • The timeline (rules keyframes and ease): values that move by the time of a loop in seconds rather than by a stored channel, for a scene that tells a story, e.g. a video for a talk. A moving value is a list of keyframes (t, v) or (t, v, ease) with the eases linear, smooth, in, out, in-out, and hold, written with ty.keyframes, and ty.fade writes an opacity that rises and falls. The opacity of every layer, of a trajectory's head, of a marker, of a declared panel, and of an overlay may be given by keyframes, as may a marker's size and a split's ratio (ty.split(..., keyframes=)).

  • A clock in epoch mode can take keyframes in place of a range, so that the mission time pauses, runs at several speeds, and eases (rule clock-keyframes), and end="stop" holds the end of the loop as a video does.

  • A trajectories, arrow, points, or label layer can carry a clock of its own, ty.layer_clock(channel, range=, keyframes=), and then reads its trajectories on that channel whatever the scene's clock does (rule layer-clock).

  • A 2d camera can carry keyframes, ty.camera_keyframe(at, width=, center=, follow=, offset=, height=, ease=), which zoom, pan, and follow the mean of moving points of the panel's trajectories layers (ty.follow(layer, member)), with eased blends in which the width changes geometrically (rule camera-keyframes). The evaluator returns the window of such a camera under the panel's key camera.

  • A label layer, ty.label(text, at, ...), writes a text at a point, a moving member, or a place in the panel, with a leader, a box, and matplotlib's linespacing (rule label), and the scene can carry overlays, texts and legends over the whole panel area, with scene.text and scene.legend.

  • The parts of readouts, labels, and overlays include the clock's value (ty.clock_value), the time (ty.clock_time), the value of keyframes for a counter (ty.keyframed_number), and a caption that changes at given times (ty.timed_text), and a number part takes decimals, grouping, factor, and offset (rule timeline-parts). A channel part reads a channel with "interp": "hold" without a blend.

  • A points layer, ty.points(sets, members, marker=, reveal=), draws stored samples as markers, which can appear as the clock passes them (rule points). Markers, ty.marker(shape=, size=, color=, edge=, edge_width=, opacity=), come in eight shapes and draw their edges as matplotlib does, a trajectory's head takes the same form and a glow while a channel is positive, and ty.trajectories(..., line=False) draws the heads alone.

  • A translucent trajectories layer with group_opacity=True blends each pixel its lines cover once, as matplotlib draws one translucent path, rather than once per segment, so that a cloud of many lines at opacity 0.2 keeps one shade where its lines overlap and tints what lies beneath it by that much. The renderer marks the pixels in a stencil, which the canvas and the targets of the static layers now carry.

  • A trajectories layer can be dashed (dash=), each trajectory's pattern starting again wherever the trajectory enters the panel area, as matplotlib clips a line to its figure before it dashes it, filled down to a base value (fill=), and colored at thresholds of a channel (ty.threshold_color). An axes layer with span="box" draws the box of a plot with tick numbers and titles outside it, a declared panel can carry a margin and an opacity, a body an image drawn in place of its disc, and the theme a font and a gutter color.

  • A panel whose camera has keyframes and whose view the viewer panned or zoomed shows a button, Timeline view, which hands its camera back to the keyframes. The key f and the house icon of the View group do so for every panel, and fit a panel without keyframes as before.

  • A scene can name steps, the times a presentation stops at, with scene.step(id, at), and the viewer element gives seek(t), goto(step), playTo(step), next(), previous(), time, steps, currentStep, and the event tycho-step, so that a slide deck advances a scene one step per click (rule steps).

  • The script web/scripts/video.mjs takes --font-bold, the bold face of the font given by --font, and --font-fallback, installed fonts for the characters the font lacks, e.g. mathematical italics.

  • With --page full or --page minimal of the script web/scripts/video.mjs, the whole page is recorded as it plays, i.e. the title, the controls, the readouts, and the playback control around the panels, with the viewer's minimal attribute under minimal. The frames are encoded with ffmpeg, which must be on the PATH.

  • A fixed color of a scene that equals the foreground or the background of its theme follows a palette that replaces the theme, so that a scene written for a white page, with black lines and white marker fills, is drawn light on a dark slide.

  • A citation file, CITATION.cff, from which GitHub shows how to cite TyCHO, and from which Zenodo takes the title, the authors, and the license of an archived release.

  • An arrow layer, built with ty.arrow(sets, vector, members, scale=, before=, after=, color=, opacity=, width=, head=), draws an arrow on each member at the clock's reading (rule arrow). The arrow runs from the point of the trajectory to this point displaced by scale times a vector, which is read from two or three channels of the trajectory set, e.g. ("vx", "vy") for a velocity. Its head is head CSS pixels long at every zoom, 10 by default. On a trajectory of two samples with before="hidden" and after="hidden", an arrow is shown only while the clock value is in the window of the trajectory, as for a velocity drawn at a node of a correction. The feature layers.arrows is listed in the requires of a scene with an arrow layer.

  • An inset box layer, built with ty.inset_box(panel, color=, opacity=, width=, dash=, min_size=), draws the rectangle that the first shown panel of another declared panel currently shows, and it follows that panel's camera as the viewer pans and zooms it (rule inset-box). The rectangle is mapped from the display frame of that panel into the display frame of the layer's panel at the reading of the layer's reference trajectory, hence a close-up in a magnified frame is outlined where it lies on the large panel. The box is min_size CSS pixels wide and tall at least, 8 by default, it can be dashed with dash=(on, off), and it is not part of the camera fit. It is not drawn while the layout does not show the target panel. In the result of the evaluator, an inset box layer gives the declared target as panel and the shown target as shown_panel. The feature layers.inset_box is listed in the requires of a scene with an inset box layer.

  • The origin of a frame can be given by channels, e.g. origin=[ty.channel("tx"), ty.channel("ty"), 0.0], together with a scale given by a channel, for a frame that follows and magnifies a moving point (rule origin). A scene with such an origin lists the feature frames.origin_channel in its requires. The position of a body still takes numbers and attributes only.

  • A trajectories layer can be left out of the camera fit with fit=False in ty.trajectories, i.e. "fit": false in the scene, while it is still drawn. A close-up can then draw a whole curve and keep its camera fitted to the window that another trajectories layer gives. The default is unchanged, and the key is not a feature, since a reader that ignores it draws the same trajectories at another zoom.

  • A trajectories layer can read its samples from the reference trajectory, with read_from="reference" in ty.trajectories. Every sample of its trajectories is then transformed into the display frame with the attributes and channels of the reference trajectory at its current reading (rule read-from). A grid stored in the rotating-pulsating frame of the elliptic problem thus breathes and turns with this frame when the rotating or an inertial frame is shown, and its trajectory set does not need to carry any channel. A scene with such a layer lists the feature layers.read_from in its requires. The camera is fitted to the layer as it is drawn at every sample of the reference trajectory, or to the images of the 8 corners of its box when the layer has more than 8 points and the reference trajectory very many samples. On a layer with both a bad reveal and a bad read_from, the error of the reveal is reported first, by pytycho and by the runtime alike.

  • A 2d camera can be given "aspect": "free", under which the two axes are scaled separately in the fit, so that a diagram such as a residual against an iteration count is drawn across the whole panel in both directions. Each axis of the axes and grid layers is then ticked at a step for its scale. Under the default, "equal", one unit is as long across the panel as up it.

  • A 3d camera can be given a stretch, three factors along x, y, and z by which every position in its panel is multiplied, e.g. [1, 1, 5] to show the out-of-plane motion of a halo orbit. The camera is fitted to the stretched drawing, every axis is drawn at one length, and a stretched axis is titled with its factor, as in z ×5.

  • A 3d camera can be given an auto_rotate, the degrees by which it turn...

Read more

v0.2.0

Choose a tag to compare

@ClouD-161803 ClouD-161803 released this 07 Nov 01:11

Version 0.2.0 introduces the scene grammar, i.e. a general vocabulary from which a visualization is declared. The packages at this version write and read scene format 0.2, which may still change incompatibly until 1.0, and data container version 1.

Added

  • TyCHO describes each scene in a scene grammar. A scene is two files, which a Python script writes from NumPy arrays and the browser interprets. The grammar covers track sets (collections of trajectories) with per-sample channels (numbers stored at every sample, such as the time), bodies (named points), a tree of reference frames, variables, one clock, views with layers, panels, controls, and readouts. The rules of the grammar are numbered in spec/tycho-scene.md, and spec/scene.schema.json gives its structure. The conformance corpus in spec/conformance/ holds scenes with the answers an evaluator must give, and both the Python and the TypeScript evaluators pass it.
  • Two files store a scene. The scene document scene.tys is JSON that refers to the arrays by name and specifies what they are. The data container data.tyd holds a TYCD magic number, a JSON header, and named little-endian typed arrays. Each array is stored raw or, when this is smaller, compressed without loss in chunks of about 1 MiB. The compression takes the bit pattern of each number, replaces each row by its difference from the row before (delta coding), groups the bytes by their position within each number (byte shuffling), and deflates the result. A browser inflates, i.e. decompresses, these chunks with its native DecompressionStream, and a reader can decode one chunk at a time. The input of the Broucke example takes 60 percent of its raw size, and its page takes 12.7 MB, against 22.1 MB with the whole container gzipped.
  • pytycho provides the Scene builder, thinning, and evaluate. The builder checks every call, then checks the whole scene for every value its variables can take, and reports each failure with the number of the rule it breaks. Thinning keeps a subset of the stored samples, selected by arclength, measured in the frames listed in the call, by default the frame of the set. The function evaluate returns what the browser draws for a frame index, so that a test can check what a scene draws without a browser.
  • The runtime provides the <tycho-viewer> element, which draws any scene in panels that can be rearranged by drag and drop. Each panel keeps separate values of the panel-scoped variables, e.g. the frame that it shows. The element draws sliders, tabs, toggles, a transport (the controls that play and pause the clock and switch its active channel), and readouts.
  • Playback runs at the refresh rate of the display. Every refresh draws at the progress given by the wall time, i.e. the real time elapsed, and this progress may lie between two frame indices. The layers under the first layer that takes a clock reading do not move with the animation. They are drawn once per panel, until the camera or these layers change, and copied back every frame. Body trails are read from positions kept per lap, so that a frame copies a trail instead of computing it. The frame rate shown counts the frames drawn in the last second. The script web/scripts/frame-profile.mjs measures what a frame of an example page costs, in headless Chrome.
  • The viewer exports an MP4 video of its current state, from its controls or through exportVideo. The video is encoded in the browser itself, with the WebCodecs API and the mp4-muxer library.
  • The npm package ships type declarations, which let TypeScript check code that uses the package.
  • A track set stores its positions and channels as float32 by default. pytycho now stores a clock channel as float64 in a float32 set when float32 would round the ends of a step between samples by more than 1% of the step, or would make the channel nonmonotone. A nonmonotone channel would break rule T3, under which a clock channel increases or decreases strictly along every track. The argument track_set(channel_dtypes=) sets the stored dtype of a channel by hand.
  • build_html embeds the container as base64 text without further compression, since its arrays are already compressed. It rejects a scene or data whose base64 is longer than 536,870,888 characters, the most that Chrome holds in one string, since a longer text would leave the page empty.
  • Both container readers reject a view key or an encoding they do not know (rule D2), since a reader that ignored either could read the bytes wrongly. Section 1 of the spec specifies which changes bump the container version (rule D3). Container.parse in the runtime and the load method of the element return promises, since they inflate the encoded views, which the browser does asynchronously.
  • The Broucke example reads its trajectories from broucke-input.tyd, a data container attached to each GitHub Release. It imports only NumPy, pytycho, and the standard library, hence it runs without PyDyLAN.
  • An agent skill, skills/tycho/SKILL.md, sets out the scene grammar for a coding agent. It can be installed as a Claude Code plugin from this repository or with npx skills add beeson-group/tycho.
  • The npm package bundles three.js and mp4-muxer, and it does not have any runtime dependencies, hence installing it does not install any other package.
  • Both packages declare the license Apache-2.0 AND MIT, since the bundle carries MIT-licensed code, and they ship NOTICE and THIRD_PARTY_NOTICES.md. Every bundle starts with a comment listing the bundled packages. Every page that pytycho writes inlines the bundle, and thus carries the same comment.