icecube / pisa

Monte Carlo-based data analysis
http://icecube.github.io/pisa/
Apache License 2.0
19 stars 47 forks source link

Maps internal log function broken #730

Closed LeanderFischer closed 1 year ago

LeanderFischer commented 1 year ago

map.log() breaks since the underlying datatype (uncertainties.core.AffineScalarFunc) has no log functionality.

AttributeError                            Traceback (most recent call last)
AttributeError: 'AffineScalarFunc' object has no attribute 'log'

The above exception was the direct cause of the following exception:

TypeError                                 Traceback (most recent call last)
Cell In[64], line 1
----> 1 pseudo_data.log()

File [/data/user/lfischer/software/py3_pisa_env/lib/python3.10/site-packages/decorator.py:232](https://vscode-remote+ssh-002dremote-002bcobalt07.vscode-resource.vscode-cdn.net/data/user/lfischer/software/py3_pisa_env/lib/python3.10/site-packages/decorator.py:232), in decorate..fun(*args, **kw)
    230 if not kwsyntax:
    231     args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)

File [/mnt/ceph1-npx/user/lfischer/software/pisa/pisa/core/map.py:198](https://vscode-remote+ssh-002dremote-002bcobalt07.vscode-resource.vscode-cdn.net/mnt/ceph1-npx/user/lfischer/software/pisa/pisa/core/map.py:198), in _new_obj..new_function(*args, **kwargs)
    196 args = args[2:]
    197 new_state = OrderedDict()
--> 198 state_updates = func(self, *args, **kwargs)
    199 for slot in self._state_attrs:
    200     if state_updates is not None and slot in state_updates:

File [/mnt/ceph1-npx/user/lfischer/software/pisa/pisa/core/map.py:1991](https://vscode-remote+ssh-002dremote-002bcobalt07.vscode-resource.vscode-cdn.net/mnt/ceph1-npx/user/lfischer/software/pisa/pisa/core/map.py:1991), in Map.log(self)
   1979 @_new_obj
   1980 def log(self):
   1981     """Take natural logarithm of map's values, returning a new map.
   1982 
   1983     Returns
   (...)
   1986 
   1987     """
   1988     state_updates = {
   1989         #'name': "log(%s)" % self.name,
   1990         #'tex': r"\ln\left( %s \right)" % self.tex,
-> 1991         'hist': np.log(self.hist)
   1992     }
   1993     return state_updates

TypeError: loop of ufunc does not support argument 0 of type AffineScalarFunc which has no callable log method