diff --git a/darshan-util/pydarshan/darshan/cli/summary.py b/darshan-util/pydarshan/darshan/cli/summary.py index 56050d5c0..ee33af3b8 100644 --- a/darshan-util/pydarshan/darshan/cli/summary.py +++ b/darshan-util/pydarshan/darshan/cli/summary.py @@ -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`. @@ -100,7 +116,7 @@ def generate_fig(self): encoded = self.get_encoded_fig(mpl_fig=fig) # create the img string self.fig_html = f"{self.fig_title}" - elif isinstance(fig, plot_common_access_table.DarshanReportTable): + elif isinstance(fig, DarshanReportTable): # retrieve html table from `DarshanReportTable` self.fig_html = fig.html else: diff --git a/darshan-util/pydarshan/darshan/experimental/plots/plot_common_access_table.py b/darshan-util/pydarshan/darshan/experimental/plots/plot_common_access_table.py index 6a1d50bb1..0220b901b 100644 --- a/darshan-util/pydarshan/darshan/experimental/plots/plot_common_access_table.py +++ b/darshan-util/pydarshan/darshan/experimental/plots/plot_common_access_table.py @@ -3,6 +3,7 @@ import pandas as pd import darshan +from darshan.cli.summary import DarshanReportTable def remove_nonzero_rows(df: Any) -> Any: @@ -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