Skip to main content

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*rng will 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 on and off don'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_figure is True, returns (MT point, Acceleration at MT point, Figure of the graph, Axes of 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 file doesn'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

gxscalc-0.1.0.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

gxscalc-0.1.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page