milia.data.aggregate#
Group-level profiles: feeders and transformers built from their members.
Functions
|
Weighted sum of member profiles, e.g. kW-rated customers on one feeder. |
|
A synthetic group profile from randomly drawn members of each class. |
- milia.data.aggregate.aggregate(profiles, weights=None)#
Weighted sum of member profiles, e.g. kW-rated customers on one feeder.
- Parameters:
- Return type:
- Returns:
The group profile, shape
(steps,).- Raises:
ValueError – If
weightsdoes not have one entry per member.
Examples
>>> aggregate([[1.0, 2.0], [3.0, 4.0]]) array([4., 6.]) >>> aggregate([[1.0, 2.0], [3.0, 4.0]], weights=[2.0, 0.0]) array([2., 4.])
- milia.data.aggregate.synthesize(counts, pools, rng)#
A synthetic group profile from randomly drawn members of each class.
Used when a network gives each transformer’s customer counts by class (residential, commercial) but not their meters: draw that many profiles from each class’s pool and add them. Draws are without replacement unless a class asks for more members than its pool holds.
- Parameters:
- Return type:
- Returns:
The summed profile, shape
(steps,).- Raises:
ValueError – If no class has a positive count.
Examples
>>> import numpy as np >>> pools = {"res": np.ones((5, 3)), "com": np.full((2, 3), 10.0)} >>> synthesize({"res": 2, "com": 1}, pools, np.random.default_rng(0)) array([12., 12., 12.])