 1

# input must be one of ('ba', 'zp')

Package:
scipy 8546
Exception Class:
ValueError

## Raise code

``````    if kind == 'ba':
ep = atleast_1d(roots(den)) + 0j
tz = atleast_1d(roots(num)) + 0j
elif kind == 'zp':
ep = atleast_1d(den) + 0j
tz = atleast_1d(num) + 0j
else:
raise ValueError("input must be one of {'ba', 'zp'}")

if len(ep) == 0:
ep = atleast_1d(-1000) + 0j

ez = r_['-1',
numpy.compress(ep.imag >= 0, ep, axis=-1),
numpy.compress((abs(tz) < 1e5) & (tz.imag >= 0), tz, axis=-1)]``````
🙏 Scream for help to Ukraine
Today, 25th May 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

## Ways to fix 2 `scipy.signal.findfreqs `is used to find array of frequencies for computing the response of an analog filter. The parameter kind specifies whether the numerator and denominator are specified by their polynomial coefficients (‘ba’), or their roots (‘zp’). The valid value are:

```"ba", "zp"
```

## Steps to reproduce the error:

• Install scipy
```\$ pipenv install scipy
```

```\$ pipenv shell
```

• Run the sample code:
```from scipy import signal
signal.findfreqs([1, 0], [1, 8, 25], N=9,kind="b")
```

## Output:

```---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-20ea5fdb42c8> in <module>()  1 from scipy import signal ----> 2 signal.findfreqs([1, 0], [1, 8, 25], N=9,kind="b")
/usr/local/lib/python3.7/dist-packages/scipy/signal/filter_design.py in findfreqs(num, den, N, kind)  99 tz = atleast_1d(num) + 0j  100 else: --> 101 raise ValueError("input must be one of {'ba', 'zp'}")  102   103 if len(ep) == 0:
ValueError: input must be one of {'ba', 'zp'}
```

## Fixed version of the code:

```from scipy import signal
signal.findfreqs([1, 0], [1, 8, 25], N=9,kind="ba")
```

```array([1.00000000e-02, 3.16227766e-02, 1.00000000e-01, 3.16227766e-01, 1.00000000e+00, 3.16227766e+00, 1.00000000e+01, 3.16227766e+01, 1.00000000e+02])
```