Skip to content

Commit

Permalink
Rename add_column_from_metadata_to_ensemble function (LLNL#97)
Browse files Browse the repository at this point in the history
* Rename add_column_from_metadata_to_ensemble function

* Black

* Update function name
  • Loading branch information
michaelmckinsey1 authored Oct 31, 2023
1 parent 58badfc commit ed31c06
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions thicket/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _handle_perfdata():
new_profiles = [i for i in range(len(thickets_cp[0].profile))]
for i in range(len(thickets_cp)):
thickets_cp[i].metadata["new_profiles"] = new_profiles
thickets_cp[i].add_column_from_metadata_to_ensemble(
thickets_cp[i].metadata_column_to_perfdata(
"new_profiles", drop=True
)
thickets_cp[i].dataframe.reset_index(level="profile", inplace=True)
Expand All @@ -198,7 +198,7 @@ def _handle_perfdata():
)
else: # Change second-level index to be from metadata's "metadata_key" column
for i in range(len(thickets_cp)):
thickets_cp[i].add_column_from_metadata_to_ensemble(metadata_key)
thickets_cp[i].metadata_column_to_perfdata(metadata_key)
thickets_cp[i].dataframe.reset_index(level="profile", inplace=True)
new_mappings.update(
pd.Series(
Expand Down
4 changes: 2 additions & 2 deletions thicket/tests/test_thicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _test_multiindex():
assert bool(re.search("1.000.*CalcFBHourglassForceForElems", tree_output))


def test_add_column_from_metadata(mpi_scaling_cali):
def test_metadata_column_to_perfdata(mpi_scaling_cali):
t_ens = Thicket.from_caliperreader(mpi_scaling_cali)

example_column = "jobsize"
Expand All @@ -117,7 +117,7 @@ def test_add_column_from_metadata(mpi_scaling_cali):
# Assume second level index is profile
assert t_ens.dataframe.index.names[1] == "profile"

t_ens.add_column_from_metadata_to_ensemble(example_column)
t_ens.metadata_column_to_perfdata(example_column)

# Column should be in performance data table
assert example_column in t_ens.dataframe
Expand Down
4 changes: 1 addition & 3 deletions thicket/thicket.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ def from_json(json_thicket):
# make and return thicket?
return th

def add_column_from_metadata_to_ensemble(
self, metadata_key, overwrite=False, drop=False
):
def metadata_column_to_perfdata(self, metadata_key, overwrite=False, drop=False):
"""Add a column from the metadata table to the performance data table.
Arguments:
Expand Down

0 comments on commit ed31c06

Please sign in to comment.