diff --git a/README.md b/README.md index 829a71c..fa22337 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,22 @@ # Python-VPP -3-DOF Velocity Prediction Program base on the [ORC](https://www.orc.org/index.asp?id=21) aero and hydro dynamic models. The code makes use of Object-oriented-Programming to be as general as possible. +3-DOF Velocity Prediction Program based on the [ORC](https://www.orc.org/index.asp?id=21) aero and hydro dynamic models. -## Contributing - -### Installing dependencies - -Install the required dependencies from the `requirements.txt` file. - -If using `pip` then `pip install requirements.txt`. - -If using `conda` then follow these steps to create an environment with the right dependencies: - -```bash -conda create --name Python-VPP \ - && conda config --add channels conda-forge \ - && conda activate Python-VPP \ - && conda install -y --file requirements.txt -``` - -### Running tests +Please see the demo hosted at [https://yacht-vpp.streamlit.app/](https://yacht-vpp.streamlit.app/) and go for a test sail! -Tests are implemented using [pytest](https://docs.pytest.org/en/8.0.x/). - -You can run tests with - -```bash -pytest -vv -``` - -You can run a benchmark against the YD-41 results from WinVPP by running the `benchmark.py` script. - -```bash -$ python benchmark/benchmark.py -g -o -``` +## Using the code -with `save`, `graph` and `output` as optional keyboard arguments and `output` only working in combination with `save`. +To use the code, first clone or download this repository then install the required dependencies (see below). -## Using the code +The main files that are used are `runVPP.py` and `righting_moment.json`. These have to be filled with the data of your boat. By default they are using the YD-41 (from Principle of Yacht Design). -To use the code, first clone or download this repository onto your own machine. The main file that are used are `runVPP.py` and `righting_moment.json`. These have to be filled with the data of your boat. By default they are using the YD-41 (from Principle of Yacht Design). To run the code simply type +The VPP is run with. ```bash $ python runVPP.py ``` -into your console, and the code should run. Once the code has run, it should generate the following figure (or a similar one) +Once the code has run, it should generate the following figure (or a similar one) <p align="center"> <img src="Figure.png" alt="YD-41 VPP results" width="1024"> @@ -53,9 +24,9 @@ into your console, and the code should run. Once the code has run, it should gen See the [documentation](https://marinlauber.github.io/Python-VPP/). -### Input variable +### Input variables -This is a crude list of all the input variables and their meaning, as well as the units they are expected to be in. +Here is a list of the key variables used in the VPP. 1. Appendages : * Cu : Root Chord / Upper Chord (m) @@ -83,24 +54,51 @@ This is a crude list of all the input variables and their meaning, as well as th * TWA range : range of TWA to use * TWS range : range of TWS, must be between [2, 35] +## Contributing + +We are very keen to see contributions to code, documentation and feature development! -## Authors +When you make a contribution please make sure that any new functionality is covered with additional tests. -* **[Otto Villani](https://www.linkedin.com/in/otto-villani-552760108/)** - *Initial idea, model selection* - [github](https://github.com/ottovillani) -* **[Marin Lauber](https://www.linkedin.com/in/marin-lauber/)** - *Initial idea, developement* - [github](https://github.com/marinlauber) -* **[Thomas Dickson](https://tajd.co.uk/about)** - *Developer* - [github](http://github.com/TAJD) +Follow the steps below to contribute to this project. -## License +### Install dependencies -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details +Install the required dependencies from the `requirements.txt` file. + +If using `pip` then `pip install requirements.txt`. + +If using `conda` then follow these steps to create an environment with the right dependencies: + +```bash +conda create --name Python-VPP \ + && conda config --add channels conda-forge \ + && conda activate Python-VPP \ + && conda install -y --file requirements.txt +``` + +### Run tests -## Acknowledgments +Tests are implemented using [pytest](https://docs.pytest.org/en/8.0.x/). + +You can run tests with + +```bash +pytest -vv +``` + +You can run a benchmark against the YD-41 results from WinVPP by running the `benchmark.py` script. + +```bash +$ python benchmark/benchmark.py -g -o +``` + +## Acknowledgements -* Hat tip to anyone whose code was used -* Inspiration +* **[Otto Villani](https://www.linkedin.com/in/otto-villani-552760108/)** - *Initial idea, model selection* - [GitHub](https://github.com/ottovillani) +* **[Marin Lauber](https://www.linkedin.com/in/marin-lauber/)** - *Initial idea, development* - [GitHub](https://github.com/marinlauber) +* **[Thomas Dickson](https://tajd.co.uk/about)** - *Developer* - [GitHub](http://github.com/TAJD) -## Modifications +## License -1. Formatted using [Black](https://github.com/psf/black). -1. Added a "name" to the Yacht class which can be passed to plotting function. -1. Renamed instances of Keel and Rudder objects in the example function. +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details diff --git a/demos/Home.py b/demos/Home.py index afee640..eab938c 100644 --- a/demos/Home.py +++ b/demos/Home.py @@ -16,9 +16,7 @@ It is based on the [ORC model](https://orc.org/uploads/files/ORC-VPP-Documentation-2023.pdf). - The source code can be [found here](https://github.com/marinlauber/Python-VPP) and any and all contributions are welcome 😊. - - If you have a question, feature request or perhaps a bug report then please open an issue here or [send me an email](mailto:tajdickson@protonmail.com). + If you have a question, feature request or perhaps a bug report then please open an issue [here](https://github.com/marinlauber/Python-VPP) or [send me an email](mailto:tajdickson@protonmail.com). """ ) diff --git a/demos/readme.md b/demos/readme.md index 1698267..66e7420 100644 --- a/demos/readme.md +++ b/demos/readme.md @@ -1,4 +1,4 @@ # Demos -This directory contains a VPP demo that is deployed on streamlit. It has site analytics that are GDPR compliant and collected on goat counter. +This directory contains a VPP demo that is currently deployed at [https://yacht-vpp.streamlit.app/](https://yacht-vpp.streamlit.app/) diff --git a/demos/utils.py b/demos/utils.py index 0ac4e6a..2ea5bce 100644 --- a/demos/utils.py +++ b/demos/utils.py @@ -1,25 +1,44 @@ import streamlit as st import streamlit.components.v1 as components +import subprocess + +def get_git_hash(): + try: + git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8') + return git_hash + except subprocess.CalledProcessError: + return None def header(): header = """ + <script> + window.goatcounter = {no_onload: true} + + window.addEventListener('hashchange', function(e) { + window.goatcounter.count({ + path: location.pathname + location.search + location.hash, + }) + }) + </script> <script data-goatcounter="https://yacht-vpp.goatcounter.com/count" - async src="//gc.zgo.at/count.js"></script> + async src="//gc.zgo.at/count.js"></script> """ return components.html(header) def footer(): - footer = """ + git_hash = get_git_hash() + footer = f""" <div style="text-align: center; margin-top: 50px;"> <hr> <p>Yacht VPP</p> - <p>Contact: <a href="mailto:tajdickson@protonmail.com">tajdickson@protonmail.com</a></p> <p style="font-size: 12px; color: gray;"> - This application is provided as is and without warranty. The source code is available on <a href="https://github.com/marinlauber/Python-VPP">GitHub</a>. + This application is provided as is and without warranty. + The source code is available on <a href="https://github.com/marinlauber/Python-VPP">GitHub</a>. Please file bug reports as an <a href="https://github.com/marinlauber/Python-VPP/issues">issue here</a>. </p> + <p style="font-size: 12px; color: gray;">Version {git_hash}</p> </div> """