An osu ctb gamemode star/pp calculator made in python
  • Cython 96%
  • Python 4%
Find a file
2019-05-17 19:31:49 +02:00
osu Fix merge conflicts 2018-01-16 20:21:55 +01:00
osu_parser Use bigger step for bezier sliders that have too many points 2019-05-17 19:31:49 +02:00
.gitignore Cythonized everything 2017-12-05 21:10:31 +01:00
__init__.py Replaced imports to work as a Python package, update README 2017-12-30 17:05:57 +01:00
constants.pyx Cythonized everything 2017-12-05 21:10:31 +01:00
LICENSE Added bezier curve object 2017-11-16 12:36:10 +01:00
ppCalc.pyx Cythonized everything 2017-12-05 21:10:31 +01:00
README.md Replaced imports to work as a Python package, update README 2017-12-30 17:05:57 +01:00
reanimate.osu Fixed slider duration, endpoint and tick placements 2017-12-02 23:56:14 +01:00
sample.py Replaced imports to work as a Python package, update README 2017-12-30 17:05:57 +01:00
setup.py Cythonized everything 2017-12-05 21:10:31 +01:00
test.osu Fixed Easy & HardRock mods not being applied correctly 2018-01-05 09:17:02 +01:00

Cythonized catch-the-pp

An osu ctb gamemode star/pp calculator made in Cython.
Original repo: catch-the-pp by Sunpy.
Note: This repo is meant to be used as a Python package, not as a standalone program!

Changes

  • Cythonized all files, functions, classes and methods (with static typing as well)
  • Replaced math.pow with **, this gives a bit of extra speed
  • Replaced imports
  • Minor code cleaning

Performance

These are the execution times after running pp calculation (with beatmap parsing and difficulty calculation as well) on reanimate.osu 100 times
Pure Python version: Min: 0.7986021041870117 s, Max: 0.932903528213501 s, Avg: 0.8350819730758667 s
Cythonized version: Min: 0.22933077812194824 s, Max: 0.25774192810058594 s, Avg: 0.23836223363876344 s

Compiling & Usage

$ git clone ... catch_the_pp
$ cd catch_the_pp
$ python3.6 setup.py build_ext --inplace
...
$ cd ..
$ python3.6 -m catch_the_pp.sample
Calculation:
Stars: 1.9046727418899536, PP: 42.187660217285156, MaxCombo: 1286
$ python3.6
>>> from catch_the_pp.osu_parser.beatmap import Beatmap
>>> from catch_the_pp.osu.ctb.difficulty import Difficulty
>>> from catch_the_pp.ppCalc import calculate_pp
>>> beatmap = Beatmap("catch_the_pp/test.osu")
>>> difficulty = Difficulty(beatmap=beatmap, mods=0)
>>> difficulty.star_rating
1.9046727418899536
>>> calculate_pp(diff=difficulty, accuracy=1, combo=beatmap.max_combo, miss=0)
42.187660217285156

Note: You must clone the repo in a folder that has no dashes in its name, because Python modules cannot have dashes in their name! In this example, catch_the_pp was used.