write_touchstone: don't write z_ref in complex format if it's real, fix #724.
write_touchstone: don't write z_ref in complex format if it's real, fix #724.

In scikit-rf v0.23.0, a regression was introduced in write_touchstone(),
the port reference impedance is given as a complex number even when it's
real.

    !Created with skrf (http://scikit-rf.org).
    # MHz S RI R (50+0j)

This is a regression introduced by #672 after complex impedance support
(#652) was added. Before this change, the reference impedance was always
given as a real number. Since complex impedance is not officially
supported by Touchstone v1.1 or v2. It means this change causes scikit-rf
to output an invalid file and it's breaking compatibility with nearly all
applications.

In fact, a complex impedance should never appear here. In the beginning
of write_touchstone(), we already checked and ensured that the imaginary
part of the impedance must be zero when writing a standard (non-HFSS)
Touchstone file.

This commit fixes the problem by writing "r_ref.real" instead of "r_ref",
so we get a real number "a" instead of a complex number "(a+0j)". An
assertion statement was also added to ensure the imaginary part of the
complex impedance must be zero - the complex impedance scenario should
never happen.

Signed-off-by: Yifeng Li <b3bca24d7b58766cec2e871e86f9a49e072edc77@tomli.me>

jhillairet/scikit-rf,jhillairet/scikit-rf,scikit-rf/scikit-rf,scikit-rf/scikit-rf,jhillairet/scikit-rf