Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion darshan-util/pydarshan/darshan/cli/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@
darshan.enable_experimental()


class DarshanReportTable:
"""
Stores table figures in dataframe and html formats.

Parameters
----------
df: a ``pd.DataFrame``.

kwargs: keyword arguments passed to ``pd.DataFrame.to_html()``.

"""
def __init__(self, df: Any, **kwargs):
self.df = df
self.html = self.df.to_html(**kwargs)


class ReportFigure:
"""
Stores info for each figure in `ReportData.register_figures`.
Expand Down Expand Up @@ -100,7 +116,7 @@ def generate_fig(self):
encoded = self.get_encoded_fig(mpl_fig=fig)
# create the img string
self.fig_html = f"<img src=data:image/png;base64,{encoded} alt={self.fig_title} width={self.fig_width}>"
elif isinstance(fig, plot_common_access_table.DarshanReportTable):
elif isinstance(fig, DarshanReportTable):
# retrieve html table from `DarshanReportTable`
self.fig_html = fig.html
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pandas as pd

import darshan
from darshan.cli.summary import DarshanReportTable


def remove_nonzero_rows(df: Any) -> Any:
Expand Down Expand Up @@ -106,22 +107,6 @@ def get_access_count_df(mod_df: Any, mod: str) -> Any:
return pd.concat(df_list, axis=1)


class DarshanReportTable:
"""
Stores table figures in dataframe and html formats.

Parameters
----------
df: a ``pd.DataFrame``.

kwargs: keyword arguments passed to ``pd.DataFrame.to_html()``.

"""
def __init__(self, df: Any, **kwargs):
self.df = df
self.html = self.df.to_html(**kwargs)


def plot_common_access_table(report: darshan.DarshanReport, mod: str, n_rows: int = 4) -> DarshanReportTable:
"""
Creates a table containing the most
Expand Down