Skip to content

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 turns about its up axis over each loop of the clock, at a constant rate. The rotation is added to how the viewer has turned the camera, and it is applied in an exported video as well. The static layers of a panel whose camera rotates are drawn at every frame.

  • A second example is examples/manifolds/build.py. In it, an L1 halo orbit and the L1 and L2 Lyapunov orbits of the Earth–Moon problem are drawn in 3D with the four legs of their invariant manifolds, in the rotating and the barycentric inertial frames. Its input manifolds-input.tyd is attached to the GitHub Release, and its page is shown in the gallery. With --slide dark or --slide light, a page with the halo alone in two stacked panels is written instead, in the palette of the talk template, for a video on a slide.

  • The script web/scripts/video.mjs exports the video of a page in headless Chrome, through exportVideo, and writes the MP4 and a poster.

  • The clock can be given seconds, the length of one loop at speed 1, in either mode, with scene.clock(..., seconds=24). Without it, a loop lasts 8 seconds for each revolution, as before.

  • The viewer element takes the attribute minimal, under which the Add panel group, the icons of the panel headers, the frame and rate readouts, the View group, and Export are hidden, while the title, the controls of the scene, play, the scrubber, and the speed menu stay. It is meant for a slide on which the controls of the scene are worked by hand, where kiosk hides too much. With the value panels, the Add panel group and the icons of the panel headers stay, for a slide on which panels are added by hand.

  • The options limits, keyFrameInterval, hardwareAcceleration, kiosk, and onFrame of exportVideo raise the ceiling of an export, e.g. to one loop of 72 s at 60 fps, set the interval of the key frames, down to a single key frame, choose the encoder, record a kiosk picture from any viewer, and hand each frame to the caller. The type ExportLimits is exported.

  • In a panel with a 3d camera, the keys x, y, and z show the view from the positive side of that axis, and from the negative side with Shift, and . and , turn the view about the camera's up axis by 15 degrees, or 90 with Shift (#7). They act on the panel under the pointer, or on every panel with a 3d camera. While the pointer is over such a panel, the keys are listed at its foot as key caps, except under minimal and kiosk and on a device whose pointer does not hover, such as a phone.

  • Every key of spec/scene.schema.json has a description with its unit and its default. The page Scene reference of the docs is generated from these descriptions, and the TypeScript types of the npm package carry them as doc comments. The concept pages of the guide are removed, and spec/tycho-scene.md keeps the layout of the data container and the rules that a reader follows, without the meaning of each key and without the drawing.

Changed

  • Scene format 0.5 renames keys and values of format 0.2 after the words of GLOSSARY.md, without aliases. At the top level, track_sets becomes trajectory_sets, variables becomes inputs, and views becomes panels. In a trajectory set, tracks becomes trajectories, and {"view": name} becomes {"array": name}. The input kind selector becomes parameter, its key by is removed in favor of the built-in parameter @index, the scopes scene and panel become shared and per_panel, and the reference {"var": id} becomes {"input": id}. In the clock, steps becomes frame_count, laps becomes revolutions, and the mode value becomes epoch. The cameras orbit and plane become 3d and 2d, and a panel's driver becomes reference. The layer kind track becomes trajectories, the member reference {"count": n} becomes {"evenly_spaced": n}, and the colormap's clip becomes truncate. The text parts {"member"}, {"clock": "index"}, and {"clock": "steps"} become {"parameter"}, {"clock": "frame_index"}, and {"clock": "frame_count"}. The control key variable becomes input, and the control transport becomes playback. In pytycho, TrackSet, ty.track, ty.driver, ty.every, ty.sets, and ty.set_id become TrajectorySet, ty.trajectories, ty.reference, ty.evenly_spaced, ty.by_tags, and ty.by_id, scene.track_set, scene.selector, and scene.transport become scene.trajectory_set, scene.parameter, and scene.playback, and the keyword arguments follow the same words, e.g. laps= becomes revolutions=.
  • Views are merged into panels. The key panels of a scene declares the panels that a page may show, with the frame, camera, reference trajectory, and layers that a view had, and scene.panel(id, frame=, reference=, layers=, ...) declares one in place of scene.view. A shown panel is a panel on the page, and the state maps the id of each shown panel to {"panel": declared id, "inputs": {...}}. The method scene.show(id, panel=, inputs=) adds a shown panel to the initial state, in place of the former scene.panel(id, view, values).
  • The data container is at version 2, whose header lists its arrays under arrays rather than views, and a reader rejects every container version but 2 (rule container-version).
  • The rules of the spec are named rather than numbered, e.g. transform-channels in place of F5 and revolutions in place of C6. Each rule is a bullet of spec/tycho-scene.md that opens with its name, a SceneError and a ValueError of pytycho start with the name, the rule of a TychoError is the name, and the conformance corpus cites the name.
  • In the runtime, the size preset stage of the video export becomes panels, and the custom property --head becomes --header.
  • The Add panel group offers every declared panel, by its label or its id, and nothing else, also when the scene has one declared panel and a per-panel choice, where it offered the values of the choice before. Adding a declared panel that is already shown makes a copy with a new id, whose frame is then switched with the chip in its header. A panel header hides the title of its panel when the title repeats the label of the frame, which the chip of the header already shows. The Broucke example declares one panel per frame, hence its Add panel offers the five frames.
  • The colorbar of a layer colored by a parameter is the slider of the input of that parameter under kiosk too, where the link was off before, so that a click on the bar of a kiosk page sets the value.
  • A key pressed while a tab, a switch, or a button of the viewer has the focus acts on the viewer, unless the control takes the key itself, as a button takes Space and Enter. Hence 0 rewinds the loop right after a click on a tab, where the key was swallowed before.
  • The ends of a colorbar are written as integers when both are integers, as for an iterate count, so that a bar from 0 to 10 is ticked 0 and 10 rather than 0.00 and 10.0.
  • The keys . and , no longer step one frame, and > and < no longer step ten frames, since they now turn the view of a 3d camera (#7). The right and left arrows step one frame as before, and ten frames with Shift.

Fixed

  • A frame of a video export is the picture of the viewer on the page at the time of this frame, at the same size in CSS pixels. The runtime lays out a hidden copy of the viewer at the size of the video and paints it onto the frame. Hence the export of a kiosk viewer leaves out the caption, the text is set in the fonts of the page with the halos of its labels, the colorbar sits where the page draws it with the same ticks and marker, and the camera fit of a kiosk export is that of the page, whose panel area is not shortened by a caption strip.

  • An axis title under the label of a body is hidden, while the label is kept, since it is the name of the disc beside it. In the rotating panel of the manifolds slide, the title of the x axis was drawn over the label of the Moon, which is on the x axis. The overlap is found from boxes estimated from the text, so that the same titles are hidden in a page and in an exported video.

  • The colorbars of a panel are placed under the panel header and above its row of x tick numbers, and they are shortened to fit between the two, or hidden when the panel is too short to hold their title and both ends. A tick number of the y axis is no longer drawn under the panel header, which may wrap to two rows on a phone. A tick number or an axis title that would cover a colorbar is hidden, and the label of a body that would cover one is moved to the other side of its disc, or hidden when it still covers the colorbar there. In the rotating panel of the Broucke example, the colorbar ran past the bottom of the panel and cut off its lower end, and the top tick numbers of two other panels were half hidden under their headers.

  • At a fractional device pixel ratio, e.g. 1.5, a panel no longer shifts by half a device pixel at the frames at which its static layers are drawn again. Leaving the target of those layers, three floored the canvas's viewport and scissor where setting them rounds them, so that the panel's other layers were drawn one pixel shorter at those frames, and a still picture shook in an exported video. The first frame of a video shifted the same way.

  • The static layers of a panel are no longer lost at a fractional device pixel ratio, e.g. 1.25. At such a ratio, the viewport was rounded up past the end of the drawing buffer, and the copy of these layers was refused by WebGL, which left the panel gray.

  • A drag across a panel of a 3d camera turns the view about the camera's up axis, as a turntable, and a drag up the panel tilts it toward this axis (#7). The controls took the axis from the camera before its up was set, i.e. from three's default, +y, hence a scene with the up axis z, the default, was tumbled about a horizontal axis.

  • The panel header has the background of the theme again, the surface color at 80% opacity. The viewer wrote the height of the header into --header, the color token of this background, and the header was drawn transparent over the picture of the panel.