# Path: ptsa/helper.py
# def pol2cart(theta,radius,z=None,radians=True):
#     """Converts corresponding angles (theta), radii, and (optional) height (z)
#     from polar (or, when height is given, cylindrical) coordinates
#     to Cartesian coordinates x, y, and z.
#     Theta is assumed to be in radians, but will be converted
#     from degrees if radians==False."""
#     if radians:
#         x = radius*np.cos(theta)
#         y = radius*np.sin(theta)
#     else:
#         x = radius*np.cos(deg2rad(theta))
#         y = radius*np.sin(deg2rad(theta))
#     if z is not None:
#         # make sure we have a copy
#         z=z.copy()
#         return x,y,z
#     else:
#         return x,y
# 
# def cart2pol(x,y,z=None,radians=True):
#     """Converts corresponding Cartesian coordinates x, y, and (optional) z
#     to polar (or, when z is given, cylindrical) coordinates
#     angle (theta), radius, and z.
#     By default theta is returned in radians, but will be converted
#     to degrees if radians==False."""    
#     if radians:
#         theta = np.arctan2(y,x)
#     else:
#         theta = rad2deg(np.arctan2(y,x))
#     radius = np.hypot(x,y)
#     if z is not None:
#         # make sure we have a copy
#         z=z.copy()
#         return theta,radius,z
#     else:
#         return theta,radius
# 
# def deg2rad(degrees):
#     """Convert degrees to radians."""
#     return degrees/180.*np.math.pi


import numpy as np
import matplotlib.pyplot as plt
from ptsa.helper import pol2cart, cart2pol, deg2rad
from scipy.interpolate import griddata
#
#   See the COPYING file distributed along with the PTSA package for the
#   copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##




default_head_props = {'head_linewidth': 3,
                      'head_linecolor': 'black',
                      'nose_linewidth': 2,
                      'ear_linewidth': 2,
                     }
default_label_props = {'ha': 'center',
                       'va': 'center'}
default_sensor_props = {'marker': 'o',
                        'c': 'k', 
                        's': 8}
default_contour_props = {'linewidths': 0,
                         'linestyle': '-',
                         'colors': 'black',}

def topoplot(values=None, labels=None, sensors=None, axes=None, 
             center=(0,0), nose_dir=0., radius=0.5,
             head_props=None, sensor_props=None,
             label_props=None, 
             contours=15, contour_props=None,
             resolution=400, axis_props='off', 
             plot_mask='circular', plot_radius_buffer=.2,

# Path: ptsa/helper.py
# def pol2cart(theta,radius,z=None,radians=True):
#     """Converts corresponding angles (theta), radii, and (optional) height (z)
#     from polar (or, when height is given, cylindrical) coordinates
#     to Cartesian coordinates x, y, and z.
#     Theta is assumed to be in radians, but will be converted
#     from degrees if radians==False."""
#     if radians:
#         x = radius*np.cos(theta)
#         y = radius*np.sin(theta)
#     else:
#         x = radius*np.cos(deg2rad(theta))
#         y = radius*np.sin(deg2rad(theta))
#     if z is not None:
#         # make sure we have a copy
#         z=z.copy()
#         return x,y,z
#     else:
#         return x,y
# 
# def cart2pol(x,y,z=None,radians=True):
#     """Converts corresponding Cartesian coordinates x, y, and (optional) z
#     to polar (or, when z is given, cylindrical) coordinates
#     angle (theta), radius, and z.
#     By default theta is returned in radians, but will be converted
#     to degrees if radians==False."""    
#     if radians:
#         theta = np.arctan2(y,x)
#     else:
#         theta = rad2deg(np.arctan2(y,x))
#     radius = np.hypot(x,y)
#     if z is not None:
#         # make sure we have a copy
#         z=z.copy()
#         return theta,radius,z
#     else:
#         return theta,radius
# 
# def deg2rad(degrees):
#     """Convert degrees to radians."""
#     return degrees/180.*np.math.pi


# Path: ptsa/plotting/topo.py
import numpy as np
import matplotlib.pyplot as plt
from ptsa.helper import pol2cart, cart2pol, deg2rad
from scipy.interpolate import griddata

#
#   See the COPYING file distributed along with the PTSA package for the
#   copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##




default_head_props = {'head_linewidth': 3,
                      'head_linecolor': 'black',
                      'nose_linewidth': 2,
                      'ear_linewidth': 2,
                     }
default_label_props = {'ha': 'center',
                       'va': 'center'}
default_sensor_props = {'marker': 'o',
                        'c': 'k', 
                        's': 8}
default_contour_props = {'linewidths': 0,
                         'linestyle': '-',
                         'colors': 'black',}

def topoplot(values=None, labels=None, sensors=None, axes=None, 
             center=(0,0), nose_dir=0., radius=0.5,
             head_props=None, sensor_props=None,
             label_props=None, 
             contours=15, contour_props=None,
             resolution=400, axis_props='off', 
             plot_mask='circular', plot_radius_buffer=.2,

             **kwargs):