Metadata-Version: 2.4
Name: tomsup
Version: 1.4.1
Summary: An implementation of game theory of mind in a agent based framework following the implementation of Devaine, et al. (2017).
Author: Peter T. Waade
Author-email: "Kenneth C. Enevoldsen" <kenevoldsen@pm.me>
License: Apache License 2.0
Project-URL: Homepage, https://github.com/KennethEnevoldsen/tomsup
Keywords: tom,theory-of-mind,game-theory
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: <3.13,>=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: importlib-metadata>=1.0; python_version < "3.8"
Requires-Dist: numpy>1.24.4
Requires-Dist: pandas>=1.2.3
Requires-Dist: scipy>=1.6.3
Requires-Dist: matplotlib>=3.4.2
Requires-Dist: seaborn>=0.11.1
Requires-Dist: joblib>=1.2.0
Requires-Dist: wasabi>=0.8.2
Dynamic: license-file

<a href="https://github.com/KennethEnevoldsen/tomsup"><img src="https://github.com/KennethEnevoldsen/tomsup/raw/main/img/icon_black2.png" width="190" align="right" /></a>


# tomsup: Theory of Mind Simulation using Python 

[![PyPI version](https://badge.fury.io/py/tomsup.svg)](https://pypi.org/project/tomsup/)
[![python version](https://img.shields.io/badge/Python-%3E=3.10-blue)](https://github.com/KennethEnevoldsen/tomsup)
[![license](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/KennethEnevoldsen/tomsup/blob/main/LICENSE)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

A Python Package for Agent-Based simulations. The package provides a computational eco-system for investigating and comparing computational models of hypothesized Theory of mind (ToM) mechanisms and for using them as experimental stimuli. The package notably includes an easy-to-use implementation of the variational Bayesian k-ToM model developed by [Devaine, et al. (2017)](http://dx.plos.org/10.1371/journal.pcbi.1005833). This model has been shown able to capture individual and group-level differences in social skills, including between clinical populations and across primate species. It has also been deemed among the best computational models of ToM in terms of interaction with others and recursive representation of mental states. We provide a series of tutorials on how to implement the k-ToM model and a score of simpler types of ToM mechanisms in game-theory based simulations and experimental stimuli, including how to specify custom ToM models, and show examples of how resulting data can be analyzed.


# 🔧 Setup and installation

You can install tomsup using pip If you haven't installed pip you can install it from [the official pip website](https://pip.pypa.io/en/stable/installing/), otherwise, run:

```bash
pip install tomsup 
```



## Getting Started with tomsup
To get started with tomsup we recommend the tutorials in the tutorials [folder](https://github.com/KennethEnevoldsen/tomsup/tree/main/tutorials). We recommend that you start with the introduction.

The tutorials are provided as Jupyter Notebooks. If you do not have Jupyter Notebook installed, instructions for installing and running can be found [here]( http://jupyter.org/install). 


| Tutorial                                                                                                                         | Content                                                                                        | file name                                         | Open with                                                                                                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Documentation](https://kennethenevoldsen.github.io/tomsup/)                                                                     | The documentations of tomsup                                                                   |                                                   |                                                                                                                                                                                                        |
| [Introduction](https://github.com/KennethEnevoldsen/tomsup/blob/main/tutorials/paper_implementation.ipynb)                     | a general introduction to the features of tomsup which follows the implementation in the paper | paper_implementation.ipynb                        | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/KennethEnevoldsen/tomsup/blob/main/tutorials/paper_implementation.ipynb)       |
| [Creating an agent](https://github.com/KennethEnevoldsen/tomsup/blob/main/tutorials/Creating_an_agent.ipynb)                   | an example of how you would create new agent for the package.                                  | Creating_an_agent.ipynb                           | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/KennethEnevoldsen/tomsup/blob/main/tutorials/Creating_an_agent.ipynb)          |
| [Specifying internal states](https://github.com/KennethEnevoldsen/tomsup/blob/main/tutorials/specifying_internal_states.ipynb) | a short guide on how to specify internal states on a k-ToM agent                               | specifying_internal_states.ipynb                  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/KennethEnevoldsen/tomsup/blob/main/tutorials/specifying_internal_states.ipynb) |
| [Psychopy experiment](https://github.com/KennethEnevoldsen/tomsup/tree/main/tutorials/psychopy_experiment)                     | An example of how one might implement tomsup in an experiment                                  | Not a notebook, but a folder, psychopy_experiment | [![Open in Github](https://img.shields.io/badge/%20-Open%20in%20GitHub-black?style=plastic&logo=github)](https://github.com/KennethEnevoldsen/tomsup/tree/main/tutorials/psychopy_experiment)        |


# 🤔 Issues and Usage Q&A

To ask report issues or request features, please use the [GitHub Issue Tracker](https://github.com/KennethEnevoldsen/tomsup/issues). Otherwise, please use the [discussion Forums](https://github.com/KennethEnevoldsen/tomsup/discussions).

## FAQ

<details>
  <summary>How do I test the code and run the test suite?</summary>

We recommend using `uv` to run the test as it also installs the required depencencies.
tomsup comes with an extensive test suite. In order to run the tests, you'll usually want to clone the repository and build tomsup from the source. This will also install the required development dependencies and test utilities defined in the `dev` dependency group in the `pyproject.toml`.


```python
# assuming you have downloaded the repository
uv run pytest
```

which will run all the test in the `tomsup/tests` folder.

Specific tests can be run using:

```
uv run pytest tomsup/tests/<DesiredTest>.py
```

**Code Coverage**
If you want to check code coverage you can run the following:
```
uv run pytest--cov=.
```


</details>




<details>
  <summary>Does tomsup run on X?</summary>

  tomsup is intended to run on all major OS, this includes Windows, MacOS and Linux (Ubuntu). Please note these are only the systems tomsup is being actively tested on, if you run on a similar system (e.g. an earlier version of Linux) the package will likely run there as well.

  
</details>


<details>
  <summary>How is the documentation generated?</summary>

  Tomsup uses [sphinx](https://www.sphinx-doc.org/en/main/index.html) to generate documentation. It uses the [Furo](https://github.com/pradyunsg/furo) theme with a custom styling.

  To make the documentation you can run:
  
  ```
  # install required dependencies and builds the documentation
  make build-docs

  # view docs
  make view-docs
  ```
  
</details>



# Using this Work
### License
tomsup is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

### Citing
If you use this work please cite:
```bibtex
@article{waade2022introducing,
  title={Introducing tomsup: Theory of mind simulations using Python},
  author={Waade, Peter T and Enevoldsen, Kenneth C and Vermillet, Arnault-Quentin and Simonsen, Arndis and Fusaroli, Riccardo},
  journal={Behavior Research Methods},
  pages={1--35},
  year={2022},
  publisher={Springer}
}
```
