Element_PI.Generate_PI¶
-
Element_PI.
GeneratePI
(savefile=False, pixelx=100, pixely=100, myspread=2, bounds={'maxBD': 3, 'minBD': - 0.1})¶ Outputs a visual representation of a persistence image based on file given.
- Parameters
xyz (string) –
Name for local file containing data on coordinates representing atoms in compound
savefile (bool, optional) –
Default value = False
- Options:
True = plot of PI is saved
False = plot is not saved
Saves file to: <xyz>_img.png
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 (float, optional) –
Default value = 2
Parameter for kernel
For Gaussian kernel, this specifies the variance
bounds (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)
- Returns
None (none)
No explicit return value. Outputs the plot of the PI to the screen.
Note
This function offers an alternative method to generate a PI that does not output the matrix-representation of the PI. Therefore, this should only be used for visualization purposes.
Example¶
In this example, we will generate a PI for the following molecule:
To generate this PI, we will set our filename and then call the GeneratePI
function.:
import Element_PI
fname = 'babel/95.xyz' # This file included in original repository
Element_PI.GeneratePI(fname, savefile = True, pixelx = 20, pixely = 20,
myspread = 2, bounds = {"maxBD": 3, "minBD": 0})
The PI generated from this code is shown below: