Skip to content

Commit

Permalink
fix: add GUI log error msg if spect args invalid (jonescompneurolab#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
asoplata authored Nov 26, 2024
1 parent 4149234 commit b988c7f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions hnn_core/gui/_viz_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,23 @@ def _update_ax(fig, ax, single_simulation, sim_name, plot_type, plot_config):
step_f = 1.0
freqs = np.arange(min_f, max_f, step_f)
n_cycles = freqs / 2.
dpls_copied[0].plot_tfr_morlet(
freqs,
n_cycles=n_cycles,
colormap=plot_config['spectrogram_cm'],
ax=ax, colorbar_inside=True,
show=False)

try:
dpls_copied[0].plot_tfr_morlet(
freqs,
n_cycles=n_cycles,
colormap=plot_config['spectrogram_cm'],
ax=ax, colorbar_inside=True,
show=False)

except ValueError as ex:
if str(ex) == ('At least one of the wavelets is longer than '
'the signal. Use a longer signal or shorter '
'wavelets.'):
logger.error('At least one of the wavelets is '
'longer than the signal. Use a longer signal '
'or shorter wavelets. No spectrogram will be '
'plotted.')

elif 'dipole' in plot_type:
if len(dpls_copied) > 0:
Expand Down

0 comments on commit b988c7f

Please sign in to comment.