Fix flux diagram naming of species images#2905
Merged
rwest merged 1 commit intoReactionMechanismGenerator:mainfrom Mar 27, 2026
Merged
Fix flux diagram naming of species images#2905rwest merged 1 commit intoReactionMechanismGenerator:mainfrom
rwest merged 1 commit intoReactionMechanismGenerator:mainfrom
Conversation
There can be multiple species that end the same way, so using endswith is not guaranteed to get you the right images. This change makes sure the flux diagrams will map the correct species image onto the flux diagram.
rwest
approved these changes
Mar 26, 2026
Member
|
I was curious how this came to be. Why had someone deliberately chosen It's because when Josh first wrote it in 1307f71, species_index was just the number at the end like Then, in order to fix something else, in daab0fb Connie made This fix is clearly correct. I'll rebase (as it's a single commit) and merge. |
0e48892
into
ReactionMechanismGenerator:main
19 of 29 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There can be multiple species that end the same way, so using endswith is not guaranteed to get you the right images. This change makes sure the flux diagrams will map the correct species image onto the flux diagram.
Motivation or Problem
The flux diagram tool sometimes grabs the wrong image for a species. See #2904
The problem is that it's relying on the filename ending the same as the species name, instead of matching exactly. In the above example, you get RMG using the image of C4H71-O2 for O2.
Description of Changes
Instead of searching for a file name by checking that it ends with the right key, it now forces the file name to match exactly.
Testing
I tested this using the example in ReactionMechanismGenerator/RMG-Py/issues/2904
The bad "before" image is shown in the bug, and the fixed "after" image is shown below. You can see O2 is now displaying properly.

I will also test this for the case of nested directories. If you put the O2 image inside another folder, does it still work?Yes. I tested and this works fine.