Simulates flying spinning discs.
Project description
FrisPy
Documentation for FrisPy package can be found here on RTD.
This repository contains a physical model for a flying disc. Using this code, one can simulate trajectories of discs with varying initial conditions, while also changing the underlying physical modlel. This is useful for analyzing the mechanics of a disc in terms of its design, as well as creating simulated throws for things like disc launchers or other helpful tools.
This is a pure Python rebuild of the old FrisPy code, which included a version of the integrator written in C for speed. To obtain a fast version of the modeling code, either roll back to an old version or check out the Frisbee_Simulator repository.
Installation
The easiest way to install this package is with pip. The PyPI package can be viewed here.
pip install frispy
To install from source, there are other steps involved. First, you must obtain the code from Github. If you have git installed you can clone the repository from the command line:
git clone https://github.com/tmcclintock/FrisPy.git
or with the GitHub Desktop application. Once you have the code, change into the directory and proceed.
Note, the only hard requirements for this package are python>=3.6, numpy, scipy, and matplotlib (plotting only). Note that this package uses the relatively recent scipy.integrate.solve_ivp method, which may not exist in older versions of scipy. If you have these three packages, you can install this package with the setup.py file without worrying about creating an environment.
From an Anaconda environment
The preferred method of installation is with anaconda You can install all the requirements into a compatible environment called frispy by running the following command:
conda env create -f environment.yml
You can then install the package the usual way
python setup.py install
You can also use pip to install the requirements from the requirements.txt file by running:
pip install -r requirements.txt
Then follow this by using the setup.py file to install.
Testing
Verify your installation by running:
pytest
Please report any problems you encounter on the issues page. Thank you!
Running
Check out example.py to see how to run and view results. In words, you create a disc and compute its trajectory.
from frispy import Disc
disc = Disc()
result = disc.compute_trajectory()
times = result.times
x, y, z = result.x, result.y, result.z
Once you have a trajectory, you can use that to create visualizations. For instance, to plot the height of the disc against one of its horizontal coordintes (x), you can run:
import matplotlib.pyplot as plt
plt.plot(x, z)
plt.show()
Soon
There are some big upgrades on the horizon! Stay tuned for:
animated trajectories
documentation
example Jupyter notebooks
plotting routines
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.