Performance and CachingΒΆ

All readers support automatic caching for improved performance.

import os
from pathlib import Path
import time

import matplotlib.pyplot as plt

from pylimer_tools.io.extract_thermo_data import extract_thermo_params


# Read complete log file
def _find_fixtures_dir() -> Path:
    for cur in (
        [Path(__file__).resolve().parent] if "__file__" in globals() else []
    ) + [Path.cwd()]:
        for p in [cur] + list(cur.parents):
            candidate = p / "tests" / "pylimer_tools" / "fixtures"
            if candidate.is_dir():
                return candidate
    return Path("tests/pylimer_tools/fixtures").resolve()


_fixtures_dir = _find_fixtures_dir()
log_file = str(_fixtures_dir / "log.lammps")

time_start = time.time()

extract_thermo_params() is a more elaborate version of read_log_file()

plot performance caching

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

Gallery generated by Sphinx-Gallery