citylearn.internal.kpi_population module

Evaluation-local membership masks; never cache physical values or KPI results.

class citylearn.internal.kpi_population.ActivePopulation(env)[source]

Bases: object

Snapshot sparse topology transitions once; construct masks lazily.

Thermal/condition queries carry the current membership backwards before the first recorded transition, matching active_member_ids_at. Energy masking instead leaves that prefix zero, matching its established interval loop. Arrays are read-only and keyed by member, actual series horizon and semantics.

mask(name, length, *, energy=False)[source]
property mask_bytes
citylearn.internal.kpi_population.current_population(service)[source]
citylearn.internal.kpi_population.population_scope(function)[source]

Share nested KPI readers, release the snapshot on success or failure.