|
53 | 53 | #
|
54 | 54 | fontsize = 8
|
55 | 55 | fig, ax = plt.subplots(1)
|
56 |
| - |
| 56 | +ax.set(ylabel="$D_X$", xlabel="Radii ($\AA$)", yscale="log") |
57 | 57 | site2labels = ["Na", "Ca", "Eu", "Sr"]
|
58 | 58 | # get the Shannon ionic radii for the elements in the 2+ site
|
59 | 59 | site2radii = [
|
|
103 | 103 | ax.annotate(
|
104 | 104 | l, xy=(r, d), xycoords="data", ha="right", va="bottom", fontsize=fontsize
|
105 | 105 | )
|
106 |
| -ax.set(ylabel="$D_X$", xlabel="Radii ($\AA$)", yscale="log") |
107 | 106 | fig
|
108 | 107 | ########################################################################################
|
109 | 108 | # As europium is commonly present as a mixture of both :math:`Eu^{2+}`
|
|
136 | 135 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
137 | 136 | # Given the lattice strain model and a partitioning profile (for e.g. REE data),
|
138 | 137 | # we can also fit a model to a given curve; here we fit to our REE data above,
|
139 |
| -# for which we have some known parameters to compare to: |
| 138 | +# for which we have some known parameters to compare to. Note that this uses |
| 139 | +# the youngs modulus approximation behind the scenes where it isn't provided: |
140 | 140 | #
|
141 |
| -from pyrolite.mineral.lattice import fit_lattice_strain, _lattice_opt_function |
| 141 | +from pyrolite.mineral.lattice import fit_lattice_strain, youngs_modulus_approximation |
142 | 142 |
|
143 |
| -_ri, _tk, _D = fit_lattice_strain(np.array(site3radii), site3Ds, z=3) |
| 143 | +t0 = 273.15 + 700 # estimated temperature |
| 144 | +_ri, _tk, _D = fit_lattice_strain(site3radii, site3Ds, z=3, t0=t0) |
144 | 145 | ########################################################################################
|
145 | 146 | # We can compare the results of this fit to our source parameters - the ionic radius of
|
146 |
| -# La, 900°C and estimated :math:`D_{La}`: |
| 147 | +# La, 900°C and estimated :math:`D_{La}` - note that the temperature isn't being fit |
| 148 | +# well here, but the other parameters are recovered reasonably well: |
147 | 149 | #
|
148 | 150 | import pandas as pd
|
149 | 151 |
|
|
154 | 156 | ).T
|
155 | 157 |
|
156 | 158 | ########################################################################################
|
157 |
| -# We can also compare the curves visually: |
| 159 | +# From this point, we could We can also compare the curves visually: |
158 | 160 | #
|
159 | 161 | from pyrolite.plot.spider import REE_v_radii
|
160 | 162 |
|
161 | 163 | ax = REE_v_radii(index="radii")
|
162 | 164 | ax.set(ylabel="$D_X$", xlabel="Radii ($\AA$)")
|
| 165 | + |
163 | 166 | ax.plot(site3radii, site3Ds, label="True", color="k")
|
164 |
| -ax.plot( |
165 |
| - site3radii, |
166 |
| - _lattice_opt_function(site3radii, site3radii.mean(), 298 + 1000, 1, z=3), |
167 |
| - label="Starting Guess", |
168 |
| - ls="--", |
169 |
| - color="0.5", |
| 167 | + |
| 168 | +r0 = site3radii.mean() |
| 169 | +starting_guess = strain_coefficient( |
| 170 | + r0, site3radii, r0=r0, z=3, T=t0, E=youngs_modulus_approximation(3, r0) |
170 | 171 | )
|
| 172 | +ax.plot(site3radii, starting_guess, label="Starting Guess", ls="--", color="0.5") |
171 | 173 |
|
172 |
| -ax.plot( |
173 |
| - site3radii, |
174 |
| - _lattice_opt_function(site3radii, _ri, _tk, _D, z=3), |
175 |
| - label="Fit", |
176 |
| - color="r", |
| 174 | +fit_curve = _D * strain_coefficient( |
| 175 | + _ri, site3radii, r0=_ri, T=_tk, z=3, E=youngs_modulus_approximation(3, _ri) |
177 | 176 | )
|
| 177 | +ax.plot(site3radii, fit_curve, color="r", ls="--", label="Fit") |
| 178 | + |
178 | 179 | ax.legend()
|
179 | 180 | ax.figure
|
180 | 181 | ########################################################################################
|
|
202 | 203 | # American Journal of Science 314, 1319–1372.
|
203 | 204 | # doi: `10.2475/09.2014.04 <https://doi.org/10.2475/09.2014.04>`__
|
204 | 205 | #
|
205 |
| - |
0 commit comments