osu! pp and difficulty calculator
Project description
osu! pp and difficulty calculator. pure python implementation of https://github.com/Francesco149/oppai-ng
this is meant to be a standalone single-file module that’s as portable as possible using only python 2.7+ builtins with no extra dependencies
if you need a command line interface, check out oppai-ng
usage
pip install pyttanko
or you can also manually install like so:
curl -L https://github.com/Francesco149/pyttanko/archive/HEAD.tar.gz -o HEAD.tar.gz
cd pyttanko-*
python setup.py install --user
check out
pydoc pyttanko
or
python -c "help('pyttanko')"
for the full documentation
minimal example:
#!/usr/bin/env python
import sys
import pyttanko as osu
p = osu.parser()
bmap = p.map(sys.stdin)
stars = osu.diff_calc().calc(bmap)
print("%g stars" % stars.total)
pp, _, _, _, _ = osu.ppv2(stars.aim, stars.speed, bmap=bmap)
print("%g pp" % pp)
which you can run with:
cat /path/to/file.osu | ./example.py
performance
pyttanko runs the test suite over 10 times slower than the original C implementation and uses ~8 times more memory, so if you need to batch process thousands of scores, you should consider writing native bindings for the C version.
tests were performed on linux 4.9.38, python 2.7.10 on a i7-4790k
this is still a pretty respectable speed considering python is interpreted
$ cd ~/src/pyttanko/
$ time -v ./run_test
...
Command being timed: "./run_test"
User time (seconds): 101.68
System time (seconds): 0.61
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1m 42.34s
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 88688
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 631637
Voluntary context switches: 1
Involuntary context switches: 4116
Swaps: 0
File system inputs: 0
File system outputs: 56
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
$ cd ~/src/oppai-ng/test
$ ./build
$ time -v ./oppai_test
...
Command being timed: "./oppai_test"
User time (seconds): 9.09
System time (seconds): 0.06
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0m 9.15s
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 11840
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 304
Voluntary context switches: 1
Involuntary context switches: 39
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Project details
Release history Release notifications | RSS feed
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
Hashes for pyttanko-1.0.9-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099f932650e0fd6f1544f61daee99d2339016f2c0fcee1cc71aee0d510e3af9a |
|
MD5 | 35bd2b534920da3682b1af05f8244665 |
|
BLAKE2b-256 | 3b5e9ccbf63e5a5b5cfcfcdaa562b25e6f20efbc297d019f4226bb086f59b82e |