Skip to content

Commit

Permalink
update some tests and version
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephMontoya-TRI committed Jan 30, 2025
1 parent c847cc0 commit fbe6716
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion beep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Versioning. The python code version is frequently tagged
# with a commit hash from the repo, which is supplied via
# an environment variable by the integration build procedure
__version__ = "2022.10.3.16"
__version__ = "2025.1.29.19"
VERSION_TAG = os.environ.get("BEEP_VERSION_TAG")
if VERSION_TAG is not None:
__version__ = "-".join([__version__, VERSION_TAG])
Expand Down
6 changes: 4 additions & 2 deletions beep/features/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,8 @@ def create_features(self):
parameters_path = self.hyperparameters["parameters_dir"]

cycle_types = self.datapath.diagnostic_summary.cycle_type.unique()
X = pd.DataFrame()
# X = pd.DataFrame()
summary_diag_cycle_type_list = []
for quantity in self.hyperparameters["quantities"]:
for cycle_type in cycle_types:
summary_diag_cycle_type = featurizer_helpers.get_fractional_quantity_remaining_nx(
Expand All @@ -798,8 +799,9 @@ def create_features(self):

summary_diag_cycle_type.loc[:, "cycle_type"] = cycle_type
summary_diag_cycle_type.loc[:, "metric"] = quantity
X = X.append(summary_diag_cycle_type)

summary_diag_cycle_type_list.append(summary_diag_cycle_type)
X = pd.concat(summary_diag_cycle_type_list)
X_condensed = self.get_threshold_targets(X)
self.features = X_condensed

Expand Down
4 changes: 2 additions & 2 deletions beep/features/featurizer_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ def get_resistance_soc_duration_hppc(processed_cycler_run, diag_pos):
# full name
f_name = name + '_' + str(j)
df_row[f_name] = [res_calc(chosen, j, name)]
output = output.append(df_row, ignore_index=True)
return output
output = pd.concat([output, df_row], ignore_index=True)
return df_row


def get_dr_df(processed_cycler_run, diag_pos):
Expand Down
9 changes: 5 additions & 4 deletions beep/protocol/maccor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ def insert_hppc_cyclev2(self, start, nominal_capacity, diagnostic_params):
# Initial charge step for hppc cycle
assert steps[start]["StepType"] == "Charge"
assert steps[start]["StepMode"] == "Current"
# TODO: fix float warning - need a switch between DF and numpy representations
steps[start]["StepValue"] = float(
round(
nominal_capacity * diagnostic_params["HPPC_baseline_constant_current"],
Expand All @@ -1101,7 +1102,7 @@ def insert_hppc_cyclev2(self, start, nominal_capacity, diagnostic_params):
assert steps[start + 2]["Ends"]["EndEntry"][0]["EndType"] == "StepTime"
time_s = int(round(60 * diagnostic_params["HPPC_rest_time"]))
steps[start + 2]["Ends"]["EndEntry"][0]["Value"] = time.strftime(
"%H:%M:%S", time.gmtime(time_s)
"%H:%M:%S", time.gmtime(float(time_s))
)

# Discharge step 1 for hppc cycle
Expand All @@ -1113,7 +1114,7 @@ def insert_hppc_cyclev2(self, start, nominal_capacity, diagnostic_params):
assert steps[start + 3]["Ends"]["EndEntry"][0]["EndType"] == "StepTime"
time_s = diagnostic_params["HPPC_pulse_duration_1"]
steps[start + 3]["Ends"]["EndEntry"][0]["Value"] = time.strftime(
"%H:%M:%S", time.gmtime(time_s)
"%H:%M:%S", time.gmtime(float(time_s))
)
assert steps[start + 3]["Ends"]["EndEntry"][1]["EndType"] == "Voltage"
steps[start + 3]["Ends"]["EndEntry"][1]["Value"] = float(
Expand All @@ -1137,7 +1138,7 @@ def insert_hppc_cyclev2(self, start, nominal_capacity, diagnostic_params):
assert steps[start + 5]["Ends"]["EndEntry"][0]["EndType"] == "StepTime"
time_s = diagnostic_params["HPPC_pulse_duration_2"]
steps[start + 5]["Ends"]["EndEntry"][0]["Value"] = time.strftime(
"%H:%M:%S", time.gmtime(time_s)
"%H:%M:%S", time.gmtime(float(time_s))
)
assert steps[start + 5]["Ends"]["EndEntry"][1]["EndType"] == "Voltage"
steps[start + 5]["Ends"]["EndEntry"][1]["Value"] = float(
Expand All @@ -1163,7 +1164,7 @@ def insert_hppc_cyclev2(self, start, nominal_capacity, diagnostic_params):
)
)
steps[start + 6]["Ends"]["EndEntry"][0]["Value"] = time.strftime(
"%H:%M:%S", time.gmtime(time_s)
"%H:%M:%S", time.gmtime(float(time_s))
)
assert steps[start + 6]["Ends"]["EndEntry"][1]["EndType"] == "Voltage"
steps[start + 6]["Ends"]["EndEntry"][1]["Value"] = float(
Expand Down
5 changes: 3 additions & 2 deletions beep/protocol/maccor_to_arbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ def compile_to_arbin(
blank_step["m_szCtrlValue"] = "0"
blank_step["m_szExtCtrlValue1"] = str(2 ** loop_counter)
blank_step["m_szExtCtrlValue2"] = "0"
assert isinstance(step_abs["Ends"]["EndEntry"], OrderedDict)
# TODO: is this necessary post 3.7?
# assert isinstance(step_abs["Ends"]["EndEntry"], OrderedDict)
loop_addendum = OrderedDict(
[
("EndType", "Loop Addendum"),
Expand Down Expand Up @@ -361,7 +362,7 @@ def compile_to_arbin(

# Reports
if step_abs["Reports"] is not None:
if isinstance(step_abs["Reports"]["ReportEntry"], OrderedDict):
if isinstance(step_abs["Reports"]["ReportEntry"], dict):
blank_step["m_uLimitNum"] = blank_step["m_uLimitNum"] + 1
report = step_abs["Reports"]["ReportEntry"]
report_index = 0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(name="beep",
url="https://github.com/TRI-AMDD/beep",
version="2022.10.3.16",
version="2025.1.29.19",
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit fbe6716

Please sign in to comment.