MCPcopy Index your code
hub / github.com/plotly/plotly.py / _ilr_transform

Function _ilr_transform

plotly/figure_factory/_ternary_contour.py:89–111  ·  view source on GitHub ↗

Perform Isometric Log-Ratio on barycentric (compositional) data. Parameters ---------- barycentric: ndarray of shape (3, N) Barycentric coordinates. References ---------- "An algebraic method to compute isometric logratio transformation and back transformat

(barycentric)

Source from the content-addressed store, hash-verified

87
88
89def _ilr_transform(barycentric):
90 """
91 Perform Isometric Log-Ratio on barycentric (compositional) data.
92
93 Parameters
94 ----------
95 barycentric: ndarray of shape (3, N)
96 Barycentric coordinates.
97
98 References
99 ----------
100 "An algebraic method to compute isometric logratio transformation and
101 back transformation of compositional data", Jarauta-Bragulat, E.,
102 Buenestado, P.; Hervada-Sala, C., in Proc. of the Annual Conf. of the
103 Intl Assoc for Math Geology, 2003, pp 31-30.
104 """
105 barycentric = np.asarray(barycentric)
106 x_0 = np.log(barycentric[0] / barycentric[1]) / np.sqrt(2)
107 x_1 = (
108 1.0 / np.sqrt(6) * np.log(barycentric[0] * barycentric[1] / barycentric[2] ** 2)
109 )
110 ilr_tdata = np.stack((x_0, x_1))
111 return ilr_tdata
112
113
114def _ilr_inverse(x):

Callers 1

_compute_gridFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected