When setting up a GroundSampler, if a single (or set of few) distance(s) is provided (at range for a rx for instance), the phase returned by "propagate()" may be ambiguous by multiples of 2pi radians.
using LongwaveModePropagator
using LongwaveModePropagator: QE, ME
using Plots
using LaTeXStrings
# "standard" vertical dipole transmitter at 24 kHz 1MW
txpower = 1e6
tx = Transmitter(VerticalDipole(),24e3,txpower)
# sample vertical electric field every 1 km, 250km, and 500km, out to 1500 km from tx
rx_z = GroundSampler(0:1e3:1500e3, Fields.Ez)
rx_250 = GroundSampler([250e3,500e3,750e3, 1000e3,1250e3,1500e3],Fields.Ez)
rx_500 = GroundSampler([500e3,1000e3,1500e3],Fields.Ez)
# vertical magnetic field
bfield = BField(50e-6, π/2, 0)
# "typical" seawater ground
ground = Ground(81, 4)
electrons = Species(QE, ME, z->waitprofile(z, 67, 0.4,threshold=1e15), electroncollisionfrequency)
waveguide = HomogeneousWaveguide(bfield, electrons, ground)
# return the complex electric field, amplitude (dB uV/m), and phase (radians)
Ez, az, pz = propagate(waveguide, tx, rx_z);
E, a, p_250 = propagate(waveguide, tx, rx_250);
E, a, p_500 = propagate(waveguide, tx, rx_500);
#----------------------------------------------------------------------------
plt=plot(rx_z.distance/1000,pz.*(180/pi), ylims=(-90,450),label="1km Sampler",dpi=400)
scatter!(rx_250.distance/1000,p_250.*(180/pi),label="250km Sampler")
scatter!(rx_500.distance/1000,p_500.*(180/pi),label="500km Sampler")
plot!(xlabel="Distance (km)",ylabel="Phase(\$ \\degree \$)")
savefig(plt,"PhaseTestPlot.png")