%matplotlib inline

import numpy as np
from matplotlib import pyplot as plt

"""
Explanation: Path Loss Models
This notebook illustrates some path loss models.
Initializations
First we set the Python path and import some libraries.
End of explanation
"""


from pyphysim.channels import pathloss

"""
Explanation: Now we import some pyphysim stuff
End of explanation
"""


pl_general = pathloss.PathLossGeneral(n=3.7, C=120)
pl_general.handle_small_distances_bool = True
pl_general

pl_3gpp = pathloss.PathLoss3GPP1()
pl_3gpp.handle_small_distances_bool = True
pl_3gpp

pl_fs = pathloss.PathLossFreeSpace()
pl_fs.n = 2
pl_fs.fc = 900
pl_fs.handle_small_distances_bool = True
pl_fs

d = np.linspace(0.01, 0.5, 100)
fig, ax = plt.subplots()
pl_general.plot_deterministic_path_loss_in_dB(d,
                                              ax,
                                              extra_args={'label': 'General'})
pl_fs.plot_deterministic_path_loss_in_dB(d,
                                         ax,
                                         extra_args={'label': 'Free Space'})
pl_3gpp.plot_deterministic_path_loss_in_dB(d, ax, extra_args={'label': '3GPP'})
ax.grid()
ax.set_ylabel('Path Loss (in dB)')
ax.set_xlabel('Distance (in Km)')
ax.legend(loc=5)
plt.show()

"""
Explanation: Path Loss Classes Representation in IPython
End of explanation
"""


