From 7a783382a63db97f2fcecdd8dbc6793db70ba54a Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 11 Nov 2024 20:28:00 -0800 Subject: [PATCH] don't require matplotlib to import --- miniscope_io/plots/headers.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/miniscope_io/plots/headers.py b/miniscope_io/plots/headers.py index edfbf01a..12b49e85 100644 --- a/miniscope_io/plots/headers.py +++ b/miniscope_io/plots/headers.py @@ -18,7 +18,7 @@ plt = None -def buffer_count(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: +def buffer_count(headers: pd.DataFrame, ax: "plt.Axes") -> "plt.Axes": """ Plot number of buffers by time """ @@ -32,7 +32,7 @@ def buffer_count(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: return ax -def dropped_buffers(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: +def dropped_buffers(headers: pd.DataFrame, ax: "plt.Axes") -> "plt.Axes": """ Plot number of buffers by time """ @@ -42,7 +42,7 @@ def dropped_buffers(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: return ax -def timestamps(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: +def timestamps(headers: pd.DataFrame, ax: "plt.Axes") -> "plt.Axes": """ Plot frame number against time """ @@ -57,7 +57,7 @@ def timestamps(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: return ax -def battery_voltage(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: +def battery_voltage(headers: pd.DataFrame, ax: "plt.Axes") -> "plt.Axes": """ Plot battery voltage against time """ @@ -70,7 +70,7 @@ def battery_voltage(headers: pd.DataFrame, ax: plt.Axes) -> plt.Axes: def plot_headers( headers: pd.DataFrame, size: Optional[Tuple[int, int]] = None -) -> (plt.Figure, plt.Axes): +) -> ("plt.Figure", "plt.Axes"): """ Plot the headers (generated from :meth:`.Frame.to_df` ) @@ -151,7 +151,7 @@ def __init__( def _init_plot( self, - ) -> tuple[plt.Figure, dict[str, plt.Axes], dict[str, plt.Line2D]]: + ) -> tuple["plt.Figure", dict[str, "plt.Axes"], dict[str, "plt.Line2D"]]: # initialize matplotlib plt.ion()