<!-- DO NOT EDIT. -->
<!-- THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. -->
<!-- TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -->
<!-- "auto_examples/readers_writers/plot_pylimer_tools_output_reader.py" -->
<!-- LINE NUMBERS ARE GIVEN BELOW. -->

#### NOTE
[Go to the end](#sphx-glr-download-auto-examples-readers-writers-plot-pylimer-tools-output-reader-py)
to download the full example code.

<a id="sphx-glr-auto-examples-readers-writers-plot-pylimer-tools-output-reader-py"></a>

# pylimer-tools Output Reader

Read output from pylimer-tools’ own simulators.

Relevant documentation: [`read_avg_file()`](../../pylimer_tools.io.html.md#pylimer_tools.io.read_pylimer_tools_output_file.read_avg_file)

<!-- GENERATED FROM PYTHON SOURCE LINES 11-46 -->
```none
Simulation steps: 100
```

<br/>
```Python
import os
from pathlib import Path

import matplotlib.pyplot as plt

from pylimer_tools.io.read_pylimer_tools_output_file import read_avg_file


def _find_repo_root() -> Path:
    for cur in (
        [Path(__file__).resolve().parent] if "__file__" in globals() else []
    ) + [Path.cwd()]:
        for p in [cur] + list(cur.parents):
            if (p / "examples").is_dir() and (p / "src").is_dir():
                return p
    return Path.cwd()


_examples_dir = _find_repo_root() / "examples"
example_file = str(
    _examples_dir /
    "dpd_simulations/dpd_simulation_avg_output.txt")

# Read pylimer-tools averages file
pylimer_data = read_avg_file(example_file)

# Data is automatically grouped by OutputStep
print(f"Simulation steps: {pylimer_data['Step'].nunique()}")

# Access specific measurements
plt.plot(pylimer_data["Step"], pylimer_data["Temperature"])
plt.xlabel("Output Step")
plt.ylabel("Temperature")
plt.show()
```

**Total running time of the script:** (0 minutes 0.034 seconds)

<a id="sphx-glr-download-auto-examples-readers-writers-plot-pylimer-tools-output-reader-py"></a>

[`Download Jupyter notebook: plot_pylimer_tools_output_reader.ipynb`](_downloads/c36754c12af5040c29c9a9f6876c9564/plot_pylimer_tools_output_reader.ipynb)

[`Download Python source code: plot_pylimer_tools_output_reader.py`](_downloads/343c9d56cf9bf07aa880da217bfe406e/plot_pylimer_tools_output_reader.py)

[`Download zipped: plot_pylimer_tools_output_reader.zip`](_downloads/a1d4a1af52212c0228306cea247656d5/plot_pylimer_tools_output_reader.zip)

[Gallery generated by Sphinx-Gallery](https://sphinx-gallery.github.io)
