mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-04-04 15:20:19 +02:00
Do not crash on failure to plot
This commit is contained in:
parent
13a31d9de9
commit
5a14b29281
@ -10,6 +10,7 @@ from typing import (
|
|||||||
TypeVar,
|
TypeVar,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from loguru import logger
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
from soundevent import data
|
from soundevent import data
|
||||||
@ -107,8 +108,12 @@ class BaseTask(EvaluationTaskProtocol, Generic[T_Output]):
|
|||||||
self, eval_outputs: List[T_Output]
|
self, eval_outputs: List[T_Output]
|
||||||
) -> Iterable[Tuple[str, Figure]]:
|
) -> Iterable[Tuple[str, Figure]]:
|
||||||
for plot in self.plots:
|
for plot in self.plots:
|
||||||
for name, fig in plot(eval_outputs):
|
try:
|
||||||
yield f"{self.prefix}/{name}", fig
|
for name, fig in plot(eval_outputs):
|
||||||
|
yield f"{self.prefix}/{name}", fig
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error plotting {self.prefix}: {e}")
|
||||||
|
continue
|
||||||
|
|
||||||
def evaluate(
|
def evaluate(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user