redmod-team / profit

Probabilistic Response mOdel Fitting with Interactive Tools
https://profit.readthedocs.io
MIT License
14 stars 10 forks source link

Linear variable distribution fails #168

Open Rykath opened 2 years ago

Rykath commented 2 years ago

On profit run with a variable of the form: Linear(0.001, 0.101) the following error occurs:

Traceback (most recent call last):
  File "/home/oswell/ThreeSidedDie/venv/bin/profit", line 8, in <module>
    sys.exit(main())
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/main.py", line 65, in main
    config = BaseConfig.from_file(config_file)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/config.py", line 279, in from_file
    self = cls(base_dir=path.split(filename)[0], **entries)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/config.py", line 234, in __init__
    self.process_entries()  # Postprocess the attributes to standardize different user entries.
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/config.py", line 254, in process_entries
    self.variable_group.add(vars)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/util/variable.py", line 223, in add
    v.generate_values()
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/util/variable.py", line 386, in generate_values
    self.value = globals().get(self.kind.lower())(*self.constraints, size=self.size).astype(self.dtype)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/profit/util/variable.py", line 31, in linear
    return check_ndim(np.linspace(start, end, size))
  File "<__array_function__ internals>", line 180, in linspace
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/numpy/core/function_base.py", line 120, in linspace
    num = operator.index(num)
TypeError: 'tuple' object cannot be interpreted as an integer

replacing Linear with Uniform works as expected.