Element_PI.VariancePersist¶
-
Element_PI.
VariancePersist
(pixelx=100, pixely=100, myspread=2, myspecs={'maxBD': 2, 'minBD': 0}, showplot=True)¶ - Generate a persistence image given a file with coordinates of atoms.
Includes difference in electronegativity.
- Parameters
Filename (string) –
Name of file with chemical data to read
pixelx (int, optional) –
Default value = 100
Number of pixels on x-axis
pixely (int, optional) –
Default value = 100
Number of pixels on y-axis
myspread (int, optional) –
Default value = 2
Parameter for kernel
For Gaussian kernel, this specifies the variance
myspecs (dictionary, optional) –
Default value =
{"maxBD": 2, "minBD":0}
Specifies boundary extent in Angstroms
Format:
{ "maxBD": <float>, "minBD": <float> }
maxBD
: upper boundary of persistence image (in Angstroms)minBD
: lower boundary of persistence image (in Angstroms)
showplot (bool, optional) –
Default value = True
- Options:
True
: plot the PI once generatedFalse
: do not plot the PI
- Returns
img_array –
One-dimensional vector representation of a persistence image
- Return type
Numpy array
Example¶
The following example demonstrates how to create a persistence image based on chemical data found in the compound.xyz file:
from Element_PI import VariancePersist
# Size of generated image is 10x10
pix_y = 10
pix_x = 10
spread = 2 # Set variance to 2
specs = {'maxBD': 2, 'minBD': 0}
PI_vector = VariancePersist('compound.xyz',
pixelx = pix_x,
pixely = pix_y,
myspread = spread
myspecs = specs,
showplot = True)
An example of the image output by running the above code would be: