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.3.tar.gz
(22.6 kB
view hashes)
Built Distributions
Close
Hashes for rina_pp_pyb-1.0.3-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4677b0c71ca3ea0d74af53b1c8b42f69c43d7c98801bdcdba9ddae61cee87e48 |
|
MD5 | daa60b9e4fc5cd4b8e6a336cd7a98683 |
|
BLAKE2b-256 | ecf8b1a77912a30493bc2c70f8e480a5225a92005437d96efdfe41506bfebb42 |
Close
Hashes for rina_pp_pyb-1.0.3-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | faaeeacf93431a0a994da2398bdf7f3e16a23ba8f9fc0ac9778a74d8af58fdec |
|
MD5 | cafbf8aa548519122398429023275199 |
|
BLAKE2b-256 | 0c1fffd046779bad15f0c3a9672f4414adced25e80e458a4b0f33414094823e8 |
Close
Hashes for rina_pp_pyb-1.0.3-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12b328f7eb3a461e9d15e53bce492eb48e728f2b101a079770a5b90a44979604 |
|
MD5 | dd47c44f740cad66f2533a3ae078e258 |
|
BLAKE2b-256 | d0212172643229151d6bda2e9c759a2a31f612cede6fe11f989b2d5a649c61a8 |
Close
Hashes for rina_pp_pyb-1.0.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f35d4cea3effa09069386ad34216a70f4306039bf0bf0ddd02282b7377bebf2 |
|
MD5 | c4af0b43bad074d2b1a1c647a47b98e8 |
|
BLAKE2b-256 | a15ee442c21ea9d02597c194d3dd9ac2cefb509eb44108bdc6a7b621284cb72a |
Close
Hashes for rina_pp_pyb-1.0.3-pp310-pypy310_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd3ef3f70df3de71ab4d19a0b2f3ff7e57a8c75bec961ecbc82ae73b098f9b49 |
|
MD5 | c2a4966b547eb4c1ba12a3b478b5cbda |
|
BLAKE2b-256 | 9bb6695a787c59b9324450e51b57b600a56a2170b2cb0a1355f7a30faf875726 |
Close
Hashes for rina_pp_pyb-1.0.3-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaf0a2a9493e3c321508029aa0ee6dbc27766d81579bc3a20d3f5424800548a9 |
|
MD5 | 52d2b294cd646559084e3c8c32cff0f3 |
|
BLAKE2b-256 | 712049f0c8f47f32bf8a068b125aae08fb9d1f84b1faf69f2aa5392fa20e19ed |
Close
Hashes for rina_pp_pyb-1.0.3-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cfa14ccf3056e2ba8151f59e9609a2b15f49142c23b93143f750469d5accf2 |
|
MD5 | c07d403801a94d177d0d246bbe352128 |
|
BLAKE2b-256 | cfb305629137ddff797adeba3ee5080e21caba086a1afce716d6c974c024d750 |
Close
Hashes for rina_pp_pyb-1.0.3-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3272d9a660d0227557de1947658e6b1ed89a5449bb7e07ea10ddf4118dd147a6 |
|
MD5 | 4a74d9df2939dbf3cf2e00556953b655 |
|
BLAKE2b-256 | 4c6edd3ec39891f00ce22e3fdf4b6e59efde8955b59af5ab45851ce873ae8204 |
Close
Hashes for rina_pp_pyb-1.0.3-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763d069b59b29c0f717c6b0f91fdbf6a31fb33c7e5e865fcfa3028581818bc05 |
|
MD5 | a4be33e8fed29677c1d1e139acd3883e |
|
BLAKE2b-256 | 3bd39262855797e2c0d5f949f22e52687047b5a7ff5e98cc3f01ddf7d72b3f3e |
Close
Hashes for rina_pp_pyb-1.0.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ac3963ef4e0cdecfd4905ccf06c2e981dfd436f25d9564c829c89ec9d972c6 |
|
MD5 | 58d4ab1c60a23994d5353fdd4f958632 |
|
BLAKE2b-256 | 61b557a071aa3aa1015d068683b196236cf2261b369eafe0ee397fdaa16f403a |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4a11e4000f3624d8bb039b237238c4b7f167dd51231ab1a51f9e4c7f4e44047 |
|
MD5 | 22b4342edc6a0a05568d6e0acb3aa082 |
|
BLAKE2b-256 | 0b0af077de961c6abfbdd8243385fbc00e20869af1a3552cf4fda979846e94e8 |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 649774160fadbb87a4a085460536189af8223b66b433599c66ce6b25ea175ae3 |
|
MD5 | 1b09262742c3499865795948ebdc04ef |
|
BLAKE2b-256 | 1c26cf0a02f25de9c2fe5ae3b85b1ce2f1cde30c0423210751dd1e5e37d55b98 |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a78390addb3fdddf50c1988fbc2d478e52ecbf34af50ae6380a633beca928b5 |
|
MD5 | 51f59a91665e01c0f0ad996baaea8ff5 |
|
BLAKE2b-256 | 51ec0837b5c7bdf410da8486c6d3216c789890108bbddcc7e0936702ea8c164d |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-cp312-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d7f85f5dd3d2e5becd284902c804e9c0977a2b17a318fdb736da3c94bee9e82 |
|
MD5 | eb318c549e41ad18c71e21d6c72080f1 |
|
BLAKE2b-256 | 26ca96dcad675ff2f991318385cbc74be7e084a373c2968f7dcc57fc7f10ca35 |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b48575dec3135930d4956a6ca981e6023978df5e87238345873a05192f092dab |
|
MD5 | 2ca0a4aea31453f5b2da6f013783aab3 |
|
BLAKE2b-256 | 2646bef2e38e935a8f0d042314a1e00ab17598db2f0fa5c6f114f79cbb94be0e |
Close
Hashes for rina_pp_pyb-1.0.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4551d64255481eccba03ab890c2e9e116e0dba1d279d51167877de611064d31c |
|
MD5 | d48b0a03bd9cc7c8a2559e18c9402182 |
|
BLAKE2b-256 | 6712d97117ff94d61ee1eb4d87fe5afecda63f627a06caf10409b747f4c41f88 |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 039b3bb7d6cc781a66c36b8240d60da566faf5b07a8cfe2fb26856573d78668a |
|
MD5 | 3b8825dc5e1e36e60a7a28497f41498c |
|
BLAKE2b-256 | 9e3ec9a14777714ddea969990ac0efd41dae6f40903a27cc2f16ad7687417c92 |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37cb3d0d91a1cfada72e5ee39227fade9ffa4250adcee4b7f67e7e802349cc81 |
|
MD5 | bbb4db1bef4c9968360a0d69c8076eec |
|
BLAKE2b-256 | 3f4dd3746bef76e468593617e867032b64202a9d3f682a9a724eedaf8c905e37 |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f08bc67e4be43c17aaad274dea3e2c875d9fc4255939049cf7e94af35cffebf5 |
|
MD5 | b72d6731032428c8123de7cb33beedb3 |
|
BLAKE2b-256 | 7a383d44a40256e78e866482433994a4ed650bde30224155afa62b116fa947af |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c037337d7ee994e09521875a3c0c9809f468320c09975115c39420a38b110598 |
|
MD5 | c9cf13c9315780cce250fa142b1a1ad1 |
|
BLAKE2b-256 | 73acef6c558ad0c8de0e6fc063571bccc8f71b32e51da58595d72315b8084396 |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 717d902d22e7bcaac9b588854f3e844330cebdd9afd6e0a35b9a430ff08ea86d |
|
MD5 | 65949ef1fa46e713795c055bc4752deb |
|
BLAKE2b-256 | 8116fed614110efb5472a7f4b53961105abea7b3a60b1fc4e5c54a3128ffe9a0 |
Close
Hashes for rina_pp_pyb-1.0.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8fa6d47eca41d5a677520e9a04b4fa4838ee2bc8b08a140b46d4d4803a6e5d3 |
|
MD5 | eec42b2208b64713706cb6177c470369 |
|
BLAKE2b-256 | 215abe57f3168f3c2df8a218d7e6d5407ff3e564c8a2190e18b03f3d35a4321e |
Close
Hashes for rina_pp_pyb-1.0.3-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6dfdd01cdaa49d4d58d57f705942f361412b1fe5efd383cf3eedb9038c436f0 |
|
MD5 | b19553b8bc1c50543c5d023dc0fe6e58 |
|
BLAKE2b-256 | 5a4b1678bd6fcf8e850f05fa48f16d0876de68c1e305c6e7167dcf7b2e50cd5b |
Close
Hashes for rina_pp_pyb-1.0.3-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7f7562cdcfcd856f254b4f85346871d9ae98d5b183a870a865feaa8405b7cd9 |
|
MD5 | e4a3b600b6202911c6891cd1bffc3b81 |
|
BLAKE2b-256 | b95143d9164019d50f67a47deaa570d10514d89a0ac75004d4ab8cfc4a576979 |
Close
Hashes for rina_pp_pyb-1.0.3-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e910e859bd42d3944d51dbca41276397c4f31e7c9c8db3b34912059736be516 |
|
MD5 | 93a3e091d12146455f38b8ea5eab4f43 |
|
BLAKE2b-256 | 1c0c6600ff6cb6263e6449f15dcf87383529b19ac261082569a17d5ad06858c3 |
Close
Hashes for rina_pp_pyb-1.0.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 071b70a1b7dd43152074f76ee34b5a9fa20c8c05a8fca5b2daa1791068eba0a4 |
|
MD5 | 5282187f452cc2253722a457f35d8ab7 |
|
BLAKE2b-256 | 880e6743e3815731ba66e7da3c8dbd91516b445702a1cc1712952b043fbdc4fb |
Close
Hashes for rina_pp_pyb-1.0.3-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f178e091b70ad18cfc7ad9bf8dcf75295bc42b7b9c94b0ae99f3045a5ae76360 |
|
MD5 | 51b284852c14e3f1ea7f380a8797d9de |
|
BLAKE2b-256 | b6c67e2b2a0da56a2723b4adc34d27009fbc69a1b56b7a74888d670c56477960 |
Close
Hashes for rina_pp_pyb-1.0.3-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47027fee213f29d22507faeb5628f70cc6d8ba424ec843a71582fd5d0cf49adc |
|
MD5 | 4a854d03b193e6228d041d9d4540fffa |
|
BLAKE2b-256 | e72dae08cd6862e20473aaba80857c36a834f581906e449d0b1a99d641367791 |
Close
Hashes for rina_pp_pyb-1.0.3-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c933877d7fd21dcd4f7216e5e750f3117d78e3d99703d61b02d96aed94dddad2 |
|
MD5 | 0432f3643f694d0773cf77632d140c4c |
|
BLAKE2b-256 | 56ce0d5f748293f50b82ebb62c948de9f29658c98333d9375a10ae4ad0b7cb90 |
Close
Hashes for rina_pp_pyb-1.0.3-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62fa3783c7b94c9ffa92ac7e654040d92fc412e34553ba0e177377dbd3f72ffc |
|
MD5 | 199b71eefd605af6419cceca55fe5270 |
|
BLAKE2b-256 | 6f54c1eeeef646c02ae4428f14cf6455c4bbfc6cb096a06d187be104f02e35b4 |
Close
Hashes for rina_pp_pyb-1.0.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0549164c3f7f9a0444ac3eec38553e2650280aa10f4b44bd7d60517ee60733d |
|
MD5 | 865ad651c2e953d535707346d17fb605 |
|
BLAKE2b-256 | 4c19a7b517bfebd2118dce6f4132a8538fdc1ae75389a967e2f8fa29c04e550d |
Close
Hashes for rina_pp_pyb-1.0.3-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ead2988de40e1c636bd99dd9cb1fd9984640069bc3ea1a9407015645e67684e |
|
MD5 | 906f3a7ea59621c9f8bf180560862e5a |
|
BLAKE2b-256 | 0ff86066f6f83f6cc89f12a8433d83cc845e6a17305da20e69f5fc0b4df5c0fb |
Close
Hashes for rina_pp_pyb-1.0.3-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 326334297b8aa47d745788bee4f815da699b9e174d82c5cd1f19781b4903ad27 |
|
MD5 | 83e98cd31d98483ea15348bf1b895fee |
|
BLAKE2b-256 | 7c32af00315d9e72253ebf462cd8adb5fbcdef5ae0022d08e9757e0e96df9c26 |
Close
Hashes for rina_pp_pyb-1.0.3-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b8deb90618bd995fa1ab8ec37c6a69bd3217f5453854b92749714bbc4277993 |
|
MD5 | a5acbe3b10a30a24757fd869e8a04272 |
|
BLAKE2b-256 | cba0bf7bacd1c0ad257ad23bade9f2a90b6c05098e86228dc1c671300bc456e8 |
Close
Hashes for rina_pp_pyb-1.0.3-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5738b20f5d298d9774ed8ac180e8cbabd707a6edc04f99ca0b496935dfe862a3 |
|
MD5 | 6d8ddc85339b152626b0490c8542f906 |
|
BLAKE2b-256 | 293a785fc2f7cc6df560eeacbec5937c5cb205b2199cfca909829a61181c083f |
Close
Hashes for rina_pp_pyb-1.0.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 977b97c84a21525955789dd29f909db1a6ef7a1a993eb899db924cef82f07a58 |
|
MD5 | 6512a38f9c67fcc6a5de1bf5876779ba |
|
BLAKE2b-256 | 1a6ef1c0501c03c6a61f74d0f04b6c60599986042405b8a1f6477967d1fabdff |
Close
Hashes for rina_pp_pyb-1.0.3-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a32acdabb48a622fb6355d7c348194263eea9e299de3673b16cbf02282c17ae3 |
|
MD5 | 2e1f1f2a184fe7679bdcaca64d02447b |
|
BLAKE2b-256 | 8377573fbe18c185e4fd9e918ec65aaa6779324a34d5d746ff0c787d7417ee3d |