mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/SPATZ.git
synced 2025-12-16 17:28:04 +00:00
Better logging and added BHI160 sensor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from typing import Any, Tuple
|
||||
from typing import Any, Tuple, List
|
||||
from numpy.typing import ArrayLike
|
||||
|
||||
from abc import abstractmethod
|
||||
@@ -56,7 +56,7 @@ class Logger(Advanceable):
|
||||
def _on_reset(self):
|
||||
self.__df = pd.DataFrame.from_dict({'time': [self.get_time()]}).astype(np.float64)
|
||||
|
||||
def write(self, attrib: str, value: Any, domain: str = 'all'):
|
||||
def write(self, attrib: str | List[str], value: Any | List[Any] | List[ArrayLike], domain: str = 'all'):
|
||||
"""Writes a value to the logger.
|
||||
|
||||
Args:
|
||||
@@ -64,12 +64,16 @@ class Logger(Advanceable):
|
||||
value (Any): The value to log.
|
||||
domain (str, optional): The domain the value belongs to. Defaults to 'any'.
|
||||
"""
|
||||
name = f'{domain}/{attrib}'
|
||||
if not isinstance(attrib, str):
|
||||
for attr, val in zip(attrib, value):
|
||||
self.write(attr, val, domain=domain)
|
||||
else:
|
||||
name = f'{domain}/{attrib}'
|
||||
|
||||
if name not in self.__df.columns:
|
||||
self.__df[name] = pd.Series([pd.NA] * len(self.__df))
|
||||
if name not in self.__df.columns:
|
||||
self.__df[name] = pd.Series([pd.NA] * len(self.__df))
|
||||
|
||||
self.__df.at[self.__idx, name] = value
|
||||
self.__df.at[self.__idx, name] = value
|
||||
|
||||
def get_dataframe(self) -> pd.DataFrame:
|
||||
return self.__df
|
||||
Reference in New Issue
Block a user