Open XiaoqZhang opened 3 months ago
This pull request addresses a bug in the topology featurizers of the mofdscribe library. The main changes involve modifying how atom types are handled, introducing a new function for filtering elements in persistence homology calculations, and adjusting data types to improve robustness. The changes span across multiple files in the project, primarily focusing on the topology-related modules.
Files | Changes |
---|---|
src/mofdscribe/featurizers/utils/substructures.py |
Introduced a new function 'filter_element_for_ph' specifically for persistence homology calculations |
src/mofdscribe/featurizers/topology/ph_image.py src/mofdscribe/featurizers/topology/ph_hist.py src/mofdscribe/featurizers/topology/ph_stats.py src/mofdscribe/featurizers/topology/ph_vect.py |
Changed the data type of 'atom_types' from tuple to list in multiple classes |
src/mofdscribe/featurizers/topology/_tda_helpers.py |
Modified the 'get_persistent_images_for_structure' function to use the new 'filter_element_for_ph' function |
src/mofdscribe/featurizers/topology/_tda_helpers.py |
Uncommented two lines in the 'make_supercell' function to include original coordinates and elements |
src/mofdscribe/featurizers/topology/ph_image.py src/mofdscribe/featurizers/topology/ph_hist.py src/mofdscribe/featurizers/topology/ph_stats.py src/mofdscribe/featurizers/topology/ph_vect.py |
Updated the handling of atom types in various classes to accommodate the new list data type |
interesting, thanks for looking into it!
Hi, I found a bug in the topology featurizers. The original way of splitting
atom_types
will split'Cu'
to['C', 'u']
, for example. Besides, thetuple
type is error-prone to the last,
as highlighted by the red circle in the figure attached.Thus, I made several changes accordingly:
atom_types
fromtuple
tolist
;filter_element_for_ph
, which is a modified version offilter_element
for persistence homology. This function is added instead of modifying the original function becausefilter_element
is also called bymofdscribe.featurizers.chemistry.AMD
Summary by Sourcery
Fix the atom type splitting issue in topology featurizers by changing the data type from tuple to list and introduce a new function
filter_element_for_ph
for persistence homology. Uncomment previously commented lines in_tda_helpers.py
to restore functionality.Bug Fixes:
Enhancements:
filter_element_for_ph
to handle element filtering specifically for persistence homology, ensuring compatibility with existing functionality.