icecube / skyllh

https://icecube.github.io/skyllh/
GNU General Public License v3.0
11 stars 5 forks source link

TypeError when instantiating an empty ParameterGridSet #212

Closed martwo closed 5 months ago

martwo commented 5 months ago

The code line

https://github.com/icecube/skyllh/blob/24511ca90dc6567f0d930d1228db217bd439d895/skyllh/core/parameters.py#L1550

causes a TypeError, when an empty ParameterGridSet is instantiated:

In [4]: pgs = ParameterGridSet()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-45cb9c96e673> in <module>
----> 1 pgs = ParameterGridSet()

~/software/_skyllh/skyllh.master/skyllh/core/parameters.py in __init__(self, param_grids, **kwargs)
   1548         super().__init__(
   1549             objs=param_grids,
-> 1550             obj_type=type(param_grids[0]),
   1551             **kwargs)
   1552 

TypeError: 'NoneType' object is not subscriptable

This bug was introduced by PR #210 .

A possible solution could be to fall back to ParameterGrid if no objects were specified.