# Path: gprMax/constants.py



import argparse
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from gprMax.constants import c, z0
ax.annotate('Ground', xy=(np.deg2rad(270), 0), xytext=(8, -15), textcoords='offset points')

# Plot patterns
for patt in range(0, len(radii)):
    pattplot = np.append(patterns[patt, :], patterns[patt, 0])  # Append start value to close circle
    pattplot = pattplot / np.max(np.max(patterns))  # Normalise, based on set of patterns

    # Calculate power (ignore warning from taking a log of any zero values)
    with np.errstate(divide='ignore'):
        power = 10 * np.log10(pattplot)
    # Replace any NaNs or Infs from zero division
    power[np.invert(np.isfinite(power))] = 0
    
    ax.plot(theta, power, label='{:.2f}m'.format(radii[patt]), marker='.', ms=6, lw=1.5)

# Add Hertzian dipole plot
# hertzplot1 = np.append(hertzian[0, :], hertzian[0, 0]) # Append start value to close circle
# hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot2 = np.append(hertzian[-1, :], hertzian[-1, 0]) # Append start value to close circle
# hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)

# Theta axis options
ax.set_theta_zero_location('N')
ax.set_theta_direction('clockwise')
ax.set_thetagrids(np.arange(0, 360, 30))

# Radial axis options
ax.set_rmax(0)

# Path: gprMax/constants.py



# Path: user_libs/antenna_patterns/plot_fields.py
import argparse
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from gprMax.constants import c, z0

ax.annotate('Ground', xy=(np.deg2rad(270), 0), xytext=(8, -15), textcoords='offset points')

# Plot patterns
for patt in range(0, len(radii)):
    pattplot = np.append(patterns[patt, :], patterns[patt, 0])  # Append start value to close circle
    pattplot = pattplot / np.max(np.max(patterns))  # Normalise, based on set of patterns

    # Calculate power (ignore warning from taking a log of any zero values)
    with np.errstate(divide='ignore'):
        power = 10 * np.log10(pattplot)
    # Replace any NaNs or Infs from zero division
    power[np.invert(np.isfinite(power))] = 0
    
    ax.plot(theta, power, label='{:.2f}m'.format(radii[patt]), marker='.', ms=6, lw=1.5)

# Add Hertzian dipole plot
# hertzplot1 = np.append(hertzian[0, :], hertzian[0, 0]) # Append start value to close circle
# hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot2 = np.append(hertzian[-1, :], hertzian[-1, 0]) # Append start value to close circle
# hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)

# Theta axis options
ax.set_theta_zero_location('N')
ax.set_theta_direction('clockwise')
ax.set_thetagrids(np.arange(0, 360, 30))

# Radial axis options
ax.set_rmax(0)

ax.set_rlabel_position(45)