> For the complete documentation index, see [llms.txt](https://elishai.gitbook.io/retinal-stimulation-modeling-environment/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://elishai.gitbook.io/retinal-stimulation-modeling-environment/single-sac-model/model-simulation.md).

# Model Simulation

Simply simulate the model using:

```
simulation.simulate()
```

Simulation results can be obtained in various ways.

Retrieve voltage trace in the cell soma:

```
results = simulation.trace_voltages_at_soma()
```

Now, two files are automatically generated in the corresponding results folder: trace graph (see below), and a pickle file containing a Python dictionary with the retrieved data.

You can retrieve and plot the soma voltage using:

```
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8,5))
plt.plot(results[0]['0'][1]['t'], results[0]['0'][1]['v'], ls='-', c='r', label='Expanding stimulus',linewidth=3)
plt.legend()
plt.show()
```

![](https://3823822112-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlM7rr4VP7XMZK5DA9U%2F-MlQlP2UfLO-JzuU08yQ%2F-MlQmVkARDj9tpamTVZQ%2Fv_trace.png?alt=media\&token=21b064dc-04a3-48eb-8e3a-c52978c370df)

You can also call the visualize results function:

```
simulation.visualize_results()
```

The following files will be generated:

* Stimulus
* Voltage traces across all sections

![Part of the generated stimulus](https://3823822112-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlM7rr4VP7XMZK5DA9U%2F-MlQlP2UfLO-JzuU08yQ%2F-MlQnw0jIwsoZ4ZC1KSc%2FScreen%20Shot%202021-10-07%20at%2020.31.50.png?alt=media\&token=6ffc0e24-e773-4653-a3ea-6e86d0ee5f51)

![Part of the traced voltage across the model](https://3823822112-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MlM7rr4VP7XMZK5DA9U%2F-MlQlP2UfLO-JzuU08yQ%2F-MlQo92vPCjBG9AHSVEL%2FScreen%20Shot%202021-10-07%20at%2020.32.48.png?alt=media\&token=462486ca-44d1-4674-b0c0-7ad8b144491d)
