From 5e1e54585a886c051e7af5e212bb81c483cccf81 Mon Sep 17 00:00:00 2001 From: Jens de Bruijn Date: Fri, 10 Jan 2025 09:15:20 +0100 Subject: [PATCH] support multilevel variables --- honeybees/reporter.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/honeybees/reporter.py b/honeybees/reporter.py index 3877bf1..01ab7ff 100644 --- a/honeybees/reporter.py +++ b/honeybees/reporter.py @@ -19,17 +19,12 @@ - ... """ -import sys import re from collections.abc import Iterable import os import numpy as np - -try: - import cupy as cp -except (ModuleNotFoundError, ImportError): - pass import pandas as pd +from operator import attrgetter from numba import njit from math import isinf from copy import deepcopy @@ -398,7 +393,7 @@ def extract_agent_data(self, name: str, conf: dict) -> None: name: Name of the data to report. conf: Dictionary with report configuration for values. """ - agents = getattr(self.model.agents, conf["type"]) + agents = attrgetter(conf["type"])(self.model.agents) varname = conf["varname"] fancy_index = re.search(r"\[.*?\]", varname) if fancy_index: