Skip to content

Commit

Permalink
Update pyrocomp.invert_transform
Browse files Browse the repository at this point in the history
  • Loading branch information
morganjwilliams committed Jul 6, 2020
1 parent 388d71a commit 01ad265
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyrolite/comp/__init__.py
Expand Up @@ -344,4 +344,4 @@ def invert_transform(self, **kwargs):
raise ValueError("DataFrame has no transform history.")

_invert_method = getattr(self, inv_tfm.__name__)
return geattr(self._obj, _invert_method)(**kwargs)
return _invert_method(**kwargs)
1 change: 0 additions & 1 deletion pyrolite/comp/codata.py
Expand Up @@ -333,7 +333,6 @@ def get_transforms(name):
tfm, inv_tfm : :class:`callable`
Transform and inverse transform functions.
"""
print(name)
if callable(name): # callable
name = name.__name__

Expand Down
8 changes: 8 additions & 0 deletions test/comp/comp_pyrocomp.py
Expand Up @@ -96,6 +96,14 @@ def test_logratiomean_default(self):
df = self.tridf.copy(deep=True) # copy df
out = df.pyrocomp.logratiomean()

def test_invert_transform(self):
df = self.tridf.copy(deep=True) # copy df
for tfm in [df.pyrocomp.ALR, df.pyrocomp.CLR, df.pyrocomp.ILR]:
with self.subTest(tfm=tfm):
out = tfm()
out_inv = out.pyrocomp.invert_transform()
self.assertTrue(np.allclose(out_inv.values, df.values))


if __name__ == "__main__":
unittest.main(argv=[""], exit=False)

0 comments on commit 01ad265

Please sign in to comment.