A Python package for speed-based calculation of F-ZERO GX.
Project description
Gxscalc
This is a Python package for speed-based calculation of F-ZERO GX.
Requirements
This package requires pandas and matplotlib. Also, speed data files created by my AviUtl plugin are required as input.
Installation
Gxscalc is available on PyPI:
$ python -m pip install gxscalc
Usage
from gxscalc import mtp
mtp('./sample/sa70_on.txt', './sample/sa70_off.txt') #=> (1224.2514114466828, -2.465287050388536)
gxscalc.mtp(on, off, *, std=5, rng=10, return_figure=False, with_frames=True)
Calculate the approximated MT point from two speed data files of deceleration. The accuracy compared to Naegleria's spreadsheet is within about 3 km/h.
on: str | pandas.DataFrame- File path or DataFrame of speed data for deceleration while going on the accelerator.
off: str | pandas.DataFrame- File path or DataFrame of speed data for deceleration while going off the accelerator.
std: numeric- Standard deviation of gaussian window for moving average.
rng: numeric- Values farther than
std*rngwill not be used for moving average. return_figure: boolean- If this is true, mtp() returns figure of speed vs moving averaged acceleration graph as optional output.
with_frames: boolean- Set this false if
onandoffdon't have the frame column. - returns: (float, float, [matplotlib.figure.Figure, matplotlib.axes.Axes])
- Returns the tuple of (MT point [km/h], Acceleration at MT point [km/h/f]). If
return_figureisTrue, returns (MT point, Acceleration at MT point,Figureof the graph,Axesof the graph) instead. If no cross points are detected from the inputs, it returns (None,None) or (None,None,Figure,Axes) since the MT point can not be calculated.
gxscalc.distance(file, fps=60)
Calculate the approximated travelled distance of given speed data file via trapezoidal rule. The unit of input speed is km/h and the unit of output length is m.
file: str | pandas.DataFrame- File path or DataFrame of speed data to be calculated.
fps: numeric- The reciprocal of time between the adjacent speed values, in seconds.
with_frames: boolean- Set this false if
filedoesn't have the frame column. - returns: float
- Returns the travelled distance in meter.
Notice
The input speed data files are assumed to be created by my AviUtl plugin. The files should include frame numbers and separators should be spaces (default settings of the plugin). './sample/sa70_on.txt' and './sample/sa70_off.txt' are sample input files, which are data of Space Angler at 70%.
If you have speed-only text file, call functions with with_frames=False.
If you need some modification before calling gxscalc functions, you can send DataFrame objects instead of file paths of the speed data.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/cycloawaodorin/gxscalc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gxscalc-0.1.0.tar.gz.
File metadata
- Download URL: gxscalc-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3d3572af29ce8fd9caeaa2f288539b46ea22fec99ac5a7f794e3ce900894370
|
|
| MD5 |
5f857f13689c2abea79c793fae37284b
|
|
| BLAKE2b-256 |
7017bdf844a0eb13e4ad2e9cebdbb4acd43b583b9a5f339e989d3a223657e5f3
|
File details
Details for the file gxscalc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gxscalc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e13238b724c87c63737aa7961c6a840cd56e0aa3fb4fcbdd0c755028e2d24775
|
|
| MD5 |
0028ac13ffb47720bf1fc36087599b73
|
|
| BLAKE2b-256 |
2a053fe18fe84ab5e8ac6663a8db7b4c3e5db593466facf8f070b5f71e9de1e9
|