Metadata-Version: 2.4
Name: rodent-sdk
Version: 0.3.1
Summary: Run Virtual Rodent Behaviour Environment experiments from Python, headlessly.
Author: Huzaifa Majeed, Ahmed Majeed, Muhammed Abed, Zidan Fajandar
License-Expression: Apache-2.0
Project-URL: Documentation, https://virtual-rodent-docs.pages.dev/docs/API/python-sdk
Project-URL: User guide, https://virtual-rodent-docs.pages.dev/docs/User%20Guide/python-and-colab
Project-URL: Simulation packs, https://github.com/HuzaifaMajeed/rodent-sdk-releases
Keywords: neuroscience,behaviour,rodent,simulation,godot
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Provides-Extra: analysis
Requires-Dist: pandas; extra == "analysis"
Requires-Dist: matplotlib; extra == "analysis"
Dynamic: license-file

# rodent-sdk

Run Virtual Rodent Behaviour Environment experiments from Python, with no graphics.

```bash
pip install rodent-sdk
```

On first use the SDK downloads the official Godot build and the simulation pack for this
version, checks the pack's SHA-256 fingerprint, and caches both. The same experiment and
seed always produce the same run on any machine.

The rat is moved by a simple statistical placeholder model. Its behaviour is not a
validated biological result.

- Documentation: https://virtual-rodent-docs.pages.dev/docs/API/python-sdk
- Step-by-step guide for Google Colab: https://virtual-rodent-docs.pages.dev/docs/User%20Guide/python-and-colab

```python
import rodent_sdk as rodent

exp = rodent.experiment("complex_habitat", seed=42)
exp.doors["bridge_entry_gate"].open = False
exp.treatment.condition = "placebo"
run = exp.run(steps=5000, changes={2500: {"doors": {"bridge_entry_gate": True}}})

run.summary()        # time, entries and first entry per region, plus distance
run.to_dataframe()   # one row per step
run.plot()           # trajectory with walls and doors
run.save_csv("run.csv")
```

## Working with the website

Running experiments needs no account. Saving them to the RODENT website, and opening
your team's projects, needs a RODENT website account; a project lead then adds you to
their projects.

```python
import rodent_sdk as rodent

client = rodent.login()   # in Colab, reads RODENT_EMAIL and RODENT_PASSWORD from Secrets
project = client.project("Anxiety study")          # or client.create_project(...)
exp = project.experiment("Baseline")               # or project.create_experiment(...)

exp.doors["bridge_entry_gate"].open = False
exp.save()                                          # checked against your role's modules

run = exp.run(steps=5000)
run.save()                                          # appears under Review on the website
```

- Only project leads (and instructors) can add experiments from a template. Everyone else
  copies one with `exp.save_as_new("name")`, within their modules.
- Published versions are frozen: continue from them with `save_as_new`.
- If someone else saved the experiment after you loaded it, `save()` refuses instead of
  overwriting their work. Load it again and reapply your changes.
- A run made with unsaved edits cannot be saved to Review, because the website replays it
  on the saved arena.

All errors are subclasses of `rodent.RodentError`, with a message that says what to do next.

## Licence

Apache License 2.0. See `LICENSE` and `NOTICE`.
