Description
Environment
- Python: 3.14
- NumPy: 1.18.0
- SciPy: 2.5.1
- PathSim: 0.23.2
- PathView: latest local version
Problem
I found a reproducible issue with the LUT1D block in PathSim 0.23.2.
When I run a model containing a LUT1D block, the simulation fails with:
TypeError: len() of unsized object
The failure occurs even when the LUT1D block has no input connection.
For example:
lut1d = LUT1D(
points=[0, 100],
values=[0, 100],
fill_value="extrapolate"
)
Running a model containing only this block produces:
Streaming simulation failed: len() of unsized object
By comparison, a model containing only a Constant block runs successfully.
Investigation
I checked the installed PathSim source code.
PathSim reports:
0.23.2
<class 'pathsim.blocks.table.LUT1D'>
C:\...\site-packages\pathsim\blocks\table.py
The LUT1D implementation uses SciPy's interp1d:
self.inter = interp1d(
self.points,
self.values,
fill_value=fill_value
)
and its function is:
def func(*x):
return self.inter(x[0])
LUT1D inherits from Function, whose implementation evaluates the function using:
self.op_alg = Operator(func=lambda x: func(*x))
I also inspected the runtime input representation. The Function block's input array can be represented as a NumPy ndarray, for example:
<class 'numpy.ndarray'>
[0.]
The error message suggests that a scalar / 0-D NumPy value may be reaching interp1d in some execution path.
Reproduction
A minimal model containing only:
with:
points = [0, 100]
values = [0, 100]
fill_value = "extrapolate"
is sufficient to reproduce the error in my environment.
Adding a Constant and connecting:
also reproduces the same error.
Expected behavior
I would expect LUT1D to accept scalar input values and perform the interpolation without raising an exception.
Question
Could you please check whether this is a bug in the LUT1D / Function implementation in PathSim 0.23.2?
In particular, could the input passed to:
sometimes be a 0-D NumPy array or scalar?
If so, would explicit scalar/array handling before calling interp1d be an appropriate fix?
Thank you for your help.
Steps to Reproduce
- Open PathView with PathSim 0.23.2.
- Create a Constant block with value = 50.
- Create a LUT1D block with:
points = [0, 100]
values = [0, 100]
fill_value = "extrapolate"
- Connect the Constant output to the LUT1D input.
- Run the simulation.
- The simulation fails immediately with:
TypeError: len() of unsized object
The simulation stops with:
FINISHED -> STREAMING (total steps: 0, successful: 0)
Expected Behavior
No response
Version
No response
Browser
No response
Additional Context
No response
Description
Environment
Problem
I found a reproducible issue with the
LUT1Dblock in PathSim 0.23.2.When I run a model containing a
LUT1Dblock, the simulation fails with:The failure occurs even when the
LUT1Dblock has no input connection.For example:
Running a model containing only this block produces:
By comparison, a model containing only a
Constantblock runs successfully.Investigation
I checked the installed PathSim source code.
PathSim reports:
The
LUT1Dimplementation uses SciPy'sinterp1d:and its function is:
LUT1Dinherits fromFunction, whose implementation evaluates the function using:I also inspected the runtime input representation. The Function block's input array can be represented as a NumPy ndarray, for example:
The error message suggests that a scalar / 0-D NumPy value may be reaching
interp1din some execution path.Reproduction
A minimal model containing only:
with:
is sufficient to reproduce the error in my environment.
Adding a
Constantand connecting:also reproduces the same error.
Expected behavior
I would expect
LUT1Dto accept scalar input values and perform the interpolation without raising an exception.Question
Could you please check whether this is a bug in the
LUT1D/Functionimplementation in PathSim 0.23.2?In particular, could the input passed to:
sometimes be a 0-D NumPy array or scalar?
If so, would explicit scalar/array handling before calling
interp1dbe an appropriate fix?Thank you for your help.
Steps to Reproduce
points = [0, 100]
values = [0, 100]
fill_value = "extrapolate"
TypeError: len() of unsized object
The simulation stops with:
FINISHED -> STREAMING (total steps: 0, successful: 0)
Expected Behavior
No response
Version
No response
Browser
No response
Additional Context
No response