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.0.tar.gz
(33.0 kB
view hashes)
Built Distributions
Close
Hashes for rina_pp_pyb-1.0.0-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b24011ee79f664157667d86f525c3eeff70f278a2dc1ba85c6c929cd3944faea |
|
MD5 | 688b7cd6a0143e0a5ef6f115b96c94de |
|
BLAKE2b-256 | fc544c638c8caa5c97fdcdd73458b5c688ef3168115f5053d63b2f1e0f0171da |
Close
Hashes for rina_pp_pyb-1.0.0-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75c5cdc151b233dd900e0b12b9b6988e7fe66b3dc0620fe0001317c8be015fb6 |
|
MD5 | 32977b0c97f7904ef06d50c71b994e7c |
|
BLAKE2b-256 | 6913589798745ff0fd218b2d8a173d5d6bd971d770202288ebacde8ee7448654 |
Close
Hashes for rina_pp_pyb-1.0.0-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3176431f518bfea15022fb131f8b8caa642b86e85f4b17a5cbec83f3cbb2f04e |
|
MD5 | 67ce9fc099fd029dd0c049fe0b1b8c4f |
|
BLAKE2b-256 | be45ddc75d9856835f6528d3136225a1af4ddf2d0f05d10093cacc897bdaba32 |
Close
Hashes for rina_pp_pyb-1.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61690b9dedd54bf37d32f4cd5fb11f9d553852128e03a3be076060735c0e5939 |
|
MD5 | c80eb039971c0c8be2e3e9fd02a102c4 |
|
BLAKE2b-256 | c17bcb49bdddfe88e5a17a256e2d4eeb836eaa5c370d867840ff3be4f19ed8b6 |
Close
Hashes for rina_pp_pyb-1.0.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d785b9fd5d19b6e977877e0c7e22f60a116b772fb6a92c522c3acb6e678e74cd |
|
MD5 | 1b89720487ca1c607c6ebed9ac2f8ef6 |
|
BLAKE2b-256 | 8f5738d16a738d7c5d32559da0bb3e9fe4ec27c2c0420318ebe135777fc0d262 |
Close
Hashes for rina_pp_pyb-1.0.0-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb1247157eba3c9f74edc53e90ee993da5391a86db68e1d360471c6257ad842b |
|
MD5 | e36b55a4fb2b56e7c9be4ee01859605e |
|
BLAKE2b-256 | df8841562abe4db36dc09e50b8f016ebb7c168fd6226aa5ff0e9c6776b348d6e |
Close
Hashes for rina_pp_pyb-1.0.0-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f140a2ed0b94bc7511ac4efaed49b6d48088b337ed118ea295c107e30de0d44 |
|
MD5 | 7edc30ac61cc22d8b638c230bec8871c |
|
BLAKE2b-256 | c92927c92102710d73124c8637965a655fc1eb65eff08549b774934a70aea479 |
Close
Hashes for rina_pp_pyb-1.0.0-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 889bf16916a80b90a9a99b0a608674eaba0da6a6034b31e876a5faf6702d7678 |
|
MD5 | ae74a9d5371f5734503be6a6a50ac9a0 |
|
BLAKE2b-256 | 19de2925a0da43174a0cd8a57145713fe5fdb43ec85ba0da32edbd24ef82d0c1 |
Close
Hashes for rina_pp_pyb-1.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8429a71a532a98f291b798f1637f06298443f93b9117b4d9be65017f834a9153 |
|
MD5 | 6bc5b48f413818713c724b8517d5e607 |
|
BLAKE2b-256 | 81305bd0cc0621f9cca6465b273da9494473b68e7986016092fe232aa7399898 |
Close
Hashes for rina_pp_pyb-1.0.0-pp39-pypy39_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a06d07c489ab0b279569074701da601da9efff162d6e0a492094f9236ed699c |
|
MD5 | d07e0c26814b4b7524e1646ee1bd1c66 |
|
BLAKE2b-256 | 08b8e11b526368c100a89b4cf8eaff96386c41afc05e46e16f295fe6cc96e1b0 |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6ceef62afb229bb877f2f985632d3f85d7a73ba61f4e3cd08ffdd540c931ef0 |
|
MD5 | 015c85177fb2350dc5205bf2a8f4fb23 |
|
BLAKE2b-256 | 60808dc6756da9943ebbaf70ce518be8b066c9fc6736050483ec175eaf4aa443 |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd57f223877c227cee166ede4d23b16308038093d4e9678fd3e920c963cb03b9 |
|
MD5 | ac4ebdd28b153c725482103cb788f0af |
|
BLAKE2b-256 | 234e49e83bb0cf1905ee3726ce74e38eef8ff9f30a7b921d3725c615235c717b |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7743cbf7622d01dfa734af1982a2d395a354836f7eecfd41746fee5479066f36 |
|
MD5 | 6ce50314a040ade2b4245061580f70a2 |
|
BLAKE2b-256 | f9b20500bf46124c201751ae24c9fca25a210f1f610a7ca481b9622fdc817a4a |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-cp312-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfc5fbc0dd7ac4e80acd8ec1439b22c4b53436b926b33fe7579e6695b067fdb3 |
|
MD5 | 7896f3627cd398a2ed9a9df2f43095b4 |
|
BLAKE2b-256 | f289a759c2952bc7a36ff2a0c9c099ff9dbbae4e4b20bc72a5a445ce409485a4 |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf80c1ba482bcd0679d97440c761129d6efd4ebdad94639aa98cf52f45c4bbc9 |
|
MD5 | 7b10e1de69b5a69654360bcdb9693d17 |
|
BLAKE2b-256 | 58cc3ec06938d113a22fcab1fc3f06a7a19d74e9c77da880dbb1c309d6b9766a |
Close
Hashes for rina_pp_pyb-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b6df99501cc23b8a018a9c02eca15722586fc9d5a30ced7f715e66bb5d24870 |
|
MD5 | 04ca28456e96539706a077717ce18525 |
|
BLAKE2b-256 | a696a16fb69152cecb13d3c2bf51cc53d57bb07849e5ee0d0bdd9b1ce0023824 |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 884e6ee182bbc54d18f8b64b8968bd49bdee94a60f40d23e376f83f75b040955 |
|
MD5 | 9e2bd3fafd7a826ae1c062e821460133 |
|
BLAKE2b-256 | 8f70426ebaac9077cf95861db2327b4a7966119515a3927c35f51fa06b9f82ea |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1f49cc85b303f79fbc54751d0862f071219515fac2825b4db796024e7983831 |
|
MD5 | 4d124d769405d2e909098f97a2b52aab |
|
BLAKE2b-256 | 14177c96e05f0fa921662a4feb567cc0465782d9115fd91d4fbe4cae31d8ee37 |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ec298f092ece0dcea0d43a361deee34e0044bc45d31e0531d6fe5838002633 |
|
MD5 | 6c7dc0477b7a066ab52baa7f74935bea |
|
BLAKE2b-256 | 2b78191df53bfe03728fd4debdbf24a603456bc34e3d7dd6c57a3a13e71606f6 |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 984d3b43864c1fb3a6f8a6f2e177c11f854cdd9bb23c9c671a482c362a9a627f |
|
MD5 | bc03ed9995b5c2048b23a6d45c09e298 |
|
BLAKE2b-256 | dffe32983b9d49a891c72950fcda344250038af5883cde42cf6aafe9c6aa09e3 |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b9dbbcfffe3f0a283ae0da368e65a3f784f2cb33a77ac771696492c37a676d3 |
|
MD5 | 9fca1afb1cb42aa338b8612bffec8005 |
|
BLAKE2b-256 | 9432cadfd00b452ca35fd6be6a45bb7cb5af39d87f33af173b4c33de132d2cc8 |
Close
Hashes for rina_pp_pyb-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95259399e5378817c806e260d2dea3e1549c35469d2e4d06cae2a2eb5f233947 |
|
MD5 | f34b3e6d5613d58f019907932d52ec17 |
|
BLAKE2b-256 | ab0a3842a76cd0e4212cff9a12d3af9b1d4c9d1114e5690c05a74e8f450baa9a |
Close
Hashes for rina_pp_pyb-1.0.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2df3a28dae9f2a0676574e5cac12719f25cce08e078583cefd94503ae6631f6c |
|
MD5 | a140f80dd5cbb657dd291980fc4a0d79 |
|
BLAKE2b-256 | a458765ce4c9a77489e34531c1f04bad0d992bf98ee5ed36f57a0358c972dfa0 |
Close
Hashes for rina_pp_pyb-1.0.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd5f9446652cd8e0a9d300642face9d407e05bca528846cb854f49e66abc79d2 |
|
MD5 | 2e7416b6703a8d3ff9ca057e084359b7 |
|
BLAKE2b-256 | 0b678aafdcb9d0397e76d3eb9c0a8b8ae3fc5f590d53ca3ae6917142566e7c78 |
Close
Hashes for rina_pp_pyb-1.0.0-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9a9711f6b92c5f7d565b17e594ad2f4fe8bdedaf30f3e9f68b98ec50f8a9485 |
|
MD5 | 3fca87345b4386fa64b80e322174349b |
|
BLAKE2b-256 | 34b2b571e93188b315cd7a4e9d6ccb53399667ca00715dd68a95ead7b7171176 |
Close
Hashes for rina_pp_pyb-1.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17426cbc51c6f794c1ff3faff789121ef215975892407170159da66b5425b3ef |
|
MD5 | 9ba3fccaafe08a45064ff458c7bf75a9 |
|
BLAKE2b-256 | e25b5ceab2dc54b525bbc82138e12748853cc61b11e176421ea093ceedeafeda |
Close
Hashes for rina_pp_pyb-1.0.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c36514f1086a39c6afc751ed44c120534ff628d0ddf5f41cb3765f32b5f0f7d8 |
|
MD5 | 5c28899928325ed2df4145ab9936605c |
|
BLAKE2b-256 | 7865d50b7da1909bc757f1ad79496c192b436db39ba5bf56b0c6ec90c53286e5 |
Close
Hashes for rina_pp_pyb-1.0.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 988496019523cc8fc1691577151b3ccf3ffc7e2d2f32a9cafbc4aeaaa1654b59 |
|
MD5 | f4fbd14f05df3c0c9cb29a393bbe9151 |
|
BLAKE2b-256 | e1261765d348c6205dd9489d0fcd0c93c4481e178f13b98b02f5c847f1ab258e |
Close
Hashes for rina_pp_pyb-1.0.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f95ef14e639e601f4f6453dfb77b226541c1a3343d6ae13f222990e9ea4a888e |
|
MD5 | d5f450dd1775fa56fd97a0b0d5227c1d |
|
BLAKE2b-256 | ce61a678456bfe17e7e6d8f4b31b7160d9e6141419a9aa8f8093e44334b2ab90 |
Close
Hashes for rina_pp_pyb-1.0.0-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57171a9259760f4177eec29832903f71f8df9c92314dc636c90cf0ff9b373505 |
|
MD5 | ee2890554de361d94011b02ac8cef6f3 |
|
BLAKE2b-256 | bcc36828bbf2a519c3d97c39b8102e91fec1b3ba716f0ac07656c5b98da28908 |
Close
Hashes for rina_pp_pyb-1.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 045020e7d015e01d56c639575edec685e6e7e21571bd00c49786cc7214777396 |
|
MD5 | 988eadb9defc5129b01e58954f13a467 |
|
BLAKE2b-256 | ff6c4bd6e9cd570acbc0ffe0327d43f0e7db59841e44c134843f300a4a6b74e1 |
Close
Hashes for rina_pp_pyb-1.0.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 404d8b693e85009542d0aaaed9146dcecd67e75d1c1ece4f1e13a920aae038ee |
|
MD5 | 7822eacab55b69954bf9678be374a8fe |
|
BLAKE2b-256 | 8a6f18d7b953b552c7f75ec00068688d4bbe13076c82ea4f79af696f5358412c |
Close
Hashes for rina_pp_pyb-1.0.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02804b9893877477026a91a85f5c23092288bb780eda3ac67974b2398fa4afa8 |
|
MD5 | a0051823554af6047c076e000c233ebc |
|
BLAKE2b-256 | fbed73d2bca49366da21de4ac98ed968ad23db62106833b12ba4b809748c1877 |
Close
Hashes for rina_pp_pyb-1.0.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92dbb29f65a7948b792ab500e23e624d8d2e510ad9ff15c6e51045d53b7f79b4 |
|
MD5 | 977b0be1942f54abe17c646479c30d15 |
|
BLAKE2b-256 | 87739d5e801de69ed1af32d22e486dc57e21f93fb40ffd0e6b53ccd83517fe0b |
Close
Hashes for rina_pp_pyb-1.0.0-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3207fcdf880d44b01853f7ca07e409a25be7ce9117ff104b0cc19cb8a361602 |
|
MD5 | 24a356c2340bef2e02141a450f43267a |
|
BLAKE2b-256 | af09e3a60bb7cdc5321103f6ae8a0788e514e09df242cc9c0c503898efbc450f |
Close
Hashes for rina_pp_pyb-1.0.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 032c33a84f25d11299e5289edd3faf0a904848e9ce062df99fc252be3d76f590 |
|
MD5 | 49d9ffb584fcf815c07abbe3c73e9286 |
|
BLAKE2b-256 | 123167950b78b112aa2d92c0fd264f92d12eef37e110498804c69fe9ac0ec876 |
Close
Hashes for rina_pp_pyb-1.0.0-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6e0d3fb7acf7daafe771468a5f8661da33a0a36cd29d444994444f53131648e |
|
MD5 | 8933011627db7ffd5fe8ae50ca202fee |
|
BLAKE2b-256 | d04aaa4de73bad8b0c646d54e01bf2c633c56fa1fd8a92189149f0f68f9fa7e6 |