talosdb
Lightweight experiment storage library for scientific simulations. Named after Talos I station.
Installation
pip install talosdb
Quickstart
from talosdb import TalosDB
from itertools import product
db = TalosDB("~/science/results")
exp = db.experiment("vc_sweep_2025")
A_grid = [0.5, 1.0, 1.5]
beta_grid = [1.0, 2.0]
for A, beta in product(A_grid, beta_grid):
result = simulate(A, beta) # numpy array
with exp.run({"A": A, "beta": beta}) as run:
run.save(result)
run.save_params({"gamma": 0.1, "T": 300}) # extra constants
run.save_plot(my_plot_fn, result)
File layout
db_root/
└── vc_sweep_2025/
├── experiment.json # metadata: name, creation date
├── A=0.5_beta=1.0/
│ ├── data.dat # human-readable TSV (numpy array)
│ ├── params.json # all parameters (name + extra)
│ └── plot.png # if save_plot() was called
└── A=1.0_beta=2.0/
├── data.dat
└── params.json
API reference
TalosDB
db = TalosDB("path/to/db") # creates root folder if absent
db.experiment("name") # create / open experiment
db.experiment() # name = datetime stamp
db.list_experiments() # → list[str]
db.delete_experiment("name", confirm=True)
Experiment
exp = db.experiment("my_exp")
# Create / open a run
run = exp.run({"A": 0.5, "beta": 1.0})
# or as context manager (marks failed.json on exception):
with exp.run({"A": 0.5, "beta": 1.0}) as run:
...
# Load
run = exp.load({"A": 0.5, "beta": 1.0}) # exact match
runs = exp.query({"beta": 1.0}) # subset match → list[Run]
runs = exp.all_runs() # every run
Run
run.save(result) # numpy array → data.dat
run.save_params({"gamma": 0.1, "T": 300}) # extra params → params.json
run.save_plot(plot_fn, result) # calls plot_fn(result, path)
result = run.load_data() # → np.ndarray
params = run.load_params() # → dict
run.is_failed() # → bool
run.load_failure() # → dict with error info
plot_fn contract
def my_plot_fn(result, save_path):
fig, ax = plt.subplots()
ax.plot(result[:, 0], result[:, 1])
fig.savefig(save_path)
plt.close(fig)
talosdb does not import matplotlib — rendering is entirely the caller's responsibility.
.dat format
Arrays are stored as human-readable TSV with a small header:
# shape: 100 2
# dtype: float64
0.0 0.001
0.1 0.043
...
3D+ arrays are split into labelled 2D slices:
# shape: 2 3 4
# dtype: float64
# slice [0]
1.0 2.0 3.0 4.0
5.0 6.0 7.0 8.0
9.0 10.0 11.0 12.0
# slice [1]
...
The shape header ensures exact reconstruction on load regardless of dimensionality.
License
MIT
Release files for talosdb 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| talosdb-0.1.2.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| talosdb-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / talosdb-0.1.2.tar.gz
| Download URL | talosdb-0.1.2.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3273890409a90d15f856a9470318131b470ef46af4e3b7906557c17f4ec5f1b
|
|
BLAKE2b-256 checksum How to use checksums |
ca55cdc1e97c44902d2b6aff77745e08f0b11aa3b7799d1b264188dbc28e85a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / talosdb-0.1.2-py3-none-any.whl
| Download URL | talosdb-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
191d8d759b9c5ac62951bdafa30b9688bf4f7f8c2a98f45f1584df5651baf9c5
|
|
BLAKE2b-256 checksum How to use checksums |
01d6728b5b2c68f6561d80cc218b42b23b5c4621e2988e245f471f65952124c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|