I am using PySpice for circuit simulation in Python and find it puzzling that the slice()
function is used in this context with a fractional value for step size. For example, the following line of code from docs sweeps over an input voltage from -2 volts to 5 volts in increments of 0.01 volts.
analysis = simulator.dc(Vinput=slice(-2, 5, .01))
Looking up slice()
in Python, docs state that the step is integer-valued.
Step: (Optional) An integer that specifies the step of the slicing process.
Wouldn't it be more natural to use a numpy array created with np.arange(-2, 5, 0.01)
in place of slice? The method simulator.dc()
however only accepts slice as shown.
What gives?