Skip to main content
Regolith Water Loop Logo

Regolith Water Loop

Three-stage water pre-treatment column: bioremediated regolith, pyrolysis biochar, and a gravity feed. Bench-built and tested.

Leonardo Salas · rwl.leonardosalas.dev


rwl on PyPI Sponsor Regolith Water Loop on GitHub Sponsors

Built and documented in the open by one person. Sponsorship keeps it that way.



What this is

A habitat has to detoxify its own soil, handle the waste it produces every day, and recycle water. Solved separately those are three problems. Solved together they are one machine, where the furnace that processes waste also keeps the bioreactor warm and fed, and both of them produce the material the filter is made of.

This repository holds the design, the bench build, and the code that measures whether it works.

docs/system.md The three stages and how they depend on each other
docs/mars.md Mars conditions, sizing for six crew and habitat requirements
docs/method.md How turbidity is measured from photographs
docs/protocol.md Greywater recipe, grading, calibration and run procedure
docs/build.md Build log with photographs and measured volumes
docs/results.md First runs and what they show
docs/print/target-sheet.pdf Printable checker target and white card for the rig
docs/drawings/ Bench drawings RWL-001 and RWL-002, system schematics RWL-003 and RWL-004
docs/references.md Every source, checked against the claim it supports
GLOSSARY.md Terms used throughout

Stage 2, the filtration column, is the stage built and tested on the bench; see docs/results.md. Stages 1 and 3 are supported by published work. Perchlorate salts are strong oxidisers and are not handled in this project.


Install

pipx install rwl   # or: pip install rwl

Published as rwl on PyPI. Run rwl with no arguments, or rwl info, for a summary of every command.

Measuring turbidity

Removal is measured from photographs rather than an electronic probe: a phone camera is available and free, a nephelometer is not. A printed target behind the sample loses contrast as suspended solids rise, and a white card in frame cancels exposure differences between shots.

Results are relative to the influent, never reported in NTU.

rwl target --out target-sheet.pdf   # print this at 100%, next to the sample
rwl roi photos/cal0.jpg --setup setup.json   # check the regions before measuring

rwl measure photos/cal*.jpg --setup setup.json --out readings.csv
rwl calibrate --readings readings.csv --levels levels.csv --out calibration.json
rwl measure photos/influent.jpg photos/charge*.jpg --setup setup.json --out run.csv
rwl report --readings run.csv --calibration calibration.json \
    --before influent --after charge1 charge2 charge3

report flags any result outside the calibrated range instead of extrapolating it. The timed drain of a charge doubles as a falling-head test: rwl permeability --seconds 45 --outlet-drop 0.30 gives the bed's hydraulic conductivity on Earth and at 0.37 g.

Read docs/method.md before shooting a session. The rig has to stay fixed or the series is void.

Sizing

rwl size --crew 6 --base early --explain
rwl cartridge --crew 6

size covers greywater, filter area under Mars gravity, retort heat, char output and perchlorate, chloride and oxygen stoichiometry for a crew. cartridge splits one filter cartridge into what Mars supplies and what Earth does. --explain prints the formula and source behind every number, --json the raw values; each constant is also cited directly in src/rwl/sizing.py.

Development

pip install -e '.[dev]'
pytest

Documentation site

A static site under site/, English at the root and Spanish under /es/. Besides the documentation it has three tools that run entirely in the browser:

  • Sizing simulator: the rwl size model, live, from the same constants
  • Measure in the browser: the photographic method from photos or a live camera, with files interchangeable with the CLI
  • 3D model: the habitat layout of RWL-004 and the column of RWL-001
pnpm install --dir site
pnpm --dir site dev # development
pnpm --dir site build # static export into site/out/

Building the PDF

The whole technical document is assembled from these Markdown files and the SVG drawings with doc-engine-cli. doc-engine.md is the manifest.

pipx install doc-engine-cli
doc-engine build doc-engine.md

Docker

docker compose up site # site on http://localhost:8080
docker compose run --rm rwl --help

Share this project

Share the link directly or scan the code: rwl.leonardosalas.dev

QR code linking to the project

Support

If this is useful to you, sponsorship on GitHub funds the parts, the materials and the time that go into documenting it properly.


License

Licensing is split by what you are using:

  • Source code — MIT. Use, modify and build on it freely.
  • Documentation, guides and media — CC BY 4.0. Share and adapt with credit.
  • 3D models in site/public/models/ — CC BY-NC-ND 4.0. Share unchanged with credit; no modifications, no commercial use. Textures excluded, see the notice.

Metadata

Release files for rwl 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rwl 0.2.0
File Size Uploaded Provenance Actions
rwl-0.2.0.tar.gz 29.5 kB With provenance Details for rwl-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rwl 0.2.0
File Interpreter ABI Platform Actions
rwl-0.2.0-py3-none-any.whl Python 3 none any Details for rwl-0.2.0-py3-none-any.whl

Total release size: 57.9 kB

Release files / rwl-0.2.0.tar.gz

Download URL rwl-0.2.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8740117705aa44074e67ac2726e677370a10a0e0f460689154bf211413102f31
BLAKE2b-256 checksum
How to use checksums
61b1c849217c526b4e323760dbc2e41a2569e1b0533676d2d445835007849460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / rwl-0.2.0-py3-none-any.whl

Download URL rwl-0.2.0-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e157638dd08eaaad8ba7055ade0b966d5229627be8f714151135c608c847f41c
BLAKE2b-256 checksum
How to use checksums
0ca36ada74e4f92095f00bda905b29aa6120d987ca0195ef69706f39232d12c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for rwl 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rwl-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page