betting_combat.features.fight_blocks
fight_blocks — features.fight_blocks: fight x round x 30-second block, WHAT HAPPENED IN THE BLOCK - the
ticks (features.fight_ticks: what happened in each reading) added up into fixed 30-second blocks of the
round. The in-round base, as ufc.rounds is the round’s: anything thus far, and what is known at a moment
given Cito’s delay, is the feature layer’s, built backward from these. block_labels holds what happened
after each block.
FightBlocksTable NAME fight_blocks, KEY (bout_id, round, block), DATE dateThe grid: each round Cito clocked (its start = the median of round_start_at over its live readings with a
running clock, 0 < clock < the round’s length), a block every BLOCK_S OF THE FIGHT CLOCK from the bell -
block 0 = 0-30 s, 1 = 30-60 s … 9 = 270-300 s - while the round is on (the fight’s last round stops at its
official finish second; a round without an official length is left out, counted in skipped).
The clock’s stops (a foul, a doctor’s look: Cito’s clock stands while the wall clock runs - 11-18, over 30 s in
5 % of the rounds Cito read, up to 6 minutes): each running reading’s offset (capture - clock) jumps by the stop.
pauses: where the offset steps up, five readings each side (as live.clock: Cito’s capture times jitter ~±4 s; a reading whose clock went back left out; a round whose stops would run it into the next one keeps none),
PAUSE_MIN_S and under none; the clock it stood at from the readings frozen in it. A round with a stop starts at its start before it (the median of its first
five readings), and its blocks’ wall times (block_at / block_end_at: when the fight clock reached the
block’s start / end; paused_s the stops so far) and the readings kept (to the round’s end + its stops +
LATE_S) follow the stops: what the market did in a block (features.market_blocks) is on the same clock.
A block holds the live readings with counts captured while its round was on (from the bell to the round’s end
LATE_S, Cito’s capture lag), each in the block its clock falls in (elapsed_s; without a clock, by its capture time). Readings in the break and after the fight (status completed: Cito’s corrections, minutes to hours later) are in no block - they stay in the ticks: a block is what the live feed showed while it was on.
Columns:
bout_id, round, block the key; block_s its start in the round, fight_s in the fight
event_id, date, fighter_a_id, fighter_b_id, scheduled_rounds
block_at, block_end_at, round_start_at the wall times the fight clock reached the block’s start / end (the
stops included), the round’s start (Cito’s clock)
paused_s the clock’s stops so far, at the block’s start
readings the readings with counts in the block (0: none - its counts are blank)
first_s, last_s the first / last of them, seconds into the round
max_interval_s the longest wait before one of them: over GAP_S, its counts may hold
what happened in the block before (gap 1)
source ‘lines’ / ‘totals’ / ‘mixed’ (the ticks’), blank: not known
correction, catchup a tick of the block held a correction / took up after an empty reading
a_* / b_* what happened in the block: A’s and B’s 22 counts (from totals: 10)
A round’s blocks add up to its live readings inside the round (the corrections after the bell are the ticks’). Counts are the live feed’s (noisy against the official lines): training and live read the same numbers.
Classes
FightBlocksInputs
The ticks the blocks add up (features.fight_ticks).
read
read(db: DBClient) -> FightBlocksInputsFightBlocksTable
Bases: FeatureTable
features.fight_blocks: fight x round x 30-second block, what happened in it (module doc).
build
build(db: DBClient, base: Base | None = None) -> dict[str, int]compute
compute(base: Base) -> pd.DataFrameupdate
update(db: DBClient, since: Any, base: Base | None = None) -> dict[str, int]write
write(db: DBClient, rows: pd.DataFrame) -> dict[str, int]Functions
pauses
pauses(clocked: pd.DataFrame) -> tuple[pd.DataFrame, pd.DataFrame]The clock’s stops (module doc), from a round’s live readings in it (bout_id, round, captured_at, elapsed_s). Each running reading’s offset (capture - clock); a stop where the median offset of the STEADY readings from one on less that of the STEADY up to the one before reaches PAUSE_MIN_S: its size that step, its place the biggest single step among the next STEADY, its clock where the clock stood (the readings frozen in it, else the earlier reading’s), its end the later reading’s capture. Returns the stops (bout_id, round, clock_s, end_at, size_s) and each round’s start before any (bout_id, round, start0: the median offset of its first STEADY readings before its first stop - a stop in its first seconds never moves the start).
replace_bouts
replace_bouts(db: DBClient, name: str, rows: pd.DataFrame) -> NoneDelete the stored rows of the fights about to be written (a fight’s grid can shrink: an official end corrected), so a write never leaves rows past a fight’s end.
stopped_between
stopped_between(fights: pd.DataFrame) -> pd.SeriesThe fights stopped BETWEEN rounds - a corner’s / doctor’s stoppage, a DQ or a result recorded at 5:00 of a round before
the last scheduled one (a decision there: a technical one, also between rounds): the break after that round was a real
moment - the market open, the round coming placed at its bell - and its first block (-2) a row (Sam 11-19). fights:
end_round, end_time_s, scheduled_rounds.