Skip to content
Snippets Groups Projects
Commit 2e7635d1 authored by Danilo Ferreira de Lima's avatar Danilo Ferreira de Lima
Browse files

Created VS configuration.

parent 203b48c7
No related branches found
No related tags found
1 merge request!26Added example for SCS.
......@@ -8,6 +8,7 @@ import re
import numpy as np
from copy import deepcopy
import json
import pandas as pd
class VSConfig(object):
"""
......@@ -108,12 +109,13 @@ class VSConfig(object):
"""
diff = self - other
for k, v in diff.voltage_mean.items():
if np.fabs(v) > 1e-2:
if np.fabs(v) > 0.1:
return False
if np.log10(np.fabs(diff.pressure_mean)) > 0.1:
return False
if len(diff.gas_active) > 0:
return False
return True
def to_dict(self) -> Dict[str, Union[List[float], float, List[str]]]:
"""
......@@ -127,6 +129,21 @@ class VSConfig(object):
gas_active=list(self.gas_active))
return out
def to_pandas(self) -> pd.DataFrame:
"""
Return as a DataFrame.
"""
out = self.to_dict()
data = dict()
for k, v in out["voltage_mean"].items():
data[f"mean_{k}"] = [v]
for k, v in out["voltage_std"].items():
data[f"std_{k}"] = [v]
data[f"pressure_mean"] = [out["pressure_mean"]]
data[f"pressure_std"] = [out["pressure_std"]]
data["gas_active"] = ["_".join(out["gas_active"])]
return pd.DataFrame(data)
@staticmethod
def from_dict(data: Dict[str, Union[List[float], float, List[str]]]) -> 'VSConfig':
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment