Skip to content

New entropy functions and dump_colored_trj. #127

Merged
matteobecchi merged 27 commits intoGMPavanLab:mainfrom
matteobecchi:devel
Nov 7, 2025
Merged

New entropy functions and dump_colored_trj. #127
matteobecchi merged 27 commits intoGMPavanLab:mainfrom
matteobecchi:devel

Conversation

@matteobecchi
Copy link
Copy Markdown
Collaborator

@matteobecchi matteobecchi commented Nov 5, 2025

Requested Reviewers: @andrewtarzia @SimoneMartino98

Two improvements:
First, I added the method Trj.dump_color_trj() which takes an array of labels and saves a .xyz file with the atoms correctly labelled. There is an analogous function for OnionSmoothInsight, but in this way the user can do it with any array of labels.

Second, I created two new functions to compute Shannon entropy and information gain, respectively. The idea is that these functions are better than the many functions implemented before, so the user should stick to those.

They are better in the sense that:

  • They work for bot uni- and multivariate datasets (no need to distinguish between "shannon" and "shannon_multi" and stuff like that)
  • They work for both discrete and continuous observables, and the user always has to set the nature of the dataset he is computing the entropy of. In this way, users should be "encouraged" to compute entropy in the right way.

I added to the old functions a warning saying they are deprecated, then I left them there for backward compatibility.
I updated the examples and recipes accordingly.

@matteobecchi matteobecchi changed the title Devel New entropy functions and dump_colored_trj. Nov 5, 2025
@matteobecchi matteobecchi added the enhancement New feature or request label Nov 5, 2025
@matteobecchi matteobecchi self-assigned this Nov 5, 2025
@matteobecchi
Copy link
Copy Markdown
Collaborator Author

I started to make the names of parameters in functions and methods consistent (see issue #125 ).

I did the easy part, what remains to be done requires to modify the lens functions, it will be a future PR.

Copy link
Copy Markdown
Collaborator

@andrewtarzia andrewtarzia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @matteobecchi

Comment thread docs/source/recipe_entropy.rst Outdated
Comment thread docs/source/recipe_entropy.rst
Comment thread docs/source/recipe_entropy.rst
Comment thread docs/source/info_gain.rst
Comment thread docs/source/recipe_info_gain.rst Outdated
Comment thread src/dynsight/_internal/analysis/entropy.py Outdated
Comment thread src/dynsight/_internal/analysis/entropy.py Outdated
Comment thread src/dynsight/_internal/trajectory/trajectory.py
Comment thread src/dynsight/_internal/trajectory/trajectory.py Outdated
Comment thread pyproject.toml Outdated
Copy link
Copy Markdown
Collaborator

@SimoneMartino98 SimoneMartino98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, Approved

@matteobecchi matteobecchi merged commit d23203e into GMPavanLab:main Nov 7, 2025
11 checks passed
@matteobecchi matteobecchi deleted the devel branch November 7, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants