Skip to content

Commit

Permalink
Remove unused lines in composition module
Browse files Browse the repository at this point in the history
  • Loading branch information
AntObi committed Nov 10, 2023
1 parent cd259cd commit a5e506a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/elementembeddings/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ def num_atoms(self) -> float:
"""Total number of atoms in Composition."""
return self._natoms

@property
def embedding_dim(self) -> int:
"""Dimension of the embedding."""
return self.embedding.dim

def as_dict(self) -> dict:
# TO-DO: Need to create a dict representation for the embedding class
"""Return the CompositionalEmbedding class as a dict."""
Expand All @@ -158,9 +153,6 @@ def as_dict(self) -> dict:
"composition": self.composition,
"fractional_composition": self.fractional_composition,
}
# Se

# Set an attribute

def _mean_feature_vector(self) -> np.ndarray:
"""Compute a weighted mean feature vector based of the embedding.
Expand Down Expand Up @@ -241,12 +233,6 @@ def feature_vector(self, stats: Union[str, list] = "mean"):
]
if isinstance(stats, str):
stats = [stats]
if not isinstance(stats, list):
msg = "Stats argument must be a list of strings"
raise ValueError(msg)
if not all(isinstance(s, str) for s in stats):
msg = "Stats argument must be a list of strings"
raise ValueError(msg)
if not all(s in implemented_stats for s in stats):
msg = (

Check warning on line 237 in src/elementembeddings/composition.py

View check run for this annotation

Codecov / codecov/patch

src/elementembeddings/composition.py#L237

Added line #L237 was not covered by tests
f" {[stat for stat in stats if stat not in implemented_stats]} "
Expand Down
10 changes: 10 additions & 0 deletions src/elementembeddings/tests/test_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,13 @@ def test_composition_distance(self):
)
== 0
)

assert self.valid_magpie_compositions[0].distance(
self.formulas[1],
stats=["mean", "variance"],
distance_metric="cosine_distance",
) == self.valid_magpie_compositions[1].distance(
self.valid_magpie_compositions[0],
stats=["mean", "variance"],
distance_metric="cosine_distance",
)

0 comments on commit a5e506a

Please sign in to comment.