mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-10 17:19:34 +01:00
Ignore plotting failures in gallery plot
This commit is contained in:
parent
c3d377b6e0
commit
2341f822a7
@ -93,39 +93,51 @@ def plot_class_examples(
|
||||
|
||||
for index, match in enumerate(true_positives):
|
||||
ax = plt.subplot(4, n_examples, index + 1)
|
||||
plotting.plot_true_positive_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
try:
|
||||
plotting.plot_true_positive_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
for index, match in enumerate(false_positives):
|
||||
ax = plt.subplot(4, n_examples, n_examples + index + 1)
|
||||
plotting.plot_false_positive_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
try:
|
||||
plotting.plot_false_positive_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
for index, match in enumerate(false_negatives):
|
||||
ax = plt.subplot(4, n_examples, 2 * n_examples + index + 1)
|
||||
plotting.plot_false_negative_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
try:
|
||||
plotting.plot_false_negative_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
for index, match in enumerate(cross_triggers):
|
||||
ax = plt.subplot(4, n_examples, 4 * n_examples + index + 1)
|
||||
plotting.plot_cross_trigger_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
try:
|
||||
plotting.plot_cross_trigger_match(
|
||||
match,
|
||||
ax=ax,
|
||||
preprocessor=preprocessor,
|
||||
duration=duration,
|
||||
)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
return fig
|
||||
|
||||
|
||||
@ -22,6 +22,8 @@ __all__ = [
|
||||
"plot_cross_trigger_match",
|
||||
]
|
||||
|
||||
|
||||
DEFAULT_DURATION = 0.05
|
||||
DEFAULT_FALSE_POSITIVE_COLOR = "orange"
|
||||
DEFAULT_FALSE_NEGATIVE_COLOR = "red"
|
||||
DEFAULT_TRUE_POSITIVE_COLOR = "green"
|
||||
@ -119,9 +121,6 @@ def plot_matches(
|
||||
return ax
|
||||
|
||||
|
||||
DEFAULT_DURATION = 0.05
|
||||
|
||||
|
||||
def plot_false_positive_match(
|
||||
match: MatchEvaluation,
|
||||
preprocessor: Optional[PreprocessorProtocol] = None,
|
||||
@ -149,7 +148,8 @@ def plot_false_positive_match(
|
||||
clip = data.Clip(
|
||||
start_time=max(start_time - duration / 2, 0),
|
||||
end_time=min(
|
||||
start_time + duration / 2, sound_event.recording.duration
|
||||
start_time + duration / 2,
|
||||
sound_event.recording.duration,
|
||||
),
|
||||
recording=sound_event.recording,
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user