When calling power2b = beam.get2BeamPloss(Z, tau_s=tau_s), with Z_1 left as default to None, the function incorrectly assumes Z_1 exists, even though it’s an optional argument. Hence:
```AttributeError: 'NoneType' object has no attribute 'Zr'```
This happens because if the beam spectrum max frequency is lower than the impedance max frequency, then in power.py we hit the branch
elif np.max(f) < np.max(Z_0.f):
...
Zreal_1 = Z_1.Zr[mask] # <-- unconditional access to Z_1
which incorrectly assumes Z_1 exists, even though it’s an optional argument. It tries to crop the impedance to the spectrum bandwidth, but mistakenly crops Z_1 too.
Possible fix:
in the elif np.max(f) < np.max(Z_0.f): block (in power.py), remove or guard the Z_1 line, changing
to
if Z_1 is not None:
Zreal_1 = Z_1.Zr[mask]
This should make Z_1 truly optional.
When calling
power2b = beam.get2BeamPloss(Z, tau_s=tau_s), withZ_1left as default toNone, the function incorrectly assumesZ_1exists, even though it’s an optional argument. Hence:This happens because if the beam spectrum max frequency is lower than the impedance max frequency, then in
power.pywe hit the branchwhich incorrectly assumes
Z_1exists, even though it’s an optional argument. It tries to crop the impedance to the spectrum bandwidth, but mistakenly cropsZ_1too.Possible fix:
in the
elif np.max(f) < np.max(Z_0.f):block (inpower.py), remove or guard theZ_1line, changingto
This should make
Z_1truly optional.