# Notebooks

# Notebooks

Use a notebook to work out a number on live data while the test runs: filter a
noisy pressure, take an RMS, chase a wobble from yesterday's run. A setup runs
the test; a notebook only analyzes. It has no **Deploy** and no **Stop**, and
it can never drive an output.

In **Trellis**, choose **New notebook**. Write cells, separated by `# %%`:

```python
ch = channels()

# %% [markdown]
# How much noise rides on this signal?

# %%
sig = ch["/ni/ai1"]
sig_clean = weir.ema(sig, alpha=0.2)

# %%
noise = weir.rms(sig, window_ms=1000)
chart("noise vs signal", [sig_clean, noise])

# %%
probe(noise.below(0.4))
```

## Draft channels

Each name you compute becomes a live **draft channel** under the notebook's
name: `sig_clean` above is `/draft/noise-check/sig_clean`. Use it like any other
channel: chart it, watch it on **Live**, name it in an alert. It stops when the
notebook does.

A draft can't be used in an interlock; the deploy is refused. Publish it as a
derived channel first, or use an alert instead.

When you edit a cell, only that cell and the cells that depend on it restart.
Fixing a typo in your notes never restarts a running calculation. A cell with a
mistake turns red; the others keep running.

| Per cell | Does |
|---|---|
| **Run** (⇧⏎) | runs the cell |
| **Mute** | pauses it |
| **Reset** | clears its built-up state (an integrator, an RMS window) and starts it fresh |

## Where a number came from

Every draft and derived channel remembers the notebook **and the cell** that
defined it.

On **Live**, a computed channel's tile has a small branch chip by its name.
Click it to see what the channel is, what it can feed, and an **origin** row
naming the notebook. Click that row to open the notebook in Trellis, scrolled to
the defining cell with a ring around it. An older channel that names no cell
opens the notebook.

**Note:** Loading a demo document clears the notebooks, documents and functions
a previous demo left behind, and only those. Anything you wrote yourself is
never touched.
