Metadata-Version: 2.4
Name: sopsim
Version: 0.2.4
Summary: SOPSim simulation library
Author: Olaolu Olugbenle, Dr. William Annan
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: tqdm
Requires-Dist: shapely
Requires-Dist: matplotlib
Requires-Dist: fastapi
Requires-Dist: uvicorn[standard]
Requires-Dist: pydantic
Requires-Dist: python-dotenv

# SOPSim

SOPSim is a Python simulation package for investigating SOP pattern formation. You can choose to use it in one of four ways:

1. The official SOPSim website
2. As a Command line tool
3. As a website, local to your computer
4. As a Python API

Each method is explained in detail below.

## 1. The official SOPSim website

The official SOPSim website is available at (*link coming soon*).

## 2. As a Command line tool

Inside your command line, type:

```bash
pip install sopsim
```

to install the package.

Use this command below to run a single simulation:

```bash
sopsim run --nc 4 --filopodia-type A --filopodia-life-time 10 --out-dir output
```

In this specific example, this command will also generate plots and metadata to a folder called `output`.

For help, run:

```bash
sopsim run -h
```

## 3. As a website, local to your computer

After installing SOPSim with `pip install`, you can start the local web app with:

```bash
sopsim serve
```

Once you run this, copy the link and paste it into your browser. The link will show up in your terminal and will start with:
```bash
http://...
```

For help, run:

```bash
sopsim serve -h
```

## 4. As a Python API

Assuming you have Python and the `sopsim` library installed, create a new Python script and add the following code:

```python
from sopsim import sopsim

if __name__ == '__main__':
    results = sopsim(Nc=4, filopodia_type="A", filopodia_life_time=10)
    print(results["FData"])
```

Note: In its current version, using the API does not allow users to view plots.

- ```results["FData"][0]``` &rarr; Convergence time
- ```results["FData"][1]``` &rarr; Relative Sensory Area (RSA)
- ```results["FData"][2]``` &rarr; Mean Local Sensory Area (LSA)

<!-- ## Sanity Checks

By default, SOPSim uses NumPy's random number generator, so repeated runs with the same inputs can still produce different results.

For a deterministic legacy comparison, use the bundled MATLAB reference matrices in this way:


### Command Line
```bash
sopsim run --nc 4 --use-mat-files --out-dir output
```

### Website Local to your Computer
Tick the "Use bundled legacy MAT files" checkbox

### Python API (OLAOLU: MAKE SURE TO TEST THIS)
```python
from sopsim import sopsim

results = sopsim(Nc=4, use_mat_files=True)
print(results["FData"])
``` -->

### *Input Values*

The repo enforces these input rules:

| Input | Allowed values |
| --- | --- |
| `Nc` (Number of cells per row in final square tissue*) | Integer `>= 1` |
| `filopodia_type` | One of `A`, `B`, `C`, `D`. Default = `A` |
| `filopodia_life_time` | Integer `>= 1`. Default = `10` |
<!-- | `use_mat_files` | `true` / `false`, only valid when `Nc = 4` | -->

Important:

<!-- - `--use-mat-files` is only supported when `Nc=4`
- This mode is the best option when you want the same starting RNG state used in the legacy MATLAB workflow
- For other `Nc` values, the simulation uses fresh random draws each run -->
- *`Nc = 4` implies a 4x4 tissue
- `Nc>=10` can take many hours to run, so start smaller when testing

## Bug fixes:
- 0.2.4: Made an update to better describe FData in the `README.md` file
- 0.2.3: Backend works. Front end changes now applied so cards do not overlap. Slight rewording of help command
- 0.2.2: Broken. Issue: default values for filopodia type and lifetime come from a single source
- 0.2.1: Broken. Issue: default values for filopodia type and lifetime come from a single source
