Pressure
In [1]:
Copied!
from PASCal.app import fit
import numpy as np
from PASCal.app import fit
import numpy as np
In [2]:
Copied!
# Define example data from the app
data = np.loadtxt((line for line in """
#Variable Pressure Data for Ag3CoCN6 Phase II
0.190 1 6.6985 11.5782 6.5554 90 78.522 90
0.226 1 6.6934 11.5391 6.5661 90 78.521 90.0000
0.290 1 6.68 11.468 6.577 90 78.47 90.0000
0.294 1 6.6745 11.497 6.5707 90 78.473 90.0000
0.395 1 6.6415 11.4251 6.5959 90 78.284 90.0000
0.55 1 6.605 11.295 6.629 90 78.21 90.0000
0.78 1 6.553 11.196 6.646 90 77.967 90.0000
0.90 1 6.539 11.156 6.654 90 77.871 90.0000
0.92 1 6.5333 11.154 6.6507 90 77.91 90.0000
1.08 1 6.505 11.116 6.663 90 77.73 90.0000
1.87 1 6.4172 10.922 6.696 90 77.584 90.0000
3.02 1 6.2904 10.739 6.747 90 77.39 90.0000
5.13 1 6.0657 10.493 6.833 90 77.09 90.0000
6.92 1 5.91 10.333 6.891 90 77.01 90.0000
7.65 1 5.8657 10.27 6.908 90 76.921 90.0000
""".splitlines()))
# Define example data from the app
data = np.loadtxt((line for line in """
#Variable Pressure Data for Ag3CoCN6 Phase II
0.190 1 6.6985 11.5782 6.5554 90 78.522 90
0.226 1 6.6934 11.5391 6.5661 90 78.521 90.0000
0.290 1 6.68 11.468 6.577 90 78.47 90.0000
0.294 1 6.6745 11.497 6.5707 90 78.473 90.0000
0.395 1 6.6415 11.4251 6.5959 90 78.284 90.0000
0.55 1 6.605 11.295 6.629 90 78.21 90.0000
0.78 1 6.553 11.196 6.646 90 77.967 90.0000
0.90 1 6.539 11.156 6.654 90 77.871 90.0000
0.92 1 6.5333 11.154 6.6507 90 77.91 90.0000
1.08 1 6.505 11.116 6.663 90 77.73 90.0000
1.87 1 6.4172 10.922 6.696 90 77.584 90.0000
3.02 1 6.2904 10.739 6.747 90 77.39 90.0000
5.13 1 6.0657 10.493 6.833 90 77.09 90.0000
6.92 1 5.91 10.333 6.891 90 77.01 90.0000
7.65 1 5.8657 10.27 6.908 90 76.921 90.0000
""".splitlines()))
In [3]:
Copied!
x = data[:, 0]
x_error = data[:, 1]
unit_cells = data[:, 2:]
x = data[:, 0]
x_error = data[:, 1]
unit_cells = data[:, 2:]
In [4]:
Copied!
fit_results = fit(x, x_error, unit_cells, {"data_type": "pressure"})
fit_results = fit(x, x_error, unit_cells, {"data_type": "pressure"})
Performing fit with options=Options(data_type=<PASCalDataType.PRESSURE: 'Pressure'>, eulerian_strain=True, finite_strain=True, use_pc=False, pc_val=None, deg_poly_strain=5, deg_poly_vol=5)
In [5]:
Copied!
from PASCal.plotting import plot_strain, plot_volume
from PASCal.plotting import plot_strain, plot_volume
In [6]:
Copied!
fit_results.plot_strain()
fit_results.plot_strain()
In [7]:
Copied!
fit_results.plot_volume()
fit_results.plot_volume()
In [8]:
Copied!
fit_results.plot_indicatrix(plot_size=600)
fit_results.plot_indicatrix(plot_size=600)
In [9]:
Copied!
fit_results.plot_compressibility()
fit_results.plot_compressibility()
In [10]:
Copied!
import pprint
pprint.pprint(fit_results.named_coefficients)
import pprint
pprint.pprint(fit_results.named_coefficients)
{'B0': array([24.62696904, 12.08767507]), 'BPrime': array([ 4. , 11.85340906]), 'CalEpsilon0': array([ 0.0390179 , 0.00341754, -0.00167155]), 'CalLambda': array([-0.08036248, -0.03591663, 0.01856326]), 'CalNu': array([0.33258547, 0.68308275, 0.5307593 ]), 'CalPc': array([0.08172067, 0.17238386, 0.18292445]), 'CalPress': array([[-0.60188815, -0.49905322, -0.22628737, -0.25686882, 0.06956871, 0.55851053, 1.15186482, 1.34221086, 1.39677469, 1.65210928, 2.67473018, 3.78753886, 5.50135179, 6.63916142, 7.02527641], [-0.15553569, -0.09481268, 0.07002167, 0.05126458, 0.25517921, 0.57638424, 0.99320692, 1.13355797, 1.17440708, 1.36929596, 2.2153013 , 3.26867169, 5.21463635, 6.76822512, 7.35083189], [ 0.12718238, 0.16177168, 0.25873287, 0.24747641, 0.37285064, 0.58332567, 0.87883973, 0.98375769, 1.01479011, 1.16586422, 1.87661684, 2.87545369, 5.00825043, 6.94324167, 7.71646062]]), 'PcCoef': array([0., 0., 0.]), 'SigB0': array([0.93058209, 1.55899714]), 'SigBPrime': array(['n/a', 1.6479251595018671], dtype=object), 'SigV0': array([1.76380397, 1.98806401]), 'V0': array([495.06956949, 503.21719632]), 'VolCoef': 24.44571205846455, 'VolCoefErr': 1.3225221768973972, 'XCal': array([[ 0.06509574, -0.31922425, -0.86740335, -0.89767243, -1.56091231, -2.34228427, -3.22969031, -3.61592132, -3.67654026, -4.12985614, -5.84832291, -7.5991747 , -9.86740606, -11.32977399, -11.85236066], [ 0.11418795, -0.1449885 , -0.49067565, -0.50991107, -0.94537698, -1.50490227, -2.21386698, -2.54868225, -2.60271925, -3.01979356, -4.81403252, -6.99905572, -10.37897833, -12.89171925, -13.85366046], [ -0.0330655 , 0.1825966 , 0.39993694, 0.41108415, 0.64789259, 0.92339164, 1.24466649, 1.38878934, 1.41167397, 1.58518302, 2.28308192, 3.06148596, 4.16981335, 4.94228395, 5.22903306]])}