Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix petab.visualize.data_overview.create_report #96

Merged
merged 2 commits into from
Nov 30, 2021
Merged
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
14 changes: 7 additions & 7 deletions petab/visualize/data_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def create_report(
template_file = "report.html"

data_per_observable = get_data_per_observable(problem.measurement_df)
num_conditions = (len(problem.condition_df.columns)
- 1 * (CONDITION_NAME in problem.condition_df.columns))
num_conditions = len(problem.condition_df.index)

# Setup template engine
import jinja2
Expand All @@ -55,17 +54,18 @@ def get_data_per_observable(measurement_df: pd.DataFrame) -> pd.DataFrame:
Arguments:
measurement_df: PEtab measurement data frame
Returns:
data_per_observable:
Pivot table with number of data points per observable and condition
Pivot table with number of data points per observable and condition
"""

my_measurements = measurement_df.copy()

my_measurements[PREEQUILIBRATION_CONDITION_ID].fillna('', inplace=True)
index = [SIMULATION_CONDITION_ID]
if PREEQUILIBRATION_CONDITION_ID in my_measurements:
my_measurements[PREEQUILIBRATION_CONDITION_ID].fillna('', inplace=True)
index.append(PREEQUILIBRATION_CONDITION_ID)

data_per_observable = pd.pivot_table(
my_measurements, values=MEASUREMENT, aggfunc='count',
index=[SIMULATION_CONDITION_ID, PREEQUILIBRATION_CONDITION_ID],
index=index,
columns=[OBSERVABLE_ID], fill_value=0)

# Add row and column sums
Expand Down