Repository navigation
v0.3.0
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
keyframesandease): 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 easeslinear,smooth,in,out,in-out, andhold, written withty.keyframes, andty.fadewrites 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
keyframesin place of arange, so that the mission time pauses, runs at several speeds, and eases (ruleclock-keyframes), andend="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 (rulelayer-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 (rulecamera-keyframes). The evaluator returns the window of such a camera under the panel's keycamera. -
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'slinespacing(rulelabel), and the scene can carry overlays, texts and legends over the whole panel area, withscene.textandscene.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 takesdecimals,grouping,factor, andoffset(ruletimeline-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 (rulepoints). 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 aglowwhile a channel is positive, andty.trajectories(..., line=False)draws the heads alone. -
A translucent trajectories layer with
group_opacity=Trueblends 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 withspan="box"draws the box of a plot with tick numbers and titles outside it, a declared panel can carry amarginand anopacity, a body animagedrawn in place of its disc, and the theme afontand aguttercolor. -
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
fand 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 givesseek(t),goto(step),playTo(step),next(),previous(),time,steps,currentStep, and the eventtycho-step, so that a slide deck advances a scene one step per click (rulesteps). -
The script
web/scripts/video.mjstakes--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 fullor--page minimalof the scriptweb/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'sminimalattribute underminimal. 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 (rulearrow). The arrow runs from the point of the trajectory to this point displaced byscaletimes a vector, which is read from two or three channels of the trajectory set, e.g.("vx", "vy")for a velocity. Its head isheadCSS pixels long at every zoom, 10 by default. On a trajectory of two samples withbefore="hidden"andafter="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 featurelayers.arrowsis listed in therequiresof 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 (ruleinset-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 ismin_sizeCSS pixels wide and tall at least, 8 by default, it can be dashed withdash=(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 aspaneland the shown target asshown_panel. The featurelayers.inset_boxis listed in therequiresof 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 (ruleorigin). A scene with such an origin lists the featureframes.origin_channelin itsrequires. The position of a body still takes numbers and attributes only. -
A trajectories layer can be left out of the camera fit with
fit=Falseinty.trajectories, i.e."fit": falsein 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"inty.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 (ruleread-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 featurelayers.read_fromin itsrequires. 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 badrevealand a badread_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 alongx,y, andzby 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 inz ×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 inputmanifolds-input.tydis attached to the GitHub Release, and its page is shown in the gallery. With--slide darkor--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.mjsexports the video of a page in headless Chrome, throughexportVideo, and writes the MP4 and a poster. -
The clock can be given
seconds, the length of one loop at speed 1, in either mode, withscene.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, wherekioskhides too much. With the valuepanels, 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, andonFrameofexportVideoraise 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 typeExportLimitsis exported. -
In a panel with a 3d camera, the keys
x,y, andzshow 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 underminimalandkioskand on a device whose pointer does not hover, such as a phone. -
Every key of
spec/scene.schema.jsonhas adescriptionwith 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, andspec/tycho-scene.mdkeeps 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_setsbecomestrajectory_sets,variablesbecomesinputs, andviewsbecomespanels. In a trajectory set,tracksbecomestrajectories, and{"view": name}becomes{"array": name}. The input kindselectorbecomesparameter, its keybyis removed in favor of the built-in parameter@index, the scopessceneandpanelbecomesharedandper_panel, and the reference{"var": id}becomes{"input": id}. In the clock,stepsbecomesframe_count,lapsbecomesrevolutions, and the modevaluebecomesepoch. The camerasorbitandplanebecome3dand2d, and a panel'sdriverbecomesreference. The layer kindtrackbecomestrajectories, the member reference{"count": n}becomes{"evenly_spaced": n}, and the colormap'sclipbecomestruncate. The text parts{"member"},{"clock": "index"}, and{"clock": "steps"}become{"parameter"},{"clock": "frame_index"}, and{"clock": "frame_count"}. The control keyvariablebecomesinput, and the controltransportbecomesplayback. In pytycho,TrackSet,ty.track,ty.driver,ty.every,ty.sets, andty.set_idbecomeTrajectorySet,ty.trajectories,ty.reference,ty.evenly_spaced,ty.by_tags, andty.by_id,scene.track_set,scene.selector, andscene.transportbecomescene.trajectory_set,scene.parameter, andscene.playback, and the keyword arguments follow the same words, e.g.laps=becomesrevolutions=. - Views are merged into panels. The key
panelsof a scene declares the panels that a page may show, with the frame, camera, reference trajectory, and layers that a view had, andscene.panel(id, frame=, reference=, layers=, ...)declares one in place ofscene.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 methodscene.show(id, panel=, inputs=)adds a shown panel to the initial state, in place of the formerscene.panel(id, view, values). - The data container is at version 2, whose header lists its arrays under
arraysrather thanviews, and a reader rejects every container version but 2 (rulecontainer-version). - The rules of the spec are named rather than numbered, e.g.
transform-channelsin place of F5 andrevolutionsin place of C6. Each rule is a bullet ofspec/tycho-scene.mdthat opens with its name, aSceneErrorand aValueErrorof pytycho start with the name, theruleof aTychoErroris the name, and the conformance corpus cites the name. - In the runtime, the size preset
stageof the video export becomespanels, and the custom property--headbecomes--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
kiosktoo, 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
0rewinds 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.