Notebooks
Notebooks are ordinary .ipynb files. Anything you write here opens in Jupyter
or VS Code, and anything you already have imports without conversion. What
Relay adds is the machine behind the notebook, the files around it, and Ray.
Starting one
Section titled “Starting one”The Notebooks app shows Your notebooks and a New button. Click New to create a Python notebook, or open the dropdown beside it for more options:
- Choose notebook language… — create a Python or R notebook.
- From template — start with an existing example.
- Import notebook… — open an
.ipynbfrom this computer.
Every notebook is saved to Notebooks/ in your Drive as you work, so it is findable in the Data app next to the data it reads.
Try a real sample
Section titled “Try a real sample”Open Data → Relay Drive → sample_data → notebooks. penguins.ipynb reads the Palmer Penguins measurements from the sample CSV. The Histology notebook reads the real CMU slide and measures candidate objects; its automatic segmentation is not a validated cell count. Opening either sample creates or reuses your editable copy in Notebooks/ without changing the shared template.
The notebook tour opens Penguins when no notebook is already in use.
Running cells
Section titled “Running cells”Shift+Enter or the play button on a cell runs that cell. Its status shows progress and elapsed time. The notebook header shows kernel readiness separately from the run’s status.
The Kernel tab in Controls has Run all, an interrupt button, Add cell, Fork (a copy with outputs cleared) and History.
A cell’s ⋮ menu has Ask Ray, Configure widgets, Insert reference, Mark as inputs cell, Switch to Markdown / Switch to Code, and Delete cell.
Reading a file without knowing its path
Section titled “Reading a file without knowing its path”You should never have to type a path. Either:
- drag a file from the Data app onto a cell, or
- choose Insert reference from the cell’s ⋮ menu and pick a file.
Relay inserts the line that opens it:
data = relay.open('asset-id') # plate_07.ome.tiffdata <- relay$open('asset-id') # plate_07.ome.tiffA cloud kernel needs a file it can access, such as a saved Relay asset or an
authorized connected source. A file only on your computer must first be uploaded
or read with ordinary filesystem paths in a local session. relay.open returns
a file-like object for your usual library.
Running on your computer
Section titled “Running on your computer”In Relay Desktop, open Controls → Kernel → Run on and choose This computer. Set up local notebooks checks for existing Python and R installations and shows whether notebook support and scientific packages are present.
Use a ready environment with Use this environment, or choose components:
- Python notebooks
- R notebooks
- Common scientific packages (optional for either language)
For an offline download, extract its ZIP and select the notebook-runtimes
folder with Choose downloaded notebook pack. Install selected components
extracts the selected environments from that pack without downloading software.
The app-only installer does not contain these packs. Existing Python and R installations are
left unchanged. You can return to setup later to add another language. R includes
a private Python-based notebook engine; selecting R does not require enabling
Python notebooks too.
Choose a working folder when starting a local session. Ordinary paths such as
pandas.read_csv("results.csv") or read.csv("results.csv") refer to files in that
folder. Local sessions use your computer’s CPU and RAM, support plots and
interrupting execution, and stop when Relay closes. Run only code you trust:
local notebook code has your account’s file permissions.
Local execution supports individual cells and Run all. Staged runs,
checkpoint recovery, scheduled notebook execution, and cloud helpers such as
relay.open use Relay cloud. Local run history lasts for the current app
session; saved cell outputs remain in the notebook. Switching execution location
starts a fresh session; variables and installed packages do not carry over.
Choosing a cloud runtime
Section titled “Choosing a cloud runtime”Click the runtime (for example, CPU) in the notebook’s bottom-right corner to open Controls → Kernel → Compute profile. Adjust CPU and RAM with the sliders, or choose an available T4, A10G or A100 GPU. Allocations are bounded by each runtime’s existing limits and apply at the next start.
Free cloud notebooks use CPU. GPU runtimes require a plan that includes them. The profile shows remaining monthly CPU or GPU hours and the consumption rate. GPU hours are T4-equivalent: a T4 uses one GPU hour per connected hour, an A10G uses two, and an A100 uses four.
Versions and forks
Section titled “Versions and forks”History lists saved versions; Restore this version rolls back, and the version you were on is kept. Fork makes a separate copy with outputs cleared, for trying something without touching the original.
Notebooks and Ray
Section titled “Notebooks and Ray”Select one or more cells and ask Ray about them — the placeholder changes to Ask Ray about 3 cells…. Ray can explain a cell, fix an error, or write the next one. It can also create and run a whole notebook from a question in the chat bar: write a notebook that loads this h5ad and plots a UMAP coloured by sample.
Notebooks in pipelines and schedules
Section titled “Notebooks in pipelines and schedules”Save as pipeline node publishes a notebook as a step other pipelines can use. Mark the cell that reads inputs with Mark as inputs cell so the pipeline knows where to feed the file in. A notebook can also run on a schedule on its own; see Automation.