# Path: tests/convenience.py
# def plot_aa_style(cols=1):
#     """Use a plotting style specifically for Astronomy & Astrophyiscs."""
#     # Use a style file
#     dir = os.path.abspath(os.path.dirname(__file__))
#     style_file = os.path.join(dir, './aa.mplstyle')
#     plt.style.use(style_file)
# 
#     # Check whether interactive backend is present
#     if os.name == 'posix' and "DISPLAY" not in os.environ:
#         # On a cluster
#         plt.switch_backend('Agg')
#         # Use just the basic latex package allowing \text to be used
#         plt.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}'
# 
#     if cols == 2:
#         plt.rcParams["figure.figsize"] = (5.75373, 3.556)
# 
# def rel_path(path):
#     """Return the relative path name for this directory."""
#     return os.path.join(os.path.abspath(os.path.dirname(__file__)), path)


from matplotlib.lines import Line2D
from matplotlib.patches import Patch
from tests.convenience import plot_aa_style, rel_path
from alpha_complex import complex_rates
from alpha_real import real_rates
from alpha_simple import simple_rates
from alpha_analytical import analytical_rates
import matplotlib.pyplot as plt
import numpy as np
    elements = []
    for i, surv in enumerate(surveys):
        c = cmap(i)
        line = Line2D([0], [0], color=c)
        label = surv
        elements.append((line, label))

    # Add gap in legend
    elements.append((Line2D([0], [0], color='white'), ''))

    # Add line styles
    if analytical:
        n = 'analytical'
        elements.append((Line2D([0], [0], color='gray', linestyle='dotted'),
                        n))
    if simple:
        elements.append((Line2D([0], [0], color='gray'), 'simple'))
    elements.append((Line2D([0], [0], color='gray', linestyle='dashed'),
                     'complex'))

    # Add gap in legend
    elements.append((Line2D([0], [0], color='white'), ''))

    if real:
        elements.append((Patch(facecolor='gray', edgecolor='gray', alpha=0.6),
                         'real'))

    lines, labels = zip(*elements)
    plt.legend(lines, labels, bbox_to_anchor=(1.04, 0.5), loc="center left")


# Path: tests/convenience.py
# def plot_aa_style(cols=1):
#     """Use a plotting style specifically for Astronomy & Astrophyiscs."""
#     # Use a style file
#     dir = os.path.abspath(os.path.dirname(__file__))
#     style_file = os.path.join(dir, './aa.mplstyle')
#     plt.style.use(style_file)
# 
#     # Check whether interactive backend is present
#     if os.name == 'posix' and "DISPLAY" not in os.environ:
#         # On a cluster
#         plt.switch_backend('Agg')
#         # Use just the basic latex package allowing \text to be used
#         plt.rcParams['text.latex.preamble'] = r'\usepackage{amsmath}'
# 
#     if cols == 2:
#         plt.rcParams["figure.figsize"] = (5.75373, 3.556)
# 
# def rel_path(path):
#     """Return the relative path name for this directory."""
#     return os.path.join(os.path.abspath(os.path.dirname(__file__)), path)


# Path: tests/rates/alpha_overview.py
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
from tests.convenience import plot_aa_style, rel_path
from alpha_complex import complex_rates
from alpha_real import real_rates
from alpha_simple import simple_rates
from alpha_analytical import analytical_rates
import matplotlib.pyplot as plt
import numpy as np

    elements = []
    for i, surv in enumerate(surveys):
        c = cmap(i)
        line = Line2D([0], [0], color=c)
        label = surv
        elements.append((line, label))

    # Add gap in legend
    elements.append((Line2D([0], [0], color='white'), ''))

    # Add line styles
    if analytical:
        n = 'analytical'
        elements.append((Line2D([0], [0], color='gray', linestyle='dotted'),
                        n))
    if simple:
        elements.append((Line2D([0], [0], color='gray'), 'simple'))
    elements.append((Line2D([0], [0], color='gray', linestyle='dashed'),
                     'complex'))

    # Add gap in legend
    elements.append((Line2D([0], [0], color='white'), ''))

    if real:
        elements.append((Patch(facecolor='gray', edgecolor='gray', alpha=0.6),
                         'real'))

    lines, labels = zip(*elements)
    plt.legend(lines, labels, bbox_to_anchor=(1.04, 0.5), loc="center left")


    plt.savefig(rel_path('plots/rates_overview.pdf'), bbox_inches='tight')