mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-11 17:29: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):
|
for index, match in enumerate(true_positives):
|
||||||
ax = plt.subplot(4, n_examples, index + 1)
|
ax = plt.subplot(4, n_examples, index + 1)
|
||||||
plotting.plot_true_positive_match(
|
try:
|
||||||
match,
|
plotting.plot_true_positive_match(
|
||||||
ax=ax,
|
match,
|
||||||
preprocessor=preprocessor,
|
ax=ax,
|
||||||
duration=duration,
|
preprocessor=preprocessor,
|
||||||
)
|
duration=duration,
|
||||||
|
)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
for index, match in enumerate(false_positives):
|
for index, match in enumerate(false_positives):
|
||||||
ax = plt.subplot(4, n_examples, n_examples + index + 1)
|
ax = plt.subplot(4, n_examples, n_examples + index + 1)
|
||||||
plotting.plot_false_positive_match(
|
try:
|
||||||
match,
|
plotting.plot_false_positive_match(
|
||||||
ax=ax,
|
match,
|
||||||
preprocessor=preprocessor,
|
ax=ax,
|
||||||
duration=duration,
|
preprocessor=preprocessor,
|
||||||
)
|
duration=duration,
|
||||||
|
)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
for index, match in enumerate(false_negatives):
|
for index, match in enumerate(false_negatives):
|
||||||
ax = plt.subplot(4, n_examples, 2 * n_examples + index + 1)
|
ax = plt.subplot(4, n_examples, 2 * n_examples + index + 1)
|
||||||
plotting.plot_false_negative_match(
|
try:
|
||||||
match,
|
plotting.plot_false_negative_match(
|
||||||
ax=ax,
|
match,
|
||||||
preprocessor=preprocessor,
|
ax=ax,
|
||||||
duration=duration,
|
preprocessor=preprocessor,
|
||||||
)
|
duration=duration,
|
||||||
|
)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
for index, match in enumerate(cross_triggers):
|
for index, match in enumerate(cross_triggers):
|
||||||
ax = plt.subplot(4, n_examples, 4 * n_examples + index + 1)
|
ax = plt.subplot(4, n_examples, 4 * n_examples + index + 1)
|
||||||
plotting.plot_cross_trigger_match(
|
try:
|
||||||
match,
|
plotting.plot_cross_trigger_match(
|
||||||
ax=ax,
|
match,
|
||||||
preprocessor=preprocessor,
|
ax=ax,
|
||||||
duration=duration,
|
preprocessor=preprocessor,
|
||||||
)
|
duration=duration,
|
||||||
|
)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
return fig
|
return fig
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,8 @@ __all__ = [
|
|||||||
"plot_cross_trigger_match",
|
"plot_cross_trigger_match",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULT_DURATION = 0.05
|
||||||
DEFAULT_FALSE_POSITIVE_COLOR = "orange"
|
DEFAULT_FALSE_POSITIVE_COLOR = "orange"
|
||||||
DEFAULT_FALSE_NEGATIVE_COLOR = "red"
|
DEFAULT_FALSE_NEGATIVE_COLOR = "red"
|
||||||
DEFAULT_TRUE_POSITIVE_COLOR = "green"
|
DEFAULT_TRUE_POSITIVE_COLOR = "green"
|
||||||
@ -119,9 +121,6 @@ def plot_matches(
|
|||||||
return ax
|
return ax
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_DURATION = 0.05
|
|
||||||
|
|
||||||
|
|
||||||
def plot_false_positive_match(
|
def plot_false_positive_match(
|
||||||
match: MatchEvaluation,
|
match: MatchEvaluation,
|
||||||
preprocessor: Optional[PreprocessorProtocol] = None,
|
preprocessor: Optional[PreprocessorProtocol] = None,
|
||||||
@ -149,7 +148,8 @@ def plot_false_positive_match(
|
|||||||
clip = data.Clip(
|
clip = data.Clip(
|
||||||
start_time=max(start_time - duration / 2, 0),
|
start_time=max(start_time - duration / 2, 0),
|
||||||
end_time=min(
|
end_time=min(
|
||||||
start_time + duration / 2, sound_event.recording.duration
|
start_time + duration / 2,
|
||||||
|
sound_event.recording.duration,
|
||||||
),
|
),
|
||||||
recording=sound_event.recording,
|
recording=sound_event.recording,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user