PyToDa (Python Tools for the Daily Usage) provides useful tools for the day to day usage with the multi-physics simulation framework 4C and is based on PySkel. Currently the following tools are available:
- A 4C .dat input file formatter which beautifully formats the input file so all columns and numbers are aligned for easier readability.
- An arbitrary unit converter which can be very easily be included in other frameworks.
- A logging framework which can be easily included into other frameworks.
The remaining parts of the readme are structured as follows:
For a quick and easy start an Anaconda/Miniconda environment is highly recommended. Other ways to install PyToDa are possible but here the installation procedure is explained based on a conda install. After installing Anaconda/Miniconda execute the following steps:
- Create a new Anaconda environment based on the
environment.yml
file:
conda env create -f environment.yml
- Activate your newly created environment:
conda activate pytoda
- Install all PyToDa requirements with:
pip install -e .
- Finally, install the pre-commit hook with:
pre-commit install
Now you are up and running 🎉
The following brief tutorials highlight how each tool can be used:
Simply call the .dat input file formatter with
format_dat --dat_file_path ../path/to/datfile.dat --output_file_path ../path/to/final/datfile.dat --format_sections NODE COORDS
If the output file path coincides with the input file path the original file simply gets overwritten. Additionally, you need to provide the sections which will be formatted.
The unit converter can be called with
convert_unit --unit_length "m" --unit_weight "g" --unit_time "s" --quantity "1 bar"
by providing the base units for the target unit system. Finally, the provided quantity will be converted into the taret unit system.
The logger can be simply included into any software framework by providing the functions with the necessary arguments. An example for the logger usage can be found within PySkel.
To locally execute the tests and create the html coverage report simply run
pytest
To locally create the documentation from the provided docstrings simply run
pdoc --html --output-dir docs src/pytoda
To ease the dependency update process pip-tools
is utilized. To create the necessary requirements.txt
file simply execute
pip-compile --all-extras --output-file=requirements.txt requirements.in
To upgrade the dependencies simply execute
pip-compile --all-extras --output-file=requirements.txt --upgrade requirements.in
Finally, perforfmance critical packages such as Numpy and Numba are installed via conda to utilize BLAS libraries.
All contributions are welcome. See CONTRIBUTING.md
for more information.
This project is licensed under a MIT license. For further information check LICENSE.md
.