SNEWS2 / snewpy

A Python package for working with supernova neutrinos
https://snewpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
24 stars 17 forks source link

Value Error in SNEWPY Notebooks #277

Closed EmmaTintinger closed 9 months ago

EmmaTintinger commented 9 months ago

Error: ValueError: Invalid value 'None' provided for parameter direction, allowed value(s): [1, 2, 3]

Locations: Tamborra_2014 cell [3] Walk_2018: cell [3] Walk_2019 cell [3]

Solution: Add “direction=1” (or a different allowed value) as a parameter in the definitions that are returning the errors

Error trace in Walk_2018:

ValueError Traceback (most recent call last) Input In [3], in <cell line: 1>() ----> 1 model = Walk_2018(progenitor_mass=15*u.solMass, rotation='slow') 3 model

File ~/snewpy/python/snewpy/models/ccsn.py:58, in _warn_deprecated_filename_argument..decorator(cls, *args, *kwargs) 54 msg = ''.join(['Initializing this model with a filename is deprecated. ', 55 f'Instead, use keyword arguments {list(cls.param.keys())}. ', 56 f'See {cls.__name__}.param, {cls.__name__}.get_param_combinations() for more info.']) 57 warn(FutureWarning(msg), stacklevel=2) ---> 58 return func(cls, args, **kwargs)

File ~/snewpy/python/snewpy/models/ccsn.py:308, in Walk_2018.new(cls, filename, eos, progenitor_mass, rotation, direction) 304 if filename is not None: 305 # Metadata creation is implemented in snewpy.models.base._GarchingArchiveModel 306 return loaders.Walk_2018(os.path.abspath(filename)) --> 308 cls.check_valid_params(cls, progenitor_mass=progenitor_mass, rotation=rotation, direction=direction) 309 filename = f's{progenitor_mass.value:3.1f}c3D{rotation}rot_dir{direction}' 311 metadata = { 312 'Progenitor mass': progenitor_mass, 313 'EOS': 'LS220' 314 }

File ~/snewpy/python/snewpy/models/base.py:462, in _RegistryModel.check_valid_params(cls, **user_params) 460 continue 461 else: --> 462 raise ValueError(f"Invalid value '{user_param}' provided for parameter {key}, " 463 f"allowed value(s): {allowed_params}") 465 # Check Combinations (Logic lives inside model subclasses under model.isvalid_param_combo) 466 if user_params not in cls.get_param_combinations():

ValueError: Invalid value 'None' provided for parameter direction, allowed value(s): [1, 2, 3]