I am trying to Structuring Data from Cell Cycler using BEEP(Battery Evaluation and Early Prediction) toolbox in python. The code is as follows:
import os
import json
import pandas as pd
from beep.structure import BEEPDatapath
class CyclerDatapath(BEEPDatapath):
COLUMN_MAPPING = {
"test_time (s)": "test_time",
"steptime": "step_time",
"stepix": "step_index",
"cycle_index": "cycle_index",
"current (a)": "current",
"voltage (v)": "voltage",
"charge_capacity (ah)": "charge_capacity",
"discharge_capacity (ah)": "discharge_capacity",
"charge_energy (wh)": "charge_energy",
"discharge_energy (wh)": "discharge_energy",
}
DATA_TYPES = {
"test_time": "float64",
"step_time": "float32",
"step_index": "int32",
"cycle_index": "int32",
"current": "float32",
"voltage": "float32",
"charge_capacity": "float64",
"discharge_capacity": "float64",
"charge_energy": "float64",
"discharge_energy": "float64",
}
@classmethod
def from_file(cls, filename, metadata_path=None):
data = pd.read_csv(filename)
data.rename(columns=cls.COLUMN_MAPPING, inplace=True)
print(1)
for column, dtype in cls.DATA_TYPES.items():
if column in data:
if not data[column].isnull().values.any():
data[column] = data[column].astype(dtype)
if metadata_path:
print(1)
with open(metadata_path, "r") as f:
metadata = json.load(f)
else:
metadata = {}
path = filename
paths = {
"raw": path,
"metadata": path + "_metadata"
}
return cls(data, metadata, paths)
from beep.structure import NewareDatapath
cycler_file = ("Trial_Writing.csv")
datapath = CyclerDatapath.from_file(cycler_file)
datapath.to_json_file("my_processed_neware_data.json")
I get an error as follows:
`ValueError: raw:
File "C:\base.py", line 181, in __init__
raise ValueError(f"{path_ref}: '{path}' is not absolute! All paths must be absolute.")
I tried to debug that code and found that the code works fine till here:
# Read in metadata from a separate json file, for example
if metadata_path:
print(1)
with open(metadata_path, "r") as f:
metadata = json.load(f)
After this point i get the error.
Anyone with knowledge in BEEP library knows what I am going wrong?