osu! difficulty and pp calculation for all modes
Project description
rosu-pp-py
Difficulty and performance calculation for all osu! modes.
This is a python binding to the Rust library rosu-pp which was bootstrapped through PyO3. Since all the heavy lifting is done by Rust, rosu-pp-py comes with a very fast performance. Check out rosu-pp's README for more info.
Exposed types
The library exposes the following classes:
Calculator
: Contains various parameters to calculate strains or map, difficulty, or performance attributesBeatmap
: Contains a parsed beatmapBeatmapAttributes
: Contains various attributes about the map itselfDifficultyAttributes
: Contains various attributes about the difficulty based on the modePerformanceAttributes
: Contains various attributes about the performance and difficulty based on the modeStrains
: Contains strain values for each skill based on the mode
Additionally, the following error types are exposed:
ParseError
: Failed to parse a beatmapKwargsError
: Invalid kwargs were provided
How to use rosu-pp-py
- The first step is to create a new
Beatmap
instance by providing appropriate kwargs. Either of the kwargspath
,content
, orbytes
must be given. The kwargsar
,cs
,hp
, andod
are optional. With the settersset_ar
,set_cs
,set_hp
, andset_od
you can specify custom attributes.
map = Beatmap(path = "/path/to/file.osu", ar = 9.87)
map.set_od(1.23)
with open("/path/to/file.osu", "rb") as file:
map = Beatmap(bytes = file.read())
with open("/path/to/file.osu") as file:
map = Beatmap(content = file.read())
- Next, you need to create an instance of
Calculator
by providing the appropriate kwargs again. Any of the following kwargs are allowed:mode
,mods
,acc
,n_geki
,n_katu
,n300
,n100
,n50
,n_misses
,combo
,passed_objects
,clock_rate
, anddifficulty
. Each of these also have a setter method e.g.set_n_misses
.
calc = Calculator(mode = 2, acc = 98.76)
calc.set_mods(8 + 64) # HDDT
- The last step is to call any of the methods
map_attributes
,difficulty
,performance
, orstrains
on the calculator and provide them aBeatmap
.
Example
from rosu_pp_py import Beatmap, Calculator
map = Beatmap(path = "./maps/100.osu")
calc = Calculator(mods = 8)
# Calculate an SS on HD
max_perf = calc.performance(map)
# The mods are still set to HD
calc.set_acc(99.11)
calc.set_n_misses(1)
calc.set_combo(200)
# A good way to speed up the calculation is to provide
# the difficulty attributes of a previous calculation
# so that they don't need to be recalculated.
# **Note** that this should only be done if neither
# the map, mode, mods, nor passed objects amount changed.
calc.set_difficulty(max_perf.difficulty)
curr_perf = calc.performance(map)
print(f'PP: {curr_perf.pp}/{max_perf.pp} | Stars: {max_perf.difficulty.stars}')
map_attrs = calc.map_attributes(map)
print(f'BPM: {map_attrs.bpm}')
strains = calc.strains(map)
print(f'Maximum aim strain: {max(strains.aim)}')
Installing rosu-pp-py
Installing rosu-pp-py requires a supported version of Python and Rust.
Once Python and Rust and ready to go, you can install the project with pip:
$ pip install rosu-pp-py
or
$ pip install git+https://github.com/MaxOhn/rosu-pp-py
Learn More
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
rosu_pp_py-0.9.3.tar.gz
(17.0 kB
view hashes)
Built Distributions
rosu_pp_py-0.9.3-cp39-none-win32.whl
(319.8 kB
view hashes)
Close
Hashes for rosu_pp_py-0.9.3-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3d3b6116c00ca27dad729565142a134949101b9c36ad53996b78ecd3c7fe008 |
|
MD5 | 59af6541d23d60872accd63e5fa2eeba |
|
BLAKE2b-256 | 01f61ca0656bc2cb1bfdbaa0f9e8242b93c1fbb784de28b7234dfde81dda881c |
Close
Hashes for rosu_pp_py-0.9.3-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1d131353b32bba3035e0121ae745d16d97c96470f5d543860435fe3a5afc5ab |
|
MD5 | af7369882245e13c7246130db62c7d58 |
|
BLAKE2b-256 | 706d6f58fb2f4b676a7c42437e6d491df7018b95997599e2217e03dfed2ceac2 |
Close
Hashes for rosu_pp_py-0.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c427d493bf9c927a1b589177a4ca8a06a4865d3b2f45be2209e277f57d2b16f1 |
|
MD5 | dc1a22fbaee0d336872376e5d27c6fa6 |
|
BLAKE2b-256 | 531d37b39c9f9457703be36ca920516f508c6e06a7e0c484faa65512f4395aef |
Close
Hashes for rosu_pp_py-0.9.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6b4609103d6470ac78bdbd1c8cd4880b82cdb0a57a9faac882bde0f4e3ad38 |
|
MD5 | 9257e28ca534ffbdf4de200656da6af9 |
|
BLAKE2b-256 | fd745634a5fb8292f2be3d6dccbf5b7e4fada6ed1106944880067427820a97be |
Close
Hashes for rosu_pp_py-0.9.3-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a780412ce592b6a80c5b94462115d6b58dc98ce105673500b8c6f55a97537d7f |
|
MD5 | 65af68a182b31c5fa4582a27a73e0edd |
|
BLAKE2b-256 | 179edae1bc8114478e2af938797ac80ab48b1f01fef068cc2d6f118a007d4188 |
Close
Hashes for rosu_pp_py-0.9.3-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53ac23aef22f58681c20c5fe91bbb629c3bbe2cac8f4462e43c166ee671db3e4 |
|
MD5 | 351f3695f2206beb9c279a5256f3124b |
|
BLAKE2b-256 | 734ded18541d163f244282b1467ca5d49e6f2adf5bd57bac634144a6c42d0e4a |