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.4.tar.gz
(17.0 kB
view hashes)
Built Distributions
rosu_pp_py-0.9.4-cp39-none-win32.whl
(322.2 kB
view hashes)
Close
Hashes for rosu_pp_py-0.9.4-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c311a84d22a50f3f0a1f0584822763360642327b9f2a1e66fd44d5b753f3c5c |
|
MD5 | 03dab783a9e6956bea5038c278864226 |
|
BLAKE2b-256 | ee72b8321388d9f860c43c83f518a421c5600e2786babd20cccc114f4d87f116 |
Close
Hashes for rosu_pp_py-0.9.4-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82f2c4be8780427878b6785fa1e07eba61c5dff20f2951b097f31d3683916762 |
|
MD5 | f8717b480a0817377a883b26ad779336 |
|
BLAKE2b-256 | bd4c0c13f242cd82a496aefdb4d1dd12357dae6c6808b2e90b591a7b8048ba51 |
Close
Hashes for rosu_pp_py-0.9.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2466e6ae227bdaa68b1bc48f6b283c19c367cfbf308e6a6888e6c7eb6cc323dd |
|
MD5 | 5a74fe2d7ac3cb1c3a80af2150763533 |
|
BLAKE2b-256 | ce86a86b61cc20d4f90f79559ecd788bcc3f9b4e6c97b31e085c14a2b21c7a65 |
Close
Hashes for rosu_pp_py-0.9.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75dd69551a2faa83ae229ea260c9fbf6074f2b303ece1a0cd761ddef9db92444 |
|
MD5 | de6fad816d1f54a78ee2f579caa3cd43 |
|
BLAKE2b-256 | ebb6953ef0e4179e76646109b89555d1202f4587779e0555613959e4eb3db373 |
Close
Hashes for rosu_pp_py-0.9.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f7da049cf289440f06ad46c8883380ccd5aad3e3de1b817b2776022e6c2e09 |
|
MD5 | 59a48a5f27094e05db5b3c800bcde225 |
|
BLAKE2b-256 | a14d897adc935a4ce1eb68087dabfe1730059ecf6ae530914a60808eb11a7831 |
Close
Hashes for rosu_pp_py-0.9.4-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac81e526066c0ad3e861f630d0418660e43bb7a5a22b4e535d59829f2623fc5e |
|
MD5 | c6a13ca2c91f0f069a17058624e8194b |
|
BLAKE2b-256 | 2ee4af4ca1e8c8b07850f48fa771933761f212e4a681ab3696f03031a13f7f9f |