Performance API¶
The public calculation API build a Beatmap, then compute difficulty or
performance.
Builders¶
Public calculation API: the Beatmap, Difficulty and Performance builders.
- exception parsecore.Performance.api.RulesetNotImplementedError(mode, stage)[source]¶
Bases:
NotImplementedErrorRaised when a ruleset does not implement the requested calculation stage.
- class parsecore.Performance.api.Beatmap(pm)[source]¶
Bases:
objectA beatmap prepared for calculation, wrapping a parsed map.
Create one with
from_path()orfrom_user_beatmap(), then pass it toDifficultyorPerformance.- Parameters:
pm (PerformanceBeatmap)
- classmethod from_user_beatmap(user_beatmap, override_mode=None)[source]¶
Prepare a beatmap from an already-parsed map, optionally converting it.
- Parameters:
user_beatmap (
Any) – A parsedparsecore.Beatmap.beatmap.Beatmap.override_mode (
GameMode|None, default:None) – The target ruleset to convert to, orNoneto keep the map’s native mode.
- Return type:
- Returns:
The prepared beatmap.
- property mode: GameMode¶
Return the (possibly converted) game mode of this beatmap.
- property inner: PerformanceBeatmap¶
Return the underlying performance beatmap.
- class parsecore.Performance.api.Difficulty[source]¶
Bases:
objectBuilder for a star-rating (difficulty) calculation.
Configure mods, clock rate and difficulty overrides with the chaining methods, then call
calculate().- mods(mods)[source]¶
Set the mods.
- Parameters:
mods (
Any) – Legacy bitflags, an acronym string, or a mods object.- Return type:
- Returns:
selffor chaining.
- clock_rate(cr)[source]¶
Override the clock rate directly.
- Parameters:
cr (
float) – The clock-rate multiplier (e.g.1.5for DT).- Return type:
- Returns:
selffor chaining.
- lazer(lazer)[source]¶
Choose lazer or stable scoring semantics.
- Parameters:
lazer (
bool) –Truefor osu!lazer,Falsefor osu!(stable).- Return type:
- Returns:
selffor chaining.
- ar(ar, fixed=False)[source]¶
Override the approach rate.
- Parameters:
- Return type:
- Returns:
selffor chaining.
- cs(cs, fixed=False)[source]¶
Override the circle size (see
ar()forfixed).- Parameters:
- Return type:
- Returns:
selffor chaining.
- hp(hp, fixed=False)[source]¶
Override the HP drain rate (see
ar()forfixed).- Parameters:
- Return type:
- Returns:
selffor chaining.
- od(od, fixed=False)[source]¶
Override the overall difficulty (see
ar()forfixed).- Parameters:
- Return type:
- Returns:
selffor chaining.
- class parsecore.Performance.api.Performance(beatmap)[source]¶
Bases:
objectBuilder for a performance (pp) calculation.
Configure mods and the score state with the chaining methods, then call
calculate(). Unset counts are generated from the accuracy/miss count.- Parameters:
beatmap (Beatmap | PerformanceBeatmap | Any)
- mods(mods)[source]¶
Set the mods from a bitflag, acronym string or mods object; returns
self.- Return type:
- Parameters:
mods (Any)
- clock_rate(cr)[source]¶
Override the clock-rate multiplier; returns
self.- Return type:
- Parameters:
cr (float)
- lazer(lazer)[source]¶
Select lazer or stable scoring semantics; returns
self.- Return type:
- Parameters:
lazer (bool)
- accuracy(acc)[source]¶
Set the target accuracy in percent (generates a matching state); returns
self.- Return type:
- Parameters:
acc (float)
- n300(n)[source]¶
Set the number of 300s (great hits); returns
self.- Return type:
- Parameters:
n (int)
- n_geki(n)[source]¶
Set the number of gekis (mania perfects / max hits); returns
self.- Return type:
- Parameters:
n (int)
- n_katu(n)[source]¶
Set the number of katus (mania good / catch tiny-droplet misses); returns
self.- Return type:
- Parameters:
n (int)
- large_tick_hits(n)[source]¶
Set the number of large tick hits (lazer sliders); returns
self.- Return type:
- Parameters:
n (int)
- small_tick_hits(n)[source]¶
Set the number of small tick hits (lazer); returns
self.- Return type:
- Parameters:
n (int)
- slider_end_hits(n)[source]¶
Set the number of slider ends hit (lazer sliders); returns
self.- Return type:
- Parameters:
n (int)
- passed_objects(n)[source]¶
Only consider the first
nobjects (fails/partial plays); returnsself.- Return type:
- Parameters:
n (int)
- legacy_total_score(score)[source]¶
Set the stable total score for score-based miss estimation; returns
self.- Return type:
- Parameters:
score (int)
- ar(ar, fixed=False)[source]¶
Override AR (see
Difficulty.ar()forfixed); returnsself.- Return type:
- Parameters:
- cs(cs, fixed=False)[source]¶
Override CS (see
Difficulty.ar()forfixed); returnsself.- Return type:
- Parameters:
- hp(hp, fixed=False)[source]¶
Override HP (see
Difficulty.ar()forfixed); returnsself.- Return type:
- Parameters:
- od(od, fixed=False)[source]¶
Override OD (see
Difficulty.ar()forfixed); returnsself.- Return type:
- Parameters:
Score state¶
The score state (hit-result counts) and the hit-result value types.
- class parsecore.Performance.data.score_state.ScoreState(max_combo=0, osu_large_tick_hits=0, osu_small_tick_hits=0, slider_end_hits=0, n_geki=0, n_katu=0, n300=0, n100=0, n50=0, misses=0, legacy_total_score=None)[source]¶
Bases:
objectA complete set of hit-result counts describing one play.
- Parameters:
- class parsecore.Performance.data.score_state.HitResult(*values)[source]¶
Bases:
EnumA single hit-result kind (great, ok, meh, miss, ticks, slider ends, …).
- NONE = 1¶
- MISS = 2¶
- MEH = 3¶
- OK = 4¶
- GOOD = 5¶
- GREAT = 6¶
- PERFECT = 7¶
- SMALL_TICK_MISS = 8¶
- SMALL_TICK_HIT = 9¶
- LARGE_TICK_MISS = 10¶
- LARGE_TICK_HIT = 11¶
- SMALL_BONUS = 12¶
- LARGE_BONUS = 13¶
- IGNORE_MISS = 14¶
- IGNORE_HIT = 15¶
- COMBO_BREAK = 16¶
- SLIDER_TAIL_HIT = 17¶
- LEGACY_COMBO_INCREASE = 18¶
- class parsecore.Performance.data.score_state.HitResultPriority(*values)[source]¶
Bases:
EnumWhether to prefer more or fewer great hits when generating a score state.
- BEST_CASE = 1¶
- WORST_CASE = 2¶
Difficulty attributes¶
- class parsecore.Performance.rulesets.osu.difficulty.OsuDifficultyAttributes(aim=0.0, aim_difficult_slider_count=0.0, speed=0.0, flashlight=0.0, reading=0.0, slider_factor=1.0, aim_top_weighted_slider_factor=0.0, speed_top_weighted_slider_factor=0.0, speed_note_count=0.0, aim_difficult_strain_count=0.0, speed_difficult_strain_count=0.0, reading_difficult_note_count=0.0, nested_score_per_object=0.0, legacy_score_base_multiplier=1.0, maximum_legacy_combo_score=0.0, ar=0.0, hp=0.0, great_hit_window=0.0, ok_hit_window=0.0, meh_hit_window=0.0, n_circles=0, n_sliders=0, n_large_ticks=0, n_spinners=0, stars=0.0, max_combo=0, od=0.0)[source]¶
Bases:
objectDifficulty attributes of an osu! beatmap (aim, speed, reading, flashlight, …).
- Parameters:
aim (float)
aim_difficult_slider_count (float)
speed (float)
flashlight (float)
reading (float)
slider_factor (float)
aim_top_weighted_slider_factor (float)
speed_top_weighted_slider_factor (float)
speed_note_count (float)
aim_difficult_strain_count (float)
speed_difficult_strain_count (float)
reading_difficult_note_count (float)
nested_score_per_object (float)
legacy_score_base_multiplier (float)
maximum_legacy_combo_score (float)
ar (float)
hp (float)
great_hit_window (float)
ok_hit_window (float)
meh_hit_window (float)
n_circles (int)
n_sliders (int)
n_large_ticks (int)
n_spinners (int)
stars (float)
max_combo (int)
od (float)
- class parsecore.Performance.rulesets.taiko.difficulty.TaikoDifficultyAttributes(stamina=0.0, rhythm=0.0, color=0.0, reading=0.0, great_hit_window=0.0, ok_hit_window=0.0, mono_stamina_factor=0.0, mechanical_difficulty=0.0, consistency_factor=0.0, stars=0.0, max_combo=0, is_convert=False, clock_rate=1.0, ar=0.0, cs=0.0, hp=0.0, od=0.0)[source]¶
Bases:
objectDifficulty attributes of a taiko beatmap (stars, per-skill values, hit windows).
- Parameters:
stamina (float)
rhythm (float)
color (float)
reading (float)
great_hit_window (float)
ok_hit_window (float)
mono_stamina_factor (float)
mechanical_difficulty (float)
consistency_factor (float)
stars (float)
max_combo (int)
is_convert (bool)
clock_rate (float)
ar (float)
cs (float)
hp (float)
od (float)
- class parsecore.Performance.rulesets.catch.difficulty.CatchDifficultyAttributes(stars=0.0, preempt=0.0, n_fruits=0, n_droplets=0, n_tiny_droplets=0, is_convert=False, ar=0.0, cs=0.0, hp=0.0, od=0.0, clock_rate=1.0)[source]¶
Bases:
objectDifficulty attributes of a catch beatmap (stars, object counts, AR/CS/…).
- Parameters:
- class parsecore.Performance.rulesets.mania.difficulty.ManiaDifficultyAttributes(stars=0.0, n_objects=0, n_hold_notes=0, max_combo=0, great_hit_window=0.0, good_hit_window=0.0, is_convert=False, clock_rate=1.0, ar=0.0, cs=0.0, hp=0.0, od=0.0)[source]¶
Bases:
objectDifficulty attributes of a mania beatmap (stars, object/hold counts, hit windows).
- Parameters:
Performance attributes¶
- class parsecore.Performance.rulesets.osu.performance.OsuPerformanceAttributes(pp=0.0, pp_aim=0.0, pp_speed=0.0, pp_acc=0.0, pp_reading=0.0, pp_flashlight=0.0, effective_miss_count=0.0, speed_deviation=None, combo_based_estimated_miss_count=0.0, score_based_estimated_miss_count=None, aim_estimated_slider_breaks=0.0, speed_estimated_slider_breaks=0.0, stars=0.0, max_combo=0, difficulty=<factory>)[source]¶
Bases:
objectosu! performance result (total pp and its aim/speed/acc/reading/flashlight parts).
- Parameters:
pp (float)
pp_aim (float)
pp_speed (float)
pp_acc (float)
pp_reading (float)
pp_flashlight (float)
effective_miss_count (float)
speed_deviation (float | None)
combo_based_estimated_miss_count (float)
score_based_estimated_miss_count (float | None)
aim_estimated_slider_breaks (float)
speed_estimated_slider_breaks (float)
stars (float)
max_combo (int)
difficulty (OsuDifficultyAttributes)
- difficulty: OsuDifficultyAttributes¶
- class parsecore.Performance.rulesets.taiko.performance.TaikoPerformanceAttributes(pp=0.0, pp_acc=0.0, pp_difficulty=0.0, estimated_unstable_rate=None, stars=0.0, max_combo=0)[source]¶
Bases:
objectTaiko performance result (pp plus the difficulty attributes used).
- Parameters:
- class parsecore.Performance.rulesets.catch.performance.CatchPerformanceAttributes(pp=0.0, stars=0.0, max_combo=0, state_n300=0, state_n100=0, state_n50=0, state_n_katu=0, state_misses=0, state_max_combo=0)[source]¶
Bases:
objectCatch performance result (pp plus the difficulty attributes used).
- Parameters:
Gradual calculation (catch)¶
- class parsecore.Performance.rulesets.catch.gradual.CatchGradualDifficulty(difficulty, beatmap)[source]¶
Bases:
objectIterates catch difficulty attributes, revealing one more object each step.
- Parameters:
difficulty (Any)
beatmap (Any)
- class parsecore.Performance.rulesets.catch.gradual.CatchGradualPerformance(difficulty, beatmap)[source]¶
Bases:
objectFeeds gradual difficulty into pp for object-by-object performance.
- Parameters:
difficulty (Any)
beatmap (Any)
- next(state)[source]¶
Advance one object and return the pp for the given state.
- Parameters:
state (
CatchScoreState) – The score state so far.- Return type:
- Returns:
The performance attributes, or
Noneif exhausted.
- last(state)[source]¶
Advance to the final object and return the pp for the state.
- Return type:
- Parameters:
state (CatchScoreState)