# Path: attitude/display/hyperbola.py
# class HyperbolicErrors(object):
#     """
#     A class to simplify plotting and animation of hyperbolic error
#     areas that are orthogonal to the fitted plane.
#     `ax.fill_between` cannot be used for these (unless
#     the plane is flat), because the coordinate system
#     is rotated.
#     """
#     def __init__(self, *args, **kwargs):
#         """Wraps `hyperbolic_errors` function."""
#         if len(args):
#             self.data = hyperbolic_errors(*args,**kwargs)
#         else:
#             self.data = None
# 
#     def __setup_hyperbola(self, *args,**kwargs):
#         self.args = args
#         self.kwargs = kwargs
# 
# 
#     def __construct_errors(self):
#         pass
# 
# 
#     def plot(self, ax,**kw):
#         _ec = kw.get("color","black")
#         _ec = kw.get("fc",_ec)
#         _ec = kw.get("facecolor",_ec)
#         _ec = kw.pop("ec",_ec)
#         kw['edgecolor'] = kw.pop("edgecolor",_ec)
#         #self.n, = ax.plot([],[], '-', **kw)
#         patch = Polygon([[0,0]], **kw)
#         self.poly = ax.add_patch(patch)
#         if self.data is not None:
#             self.__set_plot_data(self.data)
# 
#     def plot_nominal(self, ax, *args, **kw):
#         ax.plot(*self.data[0],*args, **kw)
# 
#     def update_data(self, *args, **kwargs):
#         self.data = hyperbolic_errors(*args,**kwargs)
#         self.__set_plot_data(self.data)
# 
#     def __set_plot_data(self,n):
#         coords = N.concatenate((n[1],n[2]),axis=1).T
#         self.poly.set_xy(coords)
# 
# Path: attitude/error/axes.py
# def sampling_axes(fit, **kw):
#     """
#     Hyperbolic axis lengths based on sample-size
#     normal statistics.
# 
#     Note: legacy method that simply wraps the
#     `statistical_axes` function.
#     """
#     return statistical_axes(fit, method='sampling', **kw)
# 
# def noise_axes(fit, **kw):
#     """
#     Hyperbolic axis lengths based on noise statistics.
# 
#     Note: legacy method that simply wraps the
#     `statistical_axes` function.
#     """
#     return statistical_axes(fit, method='noise', **kw)
# 
# Path: attitude/geom/util.py
# def vector(*args):
#     """
#     A single vector in any coordinate basis,
#     as a numpy array.
#     """
#     return N.array(args)
# 
# def plane(normal,offset=0):
#     # This only works in Hessian-Normal form
#     return N.append(normal,offset).view(Plane)


from mplstereonet.stereonet_math import line, pole
from matplotlib.patches import Polygon
from matplotlib.gridspec import GridSpec
from matplotlib.ticker import FuncFormatter
from matplotlib.pyplot import subplots
from ..display.hyperbola import HyperbolicErrors
from ..error.axes import sampling_axes, noise_axes
from ..geom.util import vector,plane
import logging
import numpy as N

    w = 8
    ratio = (lengths[2]*2+lengths[1])/lengths[0]*1.5
    h = w*ratio
    if h < 3: h = 3

    r = (lengths[1]+5)/(lengths[2]+5)
    if r > 5:
        r = 5

    gridspec_kw = dict(height_ratios=[r, 1, 1])

    fig, axes = subplots(3, 1,figsize=(w,h), sharex=True, sharey=True)

    fig.subplots_adjust(hspace=0.05, wspace=0.1)

    #lengths = attitude.pca.singular_values[::-1]

    titles = (
        "Plan view",
        "Long cross-section",
        "Short cross-section")

    ylabels = (
        "Meters",
        "Residuals (m)",
        "Residuals (m)")

    colors = ['cornflowerblue','red']


# Path: attitude/display/hyperbola.py
# class HyperbolicErrors(object):
#     """
#     A class to simplify plotting and animation of hyperbolic error
#     areas that are orthogonal to the fitted plane.
#     `ax.fill_between` cannot be used for these (unless
#     the plane is flat), because the coordinate system
#     is rotated.
#     """
#     def __init__(self, *args, **kwargs):
#         """Wraps `hyperbolic_errors` function."""
#         if len(args):
#             self.data = hyperbolic_errors(*args,**kwargs)
#         else:
#             self.data = None
# 
#     def __setup_hyperbola(self, *args,**kwargs):
#         self.args = args
#         self.kwargs = kwargs
# 
# 
#     def __construct_errors(self):
#         pass
# 
# 
#     def plot(self, ax,**kw):
#         _ec = kw.get("color","black")
#         _ec = kw.get("fc",_ec)
#         _ec = kw.get("facecolor",_ec)
#         _ec = kw.pop("ec",_ec)
#         kw['edgecolor'] = kw.pop("edgecolor",_ec)
#         #self.n, = ax.plot([],[], '-', **kw)
#         patch = Polygon([[0,0]], **kw)
#         self.poly = ax.add_patch(patch)
#         if self.data is not None:
#             self.__set_plot_data(self.data)
# 
#     def plot_nominal(self, ax, *args, **kw):
#         ax.plot(*self.data[0],*args, **kw)
# 
#     def update_data(self, *args, **kwargs):
#         self.data = hyperbolic_errors(*args,**kwargs)
#         self.__set_plot_data(self.data)
# 
#     def __set_plot_data(self,n):
#         coords = N.concatenate((n[1],n[2]),axis=1).T
#         self.poly.set_xy(coords)
# 
# Path: attitude/error/axes.py
# def sampling_axes(fit, **kw):
#     """
#     Hyperbolic axis lengths based on sample-size
#     normal statistics.
# 
#     Note: legacy method that simply wraps the
#     `statistical_axes` function.
#     """
#     return statistical_axes(fit, method='sampling', **kw)
# 
# def noise_axes(fit, **kw):
#     """
#     Hyperbolic axis lengths based on noise statistics.
# 
#     Note: legacy method that simply wraps the
#     `statistical_axes` function.
#     """
#     return statistical_axes(fit, method='noise', **kw)
# 
# Path: attitude/geom/util.py
# def vector(*args):
#     """
#     A single vector in any coordinate basis,
#     as a numpy array.
#     """
#     return N.array(args)
# 
# def plane(normal,offset=0):
#     # This only works in Hessian-Normal form
#     return N.append(normal,offset).view(Plane)


# Path: attitude/display/pca_aligned.py
from mplstereonet.stereonet_math import line, pole
from matplotlib.patches import Polygon
from matplotlib.gridspec import GridSpec
from matplotlib.ticker import FuncFormatter
from matplotlib.pyplot import subplots
from ..display.hyperbola import HyperbolicErrors
from ..error.axes import sampling_axes, noise_axes
from ..geom.util import vector,plane
import logging
import numpy as N


    w = 8
    ratio = (lengths[2]*2+lengths[1])/lengths[0]*1.5
    h = w*ratio
    if h < 3: h = 3

    r = (lengths[1]+5)/(lengths[2]+5)
    if r > 5:
        r = 5

    gridspec_kw = dict(height_ratios=[r, 1, 1])

    fig, axes = subplots(3, 1,figsize=(w,h), sharex=True, sharey=True)

    fig.subplots_adjust(hspace=0.05, wspace=0.1)

    #lengths = attitude.pca.singular_values[::-1]

    titles = (
        "Plan view",
        "Long cross-section",
        "Short cross-section")

    ylabels = (
        "Meters",
        "Residuals (m)",
        "Residuals (m)")

    colors = ['cornflowerblue','red']


    hyp = sampling_axes(pca)