# Path: py/fiberassign/test/simulate.py
# def sim_data_dir():
# def test_subdir_create(name):
# def sim_science_fractions():
# def sim_focalplane(rundate=None, fakepos=False):
# def sim_stuck_sky(dirnm, hw, tiles):
#     def radec2xyz(r, d):
# def sim_tiles(path, selectfile=None):
# def sim_targets(path, tgtype, tgoffset, density=5000.0, science_frac=None):
# def petal_rotation(npos, reverse=False):
#         J = np.flatnonzero(r2 < maxr2)


import os
import unittest
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from fiberassign.hardware import load_hardware
from fiberassign.vis import (
    plot_positioner,
    plot_positioner_simple,
    Shape,
    set_matplotlib_pdf_backend
)
from .simulate import test_subdir_create, sim_focalplane, test_assign_date
                    if simple:
                        plot_positioner_simple(
                            ax, patrol_mm, lid, center, theta, theta_arm[lid],
                            phi, phi_arm[lid], color=col, linewidth=linewidth
                        )
                    else:
                        plot_positioner(
                            ax, patrol_mm, lid, center, shptheta, shpphi,
                            color=col, linewidth=linewidth
                        )
                    xend = xoff
                    yend = yoff
                    ax.text(xend, yend, "{}".format(inc),
                            color='k', fontsize=fontpt,
                            horizontalalignment='center',
                            verticalalignment='center',
                            bbox=dict(fc='w', ec='none', pad=1, alpha=1.0))
        pxcent = center[0]
        pycent = center[1]
        half_width = 0.5 * width
        half_height = 0.5 * height
        ax.set_xlabel("Millimeters", fontsize="large")
        ax.set_ylabel("Millimeters", fontsize="large")
        ax.set_xlim([pxcent-half_width, pxcent+half_width])
        ax.set_ylim([pycent-half_height, pycent+half_height])
        outfile = os.path.join(dir, "test_plotpos_{}.pdf".format(suffix))
        plt.savefig(outfile, dpi=300, format="pdf")
        plt.close()

    def test_plotpos(self):

# Path: py/fiberassign/test/simulate.py
# def sim_data_dir():
# def test_subdir_create(name):
# def sim_science_fractions():
# def sim_focalplane(rundate=None, fakepos=False):
# def sim_stuck_sky(dirnm, hw, tiles):
#     def radec2xyz(r, d):
# def sim_tiles(path, selectfile=None):
# def sim_targets(path, tgtype, tgoffset, density=5000.0, science_frac=None):
# def petal_rotation(npos, reverse=False):
#         J = np.flatnonzero(r2 < maxr2)


# Path: py/fiberassign/test/test_vis.py
import os
import unittest
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from fiberassign.hardware import load_hardware
from fiberassign.vis import (
    plot_positioner,
    plot_positioner_simple,
    Shape,
    set_matplotlib_pdf_backend
)
from .simulate import test_subdir_create, sim_focalplane, test_assign_date

                    if simple:
                        plot_positioner_simple(
                            ax, patrol_mm, lid, center, theta, theta_arm[lid],
                            phi, phi_arm[lid], color=col, linewidth=linewidth
                        )
                    else:
                        plot_positioner(
                            ax, patrol_mm, lid, center, shptheta, shpphi,
                            color=col, linewidth=linewidth
                        )
                    xend = xoff
                    yend = yoff
                    ax.text(xend, yend, "{}".format(inc),
                            color='k', fontsize=fontpt,
                            horizontalalignment='center',
                            verticalalignment='center',
                            bbox=dict(fc='w', ec='none', pad=1, alpha=1.0))
        pxcent = center[0]
        pycent = center[1]
        half_width = 0.5 * width
        half_height = 0.5 * height
        ax.set_xlabel("Millimeters", fontsize="large")
        ax.set_ylabel("Millimeters", fontsize="large")
        ax.set_xlim([pxcent-half_width, pxcent+half_width])
        ax.set_ylim([pycent-half_height, pycent+half_height])
        outfile = os.path.join(dir, "test_plotpos_{}.pdf".format(suffix))
        plt.savefig(outfile, dpi=300, format="pdf")
        plt.close()

    def test_plotpos(self):

        test_dir = test_subdir_create("vis_test_plotpos")