Difficulty and performance calculation for osu!
Project description
rina-pp-pyb
Library to calculate difficulty and performance attributes for all osu! modes.
This is a python binding to the Rust library rina-pp which was bootstrapped through PyO3. As such, its performance is much faster than a native python library.
Usage
The library exposes multiple classes:
Beatmap
: Parsed.osu
fileGameMode
- Calculators
Difficulty
: Class to calculate difficulty attributes, strains, or create gradual calculatorsPerformance
: Performance attributes calculatorGradualDifficulty
: Calculator to calculate difficulty attributes after each hitobjectGradualPerformance
: Calculator to calculator performance attributes after each hitresultBeatmapAttributesBuilder
: Beatmap attributes calculator
- Results
DifficultyAttributes
Strains
: Strain values of a difficulty calculation, suitable to plot difficulty over timePerformanceAttributes
BeatmapAttributes
HitResultPriority
: Passed toPerformance
, decides whether specified accuracy should be realized through good or bad hitresultsScoreState
: Hitresults and max combo of a score, found inPerformanceAttributes
and passed to gradual calculators
Example
Calculating performance
import rina_pp_pyb as rosu
# either `path`, `bytes`, or `content` must be specified when parsing a map
map = rosu.Beatmap(path = "/path/to/file.osu")
# Optionally convert to a specific mode
map.convert(rosu.GameMode.Mania)
perf = rosu.Performance(
# various kwargs available
accuracy = 98.76,
misses = 2,
combo = 700,
hitresult_priority = rosu.HitResultPriority.WorstCase, # favors bad hitresults
)
# Each kwarg can also be specified afterwards through setters
perf.set_accuracy(99.11) # override previously specified accuracy
perf.set_mods(8 + 64) # HDDT
perf.set_clock_rate(1.4)
# Second argument of map attributes specifies whether mods still need to be accounted for
# `True`: mods already considered; `False`: value should still be adjusted
perf.set_ar(10.5, True)
perf.set_od(5, False)
# Calculate for the map
attrs = perf.calculate(map)
# Note that calculating via map will have to calculate difficulty attributes
# internally which is fairly expensive. To speed it up, you can also pass in
# previously calculated attributes, but be sure they were calculated for the
# same difficulty settings like mods, clock rate, custom map attributes, ...
perf.set_accuracy(100)
perf.set_misses(None)
perf.set_combo(None)
# Calculate a new set of attributes by re-using previous attributes instead of the map
max_attrs = perf.calculate(attrs)
print(f'PP: {attrs.pp}/{max_attrs.pp} | Stars: {max_attrs.difficulty.stars}')
Gradual calculation
import rina_pp_pyb as rosu
# Parsing the map, this time through the `content` kwarg
with open("/path/to/file.osu") as file:
map = rosu.Beatmap(content = file.read())
# Specifying some difficulty parameters
diff = rosu.Difficulty(
mods = 16 + 1024, # HRFL
clock_rate = 1.1,
ar = 10.2,
ar_with_mods = True,
)
# Gradually calculating *difficulty* attributes
gradual_diff = diff.gradual_difficulty(map)
for i, attrs in enumerate(gradual_diff, 1):
print(f'Stars after {i} hitobjects: {attrs.stars}')
# Gradually calculating *performance* attributes
gradual_perf = diff.gradual_performance(map)
i = 1
while True:
state = rosu.ScoreState(
max_combo = i,
n300 = i,
n100 = 0,
# ...
)
attrs = gradual_perf.next(state)
if attrs is None:
# All hitobjects have been processed
break
print(f'PP: {attrs.pp}')
i += 1
Installing rina-pp-pyb
Installing rina-pp-pyb requires a supported version of Python and Rust.
Once Python and Rust are ready to go, you can install the project with pip:
$ pip install rina-pp-pyb
or
$ pip install git+https://github.com/osuthailand/rina-pp-pyb
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
rina_pp_pyb-1.0.1.tar.gz
(22.6 kB
view hashes)
Built Distributions
Close
Hashes for rina_pp_pyb-1.0.1-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63e98a87899453bfe2fcf0936a08f801ca138d7c8f003ade2c47be25f9fc651f |
|
MD5 | 6fdabaeccf708ec886822bc7a7a8d8ee |
|
BLAKE2b-256 | bc4e729438f9246589aa2ba8ec20c36bb0f75e380a0ccaac19ef6a0137e5c950 |
Close
Hashes for rina_pp_pyb-1.0.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04ea1cdbcf4512b6d5441a379975d8d7a9dbbfd605a265473f862de70273014b |
|
MD5 | bf3e71b9254493dd464d047eeab5c64b |
|
BLAKE2b-256 | ed99336f3119c69bdc4fe96b50b9d79a87eef7d6b4058adfd9d17226efd60318 |
Close
Hashes for rina_pp_pyb-1.0.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d779f126a6e1fdcaa3840c0f4866f901bc8a147044585bd9611d5409a633d14b |
|
MD5 | 6ff78c6b3cdc53b2fbe72bdc5e937310 |
|
BLAKE2b-256 | 1e193abe15e50d7911b8e9397ce440ace96c86335efb05d6a5d403742a4ac594 |
Close
Hashes for rina_pp_pyb-1.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cfae8579b35344a3d689cd73821cf4fcd148690e036687176becadc07a93c7f |
|
MD5 | 3a63b55e91d565ecc6dc3e15f372d3de |
|
BLAKE2b-256 | 5372fffa6ef7a5323d12f00028d171e02741398a1e354c9f54f585c7b72c1e60 |
Close
Hashes for rina_pp_pyb-1.0.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037f733d4918c22879a56dc2e3c024ff2538139f4cf9460512a499575a613c12 |
|
MD5 | 1af6b3db48cbca1727c10278035e36d9 |
|
BLAKE2b-256 | 48ab6c4a274bd39f49bec1a25150a96ded96a2dfc54a642bfcb062f2bdbf6357 |
Close
Hashes for rina_pp_pyb-1.0.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b300906224b89f563d882e4c8a0f737e5b67f652f8cc68cb81ecd86ea6a0aef9 |
|
MD5 | 1dfa4e7b95985332b7f7890f3ffae5b6 |
|
BLAKE2b-256 | 31a51df26d998a3bf432aef97f4ed4019bfb93953a14b1ae5157ca91ad1ae385 |
Close
Hashes for rina_pp_pyb-1.0.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad9a8a3a5ee3b61082eea3bc0974b3274827ac8068e276c85b707074ae23c71c |
|
MD5 | d9b83fdb31d86502995a589f507369d6 |
|
BLAKE2b-256 | 156f1a3f64b03468303de7841f2d35c3d00397f2d4089d8c97ec6acf659c3627 |
Close
Hashes for rina_pp_pyb-1.0.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39072cbb2e64b6d990c88db21db99612ed0f01d54e74c207ea137988536302a |
|
MD5 | c226d4d0377cfcb292f054111097d0f0 |
|
BLAKE2b-256 | db6bac9bfc9f400a06fef648f101e7a6ffeb1f1937fbf8fadf477903ba7091aa |
Close
Hashes for rina_pp_pyb-1.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef5355edcf069c74f6b3cb8eebd8880cdf83a9a2bcf66515d8008c3232b11941 |
|
MD5 | 0ed61e29677277c274ca71238250a6b8 |
|
BLAKE2b-256 | 48dc506e92d88351615b3976559e4060e9b3d06ab8f886835b672b82080a603f |
Close
Hashes for rina_pp_pyb-1.0.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704b40639f249076a6d41be63a4d048ed101a30102539b135136d66bd5b8d7c9 |
|
MD5 | cd2579fcd48f74ed8c71b73ac00a28b1 |
|
BLAKE2b-256 | 8c3a6cf90547752abbcfed6cb69f4b0fb73dfefe9317cb38d03acf733af7a3dd |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6e55cc359419f196e99b328d5ba9874d5618ae795df84ef92eb09b66f3bfaa8 |
|
MD5 | b933830c8740d7852bc5063db287e2f9 |
|
BLAKE2b-256 | 03645864dcac5f43200084aa469308efe41f09690196a96c7e8cb8979e065229 |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2b49a73353d06ab120aa4db7cc19f0ad64b6f24d00bce57f62b10cc3a0bddd4 |
|
MD5 | 9a1fa818d9cf602d1b6d416419008ecf |
|
BLAKE2b-256 | d10007f06d560a9613407422ee4f1528eb12022743b7d78638f5d7e5fae201e3 |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6320d0e9c376f30fb320d01c0b79804bdbe491aa4a9052bf1ea8084f364f45c0 |
|
MD5 | a7a980b748b0f9497fbe822b40c4855e |
|
BLAKE2b-256 | 762859c0a54ece0f7e6022e278d14855f81f33a4c1899eb30621808b91f619c8 |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-cp312-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84fef29149aae17ce8338f2ecb704933edb46fdaaf7b44960c4cfaab6b4ce369 |
|
MD5 | 432cad65a09045bb31dbd5dc6daa0d52 |
|
BLAKE2b-256 | 6eea7bfc991b83d5d6a4f000c172f4df08ae5732057a9b384a927cf960756f7e |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ff1be7be5562c566329565a100e7792afbf559fa75d6ad0f7509e52ae9932eb |
|
MD5 | 8a1b671acf4c670b5fe955cd40dce5b9 |
|
BLAKE2b-256 | 1fac6c3a69294261a43dc1024edc4df60beef8b062cfcdb96389ca3f91ff5c73 |
Close
Hashes for rina_pp_pyb-1.0.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b98a32b0cb03eb9495666b2a49847233fb4cb009e7bc98dac86b9d9766255cc6 |
|
MD5 | 82ec66d91dd43ea654a95f8031d414c2 |
|
BLAKE2b-256 | b2432a8f48f74889e0f43cb47fd53ca33ac643ff25d9fd7a6f5d5c203c8700ab |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e1413aa85f3744ad3f7c8c8ba2ae8d643ded565452df33481641c1a23ede1f2 |
|
MD5 | 1f71377b072ba137e23cf156d3878a59 |
|
BLAKE2b-256 | 381681e9c0194b07748245765a64dbddb44c0de10e361469edeb9bc2eaa532ea |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59596a1f8e4fd4f8ae460d33dbdd969ab82cb9b8294f93e25296720a023c5bfc |
|
MD5 | d6bdf7c3e1262135598353830275b99c |
|
BLAKE2b-256 | f9c4a22912a463c027b1ffa19691f9587aa45c74cd43c272deb566feb1891a9f |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a90a5d17fbe404cc3602e8f951302fe69b96930582224f66f98e443593928786 |
|
MD5 | 1d13ca3e8fa8dd7038f4906f730f0a1c |
|
BLAKE2b-256 | 17ddf707b43af188f57eb7698f1674cf2f9b3b6a339218776f6f57cfeba2bd17 |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8862f188ba87df09f81e446f0ca31bf3ecd9e82c74fe404bf6bfa205291cc62 |
|
MD5 | c303b314ecdc011c24ca482807d912bb |
|
BLAKE2b-256 | 6163d77e27b1e9c85d295731cd07bafe763ccf1f0b096760f8d1b3faee1ccfa3 |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e63a66b31729b7a4cf1cbccc58bb9f1d53de502462d404b98682f9e3854e60 |
|
MD5 | 6ec9957eec8f5dad627f081cd0b2807d |
|
BLAKE2b-256 | 7ddd7f6e995d5a4f10328175ec6c02978dc6456a6256c00a0468960387c26678 |
Close
Hashes for rina_pp_pyb-1.0.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccaabdf3cd8e0e3b70067dee10a1644c4ed364f54de516d895bbc3bb835fc5dd |
|
MD5 | 36f4204dcdf85ea7be8e62701ba688c1 |
|
BLAKE2b-256 | 56959e02561529ab7088c4faa2b334ffc355fd985789a97f3ab6697c141f106f |
Close
Hashes for rina_pp_pyb-1.0.1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08497ca883e9986d32edcb96125fb18f366d1d01da81b65d4794811f2874ddc5 |
|
MD5 | 6c950ce8df57292ca73e56b3f809fac6 |
|
BLAKE2b-256 | 26f2a0a054378169fb44850a6cc2be8bf0f87d1dd6bc34eb11aad0daf31baaeb |
Close
Hashes for rina_pp_pyb-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b2434e6b55d964fc9a395ccfa39b2bbf9019b4300438c1de5d9222a09ebe675 |
|
MD5 | 6b997b5f5ec0c8a68a907081abac6ae4 |
|
BLAKE2b-256 | 9e0b386dc82d618415faf52348b2cea33a2a854aca90adc0eaf85e6340d66b17 |
Close
Hashes for rina_pp_pyb-1.0.1-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e5d9c82c9c441e2a61b4e801042ce56912e72f20798ec59069160197923721a |
|
MD5 | 610da262b892f0b1245229a088210645 |
|
BLAKE2b-256 | 6300e9bfcd59d73c417e1810d39c7c847560f582e42d9ccfc81a4c0c038e1262 |
Close
Hashes for rina_pp_pyb-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6ba56e5238198450ebb021740da4b790457991dbc2859c743e485b5c797534 |
|
MD5 | 9b0a3e2ba1fc23389ba1eaf01387d24b |
|
BLAKE2b-256 | 8124904fb7dd61ab4a724bfb833502078e6b138f12b0224130bf46b69aec1578 |
Close
Hashes for rina_pp_pyb-1.0.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea9216c972e9dfcf96aa3420a8e88c4340236a9e5c9dfc9efd3a61247bb877ee |
|
MD5 | 178bf3e1cdffa83c06d55a04c08c22db |
|
BLAKE2b-256 | b5896129e5a43a2f9b724da473f0ddab6eca8d0f511082cd7a55c15fed5f9e30 |
Close
Hashes for rina_pp_pyb-1.0.1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7538f0ce189cab49742aca8c91c79891dcc16ac36005ecf125d645305463a38d |
|
MD5 | 7e9a1c5d22ccdf9f3852597a1f5cad72 |
|
BLAKE2b-256 | 6064aa35659f18319007c19126791ce260b964a3f0b248040579ef9b58a2d62e |
Close
Hashes for rina_pp_pyb-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8496125db2c2c1aef1c189acf684f04c8427e4bafc7423249fa0362e8d77701 |
|
MD5 | 9f90b7bc13e815450c6ce61385e69089 |
|
BLAKE2b-256 | d20b06830839b31d9be26a50a3cda562f0abbd3d67dd20e4c556e60100e5c8fc |
Close
Hashes for rina_pp_pyb-1.0.1-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86e9d6a4166c9193c3571b781b5611866609c0caf6764691ab71be907ad619ed |
|
MD5 | b461cd4b4dcba865d7e72bcc360f604f |
|
BLAKE2b-256 | c79a97cdc083494a29022396337dc1b2f07f2052b381e80c9c65f459cef44aac |
Close
Hashes for rina_pp_pyb-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbed061408a686624d89d1f8f315bd5a97afe0bbc8773189737bfbbb0401bb76 |
|
MD5 | 4c068140f3a9cb5c67b50835b50c3ca3 |
|
BLAKE2b-256 | e0998a7328ab9405b2cc75bbbf3cabf89b15985e0450075866efb5f2143fc4b4 |
Close
Hashes for rina_pp_pyb-1.0.1-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec2eea2d830edc477bc81b4e97373d4cfe03d62fb37d1cd2efd67f1d3caf9396 |
|
MD5 | ccfa696df751238a4d2b30a81cd1b2b4 |
|
BLAKE2b-256 | fe04023fe515c0eae2f25e3e2ec7566372ff326ccb7c5dc0b5fd029142216170 |
Close
Hashes for rina_pp_pyb-1.0.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68614d393b57baef31e21f7a8f88fa02997ad21a5fbbfe88dc9510541de145a4 |
|
MD5 | 992bfd87f18d763347738084ee0e5efb |
|
BLAKE2b-256 | fca851c204020e43a655e2d10a8d4d35a90df741f50ad65bb5ac6c666e33f784 |
Close
Hashes for rina_pp_pyb-1.0.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbf524533abb84ec6e1a2eb92565a0ecdf397681e86335f3ba5da3b02e8a09d9 |
|
MD5 | 4a593b8710d56a6040106f46c680b5c0 |
|
BLAKE2b-256 | a967e01fa7f31a5dd120e602cafcdca2ca69415b9d58c029767de5232c211434 |
Close
Hashes for rina_pp_pyb-1.0.1-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d71403883bd481019735d087042548464422c4c0c4ab1d489cb380932afb9d31 |
|
MD5 | 7e37f8dd1278335f9a694a107275ec75 |
|
BLAKE2b-256 | 259272ad1b0c369de2941d1cf634ff6786eab637cedb0665483f89ad5eff0fa7 |
Close
Hashes for rina_pp_pyb-1.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b2714ac8041b73fac05600b8c000f59a46322b19378c1650e75e1c1bc8d231a |
|
MD5 | 0a369bfb1f9f869b25dc8dbb1dc28af3 |
|
BLAKE2b-256 | 8d1cceb03d0d6e173e8bb00f81d567fa9b5e1012c94aaae4c6d943ad18a7f291 |
Close
Hashes for rina_pp_pyb-1.0.1-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1592f1e4643b92cc9493d30af7f5646dd85aa091e41e5ebe4d96ac4aebf598c3 |
|
MD5 | a155f2c0d7e1b503c2227abc2f8610b7 |
|
BLAKE2b-256 | cafbff3695f90a7711cfbccea98df8e2f3c86afc018ad076fb86e0e10d68f287 |