Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jonescompneurolab/hnn-core
Browse files Browse the repository at this point in the history
…into enh/spike-hist
  • Loading branch information
samadpls committed Apr 2, 2024
2 parents 9f8a9b9 + 54bd278 commit 12e388e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Changelog

- Add feature to convert param and json files to HDF5 format, by `George Dang`_
in :gh:`723`

- Fixed figure annotation overlap in multiple sub-plots,
by `Camilo Diaz`_ in :gh:`741`

- Fix bug in :func:`~hnn_core/network/pick_connection` where connections are
returned for cases when there should be no valid matches, by `George Dang`_
Expand Down Expand Up @@ -466,3 +469,5 @@ People who contributed to this release (in alphabetical order):
.. _Steven Brandt: https://github.com/spbrandt
.. _Kaisu Lankinen: https://github.com/klankinen
.. _George Dang: https://github.com/gtdang
.. _Camilo Diaz: https://github.com/kmilo9999

32 changes: 25 additions & 7 deletions hnn_core/gui/_viz_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,31 @@ def _plot_on_axes(b, simulations_widget, widgets_plot_type,
else:
dpl = dpls_processed
rmse = _rmse(dpl, target_dpl_processed, t0, tstop)
# Show the RMSE between the two dipoles.
ax.annotate(f'RMSE({sim_name}, {target_sim_name}): {rmse:.4f}',
xy=(0.95, 0.05),
xycoords='axes fraction',
horizontalalignment='right',
verticalalignment='bottom',
fontsize=12)
annotation_text = f'RMSE({sim_name}, {target_sim_name}): {rmse:.4f}'

# find subplot's annotation
annotation = next((child for child in ax.get_children()
if isinstance(child, plt.Annotation)), None)

# if the subplot already has an annotation, update its text.
# Otherwise, create a new one.
if annotation is not None:
annotation.set_text(annotation_text)
else:
ax.annotate(annotation_text,
xy=(0.95, 0.05),
xycoords='axes fraction',
horizontalalignment='right',
verticalalignment='bottom',
fontsize=12)

rmse_logger_text = (f'RMSE {rmse:.4f} ('
f'{sim_name} smooth:{dipole_smooth.value} '
f'scale:{dipole_scaling.value} \n'
f'{target_sim_name} smooth:{data_smooth.value} '
f'scale:{data_scaling.value})')

logger.info(rmse_logger_text)

existing_plots.children = (*existing_plots.children,
Label(f"{sim_name}: {plot_type}"))
Expand Down

0 comments on commit 12e388e

Please sign in to comment.