Skip to content

Commit

Permalink
Changed test assertions, function description - still JSON decoder er…
Browse files Browse the repository at this point in the history
…ror on end_to_end test
  • Loading branch information
BruisVanVlijmen2020 committed Sep 23, 2020
1 parent 73724cb commit e70c55d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions beep/features/featurizer_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ def get_fractional_quantity_remaining_nx(
):
"""
Similar to get_fractional_quantity_remaining()
Determine relative loss of <metric> in diagnostic_cycles of type <diagnostic_cycle_type> after 100 regular cycles
Determine relative loss of <metric> in diagnostic_cycles of type <diagnostic_cycle_type>
Also returns value of 'x', the discharge throughput passed by the first diagnostic
and the value 'n' at each diagnostic
Expand All @@ -904,7 +904,9 @@ def get_fractional_quantity_remaining_nx(
diagnostic_cycle_type (str): the diagnostic cycle to use for computing the amount of degradation
Returns:
a dataframe with cycle_index and corresponding degradation relative to the first measured value
a dataframe with cycle_index, corresponding degradation relative to the first measured value, 'x',
i.e. the discharge throughput passed by the first diagnostic
and the value 'n' at each diagnostic, i.e. the equivalent scaling factor for lifetime using n*x
"""
summary_diag_cycle_type = processed_cycler_run.diagnostic_summary[
(processed_cycler_run.diagnostic_summary.cycle_type == diagnostic_cycle_type)
Expand Down Expand Up @@ -933,7 +935,7 @@ def get_fractional_quantity_remaining_nx(
(1/x) * regular_summary[regular_summary.cycle_index.isin(indices)][normalize_qty_throughput]
).values

##
# end of nx addition
summary_diag_cycle_type[metric] = (
summary_diag_cycle_type[metric]
/ processed_cycler_run.diagnostic_summary[metric].iloc[0]
Expand Down
4 changes: 3 additions & 1 deletion beep/featurize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,12 +1099,14 @@ def validate_data(cls, processed_cycler_run, params_dict=None):
@classmethod
def features_from_processed_cycler_run(cls, processed_cycler_run, params_dict=None):
"""
Generates diagnostic-property features from processed cycler run, including values for n*x method
Args:
processed_cycler_run (beep.structure.ProcessedCyclerRun): data from cycler run
params_dict (dict): dictionary of parameters governing how the ProcessedCyclerRun object
gets featurized. These could be filters for column or row operations
Returns:
pd.DataFrame: cycles at which capacity/energy degradation exceeds thresholds
pd.DataFrame: with "cycle_index", "fractional_metric", "x", "n", "cycle_type" and "metric" columns, rows
for each diagnostic cycle of the cell
"""
if params_dict is None:
params_dict = FEATURE_HYPERPARAMS[cls.class_feature_name]
Expand Down
2 changes: 1 addition & 1 deletion beep/tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_feature_generation_list_to_json(self):
self.assertIsInstance(features_reloaded, DiagnosticProperties)
self.assertListEqual(
list(features_reloaded.X.iloc[2, :]),
[143, 0.9753520623934744, "rpt_0.2C", "discharge_energy"],
[141,0.9859837086597274,91.17758004259996,2.578137278917377,'reset','discharge_energy'],
)

# Workflow output
Expand Down

0 comments on commit e70c55d

Please sign in to comment.