A fingerprint for scalar properties

class madas.fingerprints.PROP_fingerprint.PROPFingerprint(name='PROP', property_path: str | ~typing.Callable = 'atomic_density', similarity_function=<function PROP_similarity>, from_data: bool = True)

A fingerprint object to represent a user defined property.

Provide the path to a property to compute

calculate(data: Any | None = None) object

Added for compatibility with the API.

from_material(material: Material) object

Set fingerprint data to property_path given during initialization.

Defines the following data in Fingerprint.data:

value : Poperty value, extracted from Material.data, specified by property_path.

Returns:

self: PROPFingerprint

Raises:

KeyError: if self.pass_on_exceptions == False and the material has not data entry with property_path.

madas.fingerprints.PROP_fingerprint.PROP_similarity(fingerprint1: ~madas.fingerprint.Fingerprint, fingerprint2: ~madas.fingerprint.Fingerprint, delta: float = 1, scaling_function: ~typing.Callable = <function <lambda>>) float

Calculate similarity between PROPFingerprints.

Calculates S(a, b) = delta / ( scaling_function(|a - b|) + delta )

where S is the similarity, a and b are scalar material properties encoded in PROPFingerprint objects, delta is an arbitrary scalar value to rescale the similarity, and scaling_function is any function f(x) -> y with real numbers x,y >= 0.

Arguments:

fingerprint1, fingerprint2: Fingerprint

PROPFingerprints of to calculate similarity

Keyword arguments:

delta: float

Scaling factor that allows to define how the absolute differences in the scalar property affect the similarity.

scaling_function: Callable

Function to dynamically rescale the absolute differences in properties.

Returns:

similarity: float

Similarity between input fingerprints.