|
20 | 20 | from muse.__main__ import patched_broadcast_compat_data |
21 | 21 | from muse.agents import Agent |
22 | 22 | from muse.commodities import CommodityUsage |
23 | | -from muse.timeslices import TIMESLICE, read_timeslices, setup_module |
| 23 | +from muse.timeslices import setup_module |
24 | 24 |
|
25 | 25 | # Constants |
26 | 26 | RANDOM_SEED = 123 |
27 | | -DEFAULT_FACTOR = 100.0 |
28 | | -DEFAULT_TECH_TYPES = ["solid", "liquid", "solid", "liquid"] |
29 | | -DEFAULT_FUELS = ["person", "person", "oil", "person"] |
30 | 27 |
|
31 | 28 | DEFAULT_TIMESLICES = """ |
32 | 29 | [timeslices] |
@@ -74,7 +71,6 @@ def logger(): |
74 | 71 |
|
75 | 72 | @fixture(autouse=True) |
76 | 73 | def patch_broadcast_compat_data(): |
77 | | - """Patch broadcast compatibility data.""" |
78 | 74 | with patch( |
79 | 75 | "xarray.core.variable._broadcast_compat_data", patched_broadcast_compat_data |
80 | 76 | ): |
@@ -192,15 +188,13 @@ def compare_dirs( |
192 | 188 | def default_timeslice_globals(): |
193 | 189 | """Set up default timeslice configuration.""" |
194 | 190 | setup_module(DEFAULT_TIMESLICES) |
195 | | - return DEFAULT_TIMESLICES |
196 | 191 |
|
197 | 192 |
|
198 | 193 | @fixture |
199 | 194 | def timeslice(default_timeslice_globals) -> DataArray: |
200 | 195 | """Get the default timeslice dataset.""" |
201 | | - if TIMESLICE is None: |
202 | | - # If TIMESLICE is not set, create it from the default timeslices |
203 | | - return read_timeslices(default_timeslice_globals) |
| 196 | + from muse.timeslices import TIMESLICE |
| 197 | + |
204 | 198 | return TIMESLICE |
205 | 199 |
|
206 | 200 |
|
@@ -259,9 +253,7 @@ def agent_args(coords: Mapping) -> Mapping: |
259 | 253 | } |
260 | 254 |
|
261 | 255 |
|
262 | | -def var_generator( |
263 | | - result: Dataset, dims: list[str], factor: float = DEFAULT_FACTOR |
264 | | -) -> tuple: |
| 256 | +def var_generator(result: Dataset, dims: list[str], factor: float = 100.0) -> tuple: |
265 | 257 | """Generate random variables for a dataset. |
266 | 258 |
|
267 | 259 | Args: |
@@ -289,8 +281,8 @@ def technologies(coords: Mapping) -> Dataset: |
289 | 281 | result = Dataset(coords=coords) |
290 | 282 |
|
291 | 283 | result["comm_type"] = ("commodity", coords["comm_type"]) |
292 | | - result["tech_type"] = "technology", DEFAULT_TECH_TYPES |
293 | | - result["fuel"] = "technology", DEFAULT_FUELS |
| 284 | + result["tech_type"] = "technology", ["solid", "liquid", "solid", "liquid"] |
| 285 | + result["fuel"] = "technology", ["person", "person", "oil", "person"] |
294 | 286 |
|
295 | 287 | result = result.set_coords(("comm_type", "fuel", "tech_type")) |
296 | 288 |
|
@@ -782,6 +774,4 @@ def rng(request): |
782 | 774 | Returns: |
783 | 775 | Random number generator instance |
784 | 776 | """ |
785 | | - from numpy.random import default_rng |
786 | | - |
787 | 777 | return default_rng(getattr(request.config.option, "randomly_seed", None)) |
0 commit comments