MaximaLabsOpen app

Jupyter Notebooks

Every simulation opens a real, per-user JupyterLab notebook in a new tab — pre-authenticated and wired to the SDK, with numpy/pandas/matplotlib/seaborn/scikit-learn preloaded, ready-made advanced-workflow notebooks (sensitivity, optimization/RTO, Monte Carlo, ML surrogates), and a %ai copilot that writes SDK code cells. Every computation still runs on the same REST/ARQ solver path as the Run button.

notebookjupytersdkworkflows
Concept

Every simulation gets its own real JupyterLab notebook, opened in a new browser tab. Not a re-implementation of Jupyter — the actual application, spawned on demand as a sandboxed, resource-capped per-user Docker container by JupyterHub, then MaximaLabs-branded and dark-themed. Zero install.

It opens pre-authenticated and pre-wired: the FlowSim Python SDK is already authenticated as you and pointed at the simulation you opened it from (the sim id and a scoped token come from the kernel environment, never written into the file). Every real computation — a run, a sweep, an optimization — still goes out over the same REST/ARQ path the Run button uses. The notebook orchestrates; the deterministic solver produces every number (principle #9). This is what “unlocks workflows beyond GUI sliders”: custom scripting with the full Python ecosystem, on top of the same rigorous engine.

Execution

Opening it & the starter notebook

Click Notebook in the workspace. A new tab opens with a MaximaLabs loading indicator while the kernel spins up, then real JupyterLab appears — dark theme, and the notebook named after your simulation (not a generic notebook.ipynb). There is no setup cell — the kernel pre-loads flowsim (a helper bound to this simulation), client (the full SDK, authenticated), and SIM_ID, so no credential ever lands in the file. You start on working code, not boilerplate:

# Pre-loaded for you — no setup, no credentials in the file:
#   flowsim · this simulation's helper   ·   client · the full SDK   ·   SIM_ID · the id

sim = flowsim.load_current()   # id, name, status, flowsheet, result (interactive JSON tree)
flowsim.run()                  # solve via the same worker as the app's Run button
flowsim.stream_table()         # the solved stream table, as a pandas DataFrame

The starter also plots the stream table (seaborn), a per-node plot (McCabe-Thiele for a distillation column), a node-inspection cell (parameters + a column temperature profile), and the unit’s governing equations and knowledge-base entry. Need the full SDK? It is right there as client (e.g. client.mccabe_thiele(SIM_ID, "COL")).

Execution

Batteries included

  • np, pd, plt, sns (numpy, pandas, matplotlib, seaborn) are auto-imported in every kernel — no boilerplate import cell. scipy and scikit-learn are installed too.
  • Any dict/list you display (e.g. client.get_simulation(SIM_ID)) renders as an interactive, collapsible, syntax-highlighted JSON tree.
  • Per-node plot data straight from the SDK: mccabe_thiele, pinch_curves, pump_curve, compressor_curve, plus phase_diagram / pt_envelope / residue_curve_map.
  • See the math & learn more: client.unit_equations(type) returns the governing LaTeX equations (render with IPython.display.Math) and client.unit_knowledge(type) returns the physics / applications / pitfalls for a unit op.
Execution

Advanced workflows — beyond the GUI

The starter links to four ready-made workflow notebooks, seeded next to it and pre-wired to this simulation. Each is offered only when it fits the flowsheet; the last three run on a throwaway scratch copy, so your simulation is never mutated:

  • Sensitivity Sweep — sweep a decision variable across many points and plot the response curve.
  • Custom Optimization & RTO — a SciPy optimizer running on top of the rigorous simulation equations (each evaluation is a real solve).
  • Monte Carlo & Uncertainty — inject Gaussian noise into the feed and re-solve many times to see the output distribution (operational risk).
  • ML & Surrogate Modeling — generate a dataset from solves and train a fast scikit-learn surrogate, with a parity plot.
Execution

The %ai copilot

Describe what you want and the copilot writes an SDK code cell for you — inserted below for review, never auto-run (AI proposes, you execute):

%ai run a sensitivity study on reflux ratio from 1.2 to 3.0
# → a new code cell appears below; review it, then Shift+Enter to run

The %ai magic requires the server’s AI key to be configured; without it, it reports that the copilot is unavailable and everything else keeps working.

Good to know
  • Each session is a sandboxed per-user container that can only reach the FlowSim REST API — never the solver, database, or other users’ work.
  • Idle sessions are culled after ~20 minutes, but your files live in a persistent ~/work volume, so edits survive a cull or reconnect. Re-opening a simulation you already have a notebook for keeps your edited file (the starter never clobbers it).
  • Concurrent notebook capacity is bounded on the current single droplet — if it’s full, try again shortly.