Skip to content

Commit

Permalink
update to visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Aug 1, 2024
1 parent 1b98524 commit 09db39c
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bio_check/processing_tools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np


def generate_color_gradient(self, simulator_names) -> list[str]:
def generate_color_gradient(simulator_names) -> list[str]:
"""Generate a gradient of colors from red to green to blue for a list of simulator names."""
num_simulators = len(simulator_names)

Expand Down
13 changes: 9 additions & 4 deletions bio_check/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.figure import Figure
from requests import Response
from requests.exceptions import RequestException
from requests_toolbelt.multipart.encoder import MultipartEncoder
from typing import *
from dataclasses import dataclass, asdict

from processing_tools import generate_color_gradient
from bio_check.processing_tools import generate_color_gradient


@dataclass
Expand Down Expand Up @@ -186,8 +187,9 @@ def visualize(
output_end: int,
num_points: int,
hue: str = 'simulators',
use_grid=False
) -> None:
use_grid=False,
export_plot=False
) -> Figure:
"""Visualize simulation output data, not comparison data, with subplots for each species.
Args:
Expand All @@ -198,6 +200,7 @@ def visualize(
num_points (int): number of points in simulation output time series.
hue (str): hue upon which the linplot colors are based. Options are: `'simulators'` or `'species'`. Defaults to 'simulators'.
use_grid (bool): whether to use a grid for each subplot. Defaults to False.
export_plot (bool): whether to export plots to a pdf file. Defaults to False.
"""
# grid plot params
Expand Down Expand Up @@ -227,7 +230,7 @@ def visualize(
if output_data:
# create one plot in each column mapped to each individual simulator output (for clarity :) )
simulator_output = output_data[simulator_name]
sns.lineplot(ax=ax, color=simulator_colors[j], data=simulator_output, label=f"{simulator_name}")
sns.lineplot(ax=ax, color=simulator_colors[j], x=t, y=simulator_output, label=f"{simulator_name}")

# set row title
ax.set_title(f"{species_name} simulation outputs for {simulator_name}")
Expand All @@ -238,6 +241,8 @@ def visualize(
plt.tight_layout()
plt.show()

return fig

def export_csv(self):
pass

Expand Down
Loading

0 comments on commit 09db39c

Please sign in to comment.