HSPiPy is a Python library designed for calculating and visualizing Hansen Solubility Parameters (HSP). The library provides tools to compute HSP from a grid of solvent data and offers 2D and 3D plotting capabilities to visualize the solubility parameter space
Install HSPiPy easily with pip:
pip install HSPiPy
To read HSP data from a CSV file, create an instance of the HSP
class and use the read
method:
from hspipy import HSP
hsp = HSP()
hsp.read('path_to_your_hsp_file.csv')
Use the get
method to calculate the Hansen Solubility Parameters (HSP) from your data:
hsp.get()
Use the plot_3d
and plot_2d
methods to visualize the HSP data in 3D and 2D formats, respectively:
hsp.plot_3d()
hsp.plot_2d()
Method | Description |
---|---|
read(path) | Reads solvent data from a CSV file. |
get(inside_limit=1) | Calculates the HSP and identifies solvents inside and outside the solubility sphere. |
plot_3d() | Plots the HSP data in 3D. |
plot_2d() | Plots the HSP data in 2D. |
plots() | Generates both 2D and 3D plots. |
Once you have calculated the HSP parameters using the get() method, you can access the calculated HSP parameters and related attributes through the properties of the HSP class instance. Below are the attributes you can access:
Atribute | Description |
---|---|
hsp.d |
Float - Dispersion parameter of the HSP. |
hsp.p |
Float - Polar parameter of the HSP. |
hsp.h |
Float - Hydrogen-bonding parameter of the HSP. |
hsp.radius |
Float - Radius of the solubility sphere. |
hsp.error |
Float - Error in the HSP calculation. |
hsp.inside |
Numpy array - Solvents inside the solubility sphere. |
hsp.outside |
Numpy array - Solvents outside the solubility sphere. |
hsp.grid |
A Pandas DataFrame containing the solvent data with columns for the solvent name, dispersion (D), polar (P), hydrogen-bonding (H), and score values. |
Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue on the GitHub repository.
This library is licensed under the MIT License. See the LICENSE file for details.
HSPiPy was inspired by the well-known HSP software suit Hansen Solubility Parameters in Practice (HSPiP) and by the HSP community.