Working with data

Measuring

Cursors and ranges over the plot, the samples underneath as a spreadsheet, and a calculation pad beside it.

Turning measuring on

Press the Measure button in the toolbar, or ⌘'. A readout panel docks under the tracks; drag its top edge to resize it. You can also measure without opening the panel at all — see Measuring without switching the tool on.

run_a.csv ⊕⇥
Motor
voltage
current
3.7 3.3 2.9
1 2 3
Drive
temperature
47 41
Measure CursorsRange Clear   ×
Rows 3
MOTOR DRIVE
#x voltage current temperature
00.0793.162711.3879842.622
10.2313.018311.2574445.358
20.293.37870.97145946.42
0 mean(voltage) 3.18657
1 swing = max(current) − min(current) 0.416525
2 swing / 2 0.208262
3
  1. Measure — the toolbar toggle, or ⌘'.
  2. Numbered chips — drawn on the topmost track only; the lines cross every track.
  3. Snap dots — the sample each visible signal resolved to.
  4. Tool — cursors or a range. Switching discards the other tool's marks.
  5. The table — one row per cursor, one column per visible signal, grouped under the track it sits on.
  6. The calculation pad — expressions over the table, answers in a column of their own.
Three cursors, and the samples they landed on.

There are two tools, chosen with the segmented control in the panel header:

ToolMarksTable rows
CursorsNumbered vertical lines you place one at a time.One per cursor.
RangeA shaded band between two edges.One per sample inside the band.
0 1 Click → drop a cursor drag to move it, click it again to remove it Drag → select a range drag either edge to adjust, click open plot to clear
The two tools claim the plot's drag gesture while they are on.

Switching between the two tools discards the other's marks. Switching the tool off keeps them drawn over the plot, so you can go back to zooming and still see what you measured.

ActionEffect
⌘' or the toolbar buttonSwitch the tool on and off. The panel follows.
⇧⌘' or ClearDiscard the cursors and the range, keeping the tool on.
× in the panel headerClose the panel and discard the measurement.
Note

While a tool is on it takes over the plot's drag gesture, so drag-to-zoom and double-click-to-reset are suspended there. The ruler, the y-axes and the zoom commands still work.

Measuring without switching the tool on

You do not have to turn Measure on first. Two modifiers borrow a measurement tool for the length of a single gesture, without opening the panel.

GestureResult
⌘-click a plotPlace a measurement cursor.
⇧-drag across a plotSelect a statistics range.
Drag, with nothing heldZoom, exactly as before.
Drag → zoom unchanged — nothing held, no tool on 0 ⌘-click → cursor the panel stays closed ⇧-drag → range the panel stays closed
One plot, three gestures — the modifier you hold picks which.

The marks are drawn over the plot exactly as they are with the tool on, so you can annotate a plot, carry on zooming, and press ⌘' only when you want the numbers. The panel opens on whichever tool you last used.

How a modifier and the tool interact

A held modifier wins over whatever tool is switched on, so ⌘ places a cursor even while the range tool is active. Where both are held, ⌘ beats ⇧.

GestureTool onResult
⌘-clickNoneCursor placed. The panel stays closed.
⇧-dragNoneRange selected. The panel stays closed.
⌘-clickRangeCursor placed, and the open panel switches to cursors.
⇧-dragCursorsRange selected, and the open panel switches to range.
⌘-clickCursorsCursor placed, the same as a plain click.
Bare dragNoneZooms.
Note

Cursors and a range never coexist. Landing one drops the other, which is the same thing switching tools has always done — a modifier just makes the switch one gesture at a time.

The panel follows the gesture only when it is already open. A ⌘-click on a plot with the panel closed leaves it closed, which is the point of reaching the tools this way; Refract still records which tool you used, so the next ⌘' opens on it.

Cursors

With the cursor tool on, click anywhere in a plot to drop a cursor — or ⌘-click with no tool on at all. Drag it to move it; click it again to remove it. Pressing on empty plot creates a cursor straight away, so one motion can drop it and slide it into place.

A cursor marks an x position, so its line is drawn across every track and the panel reports every visible signal at that x. Numbered chips appear on the topmost track only.

Cursors always snap to the nearest sample of a visible signal on the track you clicked, so a reading is never taken from between samples. A dot on each visible signal shows which sample was picked.

Cursors stay sorted left to right, so their numbers always match the order on screen and the order of the rows in the table.

A cursor reports every signal at the one x it marks, and stays there. For a reading that follows the pointer and leaves nothing behind, quoting each sample at its own x, see the crosshair.

Range

With the range tool on, drag across a plot to select a range — or ⇧-drag with no tool on at all. Drag either edge to adjust it; a click on open plot clears it. The band shades every track.

The summary strip above the table reports Rows, and then From, To and Span. A span on an axis that measures time is reported in SI units — 12.4 ms — rather than as a bare number.

Rows are the samples inside the band. They follow the densest axis among the visible signals, and signals on any other axis are sampled onto it.

Those three describe what the measurement covers, not where the pointer stopped: they are the first and last row's own x, so the span is the samples in the table and nothing more. A drag lands between samples, and a band dragged across five samples of a 10 Hz log would otherwise claim a span up to 40% longer than the samples it holds. The numbers snap to the rows underneath as you drag, so what the strip says is always backed by a row.

A band covering no samples reports Rows 0 and nothing else — there is no start, finish or span to quote.

Tip

A range can cover millions of samples without slowing the panel down — rows are built only as you scroll to them.

The measurement table

Rows are x positions; columns are the visible signals, in track order, each under a tinted band naming the track it sits on.

MOTOR DRIVE
#x voltage current temperature
00.0793.162711.3879842.622
10.2313.018311.2574445.358
20.293.37870.971459—
  1. Row number — 0-based, and the number a formula uses to index the column.
  2. x column — the position each row was taken at.
  3. Track band — spans exactly the columns belonging to that track.
  4. No value — the signal has a gap at this row.
Cells show six significant figures; the full value is a copy away.

The table follows the tracks. Add a signal, hide one, or reorder the tracks, and the columns change with them.

Note

Every column is a signal on a track. To measure something the table does not already hold, add it as a computed signal — it then appears here as a column like any other.

Absolute values and deltas

Click a column header to switch that column between absolute values and the step from the row above. Click it again to switch back. The x column toggles the same way, where the step is the spacing between adjacent rows — the cursor-to-cursor interval on a time axis. Any number of columns can be in delta mode at once.

A column showing steps marks itself with a hollow triangle in place of its filled dot.

#x voltage current
00.0793.162711.38798
10.2313.018311.25744
20.293.37870.971459
# x voltage current
079 ms3.162711.38798
1+152 ms−0.144395−0.130541
2+59 ms+0.36039−0.285981
The same three rows, absolute and as steps from the row above. A row with nothing above it keeps its own value, dimmed and slanted, so the column still says where it started.
  • Steps are signed, and tinted green or red by direction.
  • x steps carry the axis's unit when it measures time. A y step is a difference between two samples, so it carries no x unit.
  • A row with nothing above it to measure from — the first row, or the first reading after a gap — shows its absolute value instead, dimmed and slanted.
  • A row with no reading at all shows —.
  • A delta column holds the same values diff() would compute over it.
  • Deltas are a display choice only. Copying follows what is on screen, but a reference inserted from a cell always names the sample, never the step.

The calculation pad

The pad sits to the right of the table. Each line is an expression over the table's columns, with its answer right-aligned in a column of its own. Drag the splitter between the two to set the pad's width; the width survives closing and reopening the panel.

0 mean(voltage) 3.18657
1 swing = max(current) − min(current) 0.416525
2 swing / 2 0.208262
3 voltage[2] − voltage[0] 0.215993
4 diff(voltage) 3 pts
5 rms(current ⚠
6 mean(voltage)
Line 1 names its answer; line 2 uses it. Line 4 produced one value per row rather than a single number, so the pad reports its size instead.

Reducers scope to whatever the table currently holds, so mean(voltage) follows the cursor set or the selected range and re-evaluates as either changes.

Editing

The pad keeps an empty line at the bottom and the keyboard does the rest; there is no add or remove button.

KeyAction
ReturnAccept the highlighted suggestion, or move to the next line, opening one if needed.
⌫At the head of an empty line, close it and put the caret at the end of the line above.
↑ ↓Cycle suggestions. With no list showing, walk the pad as one document.
TabTake the suggestion when it is the only one, otherwise step to the next.
EscDismiss the suggestion list.

Autocomplete offers the table's signals and the lines above the caret. A signal is inserted qualified by its source when its name alone would be ambiguous.

Answers

  • A line that reduces to a single number shows that number, to six significant figures.
  • A line that produces one value per row is a column, not an answer: the pad reports n pts, which is the cue to wrap it in a reducer.
  • While you are typing, the column holds the last answer that parsed, dimmed.
  • A committed error shows a warning triangle with the reason on hover; the editor marks the offending token.

Referring to cells and lines

Click a cell in the table to write a reference to it into the pad. Drag down a column to select a span of rows and reference all of them at once.

In the tableInsertedMeans
Click one cellvoltage[2]That signal at row 2.
Drag down a columnvoltage[2:5]Rows 2 to 5, inclusive at both ends.
Click an answer in the padline2 or its nameThat line's answer.

Row numbers count from zero, matching the chips on the plot and the row-number column: voltage[0] is the first row, and a span is inclusive at both ends. The reference lands at the caret in the line you were last editing, and the keyboard follows it there.

Naming a line

Write name = expression to name a line's answer. Lines below can then use that name. Every line is also reachable as line0, line1, … whether it is named or not — the first line is line0.

References only reach upward: a line can name the lines above it, never below.

  • Redefining a name shadows the earlier one from that line down.
  • Deleting a line renumbers the line<N> references that pointed past it.
  • A reference to the deleted line becomes line_deleted, which never resolves — so it reads as broken instead of silently pointing at whichever line moved into that number.
Note

The x column is not a formula reference. To read a Δx, switch the x column to deltas, or reference a signal that carries the value you want.

Copying readouts

⌘-click a cell, or right-click it and choose Copy. A pad answer that is a single number copies the same way; ⌘-clicking any other answer inserts a reference to it instead.

Values reach the clipboard at full precision, not the six figures shown on screen.

Examples

change between cursor 0 and cursor 2
voltage[2] - voltage[0]
peak-to-peak over the selected range
max(current) - min(current)
ripple, ignoring the DC level
rms(voltage - mean(voltage))
a named intermediate, used below
span = max(temperature) - min(temperature)
span / 2
average of one window of rows
mean(voltage[10:200])
how many rows the signal actually has a value at
count(temperature)